Reiko Randoja
/
ut_bbr
Basketball robot mainboard firmware
RGBLed/RGBLed.hpp@0:88887cfb2b04, 2018-09-10 (annotated)
- Committer:
- Reiko
- Date:
- Mon Sep 10 15:24:08 2018 +0000
- Revision:
- 0:88887cfb2b04
Mainboard firmware for basketball robot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Reiko | 0:88887cfb2b04 | 1 | #ifndef RGBLED_H |
Reiko | 0:88887cfb2b04 | 2 | #define RGBLED_H |
Reiko | 0:88887cfb2b04 | 3 | |
Reiko | 0:88887cfb2b04 | 4 | #include <mbed.h> |
Reiko | 0:88887cfb2b04 | 5 | |
Reiko | 0:88887cfb2b04 | 6 | class RGBLed |
Reiko | 0:88887cfb2b04 | 7 | { |
Reiko | 0:88887cfb2b04 | 8 | public: |
Reiko | 0:88887cfb2b04 | 9 | enum Color |
Reiko | 0:88887cfb2b04 | 10 | { |
Reiko | 0:88887cfb2b04 | 11 | Black = 0, |
Reiko | 0:88887cfb2b04 | 12 | Red, |
Reiko | 0:88887cfb2b04 | 13 | Green, |
Reiko | 0:88887cfb2b04 | 14 | Yellow, |
Reiko | 0:88887cfb2b04 | 15 | Blue, |
Reiko | 0:88887cfb2b04 | 16 | Magenta, |
Reiko | 0:88887cfb2b04 | 17 | Cyan, |
Reiko | 0:88887cfb2b04 | 18 | White |
Reiko | 0:88887cfb2b04 | 19 | }; |
Reiko | 0:88887cfb2b04 | 20 | |
Reiko | 0:88887cfb2b04 | 21 | RGBLed(PinName rPin, PinName gPin, PinName bPin); |
Reiko | 0:88887cfb2b04 | 22 | |
Reiko | 0:88887cfb2b04 | 23 | bool getRed(); |
Reiko | 0:88887cfb2b04 | 24 | bool getGreen(); |
Reiko | 0:88887cfb2b04 | 25 | bool getBlue(); |
Reiko | 0:88887cfb2b04 | 26 | Color get(); |
Reiko | 0:88887cfb2b04 | 27 | |
Reiko | 0:88887cfb2b04 | 28 | RGBLed& setRed(bool value); |
Reiko | 0:88887cfb2b04 | 29 | RGBLed& setGreen(bool value); |
Reiko | 0:88887cfb2b04 | 30 | RGBLed& setBlue(bool value); |
Reiko | 0:88887cfb2b04 | 31 | RGBLed& set(bool rValue, bool gValue, bool bValue); |
Reiko | 0:88887cfb2b04 | 32 | RGBLed& set(Color color); |
Reiko | 0:88887cfb2b04 | 33 | |
Reiko | 0:88887cfb2b04 | 34 | private: |
Reiko | 0:88887cfb2b04 | 35 | DigitalOut r, g, b; |
Reiko | 0:88887cfb2b04 | 36 | }; |
Reiko | 0:88887cfb2b04 | 37 | |
Reiko | 0:88887cfb2b04 | 38 | #endif // RGBLED_H |