Led functions for the LPC1768 Ledbar
Led_Func_Lib.h@0:c203a5ca6463, 2018-11-23 (annotated)
- Committer:
- lordofthestorm12
- Date:
- Fri Nov 23 15:26:36 2018 +0000
- Revision:
- 0:c203a5ca6463
LED class;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lordofthestorm12 | 0:c203a5ca6463 | 1 | #ifndef LED_FUNC_LIB_H |
lordofthestorm12 | 0:c203a5ca6463 | 2 | #define LED_FUNC_LIB_H |
lordofthestorm12 | 0:c203a5ca6463 | 3 | |
lordofthestorm12 | 0:c203a5ca6463 | 4 | #include "mbed.h" |
lordofthestorm12 | 0:c203a5ca6463 | 5 | |
lordofthestorm12 | 0:c203a5ca6463 | 6 | const int LAUFLICHT[] = {0x00, 0x01, 0x02, 0x04, 0x08, 0x06, 0x09 ,0x0f}; |
lordofthestorm12 | 0:c203a5ca6463 | 7 | |
lordofthestorm12 | 0:c203a5ca6463 | 8 | class Led_Func |
lordofthestorm12 | 0:c203a5ca6463 | 9 | { |
lordofthestorm12 | 0:c203a5ca6463 | 10 | |
lordofthestorm12 | 0:c203a5ca6463 | 11 | public: |
lordofthestorm12 | 0:c203a5ca6463 | 12 | Led_Func(): _Led(LED1, LED2, LED3, LED4) { |
lordofthestorm12 | 0:c203a5ca6463 | 13 | _Led = LAUFLICHT[0]; |
lordofthestorm12 | 0:c203a5ca6463 | 14 | } |
lordofthestorm12 | 0:c203a5ca6463 | 15 | |
lordofthestorm12 | 0:c203a5ca6463 | 16 | void setLED(int aLED) { |
lordofthestorm12 | 0:c203a5ca6463 | 17 | switch(aLED) { |
lordofthestorm12 | 0:c203a5ca6463 | 18 | case (0): |
lordofthestorm12 | 0:c203a5ca6463 | 19 | _Led = LAUFLICHT[0]; |
lordofthestorm12 | 0:c203a5ca6463 | 20 | break; // LED Aus |
lordofthestorm12 | 0:c203a5ca6463 | 21 | case (1): |
lordofthestorm12 | 0:c203a5ca6463 | 22 | _Led = LAUFLICHT[1]; |
lordofthestorm12 | 0:c203a5ca6463 | 23 | break; // Led1 |
lordofthestorm12 | 0:c203a5ca6463 | 24 | case (2): |
lordofthestorm12 | 0:c203a5ca6463 | 25 | _Led = LAUFLICHT[2]; |
lordofthestorm12 | 0:c203a5ca6463 | 26 | break; // Led2 |
lordofthestorm12 | 0:c203a5ca6463 | 27 | case (3): |
lordofthestorm12 | 0:c203a5ca6463 | 28 | _Led = LAUFLICHT[3]; |
lordofthestorm12 | 0:c203a5ca6463 | 29 | break; // Led3 |
lordofthestorm12 | 0:c203a5ca6463 | 30 | case (4): |
lordofthestorm12 | 0:c203a5ca6463 | 31 | _Led = LAUFLICHT[4]; |
lordofthestorm12 | 0:c203a5ca6463 | 32 | break; // Led4 |
lordofthestorm12 | 0:c203a5ca6463 | 33 | case (5): |
lordofthestorm12 | 0:c203a5ca6463 | 34 | _Led = LAUFLICHT[5]; |
lordofthestorm12 | 0:c203a5ca6463 | 35 | break; // Led 1 und 4 |
lordofthestorm12 | 0:c203a5ca6463 | 36 | case (6): |
lordofthestorm12 | 0:c203a5ca6463 | 37 | _Led = LAUFLICHT[6]; |
lordofthestorm12 | 0:c203a5ca6463 | 38 | break; // Led 2 und 3 |
lordofthestorm12 | 0:c203a5ca6463 | 39 | case (7): |
lordofthestorm12 | 0:c203a5ca6463 | 40 | _Led = LAUFLICHT[7]; |
lordofthestorm12 | 0:c203a5ca6463 | 41 | break; // alle Led's |
lordofthestorm12 | 0:c203a5ca6463 | 42 | } |
lordofthestorm12 | 0:c203a5ca6463 | 43 | } |
lordofthestorm12 | 0:c203a5ca6463 | 44 | |
lordofthestorm12 | 0:c203a5ca6463 | 45 | private: |
lordofthestorm12 | 0:c203a5ca6463 | 46 | BusOut _Led; |
lordofthestorm12 | 0:c203a5ca6463 | 47 | }; |
lordofthestorm12 | 0:c203a5ca6463 | 48 | |
lordofthestorm12 | 0:c203a5ca6463 | 49 | #endif |