From 849e3a7319e337e0565715c44146ce2d88e123b3 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 13 May 2021 11:24:27 -0400 Subject: [PATCH] Style fixes, submodules --- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_SimpleMath | 2 +- ports/stm/common-hal/alarm/__init__.c | 8 ++++---- ports/stm/common-hal/alarm/__init__.h | 12 +++++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 829ba0f0a2..de68b7d457 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 829ba0f0a2d8a63f7d0215c6c9fc821e14e52a93 +Subproject commit de68b7d4575151c1648c734559e59c2932965939 diff --git a/frozen/Adafruit_CircuitPython_SimpleMath b/frozen/Adafruit_CircuitPython_SimpleMath index cdf9944730..5f382650e6 160000 --- a/frozen/Adafruit_CircuitPython_SimpleMath +++ b/frozen/Adafruit_CircuitPython_SimpleMath @@ -1 +1 @@ -Subproject commit cdf99447307473080b2f2e95e7c3667247095ac0 +Subproject commit 5f382650e62e05cc72a67dbedce13d706d699621 diff --git a/ports/stm/common-hal/alarm/__init__.c b/ports/stm/common-hal/alarm/__init__.c index 59aa7c4445..e0b900bbfc 100644 --- a/ports/stm/common-hal/alarm/__init__.c +++ b/ports/stm/common-hal/alarm/__init__.c @@ -47,7 +47,7 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { }, }; -STATIC uint8_t true_deep_wake_reason; +STATIC stm_sleep_source_t true_deep_wake_reason; STATIC mp_obj_t most_recent_alarm; void alarm_reset(void) { @@ -60,11 +60,11 @@ void alarm_reset(void) { // Kind of a hack, required as RTC is reset in port.c // TODO: in the future, don't reset it at all, just override critical flags -void alarm_set_wakeup_reason(uint8_t reason) { +void alarm_set_wakeup_reason(stm_sleep_source_t reason) { true_deep_wake_reason = reason; } -STATIC uint8_t _get_wakeup_cause(void) { +STATIC stm_sleep_source_t _get_wakeup_cause(void) { // If in light/fake sleep, check modules if (alarm_pin_pinalarm_woke_us_up()) { return STM_WAKEUP_GPIO; @@ -84,7 +84,7 @@ bool common_hal_alarm_woken_from_sleep(void) { } STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { - uint8_t cause = _get_wakeup_cause(); + stm_sleep_source_t cause = _get_wakeup_cause(); switch (cause) { case STM_WAKEUP_RTC: { return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms); diff --git a/ports/stm/common-hal/alarm/__init__.h b/ports/stm/common-hal/alarm/__init__.h index 5f1532fc37..4ec7222d2e 100644 --- a/ports/stm/common-hal/alarm/__init__.h +++ b/ports/stm/common-hal/alarm/__init__.h @@ -31,13 +31,15 @@ extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj; -#define STM_WAKEUP_UNDEF 0 -#define STM_WAKEUP_GPIO 1 -#define STM_WAKEUP_RTC 2 +typedef enum { + STM_WAKEUP_UNDEF, + STM_WAKEUP_GPIO, + STM_WAKEUP_RTC +} stm_sleep_source_t; -#define STM_ALARM_FLAG RTC->BKP0R +#define STM_ALARM_FLAG (RTC->BKP0R) -extern void alarm_set_wakeup_reason(uint8_t reason); +extern void alarm_set_wakeup_reason(stm_sleep_source_t reason); extern void alarm_reset(void); #endif // MICROPY_INCLUDED_STM32_COMMON_HAL_ALARM__INIT__H