1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

samd21:add prescaler option for rtt.c

This commit is contained in:
Dan Evans 2017-07-18 10:10:41 -07:00
parent 938ba0b3c5
commit a59714b02c

View File

@ -27,6 +27,10 @@
/* guard file in case no RTT device was specified */
#if RTT_NUMOF
/* if RTT_PRESCALER is not set, then set it to DIV1 */
#ifndef RTT_PRESCALER
#define RTT_PRESCALER RTC_MODE0_CTRL_PRESCALER_DIV1
#endif
typedef struct {
rtt_cb_t overflow_cb; /**< called from RTT interrupt on overflow */
@ -100,7 +104,8 @@ void rtt_init(void)
while (rtcMode0->STATUS.bit.SYNCBUSY || rtcMode0->CTRL.bit.SWRST) {}
/* Configure as 32bit counter with no prescaler and no clear on match compare */
rtcMode0->CTRL.reg = RTC_MODE0_CTRL_MODE_COUNT32 | RTC_MODE0_CTRL_PRESCALER_DIV1;
rtcMode0->CTRL.reg = RTC_MODE0_CTRL_MODE_COUNT32 |
RTT_PRESCALER;
while (rtcMode0->STATUS.bit.SYNCBUSY) {}
/* Setup interrupt */