David Knight / Mbed 2 deprecated lichtspiel

Dependencies:   PololuLedStrip mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LEDs.h Source File

LEDs.h

00001 #ifndef LEDS_H
00002 #define LEDS_H
00003 
00004 #include "mbed.h"
00005 #include "board.h"
00006 #include "EEPROM.h"
00007 #include "PololuLedStrip.h"
00008 
00009 #define LEDS_MAIN_STRIP_TOGGLE_OFFSET 5
00010 
00011 typedef struct hsv_color
00012 {
00013     unsigned char h;
00014     unsigned char s;
00015     unsigned char v;
00016 } hsv_color;
00017 
00018 class LEDs {
00019   public:
00020     LEDs(PinName main, PinName single);
00021     void updateSingleLED(uint8_t colorH, uint8_t colorS, uint8_t colorV);
00022     void updateStripLED(uint8_t index, uint8_t colorH, uint8_t colorS, uint8_t colorV);
00023     void setStripLED(uint8_t index, uint8_t colorH, uint8_t colorS, uint8_t colorV);
00024     void setStripLEDRGB(uint8_t index, uint8_t colorH, uint8_t colorS, uint8_t colorV);
00025     void turnOffStripLED(uint8_t index);
00026     bool isStripLEDOn(uint8_t index);
00027     void scrollStripToLeft();
00028     void scrollStripToRight();
00029     void off();
00030     void show();
00031     void saveStateToEEPROM();
00032     void loadStateFromEEPROM();
00033     void loadStateFromEEPROMAndDim(uint8_t dimAmount);
00034     void fadeToBlackBy(uint8_t amount, rgb_color& colour);
00035     rgb_color mainColours[LEDS_MAIN_STRIP_NUM_LEDS];
00036     rgb_color singleColours[LEDS_SINGLE_STRIP_NUM_LEDS];
00037   private:
00038     hsv_color RgbToHsv(rgb_color rgb);
00039     rgb_color HsvToRgb(hsv_color hsv);
00040   
00041     PololuLedStrip mainStrip;
00042     PololuLedStrip singleStrip;
00043     
00044     uint8_t currentIndex;
00045     EEPROM eeprom;
00046 };
00047 
00048 #endif