Rev 786 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 786 | Rev 787 | ||
|---|---|---|---|
| Line 26... | Line 26... | ||
| 26 | /*----------------------------------------------------------------------------- |
26 | /*----------------------------------------------------------------------------- |
| 27 | * Defines |
27 | * Defines |
| 28 | *---------------------------------------------------------------------------*/ |
28 | *---------------------------------------------------------------------------*/ |
| 29 | 29 | ||
| 30 | /** |
30 | /** |
| 31 | * @brief |
31 | * @brief Definition for timer type TimerTypeOneShot |
| 32 | * |
32 | * |
| 33 | * |
33 | * When passed as the type argument to timerSetTimeout, the |
| 34 | * timer will trigger only once and then disable itself. |
34 | * timer will trigger only once and then disable itself. |
| - | 35 | */ |
|
| - | 36 | #define TimerTypeOneShot 0 |
|
| - | 37 | ||
| - | 38 | /** |
|
| - | 39 | * @brief Definition for timer type TimerTypeFreeRunning |
|
| - | 40 | * |
|
| 35 | * |
41 | * When passed as the type argument to timerSetTimeout, |
| 36 | * the timer will reload itself at every expiration and trigger periodically. |
42 | * the timer will reload itself at every expiration and trigger periodically. |
| 37 | */ |
43 | */ |
| 38 | #define TimerTypeOneShot 0 |
- | |
| 39 | #define TimerTypeFreeRunning 1 |
44 | #define TimerTypeFreeRunning 1 |
| 40 | 45 | ||
| 41 | 46 | ||
| 42 | /*----------------------------------------------------------------------------- |
47 | /*----------------------------------------------------------------------------- |
| 43 | * Public Types |
48 | * Public Types |
| Line 69... | Line 74... | ||
| 69 | */ |
74 | */ |
| 70 | uint32_t Timer_GetTicks(void); |
75 | uint32_t Timer_GetTicks(void); |
| 71 | 76 | ||
| 72 | /** |
77 | /** |
| 73 | * @brief Initializes a software timer and starts it. |
78 | * @brief Initializes a software timer and starts it. |
| 74 | * |
79 | * |
| 75 | * @param timer |
80 | * @param timer |
| 76 | * The timer. |
81 | * The timer (0<=timer<TIMER_NUM_TIMERS). |
| 77 | * @param timeout |
82 | * @param timeout |
| 78 | * The timeout in ticks. Passing zero disables a running timer. A timeout |
83 | * The timeout in ticks. Passing zero disables a running timer. A timeout |
| 79 | * value of X ticks gives an actual timeout of between (X-1) and X ticks, |
84 | * value of X ticks gives an actual timeout of between (X-1) and X ticks, |
| 80 | * not including the time it takes for the application to check the |
85 | * not including the time it takes for the application to check the |
| 81 | * expiration status of the timer. |
86 | * expiration status of the timer. |
| Line 88... | Line 93... | ||
| 88 | * from the interrupt handler and must be very short. Null if not used. |
93 | * from the interrupt handler and must be very short. Null if not used. |
| 89 | */ |
94 | */ |
| 90 | void Timer_SetTimeout(uint8_t timer, uint16_t timeout, uint8_t type, timerCallback_t callback); |
95 | void Timer_SetTimeout(uint8_t timer, uint16_t timeout, uint8_t type, timerCallback_t callback); |
| 91 | 96 | ||
| 92 | /** |
97 | /** |
| 93 | * @brief |
98 | * @brief Check if timer expired. |
| 94 | * |
99 | * |
| 95 | * Checks if a timer has expired, should be used for polling a timer event if callback |
100 | * Checks if a timer has expired, should be used for polling a timer event if callback |
| 96 | * is not used. The timer will only signal its expiration at |
101 | * is not used. The timer will only signal its expiration at |
| 97 | * the first call to this function after a timeout period, even if multiple |
102 | * the first call to this function after a timeout period, even if multiple |
| 98 | * timeout periods have elapsed since the previous call. |
103 | * timeout periods have elapsed since the previous call. |
| 99 | * |
104 | * |
| 100 | * @param timer |
105 | * @param timer |
| 101 | * The timer (0<=timer<TIMER_NUM_TIMERS). |
106 | * The timer (0<=timer<TIMER_NUM_TIMERS). |
| 102 | * |
107 | * @retval |
| 103 | * Non-zero if timer has expired since the previous check. |
108 | * Non-zero if timer has expired since the previous check. |
| 104 | */ |
109 | */ |
| 105 | uint8_t Timer_Expired(uint8_t timer); |
110 | uint8_t Timer_Expired(uint8_t timer); |
| 106 | 111 | ||
| 107 | /**@}*/ |
112 | /**@}*/ |