Hello I need RTC_TimeStruct and RTC_DateStruct from this function from hw_rtc.c file because these have time datas like second and minute or day. This function return ticks but i can not convert it to time and data. So, I decided to get this struct to my main file and read time.
* @brief Get the RTC timer value
* @param none
* @retval RTC Timer value in ticks
*/
uint32_t HW_RTC_GetTimerValue( void )
{
RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct;
uint32_t CalendarValue = (uint32_t) HW_RTC_GetCalendarValue(&RTC_DateStruct, &RTC_TimeStruct );
return (CalendarValue);
}
In my main file I tried something like this but unfortunately failed.
void rxDoneEventCallback(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
{
//BSP_LED_On(LED2);
TimerStart(&ledTimer);
RTC_TimeTypeDef *tStruct = {0};
tStruct = HW_RTC_GetTimerValue();
if( (payload[0] + (payload[1]<<8)) > 4095 )
{
garbageRxDataCount++ ;
}
else
{
vcom_Send("Second: %d Minute: %d Data: %d" ,tStruct->Seconds, tStruct->Minutes, payload[0] + (payload[1]<<8));
PRINTF("\n");
}
}
All you need to do is call HW_RTC_GetCalendarValue()
directly.
HW_RTC_GetTimerValue()
is calling HW_RTC_GetCalendarValue()
and discards the structured data.
RTC_TimeTypeDef time ;
RTC_DateTypeDef date ;
HW_RTC_GetCalendarValue( &date , &time ) ;
RTC_DateStruct
and RTC_TimeStruct
will be filled with the date and time data by HW_RTC_GetCalendarValue()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.