diff options
Diffstat (limited to 'glcddrivers/t6963c.c')
-rw-r--r-- | glcddrivers/t6963c.c | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/glcddrivers/t6963c.c b/glcddrivers/t6963c.c index d42da35..aec2585 100644 --- a/glcddrivers/t6963c.c +++ b/glcddrivers/t6963c.c @@ -8,7 +8,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003, 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2003-2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <syslog.h> @@ -107,10 +108,8 @@ const unsigned char kSerialCDLO = 0x04; // cDriverT6963C::cDriverT6963C(cDriverConfig * config) -: config(config) +: cDriver(config) { - oldConfig = new cDriverConfig(*config); - port = new cParallelPort(); //width = config->width; @@ -125,7 +124,6 @@ cDriverT6963C::cDriverT6963C(cDriverConfig * config) cDriverT6963C::~cDriverT6963C() { delete port; - delete oldConfig; } int cDriverT6963C::Init() @@ -376,6 +374,52 @@ void cDriverT6963C::Clear() memset(newLCD[x], 0, height); } + +void cDriverT6963C::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + if (FS == 6) + { + int pos = x % 6; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + } else { + pos = 5 - pos; // reverse bit position + } + + // columns_per_line = (width + FS6-1) / FS6 (FS6 == 6 bits per byte used) + //int cols = (width + 6 - 1 ) / 6; + int col = x / 6; + + if (data == GRAPHLCD_White) + newLCD[col][y] |= (1 << pos); + else + newLCD[col][y] &= ( 0x3F ^ (1 << pos) ); + } + else + { + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + } else { + pos = 7 - pos; // reverse bit position + } + + if (data == GRAPHLCD_White) + newLCD[x / 8][y] |= (1 << pos); + else + newLCD[x / 8][y] &= ( 0xFF ^ (1 << pos) ); + } +} + + +#if 0 void cDriverT6963C::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -446,6 +490,7 @@ void cDriverT6963C::Set8Pixels(int x, int y, unsigned char data) } } } +#endif void cDriverT6963C::Refresh(bool refreshAll) { |