For 24bar graph support

Dependents:   toastboard_integrated

Fork of Adafruit_LEDBackpack_2 by Daniel Drew

Committer:
luizhespanha
Date:
Fri Aug 16 15:41:01 2013 +0000
Revision:
0:e81a6274acce
Child:
1:f066d5347c60
This is a library for the Adafruit LED Backpacks; This library works with the Adafruit Mini 8x8.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
luizhespanha 0:e81a6274acce 1 /***************************************************
luizhespanha 0:e81a6274acce 2 This is a library for our I2C LED Backpacks
luizhespanha 0:e81a6274acce 3
luizhespanha 0:e81a6274acce 4 Designed specifically to work with the Adafruit LED Matrix backpacks
luizhespanha 0:e81a6274acce 5 ----> http://www.adafruit.com/products/
luizhespanha 0:e81a6274acce 6 ----> http://www.adafruit.com/products/
luizhespanha 0:e81a6274acce 7
luizhespanha 0:e81a6274acce 8 These displays use I2C to communicate, 2 pins are required to
luizhespanha 0:e81a6274acce 9 interface. There are multiple selectable I2C addresses. For backpacks
luizhespanha 0:e81a6274acce 10 with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
luizhespanha 0:e81a6274acce 11 with 3 Address Select pins: 0x70 thru 0x77
luizhespanha 0:e81a6274acce 12
luizhespanha 0:e81a6274acce 13 Adafruit invests time and resources providing this open source code,
luizhespanha 0:e81a6274acce 14 please support Adafruit and open-source hardware by purchasing
luizhespanha 0:e81a6274acce 15 products from Adafruit!
luizhespanha 0:e81a6274acce 16
luizhespanha 0:e81a6274acce 17 Written by Limor Fried/Ladyada for Adafruit Industries.
luizhespanha 0:e81a6274acce 18 BSD license, all text above must be included in any redistribution
luizhespanha 0:e81a6274acce 19 ****************************************************/
luizhespanha 0:e81a6274acce 20
luizhespanha 0:e81a6274acce 21 #include "mbed.h"
luizhespanha 0:e81a6274acce 22 #include "Adafruit_GFX.h"
luizhespanha 0:e81a6274acce 23
luizhespanha 0:e81a6274acce 24 #define LED_ON 1
luizhespanha 0:e81a6274acce 25 #define LED_OFF 0
luizhespanha 0:e81a6274acce 26
luizhespanha 0:e81a6274acce 27 #define LED_RED 1
luizhespanha 0:e81a6274acce 28 #define LED_YELLOW 2
luizhespanha 0:e81a6274acce 29 #define LED_GREEN 3
luizhespanha 0:e81a6274acce 30
luizhespanha 0:e81a6274acce 31
luizhespanha 0:e81a6274acce 32
luizhespanha 0:e81a6274acce 33 #define HT16K33_BLINK_CMD 0x80
luizhespanha 0:e81a6274acce 34 #define HT16K33_BLINK_DISPLAYON 0x01
luizhespanha 0:e81a6274acce 35 #define HT16K33_BLINK_OFF 0
luizhespanha 0:e81a6274acce 36 #define HT16K33_BLINK_2HZ 1
luizhespanha 0:e81a6274acce 37 #define HT16K33_BLINK_1HZ 2
luizhespanha 0:e81a6274acce 38 #define HT16K33_BLINK_HALFHZ 3
luizhespanha 0:e81a6274acce 39
luizhespanha 0:e81a6274acce 40 #define HT16K33_CMD_BRIGHTNESS 0x0E
luizhespanha 0:e81a6274acce 41
luizhespanha 0:e81a6274acce 42 // this is the raw HT16K33 controller
luizhespanha 0:e81a6274acce 43 class Adafruit_LEDBackpack {
luizhespanha 0:e81a6274acce 44 public:
luizhespanha 0:e81a6274acce 45 Adafruit_LEDBackpack(I2C *i2c);
luizhespanha 0:e81a6274acce 46 void begin(uint8_t _addr);
luizhespanha 0:e81a6274acce 47 void setBrightness(uint8_t b);
luizhespanha 0:e81a6274acce 48 void blinkRate(uint8_t b);
luizhespanha 0:e81a6274acce 49 void writeDisplay(void);
luizhespanha 0:e81a6274acce 50 void clear(void);
luizhespanha 0:e81a6274acce 51
luizhespanha 0:e81a6274acce 52 uint16_t displaybuffer[8];
luizhespanha 0:e81a6274acce 53
luizhespanha 0:e81a6274acce 54 void init(uint8_t a);
luizhespanha 0:e81a6274acce 55
luizhespanha 0:e81a6274acce 56 protected:
luizhespanha 0:e81a6274acce 57 I2C *_i2c;
luizhespanha 0:e81a6274acce 58
luizhespanha 0:e81a6274acce 59 private:
luizhespanha 0:e81a6274acce 60 uint8_t i2c_addr;
luizhespanha 0:e81a6274acce 61 };
luizhespanha 0:e81a6274acce 62
luizhespanha 0:e81a6274acce 63 class Adafruit_8x8matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
luizhespanha 0:e81a6274acce 64 public:
luizhespanha 0:e81a6274acce 65 Adafruit_8x8matrix(I2C *i2c);
luizhespanha 0:e81a6274acce 66
luizhespanha 0:e81a6274acce 67 void drawPixel(int16_t x, int16_t y, uint16_t color);
luizhespanha 0:e81a6274acce 68
luizhespanha 0:e81a6274acce 69 private:
luizhespanha 0:e81a6274acce 70 };