Skip to content

Commit 42404b5

Browse files
meirarmondpgeorge
authored andcommitted
esp32/modesp32: Make wake_on_ulp available only on SoCs that support it.
The `esp32.wake_on_ulp()` method should only be available on boards that have SOC_ULP_SUPPORTED=y. Update docs to reflect this. Signed-off-by: Meir Armon <[email protected]>
1 parent fa393fe commit 42404b5

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/library/esp32.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Functions
2323
Configure whether or not the Ultra-Low-Power co-processor can wake the
2424
device from sleep. *wake* should be a boolean value.
2525

26+
.. note:: This is only available for boards that have ULP coprocessor support.
27+
2628
.. function:: wake_on_ext0(pin, level)
2729

2830
Configure how EXT0 wakes the device from sleep. *pin* can be ``None``

ports/esp32/machine_rtc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ typedef struct {
3434
uint64_t ext1_pins; // set bit == pin#
3535
int8_t ext0_pin; // just the pin#, -1 == None
3636
bool wake_on_touch : 1;
37+
#if SOC_ULP_SUPPORTED
3738
bool wake_on_ulp : 1;
39+
#endif
3840
bool ext0_level : 1;
3941
wake_type_t ext0_wake_types;
4042
bool ext1_level : 1;

ports/esp32/modesp32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_m
126126
}
127127
static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext1_obj, 0, esp32_wake_on_ext1);
128128

129+
#if SOC_ULP_SUPPORTED
129130
static mp_obj_t esp32_wake_on_ulp(const mp_obj_t wake) {
130131
if (machine_rtc_config.ext0_pin != -1) {
131132
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
@@ -134,6 +135,7 @@ static mp_obj_t esp32_wake_on_ulp(const mp_obj_t wake) {
134135
return mp_const_none;
135136
}
136137
static MP_DEFINE_CONST_FUN_OBJ_1(esp32_wake_on_ulp_obj, esp32_wake_on_ulp);
138+
#endif
137139

138140
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
139141
static mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) {
@@ -260,7 +262,9 @@ static const mp_rom_map_elem_t esp32_module_globals_table[] = {
260262
{ MP_ROM_QSTR(MP_QSTR_wake_on_touch), MP_ROM_PTR(&esp32_wake_on_touch_obj) },
261263
{ MP_ROM_QSTR(MP_QSTR_wake_on_ext0), MP_ROM_PTR(&esp32_wake_on_ext0_obj) },
262264
{ MP_ROM_QSTR(MP_QSTR_wake_on_ext1), MP_ROM_PTR(&esp32_wake_on_ext1_obj) },
265+
#if SOC_ULP_SUPPORTED
263266
{ MP_ROM_QSTR(MP_QSTR_wake_on_ulp), MP_ROM_PTR(&esp32_wake_on_ulp_obj) },
267+
#endif
264268
#if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP
265269
{ MP_ROM_QSTR(MP_QSTR_gpio_deep_sleep_hold), MP_ROM_PTR(&esp32_gpio_deep_sleep_hold_obj) },
266270
#endif

0 commit comments

Comments
 (0)