Skip to content

Commit

Permalink
chips/samd21: Run timer interrupt at lowest priority
Browse files Browse the repository at this point in the history
And allow other interrupts to run during timer interrupt

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Aug 4, 2019
1 parent 578b1a4 commit c50c4c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chips/samd21/ao-timer.c
Expand Up @@ -51,6 +51,7 @@ volatile uint8_t ao_data_count;

void samd21_systick_isr(void)
{
ao_arch_release_interrupts();
if (samd21_systick.csr & (1 << SAMD21_SYSTICK_CSR_COUNTFLAG)) {
++ao_tick_count;
#ifdef AO_TIMER_HOOK
Expand Down Expand Up @@ -81,6 +82,8 @@ ao_timer_init(void)
samd21_systick.csr = ((1 << SAMD21_SYSTICK_CSR_ENABLE) |
(1 << SAMD21_SYSTICK_CSR_TICKINT) |
(SAMD21_SYSTICK_CSR_CLKSOURCE_HCLK_8 << SAMD21_SYSTICK_CSR_CLKSOURCE));
/* Set clock to lowest priority */
samd21_scb.shpr3 |= 3 << 30;
}

#endif
Expand Down

0 comments on commit c50c4c4

Please sign in to comment.