10000 atmel-samd: Minor fixes to SysTick handler, enable all interrupts fun… · ladyada/circuitpython@2ee52c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ee52c4

Browse files
committed
atmel-samd: Minor fixes to SysTick handler, enable all interrupts function.
1 parent f77113c commit 2ee52c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

atmel-samd/mphalport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void SysTick_Handler(void) {
220220
systick_ticks_ms += 1;
221221
// Keep the counter within the range of 31 bit uint values since that's the
222222
// max value for micropython 'small' ints.
223-
systick_ticks_ms = systick_ticks_ms > 2147483647L ? 0 : systick_ticks_ms;
223+
systick_ticks_ms = systick_ticks_ms > (0xFFFFFFFF >> 1) ? 0 : systick_ticks_ms;
224224
}
225225

226226
// Interrupt flags that will be saved and restored during disable/Enable
@@ -237,8 +237,8 @@ void mp_hal_disable_all_interrupts(void) {
237237

238238
void mp_hal_enable_all_interrupts(void) {
239239
// Enable all interrupt sources after timing critical sections.
240-
// Restore ASF-based interrupts.
241-
cpu_irq_restore(irq_flags);
242240
// Restore SysTick interrupt.
243241
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
242+
// Restore ASF-based interrupts.
243+
cpu_irq_restore(irq_flags);
244244
}

0 commit comments

Comments
 (0)
0