Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of N5110 by
Revision 7:3010f24e0a81, committed 2014-05-19
- Comitter:
- eencae
- Date:
- Mon May 19 18:23:21 2014 +0000
- Parent:
- 6:adb79338d40f
- Child:
- 8:40abe5736eca
- Commit message:
- Modified refresh() function so that the address is reset to (0,0) before sending the entire screen buffer to the display. Ensures the origin of the buffer coincides with the top-left pixel. This may not be the case after printing strings.
Changed in this revision
| N5110.cpp | Show annotated file Show diff for this revision Revisions of this file |
| N5110.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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
}
--- a/N5110.h Mon Jan 27 18:41:45 2014 +0000
+++ b/N5110.h Mon May 19 18:23:21 2014 +0000
@@ -177,7 +177,7 @@
* 0 - pixel is clear
* non-zero - pixel is set
*/
- unsigned char getPixel(int x, int y);
+ int getPixel(int x, int y);
/** Refresh display
*
