8000 Added RainMaker support on Arduino IDE for ESP32-C3/S2/S3 (#6598) · bdash9/arduino-esp32@d8a99ed · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8a99ed

Browse files
authored
Added RainMaker support on Arduino IDE for ESP32-C3/S2/S3 (espressif#6598)
* Added RainMaker support on Arduino IDE for ESP32-C3/S2/S3 Closes espressif#6573 Note related to the issue espressif#6435
1 parent 0a1ba74 commit d8a99ed

File tree

4 files changed

+44
-21
lines changed

4 files changed

+44
-21
lines changed

boards.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ esp32s3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
184184
esp32s3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
185185
esp32s3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
186186
esp32s3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
187+
esp32s3.menu.PartitionScheme.rainmaker=RainMaker
188+
esp32s3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
189+
esp32s3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
187190

188191
esp32s3.menu.CPUFreq.240=240MHz (WiFi)
189192
esp32s3.menu.CPUFreq.240.build.f_cpu=240000000L
@@ -304,6 +307,9 @@ esp32c3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
304307
esp32c3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
305308
esp32c3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
306309
esp32c3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
310+
esp32c3.menu.PartitionScheme.rainmaker=RainMaker
311+
esp32c3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
312+
esp32c3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
307313

308314
esp32c3.menu.CPUFreq.160=160MHz (WiFi)
309315
esp32c3.menu.CPUFreq.160.build.f_cpu=160000000L
@@ -475,6 +481,9 @@ esp32s2.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
475481
esp32s2.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
476482
esp32s2.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
477483
esp32s2.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
484+
esp32s2.menu.PartitionScheme.rainmaker=RainMaker
485+
esp32s2.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
486+
esp32s2.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
478487

479488
esp32s2.menu.CPUFreq.240=240MHz (WiFi)
480489
esp32s2.menu.CPUFreq.240.build.f_cpu=240000000L
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# ESP RainMaker Examples
22

33
While building any examples for ESP RainMaker, take care of the following:
4+
45
1. Change partition scheme in Arduino IDE to RainMaker (Tools -> Partition Scheme -> RainMaker).
56
2. Once ESP RainMaker gets started, compulsorily call `WiFi.beginProvision()` which is responsible for user-node mapping.
6-
3. Use appropriate provisioning scheme as per the board.
7+
3. Use the appropriate provisioning scheme as per the board.
78
- ESP32 Board: BLE Provisioning
8-
- ESP32S2 Board: SoftAP Provisioning
9-
4. Set debug level to Info (Tools -> Core Debug Level -> Info). This is recommended, but not mandatory.
9+
- ESP32-C3 Board: BLE Provisioning
10+
- ESP32-S3 Board: BLE Provisioning
11+
- ESP32-S2 Board: SoftAP Provisioning
12+
4. Set debug level to Info (Tools -> Core Debug Level -> Info). This is recommended debug level but not mandatory to run RainMaker.
1013

libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ const char *service_name = "PROV_1234";
99
const char *pop = "abcd1234";
1010

1111
//GPIO for push button
12-
static int gpio_0 = 0;
12+
#if CONFIG_IDF_TARGET_ESP32C3
13+
static int gpio_0 = 9;
14+
static int gpio_dimmer = 7;
15+
#else
1316
//GPIO for virtual device
17+
static int gpio_0 = 0;
1418
static int gpio_dimmer = 16;
15-
/* Variable for reading pin status*/
19+
#endif
20+
1621
bool dimmer_state = true;
1722

1823
// The framework provides some standard device types like switch, lightbulb, fan, temperature sensor.
@@ -23,12 +28,12 @@ void sysProvEvent(arduino_event_t *sys_event)
2328
{
2429
switch (sys_event->event_id) {
2530
case ARDUINO_EVENT_PROV_START:
26-
#if CONFIG_IDF_TARGET_ESP32
27-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
28-
printQR(service_name, pop, "ble");
29-
#else
31+
#if CONFIG_IDF_TARGET_ESP32S2
3032
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
3133
printQR(service_name, pop, "softap");
34+
#else
35+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
36+
printQR(service_name, pop, "ble");
3237
#endif
3338
break;
3439
}
@@ -89,10 +94,10 @@ void setup()
8994
RMaker.start();
9095

9196
WiFi.onEvent(sysProvEvent);
92-
#if CONFIG_IDF_TARGET_ESP32
93-
WiFiProv.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name);
94-
#else
97+
#if CONFIG_IDF_TARGET_ESP32S2
9598
WiFiProv.beginProvision(WIFI_PROV_SCHEME_SOFTAP, WIFI_PROV_SCHEME_HANDLER_NONE, WIFI_PROV_SECURITY_1, pop, service_name);
99+
#else
100+
WiFiProv.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name);
96101
#endif
97102
}
98103

libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ const char *service_name = "PROV_1234";
88
const char *pop = "abcd1234";
99

1010
//GPIO for push button
11-
static int gpio_0 = 0;
11+
#if CONFIG_IDF_TARGET_ESP32C3
12+
static int gpio_0 = 9;
13+
static int gpio_switch = 7;
14+
#else
1215
//GPIO for virtual device
16+
static int gpio_0 = 0;
1317
static int gpio_switch = 16;
18+
#endif
19+
1420
/* Variable for reading pin status*/
1521
bool switch_state = true;
1622

@@ -21,13 +27,13 @@ void sysProvEvent(arduino_event_t *sys_event)
2127
{
2228
switch (sys_event->event_id) {
2329
case ARDUINO_EVENT_PROV_START:
24-
#if CONFIG_IDF_TARGET_ESP32
25-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
26-
printQR(service_name, pop, "ble");
27-
#else
30+
#if CONFIG_IDF_TARGET_ESP32S2
2831
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
2932
printQR(service_name, pop, "softap");
30-
#endif
33+
#else
34+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
35+
printQR(service_name, pop, "ble");
36+
#endif
3137
break;
3238
}
3339
}
@@ -74,10 +80,10 @@ void setup()
7480
RMaker.start();
7581

7682
WiFi.onEvent(sysProvEvent);
77-
#if CONFIG_IDF_TARGET_ESP32
78-
WiFiProv.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name);
79-
#else
83+
#if CONFIG_IDF_TARGET_ESP32S2
8084
WiFiProv.beginProvision(WIFI_PROV_SCHEME_SOFTAP, WIFI_PROV_SCHEME_HANDLER_NONE, WIFI_PROV_SECURITY_1, pop, service_name);
85+
#else
86+
WiFiProv.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name);
8187
#endif
8288
}
8389

0 commit comments

Comments
 (0)
0