L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file timer.h
5 * @author MCD Application Team
6 * @brief Wrapper to timer server
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2026 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20
21/* Define to prevent recursive inclusion -------------------------------------*/
22#ifndef __TIMER_H__
23#define __TIMER_H__
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* Includes ------------------------------------------------------------------*/
30#include "stm32_timer.h"
31/* USER CODE BEGIN Includes */
32
33/* USER CODE END Includes */
34
35/* Exported types ------------------------------------------------------------*/
36/* USER CODE BEGIN ET */
37
38/* USER CODE END ET */
39
40/* Exported constants --------------------------------------------------------*/
41/**
42 * @brief Max timer mask
43 */
44#define TIMERTIME_T_MAX ( ( uint32_t )~0 )
45
46/* USER CODE BEGIN EC */
47
48/* USER CODE END EC */
49
50/* External variables --------------------------------------------------------*/
51/* USER CODE BEGIN EV */
52
53/* USER CODE END EV */
54
55/* Exported macro ------------------------------------------------------------*/
56/**
57 * @brief Timer value on 32 bits
58 */
59#define TimerTime_t UTIL_TIMER_Time_t
60
61/**
62 * @brief Timer object description
63 */
64#define TimerEvent_t UTIL_TIMER_Object_t
65
66/**
67 * @brief Create the timer object
68 */
69#define TimerInit(HANDLE, CB) do {\
70 UTIL_TIMER_Create( HANDLE, TIMERTIME_T_MAX, UTIL_TIMER_ONESHOT, CB, NULL);\
71 } while(0)
72
73/**
74 * @brief update the period and start the timer
75 */
76#define TimerSetValue(HANDLE, TIMEOUT) do{ \
77 UTIL_TIMER_SetPeriod(HANDLE, TIMEOUT);\
78 } while(0)
79
80/**
81 * @brief Start and adds the timer object to the list of timer events
82 */
83#define TimerStart(HANDLE) do {\
84 UTIL_TIMER_Start(HANDLE);\
85 } while(0)
86
87/**
88 * @brief Stop and removes the timer object from the list of timer events
89 */
90#define TimerStop(HANDLE) do {\
91 UTIL_TIMER_Stop(HANDLE);\
92 } while(0)
93
94/**
95 * @brief return the current time
96 */
97#define TimerGetCurrentTime UTIL_TIMER_GetCurrentTime
98
99/**
100 * @brief return the elapsed time
101 */
102#define TimerGetElapsedTime UTIL_TIMER_GetElapsedTime
103
104/* USER CODE BEGIN EM */
105
106/* USER CODE END EM */
107
108/* Exported functions prototypes ---------------------------------------------*/
109/* USER CODE BEGIN EFP */
110
111/* USER CODE END EFP */
112
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* __TIMER_H__*/