timer0
Dependents: 09_PT1000 10_PT1000 11_PT1000 18_PT1000
timer0.h@2:d8e4c9bfd51d, 2015-05-08 (annotated)
- Committer:
- rs27
- Date:
- Fri May 08 07:47:04 2015 +0000
- Revision:
- 2:d8e4c9bfd51d
- Parent:
- 1:45063f72267b
080515;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rs27 | 2:d8e4c9bfd51d | 1 | #ifndef TIMER0_H |
rs27 | 2:d8e4c9bfd51d | 2 | #define TIMER0_H |
rs27 | 0:bbd867fd30d1 | 3 | |
rs27 | 0:bbd867fd30d1 | 4 | #include "mbed.h" |
rs27 | 0:bbd867fd30d1 | 5 | |
rs27 | 0:bbd867fd30d1 | 6 | #define TIMER0_NUM_COUNTDOWNTIMERS 25 |
rs27 | 0:bbd867fd30d1 | 7 | |
rs27 | 0:bbd867fd30d1 | 8 | // status definition: |
rs27 | 0:bbd867fd30d1 | 9 | // 0 the timer has expired |
rs27 | 0:bbd867fd30d1 | 10 | // 1 10 ms Timer |
rs27 | 0:bbd867fd30d1 | 11 | // 2 Sekunden Timer |
rs27 | 0:bbd867fd30d1 | 12 | // 3 Minuten Timer |
rs27 | 0:bbd867fd30d1 | 13 | // 4 Stunden Timer |
rs27 | 0:bbd867fd30d1 | 14 | // 0xFF Free timer |
rs27 | 0:bbd867fd30d1 | 15 | |
rs27 | 0:bbd867fd30d1 | 16 | |
rs27 | 0:bbd867fd30d1 | 17 | class timer0 { |
rs27 | 0:bbd867fd30d1 | 18 | private: |
rs27 | 0:bbd867fd30d1 | 19 | |
rs27 | 0:bbd867fd30d1 | 20 | struct timerStruct |
rs27 | 0:bbd867fd30d1 | 21 | { |
rs27 | 0:bbd867fd30d1 | 22 | unsigned char status; // siehe Beschreibung |
rs27 | 0:bbd867fd30d1 | 23 | unsigned int count_timer; // count down Zähler |
rs27 | 0:bbd867fd30d1 | 24 | } CountDownTimers[TIMER0_NUM_COUNTDOWNTIMERS]; |
rs27 | 0:bbd867fd30d1 | 25 | |
rs27 | 0:bbd867fd30d1 | 26 | Ticker ticker; |
rs27 | 0:bbd867fd30d1 | 27 | |
rs27 | 0:bbd867fd30d1 | 28 | public: |
rs27 | 0:bbd867fd30d1 | 29 | uint16_t counter; |
rs27 | 1:45063f72267b | 30 | uint16_t countMillisecond; |
rs27 | 0:bbd867fd30d1 | 31 | |
rs27 | 0:bbd867fd30d1 | 32 | timer0(); |
rs27 | 0:bbd867fd30d1 | 33 | void func(void); |
rs27 | 0:bbd867fd30d1 | 34 | uint8_t AllocateCountdownTimer (void); |
rs27 | 0:bbd867fd30d1 | 35 | void RemoveCountdownTimer(uint8_t timer); |
rs27 | 0:bbd867fd30d1 | 36 | uint8_t GetTimerStatus(uint8_t timer); |
rs27 | 0:bbd867fd30d1 | 37 | uint16_t GetTimerZeit(uint8_t timer); |
rs27 | 0:bbd867fd30d1 | 38 | void SetCountdownTimer(uint8_t timer, uint8_t status, uint16_t value); |
rs27 | 2:d8e4c9bfd51d | 39 | }; |
rs27 | 2:d8e4c9bfd51d | 40 | |
rs27 | 2:d8e4c9bfd51d | 41 | #endif |