RGB LED connected to PCA9555
rgb-led-pca9555.h@0:95a10b4db9ef, 2014-11-21 (annotated)
- Committer:
- Reiko
- Date:
- Fri Nov 21 18:25:01 2014 +0000
- Revision:
- 0:95a10b4db9ef
RGB LED connected to PCA9555
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Reiko | 0:95a10b4db9ef | 1 | #ifndef RGBLEDPCA9555_H |
Reiko | 0:95a10b4db9ef | 2 | #define RGBLEDPCA9555_H |
Reiko | 0:95a10b4db9ef | 3 | |
Reiko | 0:95a10b4db9ef | 4 | #include "mbed.h" |
Reiko | 0:95a10b4db9ef | 5 | #include "PCA9555.h" |
Reiko | 0:95a10b4db9ef | 6 | |
Reiko | 0:95a10b4db9ef | 7 | class RgbLed { |
Reiko | 0:95a10b4db9ef | 8 | public: |
Reiko | 0:95a10b4db9ef | 9 | RgbLed(PCA9555 *ioExt, unsigned int redPin, unsigned int greenPin, unsigned int bluePin); |
Reiko | 0:95a10b4db9ef | 10 | |
Reiko | 0:95a10b4db9ef | 11 | enum Color {RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, WHITE, OFF}; |
Reiko | 0:95a10b4db9ef | 12 | void setColor(Color color); |
Reiko | 0:95a10b4db9ef | 13 | void setRed(bool ledState); |
Reiko | 0:95a10b4db9ef | 14 | void setGreen(bool ledState); |
Reiko | 0:95a10b4db9ef | 15 | void setBlue(bool ledState); |
Reiko | 0:95a10b4db9ef | 16 | void toggleRed(); |
Reiko | 0:95a10b4db9ef | 17 | void toggleGreen(); |
Reiko | 0:95a10b4db9ef | 18 | void toggleBlue(); |
Reiko | 0:95a10b4db9ef | 19 | void toggle(); |
Reiko | 0:95a10b4db9ef | 20 | |
Reiko | 0:95a10b4db9ef | 21 | private: |
Reiko | 0:95a10b4db9ef | 22 | PCA9555 *extIO; |
Reiko | 0:95a10b4db9ef | 23 | unsigned int ledR; |
Reiko | 0:95a10b4db9ef | 24 | unsigned int ledG; |
Reiko | 0:95a10b4db9ef | 25 | unsigned int ledB; |
Reiko | 0:95a10b4db9ef | 26 | }; |
Reiko | 0:95a10b4db9ef | 27 | |
Reiko | 0:95a10b4db9ef | 28 | #endif |