//Test Sketch
//Initialize both the Adafruit library and the current library.
//Instantiate an object mbGFX so all Adafruit GFX and MB_GFX add-on functions are addressed as mbGFX.xxx();
MB_GFX_SPI mbGFX = MB_GFX_SPI(Period, numCathodeLeds, numAnodeLeds, CathodeSSPin, AnodeSSPin);
//In file MB_GFX_SPI.cpp
MB_GFX_SPI::MB_GFX_SPI(int Period, int numCathodeLEDS, int numAnodeLEDS,
int CathodeSSPin, int AnodeSSPin)
: Adafruit_GFX(numCathodeLEDS, numAnodeLEDS) {
mbR.SetMatrixSize(numCathodeLEDS, numAnodeLEDS);
clearScreen(0);
}
void MB_GFX_SPI::clearScreen(uint16_t color) {
mbR.r_totNumChannels = 99; //test set value
}
//In file mb_raster.cpp
void mbRasterClass::SetMatrixSize(int numCathodeLeds, int numAnodeLeds){
//cathodes require 1 byte per channel
//anodes require 1 bit per channel
int numAnodeChannels = numAnodeLeds;
int numCathodeChannels = mbX.pin2pin * numCathodeLeds; //times 1 or 3
r_numCathodeRegisters = (int)((numCathodeChannels+7)/8); //select next higher number of registers
r_numCathodes = 8 * r_numCathodeRegisters; //must be whole 8 bit registers - is every single chatode pin
r_numAnodeRegisters = (numAnodeChannels+7)/8; //round up to next register number
r_numAnodes = 8 * r_numAnodeRegisters; //must be whole 8 bit registers
r_PWMBufferSize = r_totNumChannels = r_numAnodes * r_numCathodes;
r_PWMBuffer = (uint8_t *) realloc(r_PWMBuffer, r_totNumChannels); //resize array for PWMBuffer
}
//Test Sketch
//Initialize both the Adafruit library and the current library.
//Instantiate an object mbGFX so all Adafruit GFX and MB_GFX add-on functions are addressed as mbGFX.xxx();
MB_GFX_SPI mbGFX = MB_GFX_SPI(Period, numCathodeLeds, numAnodeLeds, CathodeSSPin, AnodeSSPin);
//In file MB_GFX_SPI.cpp
MB_GFX_SPI::MB_GFX_SPI(int Period, int numCathodeLEDS, int numAnodeLEDS,
int CathodeSSPin, int AnodeSSPin)
: Adafruit_GFX(numCathodeLEDS, numAnodeLEDS) {
mbR.SetMatrixSize(numCathodeLEDS, numAnodeLEDS);
clearScreen(0);
}
void MB_GFX_SPI::clearScreen(uint16_t color) {
mbR.r_totNumChannels = 99; //test set value
}
//In file mb_raster.cpp
void mbRasterClass::SetMatrixSize(int numCathodeLeds, int numAnodeLeds){
//cathodes require 1 byte per channel
//anodes require 1 bit per channel
int numAnodeChannels = numAnodeLeds;
int numCathodeChannels = mbX.pin2pin * numCathodeLeds; //times 1 or 3
r_numCathodeRegisters = (int)((numCathodeChannels+7)/8); //select next higher number of registers
r_numCathodes = 8 * r_numCathodeRegisters; //must be whole 8 bit registers - is every single chatode pin
r_numAnodeRegisters = (numAnodeChannels+7)/8; //round up to next register number
r_numAnodes = 8 * r_numAnodeRegisters; //must be whole 8 bit registers
r_PWMBufferSize = r_totNumChannels = r_numAnodes * r_numCathodes;
r_PWMBuffer = (uint8_t *) realloc(r_PWMBuffer, r_totNumChannels); //resize array for PWMBuffer
}