ti bisogna il phaserunner
Dependencies: mbed PID mbed-rtos
Peripherien/LED_Ring.h@7:15e6fc689368, 2019-05-16 (annotated)
- Committer:
- EpicG10
- Date:
- Thu May 16 20:42:39 2019 +0000
- Revision:
- 7:15e6fc689368
Implementation Regler (not finished)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EpicG10 | 7:15e6fc689368 | 1 | // |
EpicG10 | 7:15e6fc689368 | 2 | // Created by yanick on 15.03.2019. |
EpicG10 | 7:15e6fc689368 | 3 | // |
EpicG10 | 7:15e6fc689368 | 4 | |
EpicG10 | 7:15e6fc689368 | 5 | #ifndef PA_LED_RING_H |
EpicG10 | 7:15e6fc689368 | 6 | #define PA_LED_RING_H |
EpicG10 | 7:15e6fc689368 | 7 | |
EpicG10 | 7:15e6fc689368 | 8 | #include "mbed.h" |
EpicG10 | 7:15e6fc689368 | 9 | #include "rtos.h" |
EpicG10 | 7:15e6fc689368 | 10 | |
EpicG10 | 7:15e6fc689368 | 11 | class LED_Ring{ |
EpicG10 | 7:15e6fc689368 | 12 | private: |
EpicG10 | 7:15e6fc689368 | 13 | PwmOut redLED;//(PC_9); |
EpicG10 | 7:15e6fc689368 | 14 | PwmOut greenLED;//(PB_8); |
EpicG10 | 7:15e6fc689368 | 15 | |
EpicG10 | 7:15e6fc689368 | 16 | Thread thread; |
EpicG10 | 7:15e6fc689368 | 17 | Ticker ticker; |
EpicG10 | 7:15e6fc689368 | 18 | |
EpicG10 | 7:15e6fc689368 | 19 | enum ledStates {off, shine_red, shine_green, shine_orange, blink_red, blink_green, blink_orange, blink_red_green}; |
EpicG10 | 7:15e6fc689368 | 20 | ledStates ledState; |
EpicG10 | 7:15e6fc689368 | 21 | |
EpicG10 | 7:15e6fc689368 | 22 | /** |
EpicG10 | 7:15e6fc689368 | 23 | * |
EpicG10 | 7:15e6fc689368 | 24 | */ |
EpicG10 | 7:15e6fc689368 | 25 | void run(); |
EpicG10 | 7:15e6fc689368 | 26 | |
EpicG10 | 7:15e6fc689368 | 27 | public: |
EpicG10 | 7:15e6fc689368 | 28 | /** |
EpicG10 | 7:15e6fc689368 | 29 | * Initialisert den LED-Ring |
EpicG10 | 7:15e6fc689368 | 30 | */ |
EpicG10 | 7:15e6fc689368 | 31 | LED_Ring(); |
EpicG10 | 7:15e6fc689368 | 32 | |
EpicG10 | 7:15e6fc689368 | 33 | /** |
EpicG10 | 7:15e6fc689368 | 34 | * Lässt den LED-Ring rot leuchten. |
EpicG10 | 7:15e6fc689368 | 35 | */ |
EpicG10 | 7:15e6fc689368 | 36 | void shineRed(); |
EpicG10 | 7:15e6fc689368 | 37 | |
EpicG10 | 7:15e6fc689368 | 38 | /** |
EpicG10 | 7:15e6fc689368 | 39 | * Lässt den LED-Ring grün leuchten. |
EpicG10 | 7:15e6fc689368 | 40 | */ |
EpicG10 | 7:15e6fc689368 | 41 | void shineGreen(); |
EpicG10 | 7:15e6fc689368 | 42 | |
EpicG10 | 7:15e6fc689368 | 43 | /** |
EpicG10 | 7:15e6fc689368 | 44 | * Lässt den LED-Ring Orange leuchten. |
EpicG10 | 7:15e6fc689368 | 45 | */ |
EpicG10 | 7:15e6fc689368 | 46 | void shineOrange(); |
EpicG10 | 7:15e6fc689368 | 47 | |
EpicG10 | 7:15e6fc689368 | 48 | /** |
EpicG10 | 7:15e6fc689368 | 49 | * Lässt den LED-Ring rot blinken. |
EpicG10 | 7:15e6fc689368 | 50 | */ |
EpicG10 | 7:15e6fc689368 | 51 | void blinkRed(); |
EpicG10 | 7:15e6fc689368 | 52 | |
EpicG10 | 7:15e6fc689368 | 53 | /** |
EpicG10 | 7:15e6fc689368 | 54 | * Lässt den LED-Ring grün blinken. |
EpicG10 | 7:15e6fc689368 | 55 | */ |
EpicG10 | 7:15e6fc689368 | 56 | void blinkGreen(); |
EpicG10 | 7:15e6fc689368 | 57 | |
EpicG10 | 7:15e6fc689368 | 58 | /** |
EpicG10 | 7:15e6fc689368 | 59 | * Lässt den LED-Ring orange blinken. |
EpicG10 | 7:15e6fc689368 | 60 | */ |
EpicG10 | 7:15e6fc689368 | 61 | void blinkOrange(); |
EpicG10 | 7:15e6fc689368 | 62 | |
EpicG10 | 7:15e6fc689368 | 63 | /** |
EpicG10 | 7:15e6fc689368 | 64 | * Lässt den LED-Ring rot-grün blinken. |
EpicG10 | 7:15e6fc689368 | 65 | */ |
EpicG10 | 7:15e6fc689368 | 66 | void blinkRedGreen(); |
EpicG10 | 7:15e6fc689368 | 67 | |
EpicG10 | 7:15e6fc689368 | 68 | /** |
EpicG10 | 7:15e6fc689368 | 69 | * Schaltet die LED aus. |
EpicG10 | 7:15e6fc689368 | 70 | */ |
EpicG10 | 7:15e6fc689368 | 71 | void turnOfLED(); |
EpicG10 | 7:15e6fc689368 | 72 | |
EpicG10 | 7:15e6fc689368 | 73 | /** |
EpicG10 | 7:15e6fc689368 | 74 | * Einfacherer Weg, um die Led zu steuern |
EpicG10 | 7:15e6fc689368 | 75 | * @param cmd Befehl für den Zustand der LED: "off", "blink red", "shine green" etc. |
EpicG10 | 7:15e6fc689368 | 76 | */ |
EpicG10 | 7:15e6fc689368 | 77 | //void operator=(string cmd); |
EpicG10 | 7:15e6fc689368 | 78 | |
EpicG10 | 7:15e6fc689368 | 79 | }; |
EpicG10 | 7:15e6fc689368 | 80 | |
EpicG10 | 7:15e6fc689368 | 81 | |
EpicG10 | 7:15e6fc689368 | 82 | #endif //PA_LED_RING_H |