diff --git a/cpu/stm32_common/periph/rtc.c b/cpu/stm32_common/periph/rtc.c index ce81dd2231d4646a5c1eeed8d6635a27a4a1e366..195354bad526f3f7eb0c4cb02f05dca14c897f92 100644 --- a/cpu/stm32_common/periph/rtc.c +++ b/cpu/stm32_common/periph/rtc.c @@ -27,7 +27,8 @@ #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F2) || \ defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || \ - defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L1) + defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L0) || \ + defined(CPU_FAM_STM32L1) /* guard file in case no RTC device was specified */ #if RTC_NUMOF @@ -65,7 +66,7 @@ void rtc_init(void) PWR->CR |= PWR_CR_DBP; #endif -#if defined(CPU_FAM_STM32L1) +#if defined(CPU_FAM_STM32L1) || defined(CPU_FAM_STM32L0) if (!(RCC->CSR & RCC_CSR_RTCEN)) { #else if (!(RCC->BDCR & RCC_BDCR_RTCEN)) { @@ -192,9 +193,15 @@ int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg) /* Enable RTC write protection */ RTC->WPR = 0xFF; +#if defined(CPU_FAM_STM32L0) + EXTI->IMR |= EXTI_IMR_IM17; +#else EXTI->IMR |= EXTI_IMR_MR17; +#endif + EXTI->RTSR |= EXTI_RTSR_TR17; -#if defined(CPU_FAM_STM32F0) + +#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32L0) NVIC_SetPriority(RTC_IRQn, 10); NVIC_EnableIRQ(RTC_IRQn); #else @@ -235,7 +242,7 @@ void rtc_clear_alarm(void) void rtc_poweron(void) { -#if defined(CPU_FAM_STM32L1) +#if defined(CPU_FAM_STM32L1) || defined(CPU_FAM_STM32L0) /* Reset RTC domain */ RCC->CSR |= RCC_CSR_RTCRST; RCC->CSR &= ~(RCC_CSR_RTCRST); @@ -274,7 +281,7 @@ void rtc_poweron(void) void rtc_poweroff(void) { -#if defined(CPU_FAM_STM32L1) +#if defined(CPU_FAM_STM32L1) || defined(CPU_FAM_STM32L0) /* Reset RTC domain */ RCC->CSR |= RCC_CSR_RTCRST; RCC->CSR &= ~(RCC_CSR_RTCRST); @@ -293,7 +300,7 @@ void rtc_poweroff(void) #endif } -#if defined(CPU_FAM_STM32F0) +#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32L0) void isr_rtc(void) #else void isr_rtc_alarm(void) @@ -331,4 +338,5 @@ static uint8_t byte2bcd(uint8_t value) #endif /* defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F2) || \ defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || \ - defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L1) */ + defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L0) || \ + defined(CPU_FAM_STM32L1) */