Hallo ![]()
Ich habe ein Problem mit 16 x HT1632 Displays an einem UNO oder ESP8266. Ich benutze die Adafruit Bibliotheken. Die Bibliothek unterstĂŒtzt von Werk aus vier Controller. Will man mehr, muss man die Bibliothek aufbohren und die Konstruktoren verĂ€ndern. Das habe ich gemacht.
15 Displays laufen schon ohne Probleme. Sobald ich aber des Letzte Display (Nummer 16) aktivieren möchte, stĂŒrzen alle ab. Entwickelt habe ich mit einem UNO. Als die Probleme anfingen, habe ich zum ESP8266 gewechselt, weil ich dachte, das der UNO zu wenig Ram hat (Ist nur eine Vermutung). Es hat sich aber nichts geĂ€ndert. Der Fehler ist komplett der gleiche. Irgendwo sitzt der Bock und ich finde ihn nicht. WĂ€re schön wenn hier einmal jemand drĂŒber schauen könnte.
//#include <FS.h> //this needs to be first, or it all crashes and burns...
#include <ESP8266WiFi.h>
//#include <DNSServer.h>
//#include <ESP8266WebServer.h>
//#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
//#include "ArduinoJson.h"
#include "Adafruit_GFX.h"
#include "Adafruit_HT1632.h"
#include<Wire.h>
#include "PCF8575.h"
PCF8575 Display_selector(0x21);
//esp8266
#define HT_DATA 14
#define HT_WR 12
#define HT_CS 30
#define HT_CS2 31
#define HT_CS3 32
#define HT_CS4 33
#define HT_CS5 34
#define HT_CS6 35
#define HT_CS7 36
#define HT_CS8 37
#define HT_CS9 38
#define HT_CS10 39
#define HT_CS11 40
#define HT_CS12 41
#define HT_CS13 42
#define HT_CS14 43
#define HT_CS15 44
#define HT_CS16 45
// use this line for single matrix
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS);
// use this line for two matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11,HT_CS12);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11,HT_CS12,HT_CS13);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11,HT_CS12,HT_CS13,HT_CS14);
// use this line for three matrices!
Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11,HT_CS12,HT_CS13,HT_CS14,HT_CS15);
// use this line for three matrices!
//Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS, HT_CS2,HT_CS3,HT_CS4,HT_CS5,HT_CS6,HT_CS7,HT_CS8,HT_CS9,HT_CS10,HT_CS11,HT_CS12,HT_CS13,HT_CS14,HT_CS15,HT_CS16);
void setup() {
Serial.begin(115200);
while (!Serial);
delay(2000);
Wire.begin();
Display_selector.begin();
Serial.print("I2C Gefunden? = "); Serial.println(Display_selector.isConnected());
matrix.begin(ADA_HT1632_COMMON_16NMOS);
Serial.println(16 * sizeof(Adafruit_HT1632));
matrix.setBrightness(1);
//matrix.setTextSize(1); // size 1 == 8 pixels high
//matrix.setTextColor(1); // 'lit' LEDs
//matrix.setTextWrap(false);
//delay(500);
}
void loop() {
matrix.clearScreen();
delay(1000);
matrix.setCursor(0, 0); // start at top left, with one pixel of spacing
//matrix.print("0123456789012345678901234567890123456789012345678901234567890123"); // 16 Displays
matrix.print("012345678901234567890123456789012345678901234567890123456789"); // 15 Displays
//matrix.print("01234567"); // 2 1 Displays
matrix.setCursor(0, 8); // start at top left, with one pixel of spacing
//matrix.print("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL"); // 16 Displays
matrix.print("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH"); // 15 Displays
matrix.writeScreen();
delay(1000);
matrix.clearScreen();
delay(1000);
}
void myPinMode(uint8_t pin, uint8_t mode) {
// char buf[32];
// snprintf(buf, sizeof(buf), "pinMode(%d, %d)", pin, mode);
// Serial.println(buf);
if (pin == 30){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 31){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 32){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 33){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 34){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 35){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 36){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 37){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 38){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 39){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 40){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 41){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 42){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 43){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 44){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 45){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 12){
pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 14){
pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 5){
pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 3){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 4){
pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 0){
//pinMode(pin, mode);
//digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
}
void myDigitalWrite(uint8_t pin, uint8_t val) {
// char buf[32];
// snprintf(buf, sizeof(buf), "digitalWrite(%d, %d)", pin, val);
// Serial.println(buf);
if (pin == 5){
digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 4){
digitalWrite( pin, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 14){
digitalWrite( pin, val);
//Display_selector.write(8, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 12){
digitalWrite( pin, val);
//Display_selector.write(8, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 30){
//digitalWrite( pin, val);
Display_selector.write(0, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 31){
//digitalWrite( pin, val);
Display_selector.write(1, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 32){
//digitalWrite( pin, val);
Display_selector.write(2, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 33){
//digitalWrite( pin, val);
Display_selector.write(3, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 34){
//digitalWrite( pin, val);
Display_selector.write(4, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 35){
//digitalWrite( pin, val);
Display_selector.write(5, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 36){
//digitalWrite( pin, val);
Display_selector.write(6, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 37){
//digitalWrite( pin, val);
Display_selector.write(7, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 38){
//digitalWrite( pin, val);
Display_selector.write(8, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 39){
//digitalWrite( pin, val);
Display_selector.write(9, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 40){
//digitalWrite( pin, val);
Display_selector.write(10, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 41){
//digitalWrite( pin, val);
Display_selector.write(11, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 42){
//digitalWrite( pin, val);
Display_selector.write(12, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 43){
//digitalWrite( pin, val);
Display_selector.write(13, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 44){
//digitalWrite( pin, val);
Display_selector.write(14, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
if (pin == 45){
//digitalWrite( pin, val);
Display_selector.write(15, val);
//Serial.print(pin);Serial.print(" : ");Serial.println(val);
}
}
Die CPP
#include "Adafruit_HT1632.h"
extern void myPinMode(uint8_t pin, uint8_t mode);
extern void myDigitalWrite(uint8_t pin, uint8_t val);
#define pinMode myPinMode
#define digitalWrite myDigitalWrite
#undef __AVR__
#ifndef _swap_int16_t
#define _swap_int16_t(a, b) \
{ \
int16_t t = a; \
a = b; \
b = t; \
}
#endif
// Constructor for single GFX matrix
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1)
: Adafruit_GFX(24, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrixNum = 1;
}
}
// Constructor for two matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2)
: Adafruit_GFX(48, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(2 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrixNum = 2;
}
}
// Constructor for three matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3)
: Adafruit_GFX(72, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(3 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrixNum = 3;
}
}
// Constructor for four matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4)
: Adafruit_GFX(96, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(4 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrixNum = 4;
}
}
// Constructor for five matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5)
: Adafruit_GFX(120, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(5 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrixNum = 5;
}
}
// Constructor for six matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6)
: Adafruit_GFX(144, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(6 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrixNum = 6;
}
}
// Constructor for seven matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7)
: Adafruit_GFX(168, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(7 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrixNum = 7;
}
}
// Constructor for eight matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8)
: Adafruit_GFX(192, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(8 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrixNum = 8;
}
}
// Constructor for nine matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9)
: Adafruit_GFX(216, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(9 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrixNum = 9;
}
}
// Constructor for ten matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10)
: Adafruit_GFX(240, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(10 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrixNum = 10;
}
}
// Constructor for eleven matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11)
: Adafruit_GFX(264, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(11 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrixNum = 11;
}
}
// Constructor for twelfmatrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11, uint8_t cs12)
: Adafruit_GFX(288, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(12 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrices[11] = Adafruit_HT1632(data, wr, cs12);
matrixNum = 12;
}
}
// Constructor for thirdteen matrices, tiled side-by-side for GFX
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11, uint8_t cs12,
uint8_t cs13)
: Adafruit_GFX(312, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(13 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrices[11] = Adafruit_HT1632(data, wr, cs12);
matrices[12] = Adafruit_HT1632(data, wr, cs13);
matrixNum = 13;
}
}
// Constructor
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14)
: Adafruit_GFX(336, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(14 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrices[11] = Adafruit_HT1632(data, wr, cs12);
matrices[12] = Adafruit_HT1632(data, wr, cs13);
matrices[13] = Adafruit_HT1632(data, wr, cs14);
matrixNum = 14;
}
}
// Constructor
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14,
uint8_t cs15)
: Adafruit_GFX(360, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(15 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrices[11] = Adafruit_HT1632(data, wr, cs12);
matrices[12] = Adafruit_HT1632(data, wr, cs13);
matrices[13] = Adafruit_HT1632(data, wr, cs14);
matrices[14] = Adafruit_HT1632(data, wr, cs15);
matrixNum = 15;
}
}
// Constructor
Adafruit_HT1632LEDMatrix::Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10,
uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14,
uint8_t cs15, uint8_t cs16)
: Adafruit_GFX(384, 16), matrices(NULL), matrixNum(0) {
if ((matrices = (Adafruit_HT1632 *)malloc(16 * sizeof(Adafruit_HT1632)))) {
matrices[0] = Adafruit_HT1632(data, wr, cs1);
matrices[1] = Adafruit_HT1632(data, wr, cs2);
matrices[2] = Adafruit_HT1632(data, wr, cs3);
matrices[3] = Adafruit_HT1632(data, wr, cs4);
matrices[4] = Adafruit_HT1632(data, wr, cs5);
matrices[5] = Adafruit_HT1632(data, wr, cs6);
matrices[6] = Adafruit_HT1632(data, wr, cs7);
matrices[7] = Adafruit_HT1632(data, wr, cs8);
matrices[8] = Adafruit_HT1632(data, wr, cs9);
matrices[9] = Adafruit_HT1632(data, wr, cs10);
matrices[10] = Adafruit_HT1632(data, wr, cs11);
matrices[11] = Adafruit_HT1632(data, wr, cs12);
matrices[12] = Adafruit_HT1632(data, wr, cs13);
matrices[13] = Adafruit_HT1632(data, wr, cs14);
matrices[14] = Adafruit_HT1632(data, wr, cs15);
matrices[15] = Adafruit_HT1632(data, wr, cs16);
matrixNum = 16;
}
}
void Adafruit_HT1632LEDMatrix::setPixel(uint8_t x, uint8_t y) {
drawPixel(x, y, 1);
}
void Adafruit_HT1632LEDMatrix::clrPixel(uint8_t x, uint8_t y) {
drawPixel(x, y, 0);
}
void Adafruit_HT1632LEDMatrix::drawPixel(int16_t x, int16_t y, uint16_t color) {
if ((x < 0) || (x >= _width) || (y < 0) || (y >= _height))
return;
switch (rotation) { // Rotate pixel into device-specific coordinates
case 1:
_swap_int16_t(x, y);
x = WIDTH - 1 - x;
break;
case 2:
x = WIDTH - 1 - x;
y = HEIGHT - 1 - y;
break;
case 3:
_swap_int16_t(x, y);
y = HEIGHT - 1 - y;
break;
}
uint8_t m = x / 24; // Which matrix controller is pixel on?
x %= 24; // Which column in matrix?
// uint16_t i;
// if (x < 8)
// i = 7;
// else if (x < 16)
// i = 128 + 7;
// else
// i = 256 + 7;
// i -= (x & 7);
// if (y < 8)
// y *= 2;
// else
// y = (y - 8) * 2 + 1;
// i += y * 8;
// if (color)
// matrices[m].setPixel(i);
// else
// matrices[m].clrPixel(i);
uint16_t i;
if ((i >=0) and (i < 384)) {
i = x * 16 + y;
if (color)
matrices[m].setPixel(i);
else
matrices[m].clrPixel(i);
}
}
boolean Adafruit_HT1632LEDMatrix::begin(uint8_t type) {
if (matrixNum) { // Did malloc() work OK?
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].begin(type);
return true;
}
return false;
}
void Adafruit_HT1632LEDMatrix::clearScreen() {
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].clearScreen();
}
void Adafruit_HT1632LEDMatrix::fillScreen() {
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].fillScreen();
}
void Adafruit_HT1632LEDMatrix::setBrightness(uint8_t b) {
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].setBrightness(b);
}
void Adafruit_HT1632LEDMatrix::blink(boolean b) {
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].blink(b);
}
void Adafruit_HT1632LEDMatrix::writeScreen() {
for (uint8_t i = 0; i < matrixNum; i++)
matrices[i].writeScreen();
}
//////////////////////////////////////////////////////////////////////////
Adafruit_HT1632::Adafruit_HT1632(int8_t data, int8_t wr, int8_t cs, int8_t rd) {
_data = data;
_wr = wr;
_cs = cs;
_rd = rd;
memset(ledmatrix, 0, sizeof(ledmatrix));
}
void Adafruit_HT1632::begin(uint8_t type) {
pinMode(_cs, OUTPUT);
digitalWrite(_cs, HIGH);
pinMode(_wr, OUTPUT);
digitalWrite(_wr, HIGH);
pinMode(_data, OUTPUT);
if (_rd >= 0) {
pinMode(_rd, OUTPUT);
digitalWrite(_rd, HIGH);
}
#ifdef __AVR__
csport = portOutputRegister(digitalPinToPort(_cs));
csmask = digitalPinToBitMask(_cs);
wrport = portOutputRegister(digitalPinToPort(_wr));
wrmask = digitalPinToBitMask(_wr);
dataport = portOutputRegister(digitalPinToPort(_data));
datadir = portModeRegister(digitalPinToPort(_data));
datamask = digitalPinToBitMask(_data);
#endif
sendcommand(ADA_HT1632_SYS_EN);
sendcommand(ADA_HT1632_LED_ON);
sendcommand(ADA_HT1632_BLINK_OFF);
sendcommand(ADA_HT1632_MASTER_MODE);
sendcommand(ADA_HT1632_INT_RC);
sendcommand(type);
sendcommand(ADA_HT1632_PWM_CONTROL | 0xF);
}
void Adafruit_HT1632::setBrightness(uint8_t pwm) {
if (pwm > 15)
pwm = 15;
sendcommand(ADA_HT1632_PWM_CONTROL | pwm);
}
void Adafruit_HT1632::blink(boolean blinky) {
sendcommand(blinky ? ADA_HT1632_BLINK_ON : ADA_HT1632_BLINK_OFF);
}
void Adafruit_HT1632::setPixel(uint16_t i) {
ledmatrix[i / 8] |= (1 << (i & 7));
}
void Adafruit_HT1632::clrPixel(uint16_t i) {
ledmatrix[i / 8] &= ~(1 << (i & 7));
}
void Adafruit_HT1632::dumpScreen() {
Serial.println(F("---------------------------------------"));
for (uint16_t i = 0; i < sizeof(ledmatrix); i++) {
Serial.print("0x");
Serial.print(ledmatrix[i], HEX);
Serial.print(" ");
if (i % 3 == 2)
Serial.println();
}
Serial.println(F("\n---------------------------------------"));
}
void Adafruit_HT1632::writeScreen() {
#ifdef __AVR__
*csport &= ~csmask;
*datadir |= datamask; // OUTPUT
#else
digitalWrite(_cs, LOW);
#endif
writedata(ADA_HT1632_WRITE, 3);
// send with address 0
writedata(0, 7);
for (uint16_t i = 0; i < sizeof(ledmatrix); i += 2) {
writedata(((uint16_t)ledmatrix[i] << 8) | ledmatrix[i + 1], 16);
}
#ifdef __AVR__
*csport |= csmask;
*datadir &= ~datamask; // INPUT
#else
digitalWrite(_cs, HIGH);
#endif
}
void Adafruit_HT1632::clearScreen() {
memset(ledmatrix, 0, sizeof(ledmatrix));
writeScreen();
}
void Adafruit_HT1632::writedata(uint16_t d, uint8_t bits) {
#ifdef __AVR__
for (uint16_t bit = 1 << (bits - 1); bit; bit >>= 1) {
*wrport &= ~wrmask;
if (d & bit)
*dataport |= datamask;
else
*dataport &= ~datamask;
*wrport |= wrmask;
}
#else
pinMode(_data, OUTPUT);
for (uint16_t bit = 1 << (bits - 1); bit; bit >>= 1) {
digitalWrite(_wr, LOW);
digitalWrite(_data, (d & bit) ? HIGH : LOW);
digitalWrite(_wr, HIGH);
}
pinMode(_data, INPUT);
#endif
}
void Adafruit_HT1632::writeRAM(uint8_t addr, uint8_t data) {
// Serial.print("Writing 0x"); Serial.print(data&0xF, HEX);
// Serial.print(" to 0x"); Serial.println(addr & 0x7F, HEX);
uint16_t d = ADA_HT1632_WRITE;
d <<= 7;
d |= addr & 0x7F;
d <<= 4;
d |= data & 0xF;
#ifdef __AVR__
*csport &= ~csmask;
writedata(d, 14);
*csport |= csmask;
#else
digitalWrite(_cs, LOW);
writedata(d, 14);
digitalWrite(_cs, HIGH);
#endif
}
void Adafruit_HT1632::sendcommand(uint8_t cmd) {
#ifdef __AVR__
*csport &= ~csmask;
*datadir |= datamask; // OUTPUT
writedata((((uint16_t)ADA_HT1632_COMMAND << 8) | cmd) << 1, 12);
*datadir &= ~datamask; // INPUT
*csport |= csmask;
#else
digitalWrite(_cs, LOW);
writedata((((uint16_t)ADA_HT1632_COMMAND << 8) | cmd) << 1, 12);
digitalWrite(_cs, HIGH);
#endif
}
void Adafruit_HT1632::fillScreen() {
memset(ledmatrix, 0xFF, sizeof(ledmatrix));
writeScreen();
}
#include "Adafruit_GFX.h"
#ifndef ADA_HT1632_H_
#define ADA_HT1632_H_
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#define ADA_HT1632_READ 0x06 //!< Read data from the RAM
#define ADA_HT1632_WRITE 0x05 //!< Write data to the RAM
#define ADA_HT1632_COMMAND 0x04 //!< Send command
#define ADA_HT1632_SYS_DIS \
0x00 //!< Stops system clock, turns off LED duty cycle generator, reducing
//!< power usage
#define ADA_HT1632_SYS_EN 0x01 //!< Turn on system oscillator
#define ADA_HT1632_LED_OFF 0x02 //!< Turn off LED duty cycle generator
#define ADA_HT1632_LED_ON 0x03 //!< Turn on LED duty cycle generator
#define ADA_HT1632_BLINK_OFF 0x08 //!< Turn off blinking function
#define ADA_HT1632_BLINK_ON 0x09 //!< Turn on blinking function
#define ADA_HT1632_SLAVE_MODE \
0x10 //!< Set slave mode and clock source from external clock
#define ADA_HT1632_MASTER_MODE \
0x14 //!< Set master mode and clock source from on-chip RC oscillator
#define ADA_HT1632_INT_RC 0x18 //!< Use internal RC oscillator
#define ADA_HT1632_EXT_CLK \
0x1C //!< Set master mode and clock source from external clock
#define ADA_HT1632_PWM_CONTROL 0xA0 //!< PWM brightness control
#define ADA_HT1632_COMMON_8NMOS \
0x20 //!< NMOS open drain output driver for commons
#define ADA_HT1632_COMMON_16NMOS \
0x24 //!< NMOS open drain output driver for commons
#define ADA_HT1632_COMMON_8PMOS \
0x28 //!< PMOS open drain output driver for commons
#define ADA_HT1632_COMMON_16PMOS \
0x2C //!< PMOS open drain output driver for commons
/*!
* @brief Driver for the Adafruit HT1632 LED matrix driver
*/
class Adafruit_HT1632 {
public:
/*!
* @brief LED matrix object
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs Chip select
* @param rd Read block input
*/
Adafruit_HT1632(int8_t data, int8_t wr, int8_t cs, int8_t rd = -1);
/*!
* @brief Initialize driver
* @param type Matrix type
* @return Returns whether or not the initialization was successful
*/
void begin(uint8_t type),
/*!
* @brief Clears a specific pixel
* @param i Pixel to clear
*/
clrPixel(uint16_t i),
/*!
* @brief Sets a specific pixel
* @param i Pixel to set
*/
setPixel(uint16_t i),
/*!
* @brief Turn display on with or without blinking
* @param state Whether or not to blink when turning on the display
*/
blink(boolean state),
/*!
* @brief Sets screen brightness
* @param pwm Desired brightness
*/
setBrightness(uint8_t pwm),
/*! Clears the screen */
clearScreen(),
/*! Fills the screen */
fillScreen(),
/*! Writes to the screen */
writeScreen(),
/*! Dumps the screen */
dumpScreen();
protected:
/**
* _data private serial data output
* _cs private chip select input
* _wr private WRITE clock input
* _rd private READ clock input with high-pull resistor
*@{
*/
int8_t _data, _cs, _wr, _rd;
/** @}*/
uint8_t ledmatrix[24 * 16 / 8]; //!< LED matrix size
/*!
* @brief Sends command to HT1632
* @param c Command to send
*/
void sendcommand(uint8_t c),
/*!
* @brief Writes data to the driver
* @param d Write address
* @param bits Bits to write
*/
writedata(uint16_t d, uint8_t bits),
/*!
* @brief Writes RAM to the driver
* @param addr Address to write to
* @param data Data to write
*/
writeRAM(uint8_t addr, uint8_t data);
#ifdef __AVR__
volatile uint8_t *dataport, *csport, *wrport, *datadir;
uint8_t datamask, csmask, wrmask;
#endif
};
/*!
* HT1632LEDMatrix main class
*/
class Adafruit_HT1632LEDMatrix : public Adafruit_GFX {
public:
/*!
* @brief LED matrix function for 1 matrix
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1);
/*!
* @brief LED matrix function for 2 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2);
/*!
* @brief LED matrix function for 3 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs Chip select input 2
* @param cs3 Chip select input 3
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs,
uint8_t cs3);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4, uint8_t cs5);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4, uint8_t cs5, uint8_t cs6);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4, uint8_t cs5, uint8_t cs6,
uint8_t cs7);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr, uint8_t cs1, uint8_t cs2,
uint8_t cs3, uint8_t cs4, uint8_t cs5, uint8_t cs6,
uint8_t cs7, uint8_t cs8);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11, uint8_t cs12);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11, uint8_t cs12,
uint8_t cs13);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14, uint8_t cs15);
/*!
* @brief LED matrix function for 4 matrixes
* @param data Serial data input or output with high-pull resistor
* @param wr WRITE clock input with pull-high resistor.
* @param cs1 Chip select input 1
* @param cs2 Chip select input 2
* @param cs3 Chip select input 3
* @param cs4 Chip select input 4
*/
Adafruit_HT1632LEDMatrix(uint8_t data, uint8_t wr,
uint8_t cs1, uint8_t cs2,uint8_t cs3, uint8_t cs4,
uint8_t cs5, uint8_t cs6,uint8_t cs7, uint8_t cs8,
uint8_t cs9, uint8_t cs10, uint8_t cs11, uint8_t cs12,
uint8_t cs13, uint8_t cs14, uint8_t cs15, uint8_t cs16);
/*!
* @brief Initialize driver
* @param type Matrix type
* @return Returns whether or not the initialization was successful
*/
boolean begin(uint8_t type);
/*!
* @brief Clears the screen
*/
void clearScreen(void),
/*!
* @brief Fills the screen
*/
fillScreen(void),
/*!
* @brief Turn display on with or without blinking
* @param b Whether or not to blink when turning on the display
*/
blink(boolean b),
/*!
* @brief Sets screen brightness
* @param brightness Desired brightness
*/
setBrightness(uint8_t brightness),
/*!
* @brief Writes to the screen
*/
writeScreen(),
/*!
* @brief Clears specified pixel
* @param x X value of specified pixel
* @param y Y value of specified pixel
*/
clrPixel(uint8_t x, uint8_t y),
/*!
* @brief Turns on specified pixel
* @param x X value of specified pixel
* @param y Y value of specified pixel
*/
setPixel(uint8_t x, uint8_t y),
/*!
* @brief Sets specified pixel with specified color
* @param x X value of desired pixel
* @param y Y value of desired pixel
* @param color color to draw to pixel
*/
drawPixel(int16_t x, int16_t y, uint16_t color);
protected:
Adafruit_HT1632 *matrices; //!< Matrix pointer
uint8_t matrixNum; //!< The matrix's number
};
#endif /* Adafruit HT1632_H_ */