summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Reimer <manuel.reimer@gmx.de>2018-03-29 08:53:20 +0200
committerManuel Reimer <manuel.reimer@gmx.de>2018-03-29 08:53:20 +0200
commit60fa0c3db34786e6c0399750e7c32ec843f69404 (patch)
tree99a731fb6d00bef7b725e1d741c335c776823b08
parent26c53c68a643a75072452a66f53dfab9c4ae7010 (diff)
downloadgraphlcd-base-60fa0c3db34786e6c0399750e7c32ec843f69404.tar.gz
graphlcd-base-60fa0c3db34786e6c0399750e7c32ec843f69404.tar.bz2
st7565r-reel: Correct calculation of display array size
-rw-r--r--glcddrivers/st7565r-reel.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/glcddrivers/st7565r-reel.c b/glcddrivers/st7565r-reel.c
index b88518e..343f7d0 100644
--- a/glcddrivers/st7565r-reel.c
+++ b/glcddrivers/st7565r-reel.c
@@ -68,10 +68,10 @@ int cDriverST7565RReel::Init(void)
height = 64;
// setup lcd array
- LCD = new unsigned char *[width / 8];
+ LCD = new unsigned char *[(width + 7) / 8];
if (LCD)
{
- for (int x = 0; x < width / 8; x++)
+ for (int x = 0; x < (width + 7) / 8; x++)
{
LCD[x] = new unsigned char[height];
}
@@ -96,7 +96,7 @@ int cDriverST7565RReel::DeInit(void)
// free lcd array
if (LCD)
{
- for (int x = 0; x < width / 8; x++)
+ for (int x = 0; x < (width + 7) / 8; x++)
{
delete[] LCD[x];
}
@@ -147,7 +147,7 @@ int cDriverST7565RReel::CheckSetup(void)
void cDriverST7565RReel::Clear(void)
{
- for (int x = 0; x < width / 8; x++)
+ for (int x = 0; x < (width + 7) / 8; x++)
memset(LCD[x], 0, height);
}
@@ -189,7 +189,7 @@ void cDriverST7565RReel::Refresh(bool refreshAll)
for (y = 0; y < (height); y+=8)
{
display_cmd( 0xb0+((y/8)&15));
- for (x = 0; x < width / 8; x+=4)
+ for (x = 0; x < (width + 7) / 8; x+=4)
{
unsigned char d[32]={0};