File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
ports/espressif/common-hal/alarm/pin Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,17 @@ mp_obj_t alarm_pin_pinalarm_record_wake_alarm(void) {
108
108
109
109
#ifdef SOC_PM_SUPPORT_EXT0_WAKEUP
110
110
if (cause == ESP_SLEEP_WAKEUP_EXT0 ) {
111
- pin_number = REG_GET_FIELD (RTC_IO_EXT_WAKEUP0_REG , RTC_IO_EXT_WAKEUP0_SEL );
111
+ int rtc_io_pin_number = REG_GET_FIELD (RTC_IO_EXT_WAKEUP0_REG , RTC_IO_EXT_WAKEUP0_SEL );
112
+ // Look up the GPIO equivalent pin for this RTC GPIO pin. On ESP32, the numbering
113
+ // is different for RTC_GPIO and regular GPIO, and there's no mapping table.
114
+ // The RTC and GPIO pin numbers match for all other current chips, so we could skip this
115
+ // for those chips, but it's not expensive, and maybe there will be another mismatch in the future.
116
+ for (gpio_num_t gpio_num = 0 ; gpio_num < SOC_GPIO_PIN_COUNT ; gpio_num ++ ) {
117
+ if (rtc_io_number_get (gpio_num ) == rtc_io_pin_number ) {
118
+ pin_number = gpio_num ;
119
+ break ;
120
+ }
121
+ }
112
122
} else {
113
123
#endif
114
124
#ifdef SOC_PM_SUPPORT_EXT1_WAKEUP
You can’t perform that action at this time.
0 commit comments