You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/programmers-guide.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1400,7 +1400,7 @@ Use the [`esp:deep_sleep/1`](./apidocs/erlang/eavmlib/esp.md#deep_sleep1) functi
1400
1400
esp:deep_sleep(60*1000).
1401
1401
```
1402
1402
1403
-
Use the [`esp:sleep_get_wakeup_cause/0`](./apidocs/erlang/eavmlib/esp.md#sleep_get_wakeup_cause0) function to inspect the reason for a wakeup. Possible return values include:
1403
+
For ESP-IDF 5.5 compatibility, use [`esp:sleep_get_wakeup_cause/0`](./apidocs/erlang/eavmlib/esp.md#sleep_get_wakeup_cause0) to inspect a single wakeup reason. Possible values include:
1404
1404
1405
1405
* `sleep_wakeup_ext0`
1406
1406
* `sleep_wakeup_ext1`
@@ -1411,7 +1411,7 @@ Use the [`esp:sleep_get_wakeup_cause/0`](./apidocs/erlang/eavmlib/esp.md#sleep_g
1411
1411
* `sleep_wakeup_uart`
1412
1412
* `sleep_wakeup_wifi`
1413
1413
* `sleep_wakeup_cocpu`
1414
-
* `sleep_wakeup_cocpu_trag_trig`
1414
+
* `sleep_wakeup_cocpu_trap_trig`
1415
1415
* `sleep_wakeup_bt`
1416
1416
* `undefined` (no sleep wakeup)
1417
1417
* `error` (unknown other reason)
@@ -1431,6 +1431,20 @@ case esp:sleep_get_wakeup_cause() of
1431
1431
end.
1432
1432
```
1433
1433
1434
+
For ESP-IDF 6+, use [`esp:sleep_get_wakeup_causes/0`](./apidocs/erlang/eavmlib/esp.md#sleep_get_wakeup_causes0) to inspect all wakeup reasons. This function returns a list, since a wakeup may have multiple causes.
1435
+
1436
+
The values match the semantics of [`esp_sleep_get_wakeup_causes`](https://docs.espressif.com/projects/esp-idf/en/release-v6.0/esp32/api-reference/system/sleep_modes.html).
1437
+
1438
+
```erlang
1439
+
WakeupCauses = esp:sleep_get_wakeup_causes(),
1440
+
case WakeupCauses of
1441
+
[] ->
1442
+
io:format("No wakeup cause available~n");
1443
+
_ ->
1444
+
io:format("Wakeup causes: ~p~n", [WakeupCauses])
1445
+
end.
1446
+
```
1447
+
1434
1448
Use the [`esp:sleep_enable_ext0_wakeup/2`](./apidocs/erlang/eavmlib/esp.md#sleep_enable_ext0_wakeup2) and [`esp:sleep_enable_ext1_wakeup/2`](./apidocs/erlang/eavmlib/esp.md#sleep_enable_ext1_wakeup2) functions to configure ext0 and ext1 wakeup mechanisms. They follow the semantics of [`esp_sleep_enable_ext0_wakeup`](https://docs.espressif.com/projects/esp-idf/en/release-v5.5/esp32/api-reference/system/sleep_modes.html#_CPPv428esp_sleep_enable_ext0_wakeup10gpio_num_ti) and [`esp_sleep_enable_ext1_wakeup`](https://docs.espressif.com/projects/esp-idf/en/release-v5.5/esp32/api-reference/system/sleep_modes.html#_CPPv428esp_sleep_enable_ext1_wakeup8uint64_t28esp_sleep_ext1_wakeup_mode_t).
0 commit comments