Controls a single ShiftBrite LED

Dependents:   4180_L1

Committer:
aswild
Date:
Tue Jan 28 16:49:57 2014 +0000
Revision:
0:5948048ae480
testing 123

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aswild 0:5948048ae480 1 #ifndef SHIFTBRITE_H
aswild 0:5948048ae480 2 #define SHIFTBRITE_H
aswild 0:5948048ae480 3
aswild 0:5948048ae480 4 #include "mbed.h"
aswild 0:5948048ae480 5
aswild 0:5948048ae480 6 #define RED(color) (((color) >> 16) & 0xFF) << 2
aswild 0:5948048ae480 7 #define GREEN(color) (((color) >> 8) & 0xFF) << 2
aswild 0:5948048ae480 8 #define BLUE(color) ((color) & 0xFF) << 2
aswild 0:5948048ae480 9
aswild 0:5948048ae480 10 class ShiftBrite
aswild 0:5948048ae480 11 {
aswild 0:5948048ae480 12 public:
aswild 0:5948048ae480 13 ShiftBrite(PinName spi1, PinName spi2, PinName spi3, PinName latch);
aswild 0:5948048ae480 14 void writeCommand(int command);
aswild 0:5948048ae480 15 void setColorRGB(int red, int green, int blue);
aswild 0:5948048ae480 16 void setColor(int color);
aswild 0:5948048ae480 17 void fadeColor(int color1, int color2, float time);
aswild 0:5948048ae480 18 void writeInit(int red_level, int green_level, int blue_level);
aswild 0:5948048ae480 19
aswild 0:5948048ae480 20 protected:
aswild 0:5948048ae480 21 SPI spi;
aswild 0:5948048ae480 22 DigitalOut latch;
aswild 0:5948048ae480 23 };
aswild 0:5948048ae480 24
aswild 0:5948048ae480 25 #endif