mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
cpu/cc2538: reset rtt on init
This commit is contained in:
parent
329a65fb3b
commit
eb8f747a34
@ -30,9 +30,9 @@
|
||||
#define SMWDTHROSC_STLOAD_STLOAD_MASK (0x00000001)
|
||||
|
||||
/* allocate memory for alarm and overflow callbacks + args */
|
||||
static rtt_cb_t alarm_cb = NULL;
|
||||
static rtt_cb_t alarm_cb;
|
||||
static void *alarm_arg;
|
||||
static rtt_cb_t overflow_cb = NULL;
|
||||
static rtt_cb_t overflow_cb;
|
||||
static void *overflow_arg;
|
||||
|
||||
static uint32_t rtt_alarm;
|
||||
@ -68,6 +68,10 @@ void rtt_poweroff(void)
|
||||
|
||||
void rtt_init(void)
|
||||
{
|
||||
rtt_clear_overflow_cb();
|
||||
rtt_clear_alarm();
|
||||
rtt_offset = 0;
|
||||
rtt_alarm = 0;
|
||||
rtt_poweron();
|
||||
}
|
||||
|
||||
@ -176,19 +180,24 @@ void isr_sleepmode(void)
|
||||
|
||||
switch (rtt_next_alarm) {
|
||||
case RTT_ALARM:
|
||||
/* 'consume' the callback (as it might be set again in the cb) */
|
||||
tmp = alarm_cb;
|
||||
alarm_cb = NULL;
|
||||
tmp(alarm_arg);
|
||||
if (alarm_cb) {
|
||||
/* 'consume' the callback (as it might be set again in the cb) */
|
||||
tmp = alarm_cb;
|
||||
alarm_cb = NULL;
|
||||
tmp(alarm_arg);
|
||||
|
||||
}
|
||||
if (!both) {
|
||||
break;
|
||||
} /* fall-through */
|
||||
case RTT_OVERFLOW:
|
||||
/* 'consume' the callback (as it might be set again in the cb) */
|
||||
tmp = overflow_cb;
|
||||
overflow_cb = NULL;
|
||||
tmp(overflow_arg);
|
||||
if (overflow_cb) {
|
||||
/* 'consume' the callback (as it might be set again in the cb) */
|
||||
tmp = overflow_cb;
|
||||
overflow_cb = NULL;
|
||||
tmp(overflow_arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user