1
0
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:
Francisco Molina 2020-10-02 09:39:40 +02:00
parent 329a65fb3b
commit eb8f747a34
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8

View File

@ -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;
}