simple wrapper for the K64F RGB Led
Diff: KRGBLed.h
- Revision:
- 0:ee2feb784400
diff -r 000000000000 -r ee2feb784400 KRGBLed.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KRGBLed.h Tue Feb 03 01:10:35 2015 +0000 @@ -0,0 +1,34 @@ + +#pragma once +#include <mbed.h> + +/** + * K64F RGB LED example: + * KRGBLed rgb(LED_RED, LED_GREEN, LED_BLUE); + * rgb.set(KRGBLed::Magenta); + */ +class KRGBLed +{ +public: + typedef enum + { + Off = 0, + Red = 1, + Green = 2, + Blue = 4, + Yellow = (Red|Green), + Cyan = (Green|Blue), // @note more like a whiteish-blue + Magenta = (Blue|Red), + White = (Red|Green|Blue), + } Color; + + KRGBLed(PinName redPin, PinName greenPin, PinName bluePin); + ~KRGBLed(); + + void set(Color color); + +private: + DigitalOut red; + DigitalOut green; + DigitalOut blue; +}; \ No newline at end of file