Skip to content

Commit 5ceb720

Browse files
committed
fixed c formating for pre-commit check
1 parent 9f0cb0e commit 5ceb720

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

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

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj
143143

144144
// Clear the FPU interrupt because it can prevent us from sleeping.
145145
if (__get_FPSCR() & ~(0x9f)) {
146-
__set_FPSCR(__get_FPSCR() & ~(0x9f));
147-
(void)__get_FPSCR();
146+
__set_FPSCR(__get_FPSCR() & ~(0x9f));
147+
(void)__get_FPSCR();
148148
}
149149

150150
// Disable RTC interrupts
@@ -161,8 +161,8 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj
161161
NVIC_EnableIRQ(RTC_IRQn);
162162

163163

164-
// END ATTEMPT ------------------------------
165-
}
164+
// END ATTEMPT ------------------------------
165+
}
166166
if (mp_hal_is_interrupted()) {
167167
return mp_const_none; // Shouldn't be given to python code because exception handling should kick in.
168168
}
@@ -186,8 +186,8 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
186186

187187
// Clear the FPU interrupt because it can prevent us from sleeping.
188188
if (__get_FPSCR() & ~(0x9f)) {
189-
__set_FPSCR(__get_FPSCR() & ~(0x9f));
190-
(void)__get_FPSCR();
189+
__set_FPSCR(__get_FPSCR() & ~(0x9f));
190+
(void)__get_FPSCR();
191191
}
192192

193193
// PinAlarm (hacky way of checking if time alarm or pin alarm)
@@ -196,41 +196,50 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
196196
NVIC_DisableIRQ(RTC_IRQn);
197197
// Must disable the RTC before writing to EVCTRL and TMPCTRL
198198
RTC->MODE0.CTRLA.bit.ENABLE = 0; // Disable the RTC
199-
while (RTC->MODE0.SYNCBUSY.bit.ENABLE); // Wait for synchronization
199+
while (RTC->MODE0.SYNCBUSY.bit.ENABLE) { // Wait for synchronization
200+
;
201+
}
200202
RTC->MODE0.CTRLA.bit.SWRST = 1; // Software reset the RTC
201-
while (RTC->MODE0.SYNCBUSY.bit.SWRST); // Wait for synchronization
203+
while (RTC->MODE0.SYNCBUSY.bit.SWRST) { // Wait for synchronization
204+
;
205+
}
202206
RTC->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_PRESCALER_DIV1024 | // Set prescaler to 1024
203-
RTC_MODE0_CTRLA_MODE_COUNT32; // Set RTC to mode 0, 32-bit timer
207+
RTC_MODE0_CTRLA_MODE_COUNT32; // Set RTC to mode 0, 32-bit timer
204208

205209
// TODO: map requested pin to limited selection of TAMPER pins
206210
RTC->MODE0.TAMPCTRL.bit.DEBNC2 = 1; // Edge triggered when INn is stable for 4 CLK_RTC_DEB periods
207211
RTC->MODE0.TAMPCTRL.bit.TAMLVL2 = 1; // rising edge
208-
//PA02 = IN2
212+
// PA02 = IN2
209213
RTC->MODE0.TAMPCTRL.bit.IN2ACT = 1; // WAKE on IN2 (doesn't save timestamp)
210214

