Skip to content

Commit 8205822

Browse files
committed
Merge branch 'release/v1.3.1'
2 parents 9ccefca + 5cced3c commit 8205822

File tree

15 files changed

+290
-6
lines changed

15 files changed

+290
-6
lines changed

.github/workflows/examples.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- "examples/arduino-internal-libs"
1414
- "examples/arduino-uno-r4-led-animation"
1515
- "examples/arduino-wifiscan"
16+
- "examples/arduino-iot-cloud-basic"
1617
- "examples/cmsis-blink"
1718
- "examples/fsp-blink"
1819
- "examples/fsp-button-isr"

boards/portenta_c33.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"variant": "PORTENTA_C33"
2727
},
2828
"debug": {
29-
"jlink_device": "R7FA6M5",
29+
"jlink_device": "R7FA6M5BH",
3030
"svd_path": "R7FA6M5BH.svd"
3131
},
3232
"frameworks": [

boards/uno_r4_minima.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"variant": "MINIMA"
2727
},
2828
"debug": {
29-
"jlink_device": "ra4m1",
29+
"jlink_device": "R7FA4M1AB",
3030
"svd_path": "R7FA4M1AB.svd"
3131
},
3232
"frameworks": [

boards/uno_r4_wifi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"onboard_tools": [
3333
"cmsis-dap"
3434
],
35-
"jlink_device": "ra4m1",
35+
"jlink_device": "R7FA4M1AB",
3636
"openocd_config": "openocd.cfg",
3737
"svd_path": "R7FA4M1AB.svd"
3838
},

builder/frameworks/arduino.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def load_flags(filename):
7979
"-mcpu=%s" % board.get("build.cpu"),
8080
"-mthumb",
8181
"-Wl,--gc-sections",
82-
"--specs=nano.specs",
8382
"--specs=nosys.specs",
84-
"-nostdlib",
8583
'-Wl,-Map="%s"' % os.path.join("${BUILD_DIR}", "${PROGNAME}.map")
8684
],
8785

@@ -149,6 +147,13 @@ def load_flags(filename):
149147
]
150148
)
151149

