From f385be34aa1621b04b02bf418692af77c94cad35 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 | 11 +++++++---- 2 files changed, 8 insertions(+), 5 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..fe4e5ec 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -197,7 +197,7 @@ extern void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirect if (is_write) { i2cs_RTC_date_from_buffer(&date_s, &i2cs_r_buff[1]); - HAL_RTC_SetDate(&hrtc, &date_s, RTC_FORMAT_BIN); + HAL_RTC_SetDate(&hrtc, &date_s, RTC_FORMAT_BCD); } HAL_RTC_GetDate(&hrtc, &date_s, RTC_FORMAT_BCD); @@ -209,7 +209,7 @@ extern void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirect if (is_write) { i2cs_RTC_time_from_buffer(&time_s, &i2cs_r_buff[1]); - HAL_RTC_SetTime(&hrtc, &time_s, RTC_FORMAT_BIN); + HAL_RTC_SetTime(&hrtc, &time_s, RTC_FORMAT_BCD); } HAL_RTC_GetTime(&hrtc, &time_s, RTC_FORMAT_BCD); @@ -280,12 +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_DATE || + reg == REG_ID_RTC_ALARM_DATE) { + if (is_write) + bytes_needed = 3; } else if (reg == REG_ID_RTC_TIME || - reg == REG_ID_RTC_DATE) { + reg == REG_ID_RTC_ALARM_TIME) { if (is_write) bytes_needed = 4; }