Modified N5110 library with the ability to the print strings at exact pxiel locations, not just at each bank
Fork of N5110 by
Credit to C.Evans for the original library (https://developer.mbed.org/users/eencae/code/N5110/)
Diff: N5110.cpp
- Revision:
- 7:3010f24e0a81
- Parent:
- 6:adb79338d40f
- Child:
- 8:40abe5736eca
--- a/N5110.cpp Mon Jan 27 18:41:45 2014 +0000 +++ b/N5110.cpp Mon May 19 18:23:21 2014 +0000 @@ -176,10 +176,10 @@ buffer[x][y/8] &= ~(1 << y%8); } -unsigned char N5110::getPixel(int x, int y) +int N5110::getPixel(int x, int y) { // return relevant bank and mask required bit - return buffer[x][y/8] & (1 << y%8); + return (int) buffer[x][y/8] & (1 << y%8); } @@ -187,6 +187,11 @@ void N5110::refresh() { int i,j; + + setXYAddress(0,0); // important to set address back to 0,0 before refreshing display + // address auto increments after printing string, so buffer[0][0] will not coincide + // with top-left pixel after priting string + sce->write(0); //set CE low to begin frame for(j = 0; j < 6; j++) { // be careful to use correct order (j,i) for horizontal addressing @@ -233,7 +238,7 @@ while(*str) { setXYAddress(x+6*n,y); // leave 1 pixel (6 = 5 + 1) between each character - printChar(*str); // print the char - can probably so *str++ and remove next line + printChar(*str); // print the char - can probably do *str++ and remove next line str++; // go to next character in string n++; // increment index }