Rev 537 | Rev 786 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 537 | Rev 544 | ||
|---|---|---|---|
| Line 47... | Line 47... | ||
| 47 | 47 | ||
| 48 | /** |
48 | /** |
| 49 | * Initializes the timer engine. The hardware timer interrupt source will be |
49 | * Initializes the timer engine. The hardware timer interrupt source will be |
| 50 | * enabled, but global interrupts need to be enabled by the application. |
50 | * enabled, but global interrupts need to be enabled by the application. |
| 51 | */ |
51 | */ |
| 52 | void |
52 | void Timer_Init(void); |
| 53 | 53 | ||
| 54 | /** |
54 | /** |
| 55 | * Reads the current time. |
55 | * Reads the current time. |
| 56 | * |
56 | * |
| 57 | * @return |
57 | * @return |
| 58 | * The current time in ticks. The tick count wraps around after 2^32 |
58 | * The current time in ticks. The tick count wraps around after 2^32 |
| 59 | * ticks without any notification. |
59 | * ticks without any notification. |
| 60 | */ |
60 | */ |
| 61 | uint32_t |
61 | uint32_t Timer_GetTicks(void); |
| 62 | 62 | ||
| 63 | /** |
63 | /** |
| 64 | * Initializes a software timer and starts it. |
64 | * Initializes a software timer and starts it. |
| 65 | * |
65 | * |
| 66 | * @param timer |
66 | * @param timer |
| Line 76... | Line 76... | ||
| 76 | * Pointer to optional callback function on the form |
76 | * Pointer to optional callback function on the form |
| 77 | * void callback(uint8_t timer). The callback function is called with the |
77 | * void callback(uint8_t timer). The callback function is called with the |
| 78 | * timer number as the argument whenever the timer expires. It is called |
78 | * timer number as the argument whenever the timer expires. It is called |
| 79 | * from the interrupt handler and must be very short. Null if not used. |
79 | * from the interrupt handler and must be very short. Null if not used. |
| 80 | */ |
80 | */ |
| 81 | void |
81 | void Timer_SetTimeout(uint8_t timer, uint16_t timeout, uint8_t type, timerCallback_t callback); |
| 82 | 82 | ||
| 83 | /** |
83 | /** |
| 84 | * Checks if a timer has expired. The timer will only signal its expiration at |
84 | * Checks if a timer has expired. The timer will only signal its expiration at |
| 85 | * the first call to this function after a timeout period, even if multiple |
85 | * the first call to this function after a timeout period, even if multiple |
| 86 | * timeout periods have elapsed since the previous call. |
86 | * timeout periods have elapsed since the previous call. |
| Line 88... | Line 88... | ||
| 88 | * @param timer |
88 | * @param timer |
| 89 | * The timer (0<=timer<TIMER_NUM_TIMERS). |
89 | * The timer (0<=timer<TIMER_NUM_TIMERS). |
| 90 | * @return |
90 | * @return |
| 91 | * Non-zero if timer has expired since the previous check. |
91 | * Non-zero if timer has expired since the previous check. |
| 92 | */ |
92 | */ |
| 93 | uint8_t |
93 | uint8_t Timer_Expired(uint8_t timer); |
| 94 | 94 | ||
| 95 | 95 | ||
| 96 | #endif /*TIMER_H_*/ |
96 | #endif /*TIMER_H_*/ |