Library for Sure Electronics HT1632 based LED matrix displays. Supports multiple displays connected together.
Dependents: HT1632MsgScroller SMS_LEDMatrixPrinter
Diff: HT1632_LedMatrix.cpp
- Revision:
- 11:0fac71b7ec1d
- Parent:
- 10:af973a9c48b2
- Child:
- 12:e621d8c89cc3
--- a/HT1632_LedMatrix.cpp Wed Nov 28 16:46:44 2012 +0000 +++ b/HT1632_LedMatrix.cpp Wed Nov 28 21:56:55 2012 +0000 @@ -1,5 +1,5 @@ /** Library for Holtek HT1632 LED driver chip, - * As implemented on the Sure Electronics DE-DP10X display board + * As implemented on the Sure Electronics DE-DP10X and DE-DP13X1X display boards * 8 x 32 dot matrix LED module.) * * Original code by: @@ -87,7 +87,7 @@ * know which bits are on without having to (slowly) read the device. */ // 4 boards at 32 bytes per board + 1 byte means we don't need to check overwrite in putChar -uint8_t shadowram[129]; // our copy of the display's RAM +uint8_t shadowram[256]; // our copy of the display's RAM // Custom character buffers - 8 characters available @@ -114,7 +114,7 @@ void HT1632_LedMatrix::init( uint8_t xDevices, uint8_t yDevices, uint8_t displayType ) { // Set up the display size based on number of devices both horizontal and vertical - + numXDevices = xDevices; numYDevices = yDevices; numDevices = numXDevices * numYDevices; @@ -125,7 +125,7 @@ } else { displayWidth = 32; displayHeight = 8; - } + } xMax = displayWidth * numXDevices-1; yMax = displayHeight * numYDevices-1; @@ -136,15 +136,15 @@ for (uint8_t chipno=0; chipno<4; chipno++) { chipfree(chipno); // unselect it - sendcmd(chipno, HT1632_CMD_SYSON); // System on - sendcmd(chipno, HT1632_CMD_LEDON); // LEDs on - sendcmd(chipno, HT1632_CMD_BLOFF); // Blink Off - sendcmd(chipno, HT1632_CMD_MSTMD); // Master Mode + sendcmd(chipno, HT1632_CMD_SYSON); // System on + sendcmd(chipno, HT1632_CMD_LEDON); // LEDs on + sendcmd(chipno, HT1632_CMD_BLOFF); // Blink Off + sendcmd(chipno, HT1632_CMD_MSTMD); // Master Mode sendcmd(chipno, HT1632_CMD_RCCLK); // Internal Oscillator if( displayType == HT1632_16x24 ) { // TODO - check sendcmd(chipno, HT1632_CMD_COMS10); // 16*24, NMOS drivers - } else { + } else { sendcmd(chipno, HT1632_CMD_COMS00); // 08*32, NMOS drivers } sendcmd(chipno, HT1632_CMD_PWM | 0x0c); // PWM Duty @@ -481,21 +481,13 @@ void HT1632_LedMatrix::scrollLeft(uint8_t numberCols, uint8_t lineNum ) { - for (int i=0; i<xMax-numberCols; i++) { shadowram[i]=shadowram[i+numberCols]; } for (int i=xMax-numberCols; i<xMax; i++) { shadowram[i]=0; } - /* - for (int i=0; i<128-numberCols-1; i++) { - shadowram[i]=shadowram[i+numberCols]; - } - for (int i=128-numberCols; i<128; i++) { - shadowram[i]=0; - } - */ + cursorX -= numberCols; if (cursorX < 0 ) cursorX = 0; }