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:   Brew

Committer:
dreschpe
Date:
Sun Feb 22 18:55:54 2015 +0000
Revision:
14:29bab588ba75
Parent:
12:9c8f3076347c
Child:
15:b9483ba842c8
correct doku

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 12:9c8f3076347c 1 #ifndef MBED_SSD1306_H
dreschpe 12:9c8f3076347c 2 #define MBED_SSD1306_H
dreschpe 12:9c8f3076347c 3
dreschpe 12:9c8f3076347c 4 #include "mbed.h"
dreschpe 12:9c8f3076347c 5 #include "LCD.h"
dreschpe 12:9c8f3076347c 6
dreschpe 14:29bab588ba75 7 /** Class for SSD1306 display controller
dreschpe 12:9c8f3076347c 8 * to be copypasted and adapted for other controllers
dreschpe 12:9c8f3076347c 9 */
dreschpe 12:9c8f3076347c 10 class SSD1306 : public LCD
dreschpe 12:9c8f3076347c 11 {
dreschpe 12:9c8f3076347c 12
dreschpe 12:9c8f3076347c 13 public:
dreschpe 12:9c8f3076347c 14
dreschpe 12:9c8f3076347c 15 /** Create a PAR display interface
dreschpe 12:9c8f3076347c 16 * @param displayproto only supports PAR_8
dreschpe 12:9c8f3076347c 17 * @param port GPIO port name to use
dreschpe 12:9c8f3076347c 18 * @param CS pin connected to CS of display
dreschpe 12:9c8f3076347c 19 * @param reset pin connected to RESET of display
dreschpe 12:9c8f3076347c 20 * @param DC pin connected to data/command of display
dreschpe 12:9c8f3076347c 21 * @param WR pin connected to SDI of display
dreschpe 12:9c8f3076347c 22 * @param RD pin connected to RS of display
dreschpe 12:9c8f3076347c 23 * @param name The name used by the parent class to access the interface
dreschpe 12:9c8f3076347c 24 * @param LCDSIZE_X x size in pixel - optional
dreschpe 12:9c8f3076347c 25 * @param LCDSIZE_Y y size in pixel - optional
dreschpe 12:9c8f3076347c 26 */
dreschpe 12:9c8f3076347c 27 SSD1306(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 64);
dreschpe 12:9c8f3076347c 28
dreschpe 12:9c8f3076347c 29 /** Create an SPI display interface
dreschpe 12:9c8f3076347c 30 * @param displayproto only supports SPI_8
dreschpe 12:9c8f3076347c 31 * @param Hz SPI speed in Hz
dreschpe 12:9c8f3076347c 32 * @param mosi SPI pin
dreschpe 12:9c8f3076347c 33 * @param miso SPI pin
dreschpe 12:9c8f3076347c 34 * @param sclk SPI pin
dreschpe 12:9c8f3076347c 35 * @param CS pin connected to CS of display
dreschpe 12:9c8f3076347c 36 * @param reset pin connected to RESET of display
dreschpe 12:9c8f3076347c 37 * @param DC pin connected to data/command of display
dreschpe 12:9c8f3076347c 38 * @param name The name used by the parent class to access the interface
dreschpe 12:9c8f3076347c 39 * @param LCDSIZE_X x size in pixel - optional
dreschpe 12:9c8f3076347c 40 * @param LCDSIZE_Y y size in pixel - optional
dreschpe 12:9c8f3076347c 41 */
dreschpe 12:9c8f3076347c 42 SSD1306(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 = 64);
dreschpe 12:9c8f3076347c 43
dreschpe 12:9c8f3076347c 44 protected:
dreschpe 12:9c8f3076347c 45
dreschpe 12:9c8f3076347c 46
dreschpe 12:9c8f3076347c 47 /** Init command sequence
dreschpe 12:9c8f3076347c 48 */
dreschpe 12:9c8f3076347c 49 void init();
dreschpe 12:9c8f3076347c 50
dreschpe 12:9c8f3076347c 51 /** set mirror mode
dreschpe 12:9c8f3076347c 52 * @note here overriding the LCD class default one because of not standard commands
dreschpe 12:9c8f3076347c 53 * @param mode NONE, X, Y, XY
dreschpe 12:9c8f3076347c 54 */
dreschpe 12:9c8f3076347c 55 virtual void mirrorXY(mirror_t mode);
dreschpe 12:9c8f3076347c 56
dreschpe 12:9c8f3076347c 57 };
dreschpe 12:9c8f3076347c 58
dreschpe 12:9c8f3076347c 59
dreschpe 12:9c8f3076347c 60 #endif