8000 Style fixes, submodules · unixjazz/circuitpython@849e3a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 849e3a7

Browse files
committed
Style fixes, submodules
1 parent 525b34b commit 849e3a7

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = {
4747
},
4848
};
4949

50-
STATIC uint8_t true_deep_wake_reason;
50+
STATIC stm_sleep_source_t true_deep_wake_reason;
5151
STATIC mp_obj_t most_recent_alarm;
5252

5353
void alarm_reset(void) {
@@ -60,11 +60,11 @@ void alarm_reset(void) {
6060

6161
// Kind of a hack, required as RTC is reset in port.c
6262
// TODO: in the future, don't reset it at all, just override critical flags
63-
void alarm_set_wakeup_reason(uint8_t reason) {
63+
void alarm_set_wakeup_reason(stm_sleep_source_t reason) {
6464
true_deep_wake_reason = reason;
6565
}
6666

67-
STATIC uint8_t _get_wakeup_cause(void) {
67+
STATIC stm_sleep_source_t _get_wakeup_cause(void) {
6868
// If in light/fake sleep, check modules
6969
if (alarm_pin_pinalarm_woke_us_up()) {
7070
return STM_WAKEUP_GPIO;
@@ -84,7 +84,7 @@ bool common_hal_alarm_woken_from_sleep(void) {
8484
}
8585

8686
STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) {
87-
uint8_t cause = _get_wakeup_cause();
87+
stm_sleep_source_t cause = _get_wakeup_cause();
8888
switch (cause) {
8989
case STM_WAKEUP_RTC: {
9090
return alarm_time_timealarm_get_wakeup_alarm(n_alarms, alarms);

ports/stm/common-hal/alarm/__init__.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@
3131

3232
extern const alarm_sleep_memory_obj_t alarm_sleep_memory_obj;
3333

34-
#define STM_WAKEUP_UNDEF 0
35-
#define STM_WAKEUP_GPIO 1
36-
#define STM_WAKEUP_RTC 2
34+
typedef enum {
35+
STM_WAKEUP_UNDEF,
36+
STM_WAKEUP_GPIO,
37+
STM_WAKEUP_RTC
38+
} stm_sleep_source_t;
3739

38-
#define STM_ALARM_FLAG RTC->BKP0R
40+
#define STM_ALARM_FLAG (RTC->BKP0R)
3941

40-
extern void alarm_set_wakeup_reason(uint8_t reason);
42+
extern void alarm_set_wakeup_reason(stm_sleep_source_t reason);
4143
extern void alarm_reset(void);
4244

4345
#endif // MICROPY_INCLUDED_STM32_COMMON_HAL_ALARM__INIT__H

0 commit comments

Comments
 (0)
0