UniGraphic-Fork for ST7920-LCD-controller and SH1106. Tested with 128x64 LCD with SPI and 128x64-OLED with IIC
Dependents: UniGraphic-St7920-Test AfficheurUTILECO
Fork of UniGraphic by
Fork of the UniGraphic-Library for monochrome LCDs with ST7920 controller and 128x64-IIC-OLED-Display with SH1106-Controller
Had to adapt LCD for following reasons:
- Give access to screenbuffer buffer[] to parent class
- pixel() and pixel_read() as they are hardware-dependent
- added reset-pin to IIC-Interface
GraphicDisplay:: sends buffer to LCD when auto_update is set to true.
Testprogram for ST7920 can be found here:
https://developer.mbed.org/users/charly/code/UniGraphic-St7920-Test/
Revision 25:daacdcf34e52, committed 2015-10-18
- Comitter:
- dreschpe
- Date:
- Sun Oct 18 13:53:20 2015 +0000
- Parent:
- 24:1a2ebae1d289
- Child:
- 26:09c1d5110134
- Commit message:
- Add check if platform supports par port mode
Changed in this revision
--- a/Display/LCD.cpp Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/LCD.cpp Sun Oct 18 13:53:20 2015 +0000 @@ -28,7 +28,9 @@ LCD::LCD(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const int ic_x_segs, const int ic_y_coms, const char *name) : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y), _LCDPAGES(lcdsize_y>>3), _IC_X_SEGS(ic_x_segs), _IC_Y_COMS(ic_y_coms), _IC_PAGES(ic_y_coms>>3) { +#if DEVICE_PORTINOUT if(displayproto==PAR_8) proto = new PAR8(port, CS, reset, DC, WR, RD); +#endif useNOP=false; buffer = (unsigned char*) malloc (screensize_X*_LCDPAGES); buffer16 = (unsigned short*)buffer;
--- a/Display/LCD.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/LCD.h Sun Oct 18 13:53:20 2015 +0000 @@ -3,7 +3,11 @@ #define MBED_LCD_H #include "GraphicsDisplay.h" + +#if DEVICE_PORTINOUT #include "PAR8.h" +#endif + #include "BUS8.h" #include "SPI8.h" #include "SPI16.h"
--- a/Display/TFT.cpp Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/TFT.cpp Sun Oct 18 13:53:20 2015 +0000 @@ -25,8 +25,10 @@ TFT::TFT(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const char *name) : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y) { +#if DEVICE_PORTINOUT if(displayproto==PAR_8) proto = new PAR8(port, CS, reset, DC, WR, RD); else if(displayproto==PAR_16) proto = new PAR16(port, CS, reset, DC, WR, RD); +#endif useNOP=false; scrollbugfix=0; mipistd=false;
--- a/Display/TFT.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/TFT.h Sun Oct 18 13:53:20 2015 +0000 @@ -2,8 +2,12 @@ #define MBED_TFT_H #include "GraphicsDisplay.h" + +#if DEVICE_PORTINOUT #include "PAR8.h" #include "PAR16.h" +#endif + #include "BUS8.h" #include "BUS16.h" #include "SPI8.h"
--- a/Display/TFT932x.cpp Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/TFT932x.cpp Sun Oct 18 13:53:20 2015 +0000 @@ -9,6 +9,7 @@ #define SWAP(a, b) { a ^= b; b ^= a; a ^= b; } +#if DEVICE_PORTINOUT TFT932x::TFT932x(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const char *name) : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y) { @@ -33,6 +34,7 @@ // cls(); // locate(0,0); } +#endif TFT932x::TFT932x(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const char *name) : GraphicsDisplay(name), screensize_X(lcdsize_x), screensize_Y(lcdsize_y) {
--- a/Display/TFT932x.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Display/TFT932x.h Sun Oct 18 13:53:20 2015 +0000 @@ -2,8 +2,12 @@ #define MBED_TFT932x_H #include "GraphicsDisplay.h" + +#if DEVICE_PORTINOUT #include "PAR8.h" #include "PAR16.h" +#endif + #include "BUS8.h" #include "BUS16.h" #include "SPI8.h" @@ -18,10 +22,12 @@ public: +#if DEVICE_PORTINOUT /** Create TFT Parallel Port interface * @param name The name used by the parent class to access the interface */ TFT932x(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const int lcdsize_x, const int lcdsize_y, const char* name); +#endif /** Create TFT Parallel Bus interface * @param name The name used by the parent class to access the interface
--- a/Inits/SEPS225.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Inits/SEPS225.h Sun Oct 18 13:53:20 2015 +0000 @@ -3,8 +3,8 @@ #include "mbed.h" #include "TFT.h" -#include "vt100.h" -extern vt100 *tty ; +//#include "vt100.h" +//extern vt100 *tty ; /** Class for SEPS225 Syncoam Co.,Ltd * 128 x 128 Dots, 262K Colors PM-OLED Display Driver and Controller
--- a/Protocols/PAR16.cpp Mon Jun 22 02:21:06 2015 +0000 +++ b/Protocols/PAR16.cpp Sun Oct 18 13:53:20 2015 +0000 @@ -15,6 +15,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#if DEVICE_PORTINOUT + #include "PAR16.h" PAR16::PAR16(PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD) @@ -224,4 +226,6 @@ void PAR16::BusEnable(bool enable) { _CS = enable ? 0:1; -} \ No newline at end of file +} + +#endif \ No newline at end of file
--- a/Protocols/PAR16.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Protocols/PAR16.h Sun Oct 18 13:53:20 2015 +0000 @@ -1,3 +1,5 @@ +#if DEVICE_PORTINOUT + #ifndef PAR16_H #define PAR16_H @@ -146,4 +148,6 @@ DigitalOut _RD; }; +#endif + #endif \ No newline at end of file
--- a/Protocols/PAR8.cpp Mon Jun 22 02:21:06 2015 +0000 +++ b/Protocols/PAR8.cpp Sun Oct 18 13:53:20 2015 +0000 @@ -15,6 +15,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +#if DEVICE_PORTINOUT #include "PAR8.h" @@ -272,4 +273,6 @@ void PAR8::BusEnable(bool enable) { _CS = enable ? 0:1; -} \ No newline at end of file +} + +#endif \ No newline at end of file
--- a/Protocols/PAR8.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Protocols/PAR8.h Sun Oct 18 13:53:20 2015 +0000 @@ -1,3 +1,5 @@ +#if DEVICE_PORTINOUT + #ifndef PAR8_H #define PAR8_H @@ -146,4 +148,6 @@ DigitalOut _RD; }; +#endif + #endif \ No newline at end of file
--- a/Protocols/Protocols.h Mon Jun 22 02:21:06 2015 +0000 +++ b/Protocols/Protocols.h Sun Oct 18 13:53:20 2015 +0000 @@ -17,6 +17,9 @@ /** Protocol types */ +#include "platform.h" + +#if DEVICE_PORTINOUT enum proto_t { PAR_8 /**< Parallel 8bit, port pins 0 to 7 */ ,PAR_16 /**< Parallel 16bit, port pins 0 to 15 */ @@ -25,6 +28,14 @@ ,SPI_8 /**< SPI 8bit */ ,SPI_16 /**< SPI 16bit */ }; +#else +enum proto_t { + BUS_8 /**< Parallel 8bit, scattered pins */ + ,BUS_16 /**< Parallel 16bit, scattered pins */ + ,SPI_8 /**< SPI 8bit */ + ,SPI_16 /**< SPI 16bit */ +}; +#endif /** Abstract interface class for spi and parallel protocols