-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysTickDelays.h
73 lines (64 loc) · 1.88 KB
/
sysTickDelays.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*!
* sysTickDelays.h
* Description: Helper file for delay functions using SysTick timer. Must be
* initialized with system clock frequency using initDelayTimer.
*
* Author: ece230
*/
#ifndef SYSTICKDELAYS_H_
#define SYSTICKDELAYS_H_
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
#define UNDERFLOW 2
#define OVERFLOW 1
#define SUCCESS 0
/*!
*
* \brief This function initializes sysTick based delay module
*
* This function initializes sysTick based delay module to set clock frequency.
*
* \param clkFreq is the frequency of the system clock in Hz
*
* \return None
*/
extern void initDelayTimer(uint32_t clkFreq);
/*!
* \brief This function delays for specified time
*
* This function delays for specified microseconds using sysTick.
*
* \param micros is the number of microseconds to delay
*
* \return 0 on success, 1 if microsecond count is too large,
* 2 if microsecond count is too small
*/
extern int delayMicroSec(uint32_t micros);
/*!
* \brief This function delays for specified time
*
* This function delays for specified milliseconds using sysTick.
*
* \param millis is the number of milliseconds to delay
*
* \return 0 on success, 1 if millisecond count is too large,
* 2 if millisecond count is too small
*/
extern int delayMilliSec(uint32_t millis);
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif /* SYSTICKDELAYS_H_ */