mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 04:51:12 +02:00
esp32/modesp32: Make wake_on_ext1 available only on SoCs supporting it.
The `esp32.wake_on_ext1()` method should only be available on boards that have SOC_PM_SUPPORT_EXT1_WAKEUP=y. And update docs to reflect this. Signed-off-by: Meir Armon <meirarmon@gmail.com>
This commit is contained in:
committed by
Damien George
parent
4697a06fdb
commit
171d751242
@@ -41,6 +41,8 @@ Functions
|
||||
or a tuple/list of valid Pin objects. *level* should be ``esp32.WAKEUP_ALL_LOW``
|
||||
or ``esp32.WAKEUP_ANY_HIGH``.
|
||||
|
||||
.. note:: This is only available for boards that have ext1 support.
|
||||
|
||||
.. function:: gpio_deep_sleep_hold(enable)
|
||||
|
||||
Configure whether non-RTC GPIO pin configuration is retained during
|
||||
|
@@ -82,7 +82,9 @@ _USER_MEM_ATTR uint8_t rtc_user_mem_data[MICROPY_HW_RTC_USER_MEM_MAX];
|
||||
static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
|
||||
|
||||
machine_rtc_config_t machine_rtc_config = {
|
||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||
.ext1_pins = 0,
|
||||
#endif
|
||||
#if SOC_PM_SUPPORT_EXT0_WAKEUP
|
||||
.ext0_pin = -1
|
||||
#endif
|
||||
|
@@ -31,7 +31,9 @@
|
||||
#include "modmachine.h"
|
||||
|
||||
typedef struct {
|
||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||
uint64_t ext1_pins; // set bit == pin#
|
||||
#endif
|
||||
#if SOC_PM_SUPPORT_EXT0_WAKEUP
|
||||
int8_t ext0_pin; // just the pin#, -1 == None
|
||||
#endif
|
||||
@@ -45,7 +47,9 @@ typedef struct {
|
||||
bool ext0_level : 1;
|
||||
wake_type_t ext0_wake_types;
|
||||
#endif
|
||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||
bool ext1_level : 1;
|
||||
#endif
|
||||
} machine_rtc_config_t;
|
||||
|
||||
extern machine_rtc_config_t machine_rtc_config;
|
||||
|
@@ -97,6 +97,7 @@ static mp_obj_t esp32_wake_on_ext0(size_t n_args, const mp_obj_t *pos_args, mp_m
|
||||
static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext0_obj, 0, esp32_wake_on_ext0);
|
||||
#endif
|
||||
|
||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||
static mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum {ARG_pins, ARG_level};
|
||||
const mp_arg_t allowed_args[] = {
|
||||
@@ -132,6 +133,7 @@ static mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_m
|
||||
return mp_const_none;
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext1_obj, 0, esp32_wake_on_ext1);
|
||||
#endif
|
||||
|
||||
#if SOC_ULP_SUPPORTED
|
||||
static mp_obj_t esp32_wake_on_ulp(const mp_obj_t wake) {
|
||||
@@ -272,7 +274,9 @@ static const mp_rom_map_elem_t esp32_module_globals_table[] = {
|
||||
#if SOC_PM_SUPPORT_EXT0_WAKEUP
|
||||
{ MP_ROM_QSTR(MP_QSTR_wake_on_ext0), MP_ROM_PTR(&esp32_wake_on_ext0_obj) },
|
||||
#endif
|
||||
#if SOC_PM_SUPPORT_EXT1_WAKEUP
|
||||
{ MP_ROM_QSTR(MP_QSTR_wake_on_ext1), MP_ROM_PTR(&esp32_wake_on_ext1_obj) },
|
||||
#endif
|
||||
#if SOC_ULP_SUPPORTED
|
||||
{ MP_ROM_QSTR(MP_QSTR_wake_on_ulp), MP_ROM_PTR(&esp32_wake_on_ulp_obj) },
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user