Skip to content

Commit

Permalink
fix error when starting with i != 0
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannipollo committed Jan 20, 2022
1 parent a00677a commit 233a286
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void flashRead(uint32_t idx, void *rdBuf, uint32_t Nsize, DataTypeDef dataType);


int log_unix_timestamp(RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate);
void log_rtc_setup(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate, const char *start);
void log_rtc_setup(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate, const char *start, struct COMM_Handle *hcomm);
void log_set_start_number(uint16_t this_number);
int log_update_number(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate, uint16_t this_number, struct COMM_Handle *hcomm);
4 changes: 3 additions & 1 deletion src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ int log_unix_timestamp(RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate) {
return t_of_day;
}

void log_rtc_setup(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate, const char *start) {
void log_rtc_setup(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *gTime, RTC_DateTypeDef *gDate, const char *start, struct COMM_Handle *hcomm) {
int hour, min, sec, day, month, year;
flashSetSectorAddrs(11, 0x080E0000);
hcomm->SrcMemory.basePtr = (uint8_t *)0x080E0000 + i;

// https://community.st.com/s/question/0D53W000004KJtn/cannot-set-time-with-halrtcsettime-on-l412kb-nucleo32-after-init
// HAL_RTC_GetDate(hrtc, gDate, RTC_FORMAT_BIN);
// HAL_RTC_GetTime(hrtc, gTime, RTC_FORMAT_BIN);
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void SystemClock_Config(void) {
}

ONNEW_SYSDTTIME_CB(onNewSysDateTime, newTime) {
log_rtc_setup(&hrtc, &gTime, &gDate, newTime);
log_rtc_setup(&hrtc, &gTime, &gDate, newTime, &hcomm);
setup_phase++;
}

Expand Down

0 comments on commit 233a286

Please sign in to comment.