diff --git a/Adafruit_TLC5947.cpp b/Adafruit_TLC5947.cpp index 612acf8..d98f5b2 100644 --- a/Adafruit_TLC5947.cpp +++ b/Adafruit_TLC5947.cpp @@ -18,7 +18,7 @@ #include -Adafruit_TLC5947::Adafruit_TLC5947(uint8_t n, uint8_t c, uint8_t d, uint8_t l) { +Adafruit_TLC5947::Adafruit_TLC5947(uint16_t n, uint8_t c, uint8_t d, uint8_t l) { numdrivers = n; _clk = c; _dat = d; @@ -32,7 +32,7 @@ Adafruit_TLC5947::Adafruit_TLC5947(uint8_t n, uint8_t c, uint8_t d, uint8_t l) { void Adafruit_TLC5947::write(void) { digitalWrite(_lat, LOW); // 24 channels per TLC5974 - for (int8_t c=24*numdrivers - 1; c >= 0 ; c--) { + for (int16_t c=24*numdrivers - 1; c >= 0 ; c--) { // 12 bits per channel, send MSB first for (int8_t b=11; b>=0; b--) { digitalWrite(_clk, LOW); @@ -53,14 +53,14 @@ void Adafruit_TLC5947::write(void) { -void Adafruit_TLC5947::setPWM(uint8_t chan, uint16_t pwm) { +void Adafruit_TLC5947::setPWM(uint16_t chan, uint16_t pwm) { if (pwm > 4095) pwm = 4095; if (chan > 24*numdrivers) return; pwmbuffer[chan] = pwm; } -void Adafruit_TLC5947::setLED(uint8_t lednum, uint16_t r, uint16_t g, uint16_t b) { +void Adafruit_TLC5947::setLED(uint16_t lednum, uint16_t r, uint16_t g, uint16_t b) { setPWM(lednum*3, r); setPWM(lednum*3+1, g); setPWM(lednum*3+2, b); diff --git a/Adafruit_TLC5947.h b/Adafruit_TLC5947.h index 6cd15ec..aec88df 100644 --- a/Adafruit_TLC5947.h +++ b/Adafruit_TLC5947.h @@ -23,19 +23,20 @@ class Adafruit_TLC5947 { public: - Adafruit_TLC5947(uint8_t n, uint8_t c, uint8_t d, uint8_t l); + Adafruit_TLC5947(uint16_t n, uint8_t c, uint8_t d, uint8_t l); boolean begin(void); - void setPWM(uint8_t chan, uint16_t pwm); - void setLED(uint8_t lednum, uint16_t r, uint16_t g, uint16_t b); + void setPWM(uint16_t chan, uint16_t pwm); + void setLED(uint16_t lednum, uint16_t r, uint16_t g, uint16_t b); void write(void); private: uint16_t *pwmbuffer; - uint8_t numdrivers, _clk, _dat, _lat; + uint16_t numdrivers; + uint8_t _clk, _dat, _lat; };