AnsweredAssumed Answered

HAL_RTC_SetTime() - Changing daylight

Question asked by Simon Schüpbach on Apr 25, 2017
Latest reply on Apr 25, 2017 by john doe

I have some problems to understand the functionality of HAL_RTC_SetTime().


It is possible to set time and daylight handling data. This makes sense.

But how can I adjust the daylight without the other time data?

Or the the hours, minutes, seconds only?

hrtc->Instance->TR = (uint32_t)(tmpreg & RTC_TR_RESERVED_MASK);
/* Clear the bits to be configured */
hrtc->Instance->CR &= (uint32_t)~RTC_CR_BCK;
/* Configure the RTC_CR register */
hrtc->Instance->CR |= (uint32_t)(sTime->DayLightSaving | sTime->StoreOperation);

Because inside HAL_RTC_SetTime() the code above is processed always (except in initialisation).

How should I initialise the struct member if I only want to adjust the daylight?

RTC_TimeTypeDef sTime;

sTime.Hours = ?;

sTime.Minutes = ?;

sTime.Seconds = ?;


s.Time.StoreOperation = RTC_STOREOPERATION_SET;

And on the other side what should be written in DayLightSaving if I just want to adjust the time (Hours, Minutes, Seconds)?