Library for Sure Electronics HT1632 based LED matrix displays. Supports multiple displays connected together.
Dependents: HT1632MsgScroller SMS_LEDMatrixPrinter
Diff: HT1632_LedMatrix.cpp
- Revision:
- 4:7513dd37efed
- Parent:
- 3:48f430fe186e
- Child:
- 5:33b2bfce06b7
--- a/HT1632_LedMatrix.cpp Fri Nov 09 16:33:53 2012 +0000 +++ b/HT1632_LedMatrix.cpp Fri Nov 09 22:27:39 2012 +0000 @@ -101,7 +101,7 @@ for( uint8_t i = 0; i < 4; i++ ) ht1632_cs[i] = HIGH; - for (uint8_t chipno=0; chipno<numDevices; chipno++) { + for (uint8_t chipno=0; chipno<4; chipno++) { chipfree(chipno); // unselect it sendcmd(chipno, HT1632_CMD_SYSDIS); // Disable system sendcmd(chipno, HT1632_CMD_COMS10); // 08*32, PMOS drivers @@ -264,13 +264,13 @@ } // Write a string at the position specified +// x and y start from 0 and count number of pixels, 2nd row on a 2 row display is y=8 void HT1632_LedMatrix::putString(int x, int y, char *str) { cursorX = x; cursorY = y; while( *str ) { putChar( cursorX, y, *str++ ); - cursorX += 6; } } @@ -396,7 +396,6 @@ char bitval = 1<<(y&7); // compute which bit will need set - if (val) { // Modify the shadow memory shadowram[shadowAddress +32*chipno] |= bitval; } else { @@ -426,14 +425,23 @@ cgram[charNum][numCols] = 0; } -void HT1632_LedMatrix::scrollLeft(uint8_t numberCols) +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; }