diff --git a/atmel-samd/mphalport.c b/atmel-samd/mphalport.c index 721f3659ef..3b70b3d052 100644 --- a/atmel-samd/mphalport.c +++ b/atmel-samd/mphalport.c @@ -220,7 +220,7 @@ void SysTick_Handler(void) { systick_ticks_ms += 1; // Keep the counter within the range of 31 bit uint values since that's the // max value for micropython 'small' ints. - systick_ticks_ms = systick_ticks_ms > 2147483647L ? 0 : systick_ticks_ms; + systick_ticks_ms = systick_ticks_ms > (0xFFFFFFFF >> 1) ? 0 : systick_ticks_ms; } // Interrupt flags that will be saved and restored during disable/Enable @@ -237,8 +237,8 @@ void mp_hal_disable_all_interrupts(void) { void mp_hal_enable_all_interrupts(void) { // Enable all interrupt sources after timing critical sections. - // Restore ASF-based interrupts. - cpu_irq_restore(irq_flags); // Restore SysTick interrupt. SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; + // Restore ASF-based interrupts. + cpu_irq_restore(irq_flags); }