Update vom 10.05.15
Dependents: 19_Taster_BSW_oo 19_Taster_a
Fork of timer0 by
timer0.h@2:fafaca146f6e, 2015-05-10 (annotated)
- Committer:
- rs27
- Date:
- Sun May 10 17:58:41 2015 +0000
- Revision:
- 2:fafaca146f6e
- Parent:
- 1:45063f72267b
100515
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rs27 | 2:fafaca146f6e | 1 | #ifndef TIMER0_H |
rs27 | 2:fafaca146f6e | 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:fafaca146f6e | 39 | }; |
rs27 | 2:fafaca146f6e | 40 | |
rs27 | 2:fafaca146f6e | 41 | #endif |