diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-06-25 21:52:54 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-06-25 21:52:54 +0200 |
commit | 82d929736a6188583fe3283b8fa2ce776f3cca21 (patch) | |
tree | 1a894c5a603415086db3e3cdbb9b8d15fabc94a5 /glcddrivers | |
parent | d7b7ae09a995d8ceab70a9d7904a7b9e25beba00 (diff) | |
download | graphlcd-base-82d929736a6188583fe3283b8fa2ce776f3cca21.tar.gz graphlcd-base-82d929736a6188583fe3283b8fa2ce776f3cca21.tar.bz2 |
adapt all drivers to support SetPixel() with 32bit colours; Set8Pixels() is no longer virtual (generic implementation in base class)
Diffstat (limited to 'glcddrivers')
35 files changed, 348 insertions, 78 deletions
diff --git a/glcddrivers/avrctl.c b/glcddrivers/avrctl.c index b0e09b9..1f5d155 100644 --- a/glcddrivers/avrctl.c +++ b/glcddrivers/avrctl.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2005 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <stdint.h> @@ -176,6 +177,27 @@ void cDriverAvrCtl::Clear() memset(newLCD[x], 0, (kBufferHeight + 7) / 8); } + +void cDriverAvrCtl::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + } + + int offset = 7 - (y % 8); + if (data == GLCD::cColor::White) + newLCD[x][y / 8] |= (1 << offset); + else + newLCD[x][y / 8] &= ( 0xFF ^ (1 << offset) ); +} + + +#if 0 void cDriverAvrCtl::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -200,6 +222,7 @@ void cDriverAvrCtl::Set8Pixels(int x, int y, unsigned char data) } } } +#endif void cDriverAvrCtl::Refresh(bool refreshAll) { diff --git a/glcddrivers/avrctl.h b/glcddrivers/avrctl.h index 557b7d2..53a8c2b 100644 --- a/glcddrivers/avrctl.h +++ b/glcddrivers/avrctl.h @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2005 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_AVRCTL_H_ @@ -48,7 +49,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); }; diff --git a/glcddrivers/dm140gink.c b/glcddrivers/dm140gink.c index 87e29c2..0b00a5f 100644 --- a/glcddrivers/dm140gink.c +++ b/glcddrivers/dm140gink.c @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Stephan Skrodzki + * (c) 2004 Stephan Skrodzki + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <fcntl.h> @@ -267,7 +268,10 @@ void cDriverDM140GINK::SetPixel(int x, int y, uint32_t data) int offset = (y/8) * width + x; char mask = (1 << (7 - (y%8))); - framebuff[offset] |= mask; + if (data == GLCD::cColor::White) + framebuff[offset] |= mask; + else + framebuff[offset] &= (0xFF ^ mask); } void cDriverDM140GINK::Clear() @@ -275,6 +279,7 @@ void cDriverDM140GINK::Clear() memset(framebuff, 0, screensize); } +#if 0 void cDriverDM140GINK::Set8Pixels(int x, int y, unsigned char data) { x &= 0xFFF8; @@ -285,6 +290,7 @@ void cDriverDM140GINK::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverDM140GINK::Refresh(bool refreshAll) { diff --git a/glcddrivers/dm140gink.h b/glcddrivers/dm140gink.h index 8686ad9..e5199a5 100644 --- a/glcddrivers/dm140gink.h +++ b/glcddrivers/dm140gink.h @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Stephan Skrodzki + * (c) 2004 Stephan Skrodzki + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_DM140GINK_H_ @@ -38,7 +39,6 @@ private: int SendReport(const char *buf, size_t size); int CheckSetup(); - void SetPixel(int x, int y, uint32_t data); public: cDriverDM140GINK(cDriverConfig * config); @@ -48,7 +48,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/driver.h b/glcddrivers/driver.h index 2ff32cb..a7175b7 100644 --- a/glcddrivers/driver.h +++ b/glcddrivers/driver.h @@ -62,7 +62,7 @@ public: virtual void Clear() {} virtual void SetPixel(int x, int y, uint32_t data) {} - virtual void Set8Pixels(int x, int y, unsigned char data); + void Set8Pixels(int x, int y, unsigned char data); // virtual void SetScreen(const unsigned char * data, int width, int height, int lineSize); virtual void SetScreen(const uint32_t *data, int width, int height); virtual void Refresh(bool refreshAll = false) {} diff --git a/glcddrivers/framebuffer.c b/glcddrivers/framebuffer.c index 10ed9fd..440af89 100644 --- a/glcddrivers/framebuffer.c +++ b/glcddrivers/framebuffer.c @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Stephan Skrodzki + * (c) 2004 Stephan Skrodzki + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <fcntl.h> @@ -164,17 +165,19 @@ void cDriverFramebuffer::SetPixel(int x, int y, uint32_t data) y = height - 1 - y; } + // Figure out where in memory to put the pixel location = (x*(1+zoom)+vinfo.xoffset) * (vinfo.bits_per_pixel/8) + (y*(1+zoom)+vinfo.yoffset) * finfo.line_length; - if (vinfo.bits_per_pixel <= 8) - { - outcol = 15; - } - else - { - outcol = 255; + if (data == GLCD::cColor::White) { + if (vinfo.bits_per_pixel <= 8) { + outcol = 15; + } else { + outcol = 255; + } + } else { + outcol = 0; } if (vinfo.bits_per_pixel <= 8) @@ -230,6 +233,7 @@ void cDriverFramebuffer::Clear() memset(offbuff, 0, screensize); } +#if 0 void cDriverFramebuffer::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -242,6 +246,7 @@ void cDriverFramebuffer::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverFramebuffer::Refresh(bool refreshAll) { diff --git a/glcddrivers/framebuffer.h b/glcddrivers/framebuffer.h index 12e307c..cd8f003 100644 --- a/glcddrivers/framebuffer.h +++ b/glcddrivers/framebuffer.h @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Stephan Skrodzki + * (c) 2004 Stephan Skrodzki + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_FRAMEBUFFER_H_ @@ -37,7 +38,6 @@ private: int zoom; int CheckSetup(); - void SetPixel(int x, int y, uint32_t data); public: cDriverFramebuffer(cDriverConfig * config); @@ -47,7 +47,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/g15daemon.c b/glcddrivers/g15daemon.c index 28c5569..88619c3 100644 --- a/glcddrivers/g15daemon.c +++ b/glcddrivers/g15daemon.c @@ -7,6 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * +* (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> +* (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <fcntl.h> @@ -191,7 +193,7 @@ void cDriverG15daemon::SetPixel(int x, int y, uint32_t data) y = height - 1 - y; } - offbuff[x + (width * y)] = 1; + offbuff[x + (width * y)] = ( (data == GLCD::cColor::White) ? 1 : 0 ); } void cDriverG15daemon::Clear() @@ -199,6 +201,7 @@ void cDriverG15daemon::Clear() memset(offbuff, 0, screensize); } +#if 0 void cDriverG15daemon::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -211,6 +214,7 @@ void cDriverG15daemon::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverG15daemon::Refresh(bool refreshAll) { diff --git a/glcddrivers/g15daemon.h b/glcddrivers/g15daemon.h index 33e3381..839102c 100644 --- a/glcddrivers/g15daemon.h +++ b/glcddrivers/g15daemon.h @@ -4,6 +4,8 @@ * g15daemon.h - pseudo device for the g15daemon * Output goes to the g15daemon which then displays it * + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_G15DAEMON_H_ @@ -30,7 +32,6 @@ private: int zoom; int CheckSetup(); - void SetPixel(int x, int y, uint32_t data); public: cDriverG15daemon(cDriverConfig * config); @@ -40,7 +41,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/gu126x64D-K610A4.c b/glcddrivers/gu126x64D-K610A4.c index 049b79f..955174a 100644 --- a/glcddrivers/gu126x64D-K610A4.c +++ b/glcddrivers/gu126x64D-K610A4.c @@ -18,7 +18,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2007 Alexander Rieger (Alexander.Rieger AT inka.de) + * (c) 2007 Alexander Rieger (Alexander.Rieger AT inka.de) + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <errno.h> @@ -417,7 +418,7 @@ int cDriverGU126X64D_K610A4::write(unsigned char data) } // cDriverGU126X64D_K610A4::write() //----------------------------------------------------------------------------- -void cDriverGU126X64D_K610A4::setPixel(int x, int y, uint32_t data) +void cDriverGU126X64D_K610A4::SetPixel(int x, int y, uint32_t data) { if (!myDrawMem ) return; if (x >= width || x < 0) return; @@ -431,9 +432,13 @@ void cDriverGU126X64D_K610A4::setPixel(int x, int y, uint32_t data) unsigned char c = 0x80 >> (y % 8); - myDrawMem[x][y/8] = myDrawMem[x][y/8] | c; -} // cDriverGU126X64D_K610A4::setPixel() + if (data == GLCD::cColor::White) + myDrawMem[x][y/8] |= c; + else + myDrawMem[x][y/8] &= ( 0xFF ^ c ); +} // cDriverGU126X64D_K610A4::SetPixel() +#if 0 //----------------------------------------------------------------------------- void cDriverGU126X64D_K610A4::Set8Pixels(int x, int y, unsigned char data) { @@ -448,6 +453,7 @@ void cDriverGU126X64D_K610A4::Set8Pixels(int x, int y, unsigned char data) } // if } // for } // cDriverGU126X64D_K610A4::Set8Pixels() +#endif //----------------------------------------------------------------------------- void cDriverGU126X64D_K610A4::Refresh(bool refreshAll) diff --git a/glcddrivers/gu126x64D-K610A4.h b/glcddrivers/gu126x64D-K610A4.h index 439da94..3d989e4 100644 --- a/glcddrivers/gu126x64D-K610A4.h +++ b/glcddrivers/gu126x64D-K610A4.h @@ -18,7 +18,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2007 Alexander Rieger (Alexander.Rieger AT inka.de) + * (c) 2007 Alexander Rieger (Alexander.Rieger AT inka.de) + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_GU126X64D_K610A4_H_ @@ -54,7 +55,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel (int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); @@ -68,7 +70,6 @@ public: , FONT_FIX_BIG }; - void setPixel (int x, int y, uint32_t data); int cmdReset (); int cmdPower (bool fOn); diff --git a/glcddrivers/gu140x32f.c b/glcddrivers/gu140x32f.c index 865d133..3baf6f1 100644 --- a/glcddrivers/gu140x32f.c +++ b/glcddrivers/gu140x32f.c @@ -14,7 +14,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas Brachold <vdr04 AT deltab.de> + * (c) 2003 Andreas Brachold <vdr04 AT deltab.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <errno.h> @@ -348,9 +350,13 @@ void cDriverGU140X32F::SetPixel(int x, int y, uint32_t data) n = x + ((y / 8) * width); c = 0x80 >> (y % 8); - m_pDrawMem[n] |= c; + if (data == GLCD::cColor::White) + m_pDrawMem[n] |= c; + else + m_pDrawMem[n] &= (0xFF ^ c); } +#if 0 void cDriverGU140X32F::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -364,6 +370,7 @@ void cDriverGU140X32F::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverGU140X32F::Refresh(bool refreshAll) { diff --git a/glcddrivers/gu140x32f.h b/glcddrivers/gu140x32f.h index 4e0d1e8..47ab748 100644 --- a/glcddrivers/gu140x32f.h +++ b/glcddrivers/gu140x32f.h @@ -14,7 +14,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas Brachold <vdr04 AT deltab.de> + * (c) 2003 Andreas Brachold <vdr04 AT deltab.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_GU140X32F_H_ @@ -51,7 +53,6 @@ class cDriverGU140X32F : public cDriver protected: void ClearVFDMem(); - void SetPixel(int x, int y, uint32_t data); void Write(unsigned char nFlags, unsigned char bData, unsigned int nMicroSecBusyTime); public: @@ -62,7 +63,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); diff --git a/glcddrivers/gu256x64-372.c b/glcddrivers/gu256x64-372.c index 41f5881..5615708 100644 --- a/glcddrivers/gu256x64-372.c +++ b/glcddrivers/gu256x64-372.c @@ -16,7 +16,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas 'randy' Weinberger (randy AT smue.org) + * (c) 2004-2011 Andreas 'randy' Weinberger (randy AT smue.org) + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <errno.h> @@ -365,9 +366,13 @@ void cDriverGU256X64_372::SetPixel(int x, int y, uint32_t data) c = 0x80 >> (y % 8); - m_pDrawMem[x][y/8] = m_pDrawMem[x][y/8] | c; + if (data == GLCD::cColor::White) + m_pDrawMem[x][y/8] |= c; + else + m_pDrawMem[x][y/8] &= ( 0xFF ^ c ); } +#if 0 void cDriverGU256X64_372::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -381,6 +386,7 @@ void cDriverGU256X64_372::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverGU256X64_372::Refresh(bool refreshAll) { diff --git a/glcddrivers/gu256x64-372.h b/glcddrivers/gu256x64-372.h index db63bcb..54719d0 100644 --- a/glcddrivers/gu256x64-372.h +++ b/glcddrivers/gu256x64-372.h @@ -16,7 +16,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas 'randy' Weinberger (randy AT smue.org) + * (c) 2004-2011 Andreas 'randy' Weinberger (randy AT smue.org) + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_GU256X64_372_H_ @@ -57,7 +58,6 @@ class cDriverGU256X64_372 : public cDriver protected: void ClearVFDMem(); - void SetPixel(int x, int y, uint32_t data); void GU256X64Cmd(unsigned char data); void GU256X64Data(unsigned char data); @@ -69,7 +69,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); diff --git a/glcddrivers/gu256x64-3900.c b/glcddrivers/gu256x64-3900.c index 938c01f..2d379bd 100644 --- a/glcddrivers/gu256x64-3900.c +++ b/glcddrivers/gu256x64-3900.c @@ -20,7 +20,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Ralf Mueller (ralf AT bj-ig.de) + * (c) 2004 Ralf Mueller (ralf AT bj-ig.de) + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <errno.h> @@ -523,9 +525,13 @@ void cDriverGU256X64_3900::SetPixel(int x, int y, uint32_t data) c = 0x80 >> (y % 8); - m_pDrawMem[x][y/8] = m_pDrawMem[x][y/8] | c; + if (data == GLCD::cColor::White) + m_pDrawMem[x][y/8] |= c; + else + m_pDrawMem[x][y/8] &= ( 0xFF ^ c ); } +#if 0 void cDriverGU256X64_3900::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -539,6 +545,7 @@ void cDriverGU256X64_3900::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverGU256X64_3900::Refresh(bool refreshAll) { diff --git a/glcddrivers/gu256x64-3900.h b/glcddrivers/gu256x64-3900.h index 163bcef..95d7d7f 100644 --- a/glcddrivers/gu256x64-3900.h +++ b/glcddrivers/gu256x64-3900.h @@ -20,7 +20,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Ralf Mueller (ralf AT bj-ig.de) + * (c) 2004 Ralf Mueller (ralf AT bj-ig.de) + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_GU256X64_3900_H_ @@ -59,7 +61,6 @@ class cDriverGU256X64_3900 : public cDriver protected: void ClearVFDMem(); - void SetPixel(int x, int y, uint32_t data); int InitSerialPort(); int InitParallelPort(); void InitNormalDisplay(); @@ -76,7 +77,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); diff --git a/glcddrivers/hd61830.c b/glcddrivers/hd61830.c index 7f0bd53..2f383bd 100644 --- a/glcddrivers/hd61830.c +++ b/glcddrivers/hd61830.c @@ -7,6 +7,8 @@ * to the COPYING file distributed with this package. * * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <syslog.h> @@ -301,6 +303,29 @@ void cDriverHD61830::Clear() memset(newLCD[x], 0, height); } + +void cDriverHD61830::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + } else { + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + newLCD[x / 8][y] |= ( 1 << pos ); + else + newLCD[x / 8][y] &= ( 0xFF ^ ( 1 << pos ) ); +} + + +#if 0 void cDriverHD61830::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -319,6 +344,7 @@ void cDriverHD61830::Set8Pixels(int x, int y, unsigned char data) newLCD[x / 8][y] = newLCD[x / 8][y] | data; } } +#endif void cDriverHD61830::Refresh(bool refreshAll) { diff --git a/glcddrivers/hd61830.h b/glcddrivers/hd61830.h index 50f3b26..a6908e2 100644 --- a/glcddrivers/hd61830.h +++ b/glcddrivers/hd61830.h @@ -7,6 +7,8 @@ * to the COPYING file distributed with this package. * * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_HD61830_H_ @@ -45,7 +47,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/image.c b/glcddrivers/image.c index 94623c4..4ca3937 100644 --- a/glcddrivers/image.c +++ b/glcddrivers/image.c @@ -105,6 +105,7 @@ void cDriverImage::Clear() memset(newLCD, 0, lineSize * height); } +#if 0 void cDriverImage::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -123,28 +124,25 @@ void cDriverImage::Set8Pixels(int x, int y, unsigned char data) newLCD[lineSize * y + x / 8] |= ReverseBits(data); } } +#endif void cDriverImage::SetPixel(int x, int y, uint32_t data) { if (x >= width || y >= height) return; - if ((data | 0xFF000000) != cColor::Black) { - data = cColor::White; - } - - if (!config->upsideDown) - { - // normal orientation - newLCD[y * x] |= data; - } - else + int pos = x % 8; + if (config->upsideDown) { - // upside down orientation x = width - 1 - x; y = height - 1 - y; - newLCD[y * x] |= ReverseBits(data); + pos = 7 - pos; // reverse bit position } + + if (data == GLCD::cColor::White) + newLCD[y * x] |= ( 1 << pos ); + else + newLCD[y * x] &= ( 0xFF ^ ( 1 << pos) ); } void cDriverImage::Refresh(bool refreshAll) diff --git a/glcddrivers/image.h b/glcddrivers/image.h index 75a2f33..972a38e 100644 --- a/glcddrivers/image.h +++ b/glcddrivers/image.h @@ -44,7 +44,7 @@ public: virtual void Clear(); virtual void SetPixel(int x, int y, uint32_t data); - virtual void Set8Pixels(int x, int y, unsigned char data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/ks0108.c b/glcddrivers/ks0108.c index de9c505..250bbcd 100644 --- a/glcddrivers/ks0108.c +++ b/glcddrivers/ks0108.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2003-2011 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <syslog.h> @@ -420,6 +421,28 @@ void cDriverKS0108::Clear() memset(LCD[x], 0, height); } + +void cDriverKS0108::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + LCD[x / 8][y] |= (1 << pos); + else + LCD[x / 8][y] &= ( 0xFF ^ (1 << pos) ); +} + + +#if 0 void cDriverKS0108::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -438,6 +461,7 @@ void cDriverKS0108::Set8Pixels(int x, int y, unsigned char data) LCD[x / 8][y] = LCD[x / 8][y] | ReverseBits(data); } } +#endif void cDriverKS0108::Refresh(bool refreshAll) { diff --git a/glcddrivers/ks0108.h b/glcddrivers/ks0108.h index 66ac425..462c1af 100644 --- a/glcddrivers/ks0108.h +++ b/glcddrivers/ks0108.h @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2003-2011 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_KS0108_H_ @@ -69,7 +70,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/network.c b/glcddrivers/network.c index 485f8ea..367962b 100644 --- a/glcddrivers/network.c +++ b/glcddrivers/network.c @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <stdio.h> @@ -122,6 +123,28 @@ void cDriverNetwork::Clear() memset(newLCD, 0, lineSize * height); } + +void cDriverNetwork::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + newLCD[lineSize * y + x / 8] |= (1 << pos); + else + newLCD[lineSize * y + x / 8] &= ( 0xFF ^ (1 << pos) ); +} + + +#if 0 void cDriverNetwork::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -140,6 +163,7 @@ void cDriverNetwork::Set8Pixels(int x, int y, unsigned char data) newLCD[lineSize * y + x / 8] |= ReverseBits(data); } } +#endif void cDriverNetwork::Refresh(bool refreshAll) { diff --git a/glcddrivers/network.h b/glcddrivers/network.h index 4664f4c..934b8d0 100644 --- a/glcddrivers/network.h +++ b/glcddrivers/network.h @@ -7,7 +7,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2004 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_NETWORK_H_ @@ -47,7 +48,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/noritake800.c b/glcddrivers/noritake800.c index 971bf5e..5665ee3 100644 --- a/glcddrivers/noritake800.c +++ b/glcddrivers/noritake800.c @@ -27,7 +27,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <errno.h> @@ -424,9 +426,13 @@ void cDriverNoritake800::SetPixel(int x, int y, uint32_t data) c = 0x80 >> (y % 8); - m_pDrawMem[x][y/8] |= c; + if (data == GLCD::cColor::White) + m_pDrawMem[x][y/8] |= c; + else + m_pDrawMem[x][y/8] &= ( 0xFF ^ c); } +#if 0 void cDriverNoritake800::Set8Pixels(int x, int y, unsigned char data) { int n; @@ -440,6 +446,7 @@ void cDriverNoritake800::Set8Pixels(int x, int y, unsigned char data) SetPixel(x + n, y, GLCD::cColor::White); } } +#endif void cDriverNoritake800::SetBrightness(unsigned int percent) { diff --git a/glcddrivers/noritake800.h b/glcddrivers/noritake800.h index e275afe..a212e59 100644 --- a/glcddrivers/noritake800.h +++ b/glcddrivers/noritake800.h @@ -27,7 +27,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2004 Lucian Muresan <lucianm AT users.sourceforge.net> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_NORITAKE800_H_ @@ -81,7 +83,7 @@ public: virtual void Clear(); virtual void SetPixel(int x, int y, uint32_t data); - virtual void Set8Pixels(int x, int y, unsigned char data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); virtual void SetBrightness(unsigned int percent); diff --git a/glcddrivers/sed1330.c b/glcddrivers/sed1330.c index e993ca0..80a8970 100644 --- a/glcddrivers/sed1330.c +++ b/glcddrivers/sed1330.c @@ -14,7 +14,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Roland Praml <praml.roland AT t-online.de> + * (c) 2003 Roland Praml <praml.roland AT t-online.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <syslog.h> @@ -539,6 +541,28 @@ void cDriverSED1330::Clear() memset(newLCD[x], 0, height); } + +void cDriverSED1330::SetPixel(int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + newLCD[x / 8][y] |= (1 << pos); + else + newLCD[x / 8][y] &= ( 0xFF ^ (1 << pos) ); +} + + +#if 0 void cDriverSED1330::Set8Pixels(int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -557,6 +581,7 @@ void cDriverSED1330::Set8Pixels(int x, int y, unsigned char data) newLCD[x / 8][y] = newLCD[x / 8][y] | ReverseBits(data); } } +#endif void cDriverSED1330::Refresh(bool refreshAll) { diff --git a/glcddrivers/sed1330.h b/glcddrivers/sed1330.h index 354b853..6f2a837 100644 --- a/glcddrivers/sed1330.h +++ b/glcddrivers/sed1330.h @@ -14,7 +14,9 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Roland Praml <praml.roland AT t-online.de> + * (c) 2003 Roland Praml <praml.roland AT t-online.de> + * (c) 2005-2010 Andreas Regel <andreas.regel AT powarman.de> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_SED1330_H_ @@ -69,7 +71,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/sed1520.c b/glcddrivers/sed1520.c index c0b1b27..edd445b 100644 --- a/glcddrivers/sed1520.c +++ b/glcddrivers/sed1520.c @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2003-2011 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <syslog.h> @@ -303,6 +304,28 @@ void cDriverSED1520::Clear() memset(LCD[x], 0, height); } + +void cDriverSED1520::SetPixel (int x, int y, uint32_t data) +{ + if (x >= width || y >= height) + return; + + int pos = x % 8; + if (config->upsideDown) + { + x = width - 1 - x; + y = height - 1 - y; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::White) + LCD[x / 8][y] |= ( 1 << pos ); + else + LCD[x / 8][y] &= (0xFF ^ ( 1 << pos )); +} + + +#if 0 void cDriverSED1520::Set8Pixels (int x, int y, unsigned char data) { if (x >= width || y >= height) @@ -321,6 +344,7 @@ void cDriverSED1520::Set8Pixels (int x, int y, unsigned char data) LCD[x / 8][y] = LCD[x / 8][y] | ReverseBits(data); } } +#endif void cDriverSED1520::Refresh(bool refreshAll) { diff --git a/glcddrivers/sed1520.h b/glcddrivers/sed1520.h index 931d51b..1d301ff 100644 --- a/glcddrivers/sed1520.h +++ b/glcddrivers/sed1520.h @@ -6,7 +6,8 @@ * This file is released under the GNU General Public License. Refer * to the COPYING file distributed with this package. * - * (c) 2003 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2003-2011 Andreas 'randy' Weinberger <vdr AT smue.org> + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_SED1520_H_ @@ -63,7 +64,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; diff --git a/glcddrivers/simlcd.c b/glcddrivers/simlcd.c index 787648a..b7c548b 100644 --- a/glcddrivers/simlcd.c +++ b/glcddrivers/simlcd.c @@ -9,6 +9,8 @@ * to the COPYING file distributed with this package. * * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + * (c) 2011 Dirk Heiser + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #include <stdio.h> diff --git a/glcddrivers/simlcd.h b/glcddrivers/simlcd.h index 750fa81..e79e52a 100644 --- a/glcddrivers/simlcd.h +++ b/glcddrivers/simlcd.h @@ -9,6 +9,8 @@ * to the COPYING file distributed with this package. * * (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online.de> + * (c) 2011 Dirk Heiser + * (c) 2011 Wolfgang Astleitner <mrwastl AT users.sourceforge.net> */ #ifndef _GLCDDRIVERS_SIMLCD_H_ diff --git a/glcddrivers/t6963c.c b/glcddrivers/t6963c.c index d42da35..de3a59f 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> @@ -376,6 +377,50 @@ 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; + 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 == GLCD::cColor::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; + pos = 7 - pos; // reverse bit position + } + + if (data == GLCD::cColor::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 +491,7 @@ void cDriverT6963C::Set8Pixels(int x, int y, unsigned char data) } } } +#endif void cDriverT6963C::Refresh(bool refreshAll) { diff --git a/glcddrivers/t6963c.h b/glcddrivers/t6963c.h index 88be16b..4377697 100644 --- a/glcddrivers/t6963c.h +++ b/glcddrivers/t6963c.h @@ -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> */ #ifndef _GLCDDRIVERS_T6963C_H_ @@ -67,7 +68,8 @@ public: virtual int DeInit(); virtual void Clear(); - virtual void Set8Pixels(int x, int y, unsigned char data); + virtual void SetPixel(int x, int y, uint32_t data); + //virtual void Set8Pixels(int x, int y, unsigned char data); virtual void Refresh(bool refreshAll = false); }; |