211215
// Enable interrupts
212216
NVIC_SetPriority(RTC_IRQn, 0);
213217
NVIC_EnableIRQ(RTC_IRQn);
214218
// Set interrupts for TAMPER or overflow
215219
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_TAMPER;
216-
// TimeAlarm
217220
} else {
221+
// TimeAlarm
218222
// Retrieve COMP1 value before resetting RTC
219-
// Disable interrupts
220223
NVIC_DisableIRQ(RTC_IRQn);
221224

222225
// Must disable the RTC before writing to EVCTRL and TMPCTRL
223226
RTC->MODE0.CTRLA.bit.ENABLE = 0; // Disable the RTC
224-
while (RTC->MODE0.SYNCBUSY.bit.ENABLE); // Wait for synchronization
227+
while (RTC->MODE0.SYNCBUSY.bit.ENABLE) { // Wait for synchronization
228+
;
229+
}
225230

226231
RTC->MODE0.CTRLA.bit.SWRST = 1; // Software reset the RTC
227-
while (RTC->MODE0.SYNCBUSY.bit.SWRST); // Wait for synchronization
232+
while (RTC->MODE0.SYNCBUSY.bit.SWRST) { // Wait for synchronization
233+
;
234+
}
228235

229236
RTC->MODE0.CTRLA.reg = RTC_MODE0_CTRLA_PRESCALER_DIV1024 | // Set prescaler to 1024
230-
RTC_MODE0_CTRLA_MODE_COUNT32; // Set RTC to mode 0, 32-bit timer
237+
RTC_MODE0_CTRLA_MODE_COUNT32; // Set RTC to mode 0, 32-bit timer
231238

232239
RTC->MODE0.COMP[1].reg = (_target/1024) * 32;
233-
while(RTC->MODE0.SYNCBUSY.reg);
240+
while(RTC->MODE0.SYNCBUSY.reg) {
241+
;
242+
}
234243

235244
// Enable interrupts
236245
NVIC_SetPriority(RTC_IRQn, 0);
@@ -241,9 +250,13 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
241250
// Set-up Deep Sleep Mode
242251
// RAM retention
243252
PM->BKUPCFG.reg = PM_BKUPCFG_BRAMCFG(0x2); // No RAM retention 0x2 partial:0x1
244-
while (PM->BKUPCFG.bit.BRAMCFG != 0x2); // Wait for synchronization
253+
while (PM->BKUPCFG.bit.BRAMCFG != 0x2) { // Wait for synchronization
254+
;
255+
}
245256
PM->SLEEPCFG.reg = PM_SLEEPCFG_SLEEPMODE_BACKUP;
246-
while(PM->SLEEPCFG.bit.SLEEPMODE != PM_SLEEPCFG_SLEEPMODE_BACKUP_Val);
257+
while (PM->SLEEPCFG.bit.SLEEPMODE != PM_SLEEPCFG_SLEEPMODE_BACKUP_Val) {
258+
;
259+
}
247260

248261
RTC->MODE0.CTRLA.bit.ENABLE = 1; // Enable the RTC
249262
while (RTC->MODE0.SYNCBUSY.bit.ENABLE); // Wait for synchronization

ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, con
9090
gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_A);
9191
if (self->pull) {
9292
gpio_set_pin_pull_mode(pin->number, GPIO_PULL_UP);
93-
} else {
93+
} else {
9494
gpio_set_pin_pull_mode(pin->number, GPIO_PULL_DOWN);
9595
}
9696
set_eic_channel_data(self->channel, (void *)self);
@@ -116,7 +116,7 @@ bool common_hal_alarm_pin_pinalarm_get_pull(alarm_pin_pinalarm_obj_t *self) {
116116
}
117117

118118
bool alarm_pin_pinalarm_woke_this_cycle(void) {
119-
if (RTC->MODE0.INTFLAG.bit.TAMPER){
119+
if (RTC->MODE0.INTFLAG.bit.TAMPER) {
120120
woke_up = true;
121121
RTC->MODE0.INTENCLR.bit.TAMPER = 1; // clear flag and interrupt setting
122122
}

ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_
119119
}
120120
// Set COMP1 for fake sleep. This will be reset for real deep sleep anyways.
121121
RTC->MODE0.COMP[1].reg = wakeup_in_ticks;
122-
while (RTC->MODE0.SYNCBUSY.reg);
122+
while (RTC->MODE0.SYNCBUSY.reg) {
123+
;
124+
}
123125

124126
// This is set for fake sleep. Max fake sleep time is ~72 hours
125127
// True deep sleep isn't limited by this

ports/atmel-samd/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ void RTC_Handler(void) {
499499
#ifdef SAM_D5X_E5X
500500
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
501501
// Check if we're sleeping
502-
if (SAMD_ALARM_FLAG){
502+
if (SAMD_ALARM_FLAG) {
503503
timer_callback();
504504
SAMD_ALARM_FLAG = 0;
505505
}

0 commit comments

Comments
 (0)