Animation demo with MIP8F_SPI_Ver60

Dependencies:   mbed MIP8F_SPI_Ver60 MIP8f_FRDM_LineBuffer_sample MIP8f_FRDM_TransferMode_sample

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Adafruit_LEDBackpack.h Source File

Adafruit_LEDBackpack.h

00001 /*************************************************** 
00002   This is a library for our I2C LED Backpacks
00003 
00004   Designed specifically to work with the Adafruit LED Matrix backpacks 
00005   ----> http://www.adafruit.com/products/
00006   ----> http://www.adafruit.com/products/
00007 
00008   These displays use I2C to communicate, 2 pins are required to 
00009   interface. There are multiple selectable I2C addresses. For backpacks
00010   with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
00011   with 3 Address Select pins: 0x70 thru 0x77
00012 
00013   Adafruit invests time and resources providing this open source code, 
00014   please support Adafruit and open-source hardware by purchasing 
00015   products from Adafruit!
00016 
00017   Written by Limor Fried/Ladyada for Adafruit Industries.  
00018   BSD license, all text above must be included in any redistribution
00019  ****************************************************/
00020  
00021  /*
00022  *  Modified by Luiz Hespanha (http://www.d3.do) 8/16/2013 for use in LPC1768
00023  */
00024 
00025 #include "mbed.h"
00026 #include "Adafruit_GFX.h"
00027 
00028 #define LED_ON 1
00029 #define LED_OFF 0
00030 
00031 #define LED_RED 1
00032 #define LED_YELLOW 2
00033 #define LED_GREEN 3
00034  
00035 
00036 
00037 #define HT16K33_BLINK_CMD 0x80
00038 #define HT16K33_BLINK_DISPLAYON 0x01
00039 #define HT16K33_BLINK_OFF 0
00040 #define HT16K33_BLINK_2HZ  1
00041 #define HT16K33_BLINK_1HZ  2
00042 #define HT16K33_BLINK_HALFHZ  3
00043 
00044 #define HT16K33_CMD_BRIGHTNESS 0x0E
00045 
00046 // this is the raw HT16K33 controller
00047 class Adafruit_LEDBackpack {
00048  public:
00049   Adafruit_LEDBackpack(I2C *i2c);
00050   void begin(uint8_t _addr);
00051   void setBrightness(uint8_t b);
00052   void blinkRate(uint8_t b);
00053   void writeDisplay(void);
00054   void clear(void);
00055 
00056   uint16_t displaybuffer[8]; 
00057 
00058   void init(uint8_t a);
00059 
00060   protected:
00061     I2C *_i2c;
00062   
00063  private:
00064   uint8_t i2c_addr;
00065 };
00066 
00067 class Adafruit_8x8matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
00068  public:
00069   Adafruit_8x8matrix(I2C *i2c);
00070 
00071   void drawPixel(int16_t x, int16_t y, uint16_t color);
00072 
00073  private:
00074 };