Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: toastboard_integrated
Fork of Adafruit_LEDBackpack_2 by
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 /* 00026 * Modified by Daniel Drew 11/13/2014 for use with 24ledbar backpack 00027 */ 00028 00029 #include "mbed.h" 00030 #include "Adafruit_GFX.h" 00031 00032 #define LED_ON 1 00033 #define LED_OFF 0 00034 00035 #define LED_RED 1 00036 #define LED_YELLOW 2 00037 #define LED_GREEN 3 00038 00039 00040 #define HT16K33_BLINK_CMD 0x80 00041 #define HT16K33_BLINK_DISPLAYON 0x01 00042 #define HT16K33_BLINK_OFF 0 00043 #define HT16K33_BLINK_2HZ 1 00044 #define HT16K33_BLINK_1HZ 2 00045 #define HT16K33_BLINK_HALFHZ 3 00046 00047 #define HT16K33_CMD_BRIGHTNESS 0x0E 00048 00049 // this is the raw HT16K33 controller 00050 class Adafruit_LEDBackpack { 00051 public: 00052 Adafruit_LEDBackpack(I2C *i2c); 00053 void begin(uint8_t _addr); 00054 void setBrightness(uint8_t b); 00055 void blinkRate(uint8_t b); 00056 void writeDisplay(void); 00057 void clear(void); 00058 00059 uint16_t displaybuffer[8]; 00060 00061 void init(uint8_t a); 00062 00063 protected: 00064 I2C *_i2c; 00065 00066 private: 00067 uint8_t i2c_addr; 00068 }; 00069 00070 class Adafruit_8x8matrix : public Adafruit_LEDBackpack, public Adafruit_GFX { 00071 public: 00072 Adafruit_8x8matrix(I2C *i2c); 00073 00074 void drawPixel(int16_t x, int16_t y, uint16_t color); 00075 00076 private: 00077 }; 00078 00079 class Adafruit_24bargraph : public Adafruit_LEDBackpack { 00080 public: 00081 Adafruit_24bargraph(I2C *i2c); 00082 00083 void setBar(uint8_t bar, uint8_t color); 00084 00085 private: 00086 };
Generated on Wed Jul 13 2022 08:55:42 by
1.7.2
