Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 19_Taster_BSW_oo 19_Taster_a
Fork of timer0 by
timer0.h@0:bbd867fd30d1, 2014-07-26 (annotated)
- Committer:
- rs27
- Date:
- Sat Jul 26 07:27:37 2014 +0000
- Revision:
- 0:bbd867fd30d1
- Child:
- 1:45063f72267b
timer
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| rs27 | 0:bbd867fd30d1 | 1 | |
| rs27 | 0:bbd867fd30d1 | 2 | #include "mbed.h" |
| rs27 | 0:bbd867fd30d1 | 3 | |
| rs27 | 0:bbd867fd30d1 | 4 | #define TIMER0_NUM_COUNTDOWNTIMERS 25 |
| rs27 | 0:bbd867fd30d1 | 5 | |
| rs27 | 0:bbd867fd30d1 | 6 | // status definition: |
| rs27 | 0:bbd867fd30d1 | 7 | // 0 the timer has expired |
| rs27 | 0:bbd867fd30d1 | 8 | // 1 10 ms Timer |
| rs27 | 0:bbd867fd30d1 | 9 | // 2 Sekunden Timer |
| rs27 | 0:bbd867fd30d1 | 10 | // 3 Minuten Timer |
| rs27 | 0:bbd867fd30d1 | 11 | // 4 Stunden Timer |
| rs27 | 0:bbd867fd30d1 | 12 | // 0xFF Free timer |
| rs27 | 0:bbd867fd30d1 | 13 | |
| rs27 | 0:bbd867fd30d1 | 14 | |
| rs27 | 0:bbd867fd30d1 | 15 | class timer0 { |
| rs27 | 0:bbd867fd30d1 | 16 | private: |
| rs27 | 0:bbd867fd30d1 | 17 | |
| rs27 | 0:bbd867fd30d1 | 18 | struct timerStruct |
| rs27 | 0:bbd867fd30d1 | 19 | { |
| rs27 | 0:bbd867fd30d1 | 20 | unsigned char status; // siehe Beschreibung |
| rs27 | 0:bbd867fd30d1 | 21 | unsigned int count_timer; // count down Zähler |
| rs27 | 0:bbd867fd30d1 | 22 | } CountDownTimers[TIMER0_NUM_COUNTDOWNTIMERS]; |
| rs27 | 0:bbd867fd30d1 | 23 | |
| rs27 | 0:bbd867fd30d1 | 24 | Ticker ticker; |
| rs27 | 0:bbd867fd30d1 | 25 | |
| rs27 | 0:bbd867fd30d1 | 26 | public: |
| rs27 | 0:bbd867fd30d1 | 27 | uint16_t counter; |
| rs27 | 0:bbd867fd30d1 | 28 | |
| rs27 | 0:bbd867fd30d1 | 29 | timer0(); |
| rs27 | 0:bbd867fd30d1 | 30 | void func(void); |
| rs27 | 0:bbd867fd30d1 | 31 | uint8_t AllocateCountdownTimer (void); |
| rs27 | 0:bbd867fd30d1 | 32 | void RemoveCountdownTimer(uint8_t timer); |
| rs27 | 0:bbd867fd30d1 | 33 | uint8_t GetTimerStatus(uint8_t timer); |
| rs27 | 0:bbd867fd30d1 | 34 | uint16_t GetTimerZeit(uint8_t timer); |
| rs27 | 0:bbd867fd30d1 | 35 | void SetCountdownTimer(uint8_t timer, uint8_t status, uint16_t value); |
| rs27 | 0:bbd867fd30d1 | 36 | }; |
