-
Notifications
You must be signed in to change notification settings - Fork 1
/
sysTickTimer.h
49 lines (46 loc) · 1.03 KB
/
sysTickTimer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/** @file
* @brief Header file for timers utility
*/
#ifndef SYSTICKTIMER_H
#define SYSTICKTIMER_H
#include <stdint.h>
#include <stdbool.h>
/**
* @defgroup sysTickTimer
*
* The utility to measure time
*
* sysTickTimer component API
* Used for time measurement
* Period of the timer 1ms
* @{
*/
/**
* @brief Configures sysTick Timer
* Should be called before any actions with module
*
* @return none
*/
void sysTickTimer_Init(void);
/**
* @brief Reading of sysTick Timer counter
* Miliseconds that are passed from moment of call of
* the init function
*
* @return actual sysTick Timer value
*/
uint32_t sysTickTimer_GetTimeMs(void);
/**
* @brief Time period passing check
*
* @param[in] savedTime the time when checking started
* @param[in] period required period
*
* @return true if the period is passed, false - if it is not passed
*/
inline bool sysTickTimer_IsTimePassedMs(uint32_t savedTime, uint32_t period)
{
return ((sysTickTimer_GetTimeMs() - savedTime) >= period);
}
/** @} */
#endif /* SYSTICKTIMER_H */