Happy times: things work on real hardware!

This commit is contained in:
2019-06-02 21:34:18 -07:00
parent a7f1ffc1b5
commit 1cc2f7adf4
27 changed files with 9353 additions and 9057 deletions

View File

@@ -38,7 +38,7 @@ void RtcDriver::enable_rtc_write()
void RtcDriver::disable_rtc_write()
{
/*<! Disable write protection */
/*<! Enable write protection */
RTC->WPR = 0x00;
}
@@ -47,10 +47,14 @@ void RtcDriver::enable_periodic_alarm()
SET(RTC->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1);
SET(RTC->ALRMASSR, RTC_ALRMASSR_MASKSS);
CLR(RTC->ALRMASSR, RTC_ALRMASSR_SS);
// Only calculate alarms when second rolls over
SET_TO(RTC->ALRMASSR, RTC_ALRMASSR_MASKSS, 0);
SET(RTC->CR, RTC_CR_ALRAE | RTC_CR_ALRAIE);
SET(EXTI->IMR, EXTI_IMR_IM17);
SET(EXTI->EMR, EXTI_EMR_EM17);
SET(EXTI->RTSR, EXTI_RTSR_RT17);
SET(RTC->CR, RTC_CR_ALRAE);
}
ReturnCode RtcDriver::init_hw()
@@ -226,14 +230,12 @@ void RtcDriver::increment_seconds()
extern "C" void RTC_IRQHandler()
{
// Clear the interrupt in the EXTI
SET(EXTI->PR, EXTI_PR_PIF20);
// Clear the wakeup and alarm interrupts in the EXTI
SET(EXTI->PR, EXTI_PR_PIF20 | EXTI_PR_PIF17);
if (RTC->ISR & RTC_ISR_ALRAF) {
RtcDriver::increment_seconds();
CLR(RTC->ISR, RTC_ISR_ALRAF);
}
if (RTC->ISR & RTC_ISR_WUTF) {