|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
configuration of the timer_if.c instances More...
#include "stm32_timer.h"#include "stm32_systime.h"Go to the source code of this file.
Macros | |
| #define | RTC_BKP_STANDBY RTC_BKP_DR3 |
| RTC backup register index used to persist the standby-mode flag across a system reset / wakeup from OFF (standby) mode. Written with RTC_BKP_STANDBY_SIGN before entering standby so that after wakeup the application knows it came from a planned sleep cycle rather than a cold power-on. | |
| #define | RTC_BKP_STANDBY_SIGN 0xABCD |
| Magic value stored in RTC_BKP_STANDBY before entering standby mode. On wakeup, if getBackUpRegister(RTC_BKP_STANDBY) == RTC_BKP_STANDBY_SIGN, the device knows it woke from a planned sleep and can skip full re-initialisation where appropriate. | |
Functions | |
| UTIL_TIMER_Status_t | TIMER_IF_Init (void) |
| Init RTC hardware. | |
| UTIL_TIMER_Status_t | TIMER_IF_StartTimer (uint32_t timeout) |
| Set the alarm. | |
| UTIL_TIMER_Status_t | TIMER_IF_StopTimer (void) |
| Stop the Alarm. | |
| uint32_t | TIMER_IF_SetTimerContext (void) |
| set timer Reference (TimerContext) | |
| uint32_t | TIMER_IF_GetTimerContext (void) |
| Get the RTC timer Reference. | |
| uint32_t | TIMER_IF_GetTimerElapsedTime (void) |
| Get the timer elapsed time since timer Reference (TimerContext) was set. | |
| uint32_t | TIMER_IF_GetTimerValue (void) |
| Get the timer value. | |
| uint32_t | TIMER_IF_GetMinimumTimeout (void) |
| Return the minimum timeout in ticks the RTC is able to handle. | |
| void | TIMER_IF_DelayMs (uint32_t delay) |
| a delay of delay ms by polling RTC | |
| uint32_t | TIMER_IF_Convert_ms2Tick (uint32_t timeMilliSec) |
| converts time in ms to time in ticks | |
| uint32_t | TIMER_IF_Convert_Tick2ms (uint32_t tick) |
| converts time in ticks to time in ms | |
| uint32_t | TIMER_IF_GetTime (uint16_t *subSeconds) |
| Get rtc time. | |
| void | TIMER_IF_BkUp_Write_Seconds (uint32_t Seconds) |
| write seconds in backUp register | |
| uint32_t | TIMER_IF_BkUp_Read_Seconds (void) |
| reads seconds from backUp register | |
| void | TIMER_IF_BkUp_Write_SubSeconds (uint32_t SubSeconds) |
| writes SubSeconds in backUp register | |
| uint32_t | TIMER_IF_BkUp_Read_SubSeconds (void) |
| reads SubSeconds from backUp register | |
configuration of the timer_if.c instances
Copyright (c) 2026 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
Definition in file timer_if.h.
| #define RTC_BKP_STANDBY RTC_BKP_DR3 |
RTC backup register index used to persist the standby-mode flag across a system reset / wakeup from OFF (standby) mode. Written with RTC_BKP_STANDBY_SIGN before entering standby so that after wakeup the application knows it came from a planned sleep cycle rather than a cold power-on.
Definition at line 61 of file timer_if.h.
Referenced by main(), and PWR_EnterOffMode().
| #define RTC_BKP_STANDBY_SIGN 0xABCD |
Magic value stored in RTC_BKP_STANDBY before entering standby mode. On wakeup, if getBackUpRegister(RTC_BKP_STANDBY) == RTC_BKP_STANDBY_SIGN, the device knows it woke from a planned sleep and can skip full re-initialisation where appropriate.
Definition at line 69 of file timer_if.h.
Referenced by main(), and PWR_EnterOffMode().
| uint32_t TIMER_IF_BkUp_Read_Seconds | ( | void | ) |
reads seconds from backUp register
Definition at line 449 of file timer_if.c.
References hrtc, and RTC_BKP_SECONDS.
| uint32_t TIMER_IF_BkUp_Read_SubSeconds | ( | void | ) |
reads SubSeconds from backUp register
Definition at line 462 of file timer_if.c.
References hrtc, and RTC_BKP_SUBSECONDS.
| void TIMER_IF_BkUp_Write_Seconds | ( | uint32_t | Seconds | ) |
write seconds in backUp register
| [in] | Seconds | time in seconds |
Definition at line 427 of file timer_if.c.
References hrtc, and RTC_BKP_SECONDS.
| void TIMER_IF_BkUp_Write_SubSeconds | ( | uint32_t | SubSeconds | ) |
writes SubSeconds in backUp register
| [in] | SubSeconds | time in SubSeconds |
Definition at line 438 of file timer_if.c.
References hrtc, and RTC_BKP_SUBSECONDS.
| uint32_t TIMER_IF_Convert_ms2Tick | ( | uint32_t | timeMilliSec | ) |
converts time in ms to time in ticks
| [in] | timeMilliSec | time in milliseconds |
Definition at line 333 of file timer_if.c.
References RTC_N_PREDIV_S.
Referenced by TIMER_IF_DelayMs().
| uint32_t TIMER_IF_Convert_Tick2ms | ( | uint32_t | tick | ) |
converts time in ticks to time in ms
| [in] | tick | time in timer ticks |
Definition at line 346 of file timer_if.c.
References RTC_N_PREDIV_S.
Referenced by TIMER_IF_GetTime().
| void TIMER_IF_DelayMs | ( | uint32_t | delay | ) |
a delay of delay ms by polling RTC
| delay | in ms |
Definition at line 359 of file timer_if.c.
References GetTimerTicks(), and TIMER_IF_Convert_ms2Tick().
Referenced by HAL_Delay().
| uint32_t TIMER_IF_GetMinimumTimeout | ( | void | ) |
Return the minimum timeout in ticks the RTC is able to handle.
Definition at line 320 of file timer_if.c.
References MIN_ALARM_DELAY.
| uint32_t TIMER_IF_GetTime | ( | uint16_t * | subSeconds | ) |
Get rtc time.
| [out] | subSeconds | in ticks |
Definition at line 403 of file timer_if.c.
References GetTimerTicks(), RTC_N_PREDIV_S, RTC_PREDIV_S, TIMER_IF_BkUp_Read_MSBticks(), and TIMER_IF_Convert_Tick2ms().
| uint32_t TIMER_IF_GetTimerContext | ( | void | ) |
Get the RTC timer Reference.
Definition at line 280 of file timer_if.c.
References RtcTimerContext, and TIMER_IF_DBG_PRINTF.
| uint32_t TIMER_IF_GetTimerElapsedTime | ( | void | ) |
Get the timer elapsed time since timer Reference (TimerContext) was set.
Definition at line 291 of file timer_if.c.
References GetTimerTicks(), and RtcTimerContext.
| uint32_t TIMER_IF_GetTimerValue | ( | void | ) |
Get the timer value.
Definition at line 304 of file timer_if.c.
References GetTimerTicks(), and RTC_Initialized.
Referenced by HAL_GetTick().
| UTIL_TIMER_Status_t TIMER_IF_Init | ( | void | ) |
Init RTC hardware.
DeActivate the Alarm A enabled by STM32CubeMX during MX_RTC_Init()
Definition at line 183 of file timer_if.c.
References hrtc, MX_RTC_Init(), RTC_Initialized, TIMER_IF_BkUp_Write_MSBticks(), TIMER_IF_SetTimerContext(), TIMER_IF_StopTimer(), and UTIL_TIMER_IRQ_MAP_INIT.
| uint32_t TIMER_IF_SetTimerContext | ( | void | ) |
set timer Reference (TimerContext)
Definition at line 266 of file timer_if.c.
References GetTimerTicks(), RtcTimerContext, and TIMER_IF_DBG_PRINTF.
Referenced by TIMER_IF_Init().
| UTIL_TIMER_Status_t TIMER_IF_StartTimer | ( | uint32_t | timeout | ) |
Set the alarm.
| timeout | Duration of the Timer in ticks |
Definition at line 220 of file timer_if.c.
References Error_Handler(), GetTimerTicks(), hrtc, RtcTimerContext, TIMER_IF_DBG_PRINTF, and TIMER_IF_StopTimer().
| UTIL_TIMER_Status_t TIMER_IF_StopTimer | ( | void | ) |
Stop the Alarm.
Definition at line 248 of file timer_if.c.
References hrtc.
Referenced by TIMER_IF_Init(), and TIMER_IF_StartTimer().