Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Dependents:   testUniGraphic_150217 maze_TFT_MMA8451Q TFT_test_frdm-kl25z TFT_test_NUCLEO-F411RE ... more

Committer:
Geremia
Date:
Tue Jan 25 17:57:55 2022 +0000
Revision:
34:c66986d80f72
Parent:
25:daacdcf34e52
align attribute fixed to gcc style, updated to OS6 then got bored

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 23:d0eb35bbd2f3 1 #ifndef SEPS225_H
Rhyme 23:d0eb35bbd2f3 2 #define SEPS225_H included
Rhyme 23:d0eb35bbd2f3 3
Rhyme 23:d0eb35bbd2f3 4 #include "mbed.h"
Rhyme 23:d0eb35bbd2f3 5 #include "TFT.h"
dreschpe 25:daacdcf34e52 6 //#include "vt100.h"
dreschpe 25:daacdcf34e52 7 //extern vt100 *tty ;
Rhyme 23:d0eb35bbd2f3 8
Rhyme 23:d0eb35bbd2f3 9 /** Class for SEPS225 Syncoam Co.,Ltd
Rhyme 23:d0eb35bbd2f3 10 * 128 x 128 Dots, 262K Colors PM-OLED Display Driver and Controller
Rhyme 23:d0eb35bbd2f3 11 */
Rhyme 23:d0eb35bbd2f3 12
Rhyme 23:d0eb35bbd2f3 13 class SEPS225 : public TFT
Rhyme 23:d0eb35bbd2f3 14 {
Rhyme 23:d0eb35bbd2f3 15
Rhyme 23:d0eb35bbd2f3 16 public:
Rhyme 23:d0eb35bbd2f3 17
Rhyme 23:d0eb35bbd2f3 18 /** Create a PAR display interface
Rhyme 23:d0eb35bbd2f3 19 * @param displayproto PAR_8 or PAR_16
Rhyme 23:d0eb35bbd2f3 20 * @param port GPIO port name to use
Rhyme 23:d0eb35bbd2f3 21 * @param CS pin connected to CS of display
Rhyme 23:d0eb35bbd2f3 22 * @param reset pin connected to RESET of display
Rhyme 23:d0eb35bbd2f3 23 * @param DC pin connected to data/command of display
Rhyme 23:d0eb35bbd2f3 24 * @param WR pin connected to SDI of display
Rhyme 23:d0eb35bbd2f3 25 * @param RD pin connected to RS of display
Rhyme 23:d0eb35bbd2f3 26 * @param name The name used by the parent class to access the interface
Rhyme 23:d0eb35bbd2f3 27 * @param LCDSIZE_X x size in pixel - optional
Rhyme 23:d0eb35bbd2f3 28 * @param LCDSIZE_Y y size in pixel - optional
Rhyme 23:d0eb35bbd2f3 29 */
Rhyme 23:d0eb35bbd2f3 30 SEPS225(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name ,const unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 128);
Rhyme 23:d0eb35bbd2f3 31
Rhyme 23:d0eb35bbd2f3 32 /** Create a BUS display interface
Rhyme 23:d0eb35bbd2f3 33 * @param displayproto BUS_8 or BUS_16
Rhyme 23:d0eb35bbd2f3 34 * @param buspins array of PinName to group as Bus
Rhyme 23:d0eb35bbd2f3 35 * @param CS pin connected to CS of display
Rhyme 23:d0eb35bbd2f3 36 * @param reset pin connected to RESET of display
Rhyme 23:d0eb35bbd2f3 37 * @param DC pin connected to data/command of display
Rhyme 23:d0eb35bbd2f3 38 * @param WR pin connected to SDI of display
Rhyme 23:d0eb35bbd2f3 39 * @param RD pin connected to RS of display
Rhyme 23:d0eb35bbd2f3 40 * @param name The name used by the parent class to access the interface
Rhyme 23:d0eb35bbd2f3 41 * @param LCDSIZE_X x size in pixel - optional
Rhyme 23:d0eb35bbd2f3 42 * @param LCDSIZE_Y y size in pixel - optional
Rhyme 23:d0eb35bbd2f3 43 */
Rhyme 23:d0eb35bbd2f3 44 SEPS225(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name ,const unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 128);
Rhyme 23:d0eb35bbd2f3 45
Rhyme 23:d0eb35bbd2f3 46 /** Create an SPI display interface
Rhyme 23:d0eb35bbd2f3 47 * @param displayproto SPI_8 or SPI_16
Rhyme 23:d0eb35bbd2f3 48 * @param Hz SPI speed in Hz
Rhyme 23:d0eb35bbd2f3 49 * @param mosi SPI pin
Rhyme 23:d0eb35bbd2f3 50 * @param miso SPI pin
Rhyme 23:d0eb35bbd2f3 51 * @param sclk SPI pin
Rhyme 23:d0eb35bbd2f3 52 * @param CS pin connected to CS of display
Rhyme 23:d0eb35bbd2f3 53 * @param reset pin connected to RESET of display
Rhyme 23:d0eb35bbd2f3 54 * @param DC pin connected to data/command of display
Rhyme 23:d0eb35bbd2f3 55 * @param name The name used by the parent class to access the interface
Rhyme 23:d0eb35bbd2f3 56 * @param LCDSIZE_X x size in pixel - optional
Rhyme 23:d0eb35bbd2f3 57 * @param LCDSIZE_Y y size in pixel - optional
Rhyme 23:d0eb35bbd2f3 58 */
Rhyme 23:d0eb35bbd2f3 59 SEPS225(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char* name ,unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 128);
Rhyme 23:d0eb35bbd2f3 60
Rhyme 23:d0eb35bbd2f3 61
Rhyme 23:d0eb35bbd2f3 62 virtual void pixel(int x, int y, unsigned short color);
Rhyme 23:d0eb35bbd2f3 63 virtual void window(int x, int y, int w, int h);
Rhyme 24:1a2ebae1d289 64 virtual void rect(int x0, int y0, int x1, int y1, unsigned short color) ;
Rhyme 23:d0eb35bbd2f3 65 virtual void cls(void) ; // virtual
Rhyme 23:d0eb35bbd2f3 66 virtual unsigned short pixelread(int x, int y);
Rhyme 23:d0eb35bbd2f3 67 virtual void window4read(int x, int y, int w, int h);
Rhyme 23:d0eb35bbd2f3 68 virtual void window_pushpixel(unsigned short color);
Rhyme 23:d0eb35bbd2f3 69 virtual void window_pushpixel(unsigned short color, unsigned int count);
Rhyme 23:d0eb35bbd2f3 70 virtual void window_pushpixelbuf(unsigned short* color, unsigned int lenght);
Rhyme 23:d0eb35bbd2f3 71 void display(int onoff) ;
Rhyme 23:d0eb35bbd2f3 72
Rhyme 23:d0eb35bbd2f3 73 void reg_write(unsigned char cmd, unsigned char data) ;
Rhyme 23:d0eb35bbd2f3 74 void cmd_write(unsigned char cmd) ;
Rhyme 23:d0eb35bbd2f3 75 void data_write(unsigned char data) ;
Rhyme 23:d0eb35bbd2f3 76 void write8(unsigned char data) ;
Rhyme 23:d0eb35bbd2f3 77 void write16(unsigned short sdata) ;
Rhyme 23:d0eb35bbd2f3 78 void bufwrite8(unsigned char *data, unsigned long len) ;
Rhyme 23:d0eb35bbd2f3 79 void bufwrite16(unsigned short *sdata, unsigned long len) ;
Rhyme 23:d0eb35bbd2f3 80
Rhyme 23:d0eb35bbd2f3 81 protected:
Rhyme 23:d0eb35bbd2f3 82
Rhyme 23:d0eb35bbd2f3 83
Rhyme 23:d0eb35bbd2f3 84 /** Init command sequence
Rhyme 23:d0eb35bbd2f3 85 */
Rhyme 23:d0eb35bbd2f3 86 void init();
Rhyme 23:d0eb35bbd2f3 87
Rhyme 23:d0eb35bbd2f3 88
Rhyme 23:d0eb35bbd2f3 89 private:
Rhyme 23:d0eb35bbd2f3 90 DigitalOut *_cs ;
Rhyme 23:d0eb35bbd2f3 91 DigitalOut *_rs ;
Rhyme 23:d0eb35bbd2f3 92 } ;
Rhyme 23:d0eb35bbd2f3 93
Rhyme 23:d0eb35bbd2f3 94 #endif /* SEPS225_H */
Rhyme 23:d0eb35bbd2f3 95