mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #12188 from jcarrano/sam0_rtt_fix_flags
cpu/sam0_common/../rtt: correcly clear flags.
This commit is contained in:
commit
c12b88ef59
@ -98,7 +98,7 @@ void rtt_init(void)
|
|||||||
_wait_syncbusy();
|
_wait_syncbusy();
|
||||||
|
|
||||||
/* initially clear flag */
|
/* initially clear flag */
|
||||||
RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_CMP0
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0
|
||||||
| RTC_MODE0_INTFLAG_OVF;
|
| RTC_MODE0_INTFLAG_OVF;
|
||||||
|
|
||||||
NVIC_EnableIRQ(RTC_IRQn);
|
NVIC_EnableIRQ(RTC_IRQn);
|
||||||
@ -116,12 +116,12 @@ void rtt_set_overflow_cb(rtt_cb_t cb, void *arg)
|
|||||||
_overflow_arg = arg;
|
_overflow_arg = arg;
|
||||||
|
|
||||||
/* enable overflow interrupt */
|
/* enable overflow interrupt */
|
||||||
RTC->MODE0.INTENSET.bit.OVF = 1;
|
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_OVF;
|
||||||
}
|
}
|
||||||
void rtt_clear_overflow_cb(void)
|
void rtt_clear_overflow_cb(void)
|
||||||
{
|
{
|
||||||
/* disable overflow interrupt */
|
/* disable overflow interrupt */
|
||||||
RTC->MODE0.INTENCLR.bit.OVF = 1;
|
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_OVF;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t rtt_get_counter(void)
|
uint32_t rtt_get_counter(void)
|
||||||
@ -158,14 +158,14 @@ void rtt_set_alarm(uint32_t alarm, rtt_cb_t cb, void *arg)
|
|||||||
_wait_syncbusy();
|
_wait_syncbusy();
|
||||||
|
|
||||||
/* enable compare interrupt and clear flag */
|
/* enable compare interrupt and clear flag */
|
||||||
RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_CMP0;
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
|
||||||
RTC->MODE0.INTENSET.reg |= RTC_MODE0_INTENSET_CMP0;
|
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtt_clear_alarm(void)
|
void rtt_clear_alarm(void)
|
||||||
{
|
{
|
||||||
/* clear compare interrupt */
|
/* clear compare interrupt */
|
||||||
RTC->MODE0.INTENCLR.bit.CMP0 = 1;
|
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtt_poweron(void)
|
void rtt_poweron(void)
|
||||||
@ -189,16 +189,16 @@ void rtt_poweroff(void)
|
|||||||
void isr_rtc(void)
|
void isr_rtc(void)
|
||||||
{
|
{
|
||||||
if (RTC->MODE0.INTFLAG.bit.OVF) {
|
if (RTC->MODE0.INTFLAG.bit.OVF) {
|
||||||
RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_OVF;
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_OVF;
|
||||||
if (_overflow_cb) {
|
if (_overflow_cb) {
|
||||||
_overflow_cb(_overflow_arg);
|
_overflow_cb(_overflow_arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (RTC->MODE0.INTFLAG.bit.CMP0) {
|
if (RTC->MODE0.INTFLAG.bit.CMP0) {
|
||||||
/* clear flag */
|
/* clear flag */
|
||||||
RTC->MODE0.INTFLAG.reg |= RTC_MODE0_INTFLAG_CMP0;
|
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
|
||||||
/* disable interrupt */
|
/* disable interrupt */
|
||||||
RTC->MODE0.INTENCLR.bit.CMP0 = 1;
|
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
|
||||||
if (_cmp0_cb) {
|
if (_cmp0_cb) {
|
||||||
_cmp0_cb(_cmp0_arg);
|
_cmp0_cb(_cmp0_arg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user