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.
Inits/ST7565.h@18:ffa58f1a680a, 2015-03-02 (annotated)
- Committer:
- Geremia
- Date:
- Mon Mar 02 10:35:41 2015 +0000
- Revision:
- 18:ffa58f1a680a
- Child:
- 21:ae0a4eedfc90
Added LCD ST7565, compatible with UC1701
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Geremia | 18:ffa58f1a680a | 1 | #ifndef MBED_ST7565_H |
Geremia | 18:ffa58f1a680a | 2 | #define MBED_ST7565_H |
Geremia | 18:ffa58f1a680a | 3 | |
Geremia | 18:ffa58f1a680a | 4 | |
Geremia | 18:ffa58f1a680a | 5 | |
Geremia | 18:ffa58f1a680a | 6 | #include "mbed.h" |
Geremia | 18:ffa58f1a680a | 7 | #include "LCD.h" |
Geremia | 18:ffa58f1a680a | 8 | |
Geremia | 18:ffa58f1a680a | 9 | /** Class for ST7565 and similar display controllers |
Geremia | 18:ffa58f1a680a | 10 | * to be copypasted and adapted for other controllers |
Geremia | 18:ffa58f1a680a | 11 | */ |
Geremia | 18:ffa58f1a680a | 12 | class ST7565 : public LCD |
Geremia | 18:ffa58f1a680a | 13 | { |
Geremia | 18:ffa58f1a680a | 14 | |
Geremia | 18:ffa58f1a680a | 15 | public: |
Geremia | 18:ffa58f1a680a | 16 | |
Geremia | 18:ffa58f1a680a | 17 | /** Create a PAR display interface |
Geremia | 18:ffa58f1a680a | 18 | * @param displayproto only supports PAR_8 |
Geremia | 18:ffa58f1a680a | 19 | * @param port GPIO port name to use |
Geremia | 18:ffa58f1a680a | 20 | * @param CS pin connected to CS of display |
Geremia | 18:ffa58f1a680a | 21 | * @param reset pin connected to RESET of display |
Geremia | 18:ffa58f1a680a | 22 | * @param DC pin connected to data/command of display |
Geremia | 18:ffa58f1a680a | 23 | * @param WR pin connected to SDI of display |
Geremia | 18:ffa58f1a680a | 24 | * @param RD pin connected to RS of display |
Geremia | 18:ffa58f1a680a | 25 | * @param name The name used by the parent class to access the interface |
Geremia | 18:ffa58f1a680a | 26 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 18:ffa58f1a680a | 27 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 18:ffa58f1a680a | 28 | */ |
Geremia | 18:ffa58f1a680a | 29 | ST7565(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 132, unsigned int LCDSIZE_Y = 64); |
Geremia | 18:ffa58f1a680a | 30 | |
Geremia | 18:ffa58f1a680a | 31 | /** Create an SPI display interface |
Geremia | 18:ffa58f1a680a | 32 | * @param displayproto SPI_8 or SPI_16 |
Geremia | 18:ffa58f1a680a | 33 | * @param Hz SPI speed in Hz |
Geremia | 18:ffa58f1a680a | 34 | * @param mosi SPI pin |
Geremia | 18:ffa58f1a680a | 35 | * @param miso SPI pin |
Geremia | 18:ffa58f1a680a | 36 | * @param sclk SPI pin |
Geremia | 18:ffa58f1a680a | 37 | * @param CS pin connected to CS of display |
Geremia | 18:ffa58f1a680a | 38 | * @param reset pin connected to RESET of display |
Geremia | 18:ffa58f1a680a | 39 | * @param DC pin connected to data/command of display |
Geremia | 18:ffa58f1a680a | 40 | * @param name The name used by the parent class to access the interface |
Geremia | 18:ffa58f1a680a | 41 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 18:ffa58f1a680a | 42 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 18:ffa58f1a680a | 43 | */ |
Geremia | 18:ffa58f1a680a | 44 | ST7565(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char* name, unsigned int LCDSIZE_X = 132, unsigned int LCDSIZE_Y = 64); |
Geremia | 18:ffa58f1a680a | 45 | |
Geremia | 18:ffa58f1a680a | 46 | |
Geremia | 18:ffa58f1a680a | 47 | |
Geremia | 18:ffa58f1a680a | 48 | protected: |
Geremia | 18:ffa58f1a680a | 49 | |
Geremia | 18:ffa58f1a680a | 50 | |
Geremia | 18:ffa58f1a680a | 51 | /** Init command sequence |
Geremia | 18:ffa58f1a680a | 52 | */ |
Geremia | 18:ffa58f1a680a | 53 | void init(); |
Geremia | 18:ffa58f1a680a | 54 | |
Geremia | 18:ffa58f1a680a | 55 | |
Geremia | 18:ffa58f1a680a | 56 | |
Geremia | 18:ffa58f1a680a | 57 | }; |
Geremia | 18:ffa58f1a680a | 58 | #endif |