From e1a77fc1cadadb48826b7e996f8442249a881983 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Sun, 1 Jun 2025 10:54:52 +0200 Subject: [PATCH] v0.5 fix patch --- Core/Inc/version.h | 2 +- Core/Src/main.c | 13 +++++++------ Core/Src/rtc.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/Inc/version.h b/Core/Inc/version.h index 58847fe..d00bd95 100644 --- a/Core/Inc/version.h +++ b/Core/Inc/version.h @@ -2,6 +2,6 @@ #define VERSION_H_ #define VERSION_MAJOR (0) -#define VERSION_MINOR (3) +#define VERSION_MINOR (5) #endif /* VERSION_H_ */ diff --git a/Core/Src/main.c b/Core/Src/main.c index 6bec462..4ea3c70 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -200,7 +200,7 @@ extern void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirect HAL_RTC_SetDate(&hrtc, &date_s, RTC_FORMAT_BIN); } - HAL_RTC_GetDate(&hrtc, &date_s, RTC_FORMAT_BCD); + HAL_RTC_GetDate(&hrtc, &date_s, RTC_FORMAT_BIN); i2cs_fill_buffer_RTC_date(&i2cs_w_buff[1], &date_s); i2cs_w_len = 5; @@ -212,7 +212,7 @@ extern void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirect HAL_RTC_SetTime(&hrtc, &time_s, RTC_FORMAT_BIN); } - HAL_RTC_GetTime(&hrtc, &time_s, RTC_FORMAT_BCD); + HAL_RTC_GetTime(&hrtc, &time_s, RTC_FORMAT_BIN); i2cs_fill_buffer_RTC_time(&i2cs_w_buff[1], &time_s); i2cs_w_len = 4; @@ -280,14 +280,15 @@ extern void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c) { reg == REG_ID_FRQ) { if (is_write) bytes_needed = 1; - } else if (reg == REG_ID_DEB) { if (is_write) bytes_needed = 2; - } else if (reg == REG_ID_RTC_TIME || - reg == REG_ID_RTC_DATE) { + } else if (reg == REG_ID_RTC_DATE || + reg == REG_ID_RTC_ALARM_DATE || + reg == REG_ID_RTC_TIME || + reg == REG_ID_RTC_ALARM_TIME) { if (is_write) - bytes_needed = 4; + bytes_needed = 3; } if (bytes_needed > 0) diff --git a/Core/Src/rtc.c b/Core/Src/rtc.c index 18e6712..d238324 100644 --- a/Core/Src/rtc.c +++ b/Core/Src/rtc.c @@ -12,7 +12,7 @@ extern void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) { uint8_t date_valid = 1; if ((rtc_conf & RTC_CFG_DATE_ALARM) == RTC_CFG_DATE_ALARM) { - HAL_RTC_GetDate(hrtc, &date_s, RTC_FORMAT_BCD); + HAL_RTC_GetDate(hrtc, &date_s, RTC_FORMAT_BIN); if (date_s.Year != rtc_alarm_date._s.Year || date_s.Month != rtc_alarm_date._s.Month || date_s.Date != rtc_alarm_date._s.Date) @@ -73,7 +73,7 @@ inline uint32_t rtc_run_alarm(void) { alarm_s.AlarmTime.Hours = rtc_alarm_time._s.Hours; alarm_s.AlarmTime.Minutes = rtc_alarm_time._s.Minutes; alarm_s.AlarmTime.Seconds = rtc_alarm_time._s.Seconds; - return (uint32_t)HAL_RTC_SetAlarm_IT(&hrtc, &alarm_s, RTC_FORMAT_BCD); + return (uint32_t)HAL_RTC_SetAlarm_IT(&hrtc, &alarm_s, RTC_FORMAT_BIN); } inline uint32_t rtc_stop_alarm(void) {