Style fixes, submodules
This commit is contained in:
parent
525b34b042
commit
849e3a7319
@ -1 +1 @@
|
|||||||
Subproject commit 829ba0f0a2d8a63f7d0215c6c9fc821e14e52a93
|
Subproject commit de68b7d4575151c1648c734559e59c2932965939
|
@ -1 +1 @@
|
|||||||
Subproject commit cdf99447307473080b2f2e95e7c3667247095ac0
|
Subproject commit 5f382650e62e05cc72a67dbedce13d706d699621
|
@ -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;
|
STATIC mp_obj_t most_recent_alarm;
|
||||||
|
|
||||||
void alarm_reset(void) {
|
void alarm_reset(void) {
|
||||||
@ -60,11 +60,11 @@ void alarm_reset(void) {
|
|||||||
|
|
||||||
// Kind of a hack, required as RTC is reset in port.c
|
// 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
|
// 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;
|
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 in light/fake sleep, check modules
|
||||||
if (alarm_pin_pinalarm_woke_us_up()) {
|
if (alarm_pin_pinalarm_woke_us_up()) {
|
||||||
return STM_WAKEUP_GPIO;
|
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) {
|
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) {
|
switch (cause) {
|
||||||
case STM_WAKEUP_RTC: {
|
case STM_WAKEUP_RTC: {
|
||||||
return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms);
|
return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms);
|
||||||
|
@ -31,13 +31,15 @@
|
|||||||
|
|
||||||
extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj;
|
extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj;
|
||||||
|
|
||||||
#define STM_WAKEUP_UNDEF 0
|
typedef enum {
|
||||||
#define STM_WAKEUP_GPIO 1
|
STM_WAKEUP_UNDEF,
|
||||||
#define STM_WAKEUP_RTC 2
|
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);
|
extern void alarm_reset(void);
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_ALARM__INIT__H
|
#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_ALARM__INIT__H
|
||||||
|
Loading…
Reference in New Issue
Block a user