/* * nbus_master_module.c * * Created on: Nov 12, 2023 * Author: juraj */ #include "nbus_master_module.h" #include "nbus_types.h" #if MODULE_MASTER == 1 void nbus_master_unicastToModuleSet(nBus_TypeDef *nbus) {} void nbus_master_unicastToModuleGet(nBus_TypeDef *nbus) { // case CMD_SYNC: { if (nbus->rx_length < 11) { return; } RTC_TimeTypeDef sTime = {0}; RTC_DateTypeDef sDate = {0}; sTime.Hours = nbus->rx_buffer[7]; sTime.Minutes = nbus->rx_buffer[8]; sTime.Seconds = nbus->rx_buffer[9]; sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; sTime.StoreOperation = RTC_STOREOPERATION_RESET; HAL_RTC_SetTime(nbus->periph->rtc, &sTime, RTC_FORMAT_BCD); sDate.WeekDay = nbus->rx_buffer[6]; sDate.Date = nbus->rx_buffer[5]; sDate.Month = nbus->rx_buffer[4]; sDate.Year = nbus->rx_buffer[3]; HAL_RTC_SetDate(nbus->periph->rtc, &sDate, RTC_FORMAT_BCD); } // break; } #endif