diff options
author | Manuel Reimer <manuel.reimer@gmx.de> | 2018-03-25 14:12:48 +0200 |
---|---|---|
committer | Manuel Reimer <manuel.reimer@gmx.de> | 2018-03-25 14:12:48 +0200 |
commit | 6dbb576acad95e580f2d7c599b50a80d3dbd2e73 (patch) | |
tree | 2d02ae6b8288b5666b1defd2729a554969a5b5c9 /glcddrivers/st7565r-reel.c | |
parent | 78fe67dd0a4be294b3abbb8a1fb253af923ea847 (diff) | |
download | graphlcd-base-6dbb576acad95e580f2d7c599b50a80d3dbd2e73.tar.gz graphlcd-base-6dbb576acad95e580f2d7c599b50a80d3dbd2e73.tar.bz2 |
st7565r-reel: Reduced memory usage of LCD buffer
Diffstat (limited to 'glcddrivers/st7565r-reel.c')
-rw-r--r-- | glcddrivers/st7565r-reel.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/glcddrivers/st7565r-reel.c b/glcddrivers/st7565r-reel.c index 7a00703..a97b9cf 100644 --- a/glcddrivers/st7565r-reel.c +++ b/glcddrivers/st7565r-reel.c @@ -61,19 +61,19 @@ cDriverST7565RReel::~cDriverST7565RReel() int cDriverST7565RReel::Init(void) { width = config->width; - if (width < 0) + if (width <= 0) width = 128; height = config->height; - if (height < 0) + if (height <= 0) height = 64; // setup lcd array - LCD = new uint32_t *[width]; + LCD = new unsigned char *[width / 8]; if (LCD) { - for (int x = 0; x < width; x++) + for (int x = 0; x < width / 8; x++) { - LCD[x] = new uint32_t[height]; + LCD[x] = new unsigned char[height]; } } @@ -101,7 +101,7 @@ int cDriverST7565RReel::DeInit(void) // free lcd array if (LCD) { - for (int x = 0; x < width; x++) + for (int x = 0; x < width / 8; x++) { delete[] LCD[x]; } @@ -152,14 +152,8 @@ int cDriverST7565RReel::CheckSetup(void) void cDriverST7565RReel::Clear(void) { - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - LCD[x][y] = GRAPHLCD_White; - } - } -// syslog(LOG_INFO, "Clear.\n"); + for (int x = 0; x < width / 8; x++) + memset(LCD[x], 0, height); } void cDriverST7565RReel::SetPixel(int x, int y, uint32_t data) |