/** ****************************************************************************** * File Name : RTC.h * Description : This file provides code for the configuration * of the RTC instances. ****************************************************************************** * @attention * *

© Copyright (c) 2021 STMicroelectronics. * All rights reserved.

* * This software component is licensed by ST under Ultimate Liberty license * SLA0044, the "License"; You may not use this file except in compliance with * the License. You may obtain a copy of the License at: * www.st.com/SLA0044 * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __rtc_H #define __rtc_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include #include #include "timeServer.h" /*! * \brief Temperature coefficient of the clock source */ #define RTC_TEMP_COEFFICIENT ( -0.035 ) /*! * \brief Temperature coefficient deviation of the clock source */ #define RTC_TEMP_DEV_COEFFICIENT ( 0.0035 ) /*! * \brief Turnover temperature of the clock source */ #define RTC_TEMP_TURNOVER ( 25.0 ) /*! * \brief Turnover temperature deviation of the clock source */ #define RTC_TEMP_DEV_TURNOVER ( 5.0 ) /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ void Board_RTCInit(void); /*! * \brief Returns the minimum timeout value * * \retval minTimeout Minimum timeout value in in ticks */ uint32_t RtcGetMinimumTimeout( void ); /*! * \brief converts time in ms to time in ticks * * \param[IN] milliseconds Time in milliseconds * \retval returns time in timer ticks */ uint32_t RtcMs2Tick( TimerTime_t milliseconds ); /*! * \brief converts time in ticks to time in ms * * \param[IN] time in timer ticks * \retval returns time in milliseconds */ TimerTime_t RtcTick2Ms( uint32_t tick ); /*! * \brief Performs a delay of milliseconds by polling RTC * * \param[IN] milliseconds Delay in ms */ void RtcDelayMs( TimerTime_t milliseconds ); /*! * \brief Sets the RTC timer reference * * \retval value Timer reference value in ticks */ uint32_t RtcSetTimerContext( void ); /*! * \brief Gets the RTC timer reference * * \retval value Timer value in ticks */ uint32_t RtcGetTimerContext( void ); /*! * \brief Gets the system time with the number of seconds elapsed since epoch * * \param [OUT] milliseconds Number of milliseconds elapsed since epoch * \retval seconds Number of seconds elapsed since epoch */ uint32_t RtcGetCalendarTime( uint16_t *milliseconds ); /*! * \brief Get the RTC timer value * * \retval RTC Timer value */ uint32_t RtcGetTimerValue( void ); /*! * \brief Get the RTC timer elapsed time since the last Alarm was set * * \retval RTC Elapsed time since the last alarm in ticks. */ uint32_t RtcGetTimerElapsedTime( void ); /*! * \brief Sets the alarm * * \note The alarm is set at now (read in this funtion) + timeout * * \param timeout [IN] Duration of the Timer ticks */ void RtcSetAlarm( uint32_t timeout ); /*! * \brief Stops the Alarm */ void RtcStopAlarm( void ); /*! * \brief Starts wake up alarm * * \note Alarm in RtcTimerContext.Time + timeout * * \param [IN] timeout Timeout value in ticks */ void RtcStartAlarm( uint32_t timeout ); /*! * \brief Processes pending timer events */ void RtcProcess( void ); /*! * \brief Computes the temperature compensation for a period of time on a * specific temperature. * * \param [IN] period Time period to compensate in milliseconds * \param [IN] temperature Current temperature * * \retval Compensated time period */ TimerTime_t RtcTempCompensation( TimerTime_t period, float temperature ); void HW_RTC_IrqHandler( void ); void Board_RTCInit(void); void RtcBkupWrite( uint32_t data0, uint32_t data1 ); void RtcBkupRead( uint32_t *data0, uint32_t *data1 ); #ifdef __cplusplus } #endif #endif /*__ rtc_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/