Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
LEDDriver.h@33:bd56fc8aeb0a, 2015-05-05 (annotated)
- Committer:
- pvaibhav
- Date:
- Tue May 05 09:59:11 2015 +0000
- Revision:
- 33:bd56fc8aeb0a
- Parent:
- 18:f51b1a94a6e2
White LED mirrors blue LED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pvaibhav | 0:943820483318 | 1 | #ifndef _H_LEDDRIVER_H |
pvaibhav | 0:943820483318 | 2 | #define _H_LEDDRIVER_H |
pvaibhav | 0:943820483318 | 3 | |
pvaibhav | 0:943820483318 | 4 | #include "I2CPeripheral.h" |
pvaibhav | 0:943820483318 | 5 | |
pvaibhav | 0:943820483318 | 6 | typedef uint32_t Color; // ARGB |
pvaibhav | 0:943820483318 | 7 | |
pvaibhav | 12:1632d7391453 | 8 | namespace Colors |
pvaibhav | 12:1632d7391453 | 9 | { |
pvaibhav | 12:1632d7391453 | 10 | // 16 named colours |
pvaibhav | 12:1632d7391453 | 11 | const Color black = 0x000000; |
pvaibhav | 12:1632d7391453 | 12 | const Color gray = 0x808080; |
pvaibhav | 12:1632d7391453 | 13 | const Color silver = 0xC0C0C0; |
pvaibhav | 12:1632d7391453 | 14 | const Color white = 0xffffff; |
pvaibhav | 12:1632d7391453 | 15 | const Color maroon = 0x800000; |
pvaibhav | 12:1632d7391453 | 16 | const Color red = 0xff0000; |
pvaibhav | 12:1632d7391453 | 17 | const Color olive = 0x808000; |
pvaibhav | 12:1632d7391453 | 18 | const Color yellow = 0xffff00; |
pvaibhav | 12:1632d7391453 | 19 | const Color green = 0x008000; |
pvaibhav | 12:1632d7391453 | 20 | const Color lime = 0x00ff00; |
pvaibhav | 12:1632d7391453 | 21 | const Color teal = 0x008080; |
pvaibhav | 12:1632d7391453 | 22 | const Color aqua = 0x00ffff; |
pvaibhav | 12:1632d7391453 | 23 | const Color navy = 0x000080; |
pvaibhav | 12:1632d7391453 | 24 | const Color blue = 0x0000ff; |
pvaibhav | 12:1632d7391453 | 25 | const Color purple = 0x800080; |
pvaibhav | 12:1632d7391453 | 26 | const Color fuschia = 0xff00ff; |
pvaibhav | 12:1632d7391453 | 27 | |
pvaibhav | 12:1632d7391453 | 28 | // aliases |
pvaibhav | 12:1632d7391453 | 29 | const Color deepred = maroon; |
pvaibhav | 12:1632d7391453 | 30 | const Color darkred = maroon; |
pvaibhav | 12:1632d7391453 | 31 | const Color cyan = aqua; |
pvaibhav | 12:1632d7391453 | 32 | const Color magenta = purple; |
pvaibhav | 12:1632d7391453 | 33 | const Color pink = fuschia; |
pvaibhav | 12:1632d7391453 | 34 | |
pvaibhav | 12:1632d7391453 | 35 | // other colours |
pvaibhav | 12:1632d7391453 | 36 | const Color orange = 0xffa500; |
pvaibhav | 12:1632d7391453 | 37 | const Color slateblue = 0x6a5acd; |
pvaibhav | 0:943820483318 | 38 | }; |
pvaibhav | 0:943820483318 | 39 | |
pvaibhav | 0:943820483318 | 40 | class LEDDriver : public I2CPeripheral |
pvaibhav | 0:943820483318 | 41 | { |
pvaibhav | 0:943820483318 | 42 | public: |
pvaibhav | 0:943820483318 | 43 | LEDDriver(I2C &i2c); |
pvaibhav | 18:f51b1a94a6e2 | 44 | void setOutputCurrent(float mA); |
pvaibhav | 0:943820483318 | 45 | void setColor(const Color color); |
pvaibhav | 0:943820483318 | 46 | void setColor(const float r, const float g, const float b); |
pvaibhav | 0:943820483318 | 47 | void setColor(const uint8_t r, const uint8_t g, const uint8_t b); |
pvaibhav | 33:bd56fc8aeb0a | 48 | void setWhiteLed(const float w); |
pvaibhav | 0:943820483318 | 49 | LEDDriver& operator=(const Color& c); |
pvaibhav | 0:943820483318 | 50 | }; |
pvaibhav | 0:943820483318 | 51 | |
pvaibhav | 0:943820483318 | 52 | #endif//_H_LED_H |