hardware_rtc: make rtc_enable_alarm public

This commit is contained in:
graham sanderson 2021-02-27 19:25:49 -06:00 committed by Graham Sanderson
parent fa34820fb9
commit 0b1de0a62e
2 changed files with 6 additions and 1 deletions

View File

@ -69,6 +69,11 @@ bool rtc_running(void);
*/ */
void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback); void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback);
/*! \brief Enable the RTC alarm (if inactive)
* \ingroup hardware_rtc
*/
void rtc_enable_alarm(void);
/*! \brief Disable the RTC alarm (if active) /*! \brief Disable the RTC alarm (if active)
* \ingroup hardware_rtc * \ingroup hardware_rtc
*/ */

View File

@ -103,7 +103,7 @@ bool rtc_get_datetime(datetime_t *t) {
return true; return true;
} }
static void rtc_enable_alarm(void) { void rtc_enable_alarm(void) {
// Set matching and wait for it to be enabled // Set matching and wait for it to be enabled
hw_set_bits(&rtc_hw->irq_setup_0, RTC_IRQ_SETUP_0_MATCH_ENA_BITS); hw_set_bits(&rtc_hw->irq_setup_0, RTC_IRQ_SETUP_0_MATCH_ENA_BITS);
while(!(rtc_hw->irq_setup_0 & RTC_IRQ_SETUP_0_MATCH_ACTIVE_BITS)) { while(!(rtc_hw->irq_setup_0 & RTC_IRQ_SETUP_0_MATCH_ACTIVE_BITS)) {