From d283aaf8fd89f498002f0070a58e75cb3e153420 Mon Sep 17 00:00:00 2001 From: Vincent Dupont Date: Wed, 3 Apr 2019 15:41:15 +0200 Subject: [PATCH] cpu/stm32_common: fix month encoding in RTC driver for alarm --- cpu/stm32_common/periph/rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/stm32_common/periph/rtc.c b/cpu/stm32_common/periph/rtc.c index 69507eb44d..6714371050 100644 --- a/cpu/stm32_common/periph/rtc.c +++ b/cpu/stm32_common/periph/rtc.c @@ -299,7 +299,7 @@ int rtc_get_alarm(struct tm *time) uint32_t alrm = RTC->ALRMAR; time->tm_year = bcd2val(dr, RTC_DR_YU_Pos, DR_Y_MASK) + YEAR_OFFSET; - time->tm_mon = bcd2val(dr, RTC_DR_MU_Pos, DR_M_MASK); + time->tm_mon = bcd2val(dr, RTC_DR_MU_Pos, DR_M_MASK) - 1; time->tm_mday = bcd2val(alrm, RTC_ALRMAR_DU_Pos, ALRM_D_MASK); time->tm_hour = bcd2val(alrm, RTC_ALRMAR_HU_Pos, ALRM_H_MASK); time->tm_min = bcd2val(alrm, RTC_ALRMAR_MNU_Pos, ALRM_M_MASK);