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: afero_poc15_180216 afero_poc15_180223 afero_poc15_180302 afero_poc15_180403R ... more
Fork of UniGraphic by
UniGraphic for La Suno Version.
To go with La Suno, WatchDog Reset functions were added in ILI9341.
Inits/SSD1306.h@18:ffa58f1a680a, 2015-03-02 (annotated)
- Committer:
- Geremia
- Date:
- Mon Mar 02 10:35:41 2015 +0000
- Revision:
- 18:ffa58f1a680a
- Parent:
- 15:b9483ba842c8
- Child:
- 19:1bdfb971b2c1
Added LCD ST7565, compatible with UC1701
Who changed what in which revision?
User | Revision | Line number | New 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 |
Geremia | 18:ffa58f1a680a | 30 | * @param displayproto SPI_8 or SPI_16 |
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); |
Geremia | 15:b9483ba842c8 | 43 | |
Geremia | 15:b9483ba842c8 | 44 | /** set the contrast of the screen |
Geremia | 15:b9483ba842c8 | 45 | * @note here overrided because of not standard value range |
Geremia | 15:b9483ba842c8 | 46 | * @param o contrast 0-255 |
Geremia | 15:b9483ba842c8 | 47 | */ |
Geremia | 15:b9483ba842c8 | 48 | virtual void set_contrast(int o); |
Geremia | 15:b9483ba842c8 | 49 | |
dreschpe | 12:9c8f3076347c | 50 | protected: |
dreschpe | 12:9c8f3076347c | 51 | |
dreschpe | 12:9c8f3076347c | 52 | |
dreschpe | 12:9c8f3076347c | 53 | /** Init command sequence |
dreschpe | 12:9c8f3076347c | 54 | */ |
dreschpe | 12:9c8f3076347c | 55 | void init(); |
dreschpe | 12:9c8f3076347c | 56 | |
dreschpe | 12:9c8f3076347c | 57 | /** set mirror mode |
dreschpe | 12:9c8f3076347c | 58 | * @note here overriding the LCD class default one because of not standard commands |
dreschpe | 12:9c8f3076347c | 59 | * @param mode NONE, X, Y, XY |
dreschpe | 12:9c8f3076347c | 60 | */ |
dreschpe | 12:9c8f3076347c | 61 | virtual void mirrorXY(mirror_t mode); |
dreschpe | 12:9c8f3076347c | 62 | |
dreschpe | 12:9c8f3076347c | 63 | }; |
dreschpe | 12:9c8f3076347c | 64 | |
dreschpe | 12:9c8f3076347c | 65 | |
dreschpe | 12:9c8f3076347c | 66 | #endif |