nbus_master_module.c 942 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * nbus_master_module.c
  3. *
  4. * Created on: Nov 12, 2023
  5. * Author: juraj
  6. */
  7. #include "nbus_types.h"
  8. #include "nbus_master_module.h"
  9. #if MODULE_MASTER == 1
  10. void nbus_master_unicastToModuleSet(nBus_TypeDef *nbus){
  11. }
  12. void nbus_master_unicastToModuleGet(nBus_TypeDef *nbus){
  13. // case CMD_SYNC:
  14. {
  15. if(nbus->rx_length < 11){
  16. return;
  17. }
  18. RTC_TimeTypeDef sTime = {0};
  19. RTC_DateTypeDef sDate = {0};
  20. sTime.Hours = nbus->rx_buffer[7];
  21. sTime.Minutes = nbus->rx_buffer[8];
  22. sTime.Seconds = nbus->rx_buffer[9];
  23. sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
  24. sTime.StoreOperation = RTC_STOREOPERATION_RESET;
  25. HAL_RTC_SetTime(nbus->periph->rtc, &sTime, RTC_FORMAT_BCD);
  26. sDate.WeekDay = nbus->rx_buffer[6];
  27. sDate.Date = nbus->rx_buffer[5];
  28. sDate.Month = nbus->rx_buffer[4];
  29. sDate.Year = nbus->rx_buffer[3];
  30. HAL_RTC_SetDate(nbus->periph->rtc, &sDate, RTC_FORMAT_BCD);
  31. }
  32. // break;
  33. }
  34. #endif