Skip to content

Commit 930cf14

Browse files
microdev1tannewt
authored andcommitted
Add check for invalid io, function to disable all alarms
1 parent e359389 commit 930cf14

File tree

14 files changed

+32
-11
lines changed

14 files changed

+32
-11
lines changed

ports/atmel-samd/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void common_hal_mcu_reset(void) {
8484
reset();
8585
}
8686

87-
void common_hal_mcu_sleep(void) {
87+
void common_hal_mcu_deep_sleep(void) {
8888
//deep sleep call here
8989
}
9090

ports/cxd56/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void common_hal_mcu_reset(void) {
8181
boardctl(BOARDIOC_RESET, 0);
8282
}
8383

84-
void common_hal_mcu_sleep(void) {
84+
void common_hal_mcu_deep_sleep(void) {
8585
//deep sleep call here
8686
}
8787

ports/esp32s2/common-hal/alarm/__init__.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131

3232
#include "esp_sleep.h"
3333

34+
void common_hal_alarm_disable_all(void) {
35+
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
36+
}
37+
3438
mp_obj_t common_hal_alarm_get_wake_alarm(void) {
3539
switch (esp_sleep_get_wakeup_cause()) {
3640
case ESP_SLEEP_WAKEUP_TIMER: ;

ports/esp32s2/common-hal/alarm_io/__init__.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ mp_obj_t common_hal_alarm_io_pin_state (alarm_io_obj_t *self_in) {
88
mp_raise_ValueError(translate("io must be rtc io"));
99
}
1010

11+
if (self_in->pull && !self_in->level) {
12+
for (uint8_t i = 0; i<=4; i+=2) {
13+
if (self_in->gpio == i) {
14+
mp_raise_ValueError(translate("IOs 0, 2 & 4 do not support internal pullup in sleep"));
15+
}
16+
}
17+
}
18+
1119
switch(esp_sleep_enable_ext0_wakeup(self_in->gpio, self_in->level)) {
1220
case ESP_ERR_INVALID_ARG:
1321
mp_raise_ValueError(translate("trigger level must be 0 or 1"));

ports/esp32s2/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void common_hal_mcu_reset(void) {
7979
while(1);
8080
}
8181

82-
void common_hal_mcu_sleep(void) {
82+
void common_hal_mcu_deep_sleep(void) {
8383
esp_deep_sleep_start();
8484
}
8585

ports/litex/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void common_hal_mcu_reset(void) {
8989
while(1);
9090
}
9191

92-
void common_hal_mcu_sleep(void) {
92+
void common_hal_mcu_deep_sleep(void) {
9393
//deep sleep call here
9494
}
9595

ports/mimxrt10xx/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void common_hal_mcu_reset(void) {
8686
NVIC_SystemReset();
8787
}
8888

89-
void common_hal_mcu_sleep(void) {
89+
void common_hal_mcu_deep_sleep(void) {
9090
//deep sleep call here
9191
}
9292

ports/nrf/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void common_hal_mcu_reset(void) {
9595
reset_cpu();
9696
}
9797

98-
void common_hal_mcu_sleep(void) {
98+
void common_hal_mcu_deep_sleep(void) {
9999
//deep sleep call here
100100
}
101101

ports/stm/common-hal/microcontroller/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void common_hal_mcu_reset(void) {
8181
NVIC_SystemReset();
8282
}
8383

84-
void common_hal_mcu_sleep(void) {
84+
void common_hal_mcu_deep_sleep(void) {
8585
//deep sleep call here
8686
}
8787

py/circuitpy_defns.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ endif
108108
ifeq ($(CIRCUITPY_ALARM_TIME),1)
109109
SRC_PATTERNS += alarm_time/%
110110
endif
111-
ifeq ($(CIRCUITPY_ALARM_TIME),1)
111+
ifeq ($(CIRCUITPY_ALARM_TOUCH),1)
112112
SRC_PATTERNS += alarm_touch/%
113113
endif
114114
ifeq ($(CIRCUITPY_ANALOGIO),1)

0 commit comments

Comments
 (0)