Merge pull request #16250 from chrysn-pull-requests/nrf52-more-timers

cpu/nrf52: Expose more timers
This commit is contained in:
chrysn 2021-03-30 20:28:27 +02:00 committed by GitHub
commit fa9a297e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -137,7 +137,7 @@ static const uint8_t pixmap[ROWS][COLS] = {
/** /**
* @brief Timer dev * @brief Timer dev
*/ */
#define TIMER_DEV_NUM (1) #define TIMER_DEV_NUM (2)
#else #else
#error "Module only compatible with microbit and microbit-v2 boards." #error "Module only compatible with microbit and microbit-v2 boards."
#endif #endif

View File

@ -42,11 +42,31 @@ static const timer_conf_t timer_config[] = {
.channels = 3, .channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_08Bit, .bitmode = TIMER_BITMODE_BITMODE_08Bit,
.irqn = TIMER2_IRQn .irqn = TIMER2_IRQn
},
/* The later timers are only present on the larger NRF52 CPUs like NRF52840
* or NRF52833, but not small ones like NRF52810 */
#ifdef NRF_TIMER3
{
.dev = NRF_TIMER3,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_08Bit,
.irqn = TIMER3_IRQn
},
#endif
#ifdef NRF_TIMER4
{
.dev = NRF_TIMER4,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_08Bit,
.irqn = TIMER4_IRQn
} }
#endif
}; };
#define TIMER_0_ISR isr_timer1 #define TIMER_0_ISR isr_timer1
#define TIMER_1_ISR isr_timer2 #define TIMER_1_ISR isr_timer2
#define TIMER_2_ISR isr_timer3
#define TIMER_3_ISR isr_timer4
#define TIMER_NUMOF ARRAY_SIZE(timer_config) #define TIMER_NUMOF ARRAY_SIZE(timer_config)
/** @} */ /** @} */

View File

@ -199,3 +199,10 @@ void TIMER_2_ISR(void)
irq_handler(2); irq_handler(2);
} }
#endif #endif
#ifdef TIMER_3_ISR
void TIMER_3_ISR(void)
{
irq_handler(3);
}
#endif