150+
if board.id != "portenta_c33":
151+
env.Append(
152+
LINKFLAGS=[
153+
"--specs=nano.specs",
154+
]
155+
)
156+
152157
#
153158
# Add Linker scripts
154159
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.pio
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
How to build PlatformIO based project
2+
=====================================
3+
4+
1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html)
5+
2. Download [development platform with examples](https://github.com/platformio/platform-renesas-ra/archive/develop.zip)
6+
3. Extract ZIP archive
7+
4. Run these commands:
8+
9+
```shell
10+
# Change directory to example
11+
$ cd platform-renesas-ra/examples/arduino-iot-cloud-basic
12+
13+
# Build project
14+
$ pio run
15+
16+
# Upload firmware
17+
$ pio run --target upload
18+
19+
# Clean build files
20+
$ pio run --target clean
21+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
This directory is intended for project header files.
3+
4+
A header file is a file containing C declarations and macro definitions
5+
to be shared between several project source files. You request the use of a
6+
header file in your project source file (C, C++, etc) located in `src` folder
7+
by including it, with the C preprocessing directive `#include'.
8+
9+
```src/main.c
10+
11+
#include "header.h"
12+
13+
int main (void)
14+
{
15+
...
16+
}
17+
```
18+
19+
Including a header file produces the same results as copying the header file
20+
into each source file that needs it. Such copying would be time-consuming
21+
and error-prone. With a header file, the related declarations appear
22+
in only one place. If they need to be changed, they can be changed in one
23+
place, and programs that include the header file will automatically use the
24+
new version when next recompiled. The header file eliminates the labor of
25+
finding and changing all the copies as well as the risk that a failure to
26+
find one copy will result in inconsistencies within a program.
27+
28+
In C, the usual convention is to give header files names that end with `.h'.
29+
It is most portable to use only letters, digits, dashes, and underscores in
30+
header file names, and at most one dot.
31+
32+
Read more about using header files in official GCC documentation:
33+
34+
* Include Syntax
35+
* Include Operation
36+
* Once-Only Headers
37+
* Computed Includes
38+
39+
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
This directory is intended for project specific (private) libraries.
3+
PlatformIO will compile them to static libraries and link into executable file.
4+
5+
The source code of each library should be placed in a an own separate directory
6+
("lib/your_library_name/[here are source files]").
7+
8+
For example, see a structure of the following two libraries `Foo` and `Bar`:
9+
10+
|--lib
11+
| |
12+
| |--Bar
13+
| | |--docs
14+
| | |--examples
15+
| | |--src
16+
| | |- Bar.c
17+
| | |- Bar.h
18+
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
19+
| |
20+
| |--Foo
21+
| | |- Foo.c
22+
| | |- Foo.h
23+
| |
24+
| |- README --> THIS FILE
25+
|
26+
|- platformio.ini
27+
|--src
28+
|- main.c
29+
30+
and a contents of `src/main.c`:
31+
```
32+
#include <Foo.h>
33+
#include <Bar.h>
34+
35+
int main (void)
36+
{
37+
...
38+
}
39+
40+
```
41+
42+
PlatformIO Library Dependency Finder will find automatically dependent
43+
libraries scanning project source files.
44+
45+
More information about PlatformIO Library Dependency Finder
46+
- https://docs.platformio.org/page/librarymanager/ldf.html
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter, extra scripting
4+
; Upload options: custom port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
;
7+
; Please visit documentation for the other options and examples
8+
; https://docs.platformio.org/page/projectconf.html
9+
10+
[env]
11+
platform = renesas-ra
12+
framework = arduino
13+
lib_ldf_mode = deep+
14+
lib_deps =
15+
arduino-libraries/ArduinoIoTCloud@^1.13.0
16+
17+
[env:portenta_c33]
18+
board = portenta_c33
19+
20+
[env:uno_r4_wifi]
21+
board = uno_r4_wifi
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
This sketch demonstrates how to exchange data between your board and the Arduino IoT Cloud.
3+
4+
* Connect a potentiometer (or other analog sensor) to A0.
5+
* When the potentiometer (or sensor) value changes the data is sent to the Cloud.
6+
* When you flip the switch in the Cloud dashboard the onboard LED lights gets turned ON or OFF.
7+
8+
IMPORTANT:
9+
This sketch works with WiFi, GSM, NB, Ethernet and Lora enabled boards supported by Arduino IoT Cloud.
10+
On a LoRa board, if it is configured as a class A device (default and preferred option), values from Cloud dashboard are received
11+
only after a value is sent to Cloud.
12+
13+
The full list of compatible boards can be found here:
14+
- https://github.com/arduino-libraries/ArduinoIoTCloud#what
15+
*/
16+
17+
#include "arduino_secrets.h"
18+
#include "thingProperties.h"
19+
20+
#if !defined(LED_BUILTIN) && !defined(ARDUINO_NANO_ESP32)
21+
static int const LED_BUILTIN = 2;
22+
#endif
23+
24+
void setup() {
25+
/* Initialize serial and wait up to 5 seconds for port to open */
26+
Serial.begin(9600);
27+
for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime > 5000); ) { }
28+
29+
/* Configure LED pin as an output */
30+
pinMode(LED_BUILTIN, OUTPUT);
31+
32+
/* This function takes care of connecting your sketch variables to the ArduinoIoTCloud object */
33+
initProperties();
34+
35+
/* Initialize Arduino IoT Cloud library */
36+
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
37+
38+
setDebugMessageLevel(DBG_INFO);
39+
ArduinoCloud.printDebugInfo();
40+
}
41+
42+
void loop() {
43+
ArduinoCloud.update();
44+
potentiometer = analogRead(A0);
45+
seconds = millis() / 1000;
46+
}
47+
48+
/*
49+
* 'onLedChange' is called when the "led" property of your Thing changes
50+
*/
51+
void onLedChange() {
52+
Serial.print("LED set to ");
53+
Serial.println(led);
54+
digitalWrite(LED_BUILTIN, led);
55+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <ArduinoIoTCloud.h>
2+
#include <Arduino_ConnectionHandler.h>
3+
4+
/* A complete list of supported boards with WiFi is available here:
5+
* https://github.com/arduino-libraries/ArduinoIoTCloud/#what
6+
*/
7+
#if defined(BOARD_HAS_WIFI)
8+
#define SECRET_SSID "YOUR_WIFI_NETWORK_NAME"
9+
#define SECRET_PASS "YOUR_WIFI_PASSWORD"
10+
#endif
11+
12+
/* ESP8266 ESP32*/
13+
#if defined(BOARD_HAS_SECRET_KEY)
14+
#define SECRET_DEVICE_KEY "my-device-password"
15+
#endif
16+
17+
/* MKR GSM 1400 */ /* MKR NB 1500 */ /* Portenta CAT.M1/NB IoT GNSS Shield */
18+
#if defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_CATM1_NBIOT)
19+
#define SECRET_PIN ""
20+
#define SECRET_APN ""
21+
#define SECRET_LOGIN ""
22+
#define SECRET_PASS ""
23+
#endif
24+
25+
/* MKR WAN 1300/1310 */
26+
#if defined(BOARD_HAS_LORA)
27+
#define SECRET_APP_EUI ""
28+
#define SECRET_APP_KEY ""
29+
#endif
30+
31+
/* Portenta H7 + Ethernet shield */
32+
#if defined(BOARD_HAS_ETHERNET)
33+
#define SECRET_OPTIONAL_IP ""
34+
#define SECRET_OPTIONAL_DNS ""
35+
#define SECRET_OPTIONAL_GATEWAY ""
36+
#define SECRET_OPTIONAL_NETMASK ""
37+
#endif
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#if !(defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_LORA) || \
2+
defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT))
3+
#error "Please check Arduino IoT Cloud supported boards list: https://github.com/arduino-libraries/ArduinoIoTCloud/#what"
4+
#endif
5+
6+
#if defined(BOARD_HAS_SECRET_KEY)
7+
#define BOARD_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
8+
#endif
9+
10+
void onLedChange();
11+
12+
bool led;
13+
int potentiometer;
14+
int seconds;
15+
16+
void initProperties() {
17+
#if defined(BOARD_HAS_SECRET_KEY)
18+
ArduinoCloud.setBoardId(BOARD_ID);
19+
ArduinoCloud.setSecretDeviceKey(SECRET_DEVICE_KEY);
20+
#endif
21+
#if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT)
22+
ArduinoCloud.addProperty(led, Permission::Write).onUpdate(onLedChange);
23+
ArduinoCloud.addProperty(potentiometer, Permission::Read).publishOnChange(10);
24+
ArduinoCloud.addProperty(seconds, Permission::Read).publishOnChange(1);
25+
#elif defined(BOARD_HAS_LORA)
26+
ArduinoCloud.addProperty(led, 1, READWRITE, ON_CHANGE, onLedChange);
27+
ArduinoCloud.addProperty(potentiometer, 2, READ, ON_CHANGE);
28+
ArduinoCloud.addProperty(seconds, 3, READ, 5 * MINUTES);
29+
#endif
30+
}
31+
32+
#if defined(BOARD_HAS_ETHERNET)
33+
/* DHCP mode */
34+
//EthernetConnectionHandler ArduinoIoTPreferredConnection;
35+
/* Manual mode. It will fallback in DHCP mode if SECRET_OPTIONAL_IP is invalid or equal to "0.0.0.0" */
36+
EthernetConnectionHandler ArduinoIoTPreferredConnection(SECRET_OPTIONAL_IP, SECRET_OPTIONAL_DNS, SECRET_OPTIONAL_GATEWAY, SECRET_OPTIONAL_NETMASK);
37+
#elif defined(BOARD_HAS_WIFI)
38+
WiFiConnectionHandler ArduinoIoTPreferredConnection(SECRET_SSID, SECRET_PASS);
39+
#elif defined(BOARD_HAS_GSM)
40+
GSMConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
41+
#elif defined(BOARD_HAS_LORA)
42+
LoRaConnectionHandler ArduinoIoTPreferredConnection(SECRET_APP_EUI, SECRET_APP_KEY, _lora_band::EU868, NULL, _lora_class::CLASS_A);
43+
#elif defined(BOARD_HAS_NB)
44+
NBConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
45+
#elif defined(BOARD_HAS_CATM1_NBIOT)
46+
CatM1ConnectionHandler ArduinoIoTPreferredConnection(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
47+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
This directory is intended for PIO Unit Testing and project tests.
3+
4+
Unit Testing is a software testing method by which individual units of
5+
source code, sets of one or more MCU program modules together with associated
6+
control data, usage procedures, and operating procedures, are tested to
7+
determine whether they are fit for use. Unit testing finds problems early
8+
in the development cycle.
9+
10+
More information about PIO Unit Testing:
11+
- https://docs.platformio.org/page/plus/unit-testing.html

platform.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"type": "git",
2222
"url": "https://github.com/platformio/platform-renesas-ra.git"
2323
},
24-
"version": "1.3.0",
24+
"version": "1.3.1",
2525
"frameworks": {
2626
"arduino": {
2727
"package": "framework-arduinorenesas-uno",

0 commit comments

Comments
 (0)