Esempio n. 1
0
File: rtc.c Progetto: ant9000/RIOT
void isr_rtc(void)
{
    if (RTC->MODE2.INTFLAG.bit.ALARM0) {
        rtc_callback.cb(rtc_callback.arg);
        /* clear flag */
        RTC->MODE2.INTFLAG.reg |= RTC_MODE2_INTFLAG_ALARM0;
    }
    if (RTC->MODE2.INTFLAG.bit.OVF) {
        /* clear flag */
        RTC->MODE2.INTFLAG.reg |= RTC_MODE2_INTFLAG_OVF;
        /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet)
        * Start RTC again with reference_year 64 years more (Be careful with alarm set) */
        reference_year += 64;
    }
    cortexm_isr_end();
}
Esempio n. 2
0
File: rtc.c Progetto: adjih/RIOT
void isr_rtc(void)
{
    RtcMode2 *rtcMode2 = &(RTC_DEV);
    uint16_t status = rtcMode2->INTFLAG.reg;
    if ((status & RTC_MODE2_INTFLAG_ALARM0) && (rtc_callback.cb != NULL)) {
        rtc_callback.cb(rtc_callback.arg);
        rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_ALARM0;
    }
    if (status & RTC_MODE2_INTFLAG_OVF) {
        /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet)
        * Start RTC again with reference_year 64 years more (Be careful with alarm set) */
        reference_year += 64;
        rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_OVF;
    }
    cortexm_isr_end();
}
Esempio n. 3
0
void isr_rtc(void)
{
    RtcMode2 *rtcMode2 = &(RTC_DEV);
    uint16_t status = rtcMode2->INTFLAG.reg;
    if (status & RTC_MODE2_INTFLAG_ALARM0) {
        rtc_callback.cb(rtc_callback.arg);
        rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_ALARM0;
    }
    if (status & RTC_MODE2_INTFLAG_OVF) {
        /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet)
        * Start RTC again with reference_year 64 years more (Be careful with alarm set) */
        reference_year += 64;
        rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_OVF;
    }
    if (sched_context_switch_request) {
        thread_yield();
    }
}
Esempio n. 4
0
static void rtc_cb(void* arg)
{
    if (rtc_callback.cb != NULL) {
        rtc_callback.cb(arg);
    }
}