Port of the Adafruit_IS31FL3731 library for Arduino. Enables control of the feather Charliewing LED Matrix peripheral board. Makes use of the I2Cdev library for I2C.
Dependencies: I2Cdev_MAX32630FTHR
Defaulty uses pinmap for the Maxim 32630FTHR Pegasus board. For a different board, change pin definitions in I2Cdev.h
Diff: Adafruit_IS31FL3731.cpp
- Revision:
- 3:0da61b470b86
- Parent:
- 0:9a73d45a17de
--- a/Adafruit_IS31FL3731.cpp Sat Mar 17 20:41:53 2018 +0000 +++ b/Adafruit_IS31FL3731.cpp Sat Mar 17 23:15:19 2018 +0000 @@ -4,23 +4,7 @@ #define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; } #endif -/* Constructor */ -/*Adafruit_IS31FL3731::Adafruit_IS31FL3731(uint8_t x, uint8_t y) : Adafruit_GFX(x, y) { - //myI2C = theI2C; - I2Cdev* myDevI2C = new I2Cdev(); - myI2C = myDevI2C; -} - -Adafruit_IS31FL3731_Wing::Adafruit_IS31FL3731_Wing() : Adafruit_IS31FL3731(15, 7) { - //myI2C = theI2C; - //myDevI2C - I2Cdev* myDevI2C = new I2Cdev(); - myI2C = myDevI2C; -}*/ - bool Adafruit_IS31FL3731::begin(uint8_t addr) { - //Wire.begin(); - _i2caddr = addr; _frame = 0; @@ -61,17 +45,8 @@ uint8_t nemo[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; for (uint8_t i=0; i<6; i++) { - // Wire.beginTransmission(_i2caddr); - // Wire.write((byte) 0x24+i*24); // write 24 bytes at once myI2C->writeBytes(_i2caddr, 0x24+i*24, 24, nemo); - - /* for (uint8_t j=0; j<24; j++) { - // Wire.write((byte) 0); - myI2C->writeByte(_i2caddr, (unsigned char)0x24+i*24, (unsigned char)0); - - }*/ - // Wire.endTransmission(); } } @@ -82,8 +57,6 @@ void Adafruit_IS31FL3731_Wing::drawPixel(int16_t x, int16_t y, uint16_t color) { - // check rotation, move pixel around if necessary - //myboss->printf("WING %i x %i y %i color\n",x,y,color); switch (getRotation()) { case 1: _swap_int16_t(x, y); @@ -121,7 +94,6 @@ void Adafruit_IS31FL3731::drawPixel(int16_t x, int16_t y, uint16_t color) { // check rotation, move pixel around if necessary -// myboss->printf("%i x %i y %i color\n",x,y,color); switch (getRotation()) { case 1: _swap_int16_t(x, y); @@ -157,10 +129,6 @@ void Adafruit_IS31FL3731::selectBank(uint8_t b) { myI2C->writeByte(_i2caddr, ISSI_COMMANDREGISTER, b); - /*Wire.beginTransmission(_i2caddr); - Wire.write((byte)ISSI_COMMANDREGISTER); - Wire.write(b); - Wire.endTransmission();*/ } void Adafruit_IS31FL3731::audioSync(bool sync) { @@ -176,36 +144,16 @@ selectBank(b); myI2C->writeByte(_i2caddr, reg, data); - - - /*Wire.beginTransmission(_i2caddr); - Wire.write((byte)reg); - Wire.write((byte)data); - Wire.endTransmission();*/ - //Serial.print("$"); Serial.print(reg, HEX); - //Serial.print(" = 0x"); Serial.println(data, HEX); } uint8_t Adafruit_IS31FL3731::readRegister8(uint8_t bank, uint8_t reg) { uint8_t x; - uint8_t status; + //uint8_t status; selectBank(bank); -/* - Wire.beginTransmission(_i2caddr); - Wire.write((byte)reg); - Wire.endTransmission(); - Wire.beginTransmission(_i2caddr); - Wire.requestFrom(_i2caddr, (byte)1); - x = Wire.read();*/ - - status = myI2C->readByte(_i2caddr, reg, &x); - - //Wire.endTransmission(); - -// Serial.print("$"); Serial.print(reg, HEX); -// Serial.print(": 0x"); Serial.println(x, HEX); + //status = + myI2C->readByte(_i2caddr, reg, &x); return x; } \ No newline at end of file