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/ILI932x.h@30:87855d03d91a, 2015-11-29 (annotated)
- Committer:
- Geremia
- Date:
- Sun Nov 29 19:58:47 2015 +0000
- Revision:
- 30:87855d03d91a
- Parent:
- 21:ae0a4eedfc90
Add ILI9320 init to ILI932x
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Geremia | 20:14daa48ffd4c | 1 | #ifndef MBED_ILI932x_H |
Geremia | 20:14daa48ffd4c | 2 | #define MBED_ILI932x_H |
Geremia | 20:14daa48ffd4c | 3 | |
Geremia | 20:14daa48ffd4c | 4 | |
Geremia | 20:14daa48ffd4c | 5 | |
Geremia | 20:14daa48ffd4c | 6 | #include "mbed.h" |
Geremia | 20:14daa48ffd4c | 7 | #include "TFT932x.h" |
Geremia | 20:14daa48ffd4c | 8 | |
Geremia | 20:14daa48ffd4c | 9 | /** Class for ILI932x tft display controller |
Geremia | 20:14daa48ffd4c | 10 | * to be copypasted and adapted for other controllers |
Geremia | 20:14daa48ffd4c | 11 | */ |
Geremia | 20:14daa48ffd4c | 12 | class ILI932x : public TFT932x |
Geremia | 20:14daa48ffd4c | 13 | { |
Geremia | 20:14daa48ffd4c | 14 | |
Geremia | 20:14daa48ffd4c | 15 | public: |
Geremia | 20:14daa48ffd4c | 16 | |
Geremia | 20:14daa48ffd4c | 17 | /** Create a PAR display interface |
Geremia | 20:14daa48ffd4c | 18 | * @param displayproto PAR_8 or PAR_16 |
Geremia | 20:14daa48ffd4c | 19 | * @param port GPIO port name to use |
Geremia | 20:14daa48ffd4c | 20 | * @param CS pin connected to CS of display |
Geremia | 20:14daa48ffd4c | 21 | * @param reset pin connected to RESET of display |
Geremia | 20:14daa48ffd4c | 22 | * @param DC pin connected to data/command of display |
Geremia | 20:14daa48ffd4c | 23 | * @param WR pin connected to SDI of display |
Geremia | 20:14daa48ffd4c | 24 | * @param RD pin connected to RS of display |
Geremia | 20:14daa48ffd4c | 25 | * @param name The name used by the parent class to access the interface |
Geremia | 20:14daa48ffd4c | 26 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 20:14daa48ffd4c | 27 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 20:14daa48ffd4c | 28 | */ |
Geremia | 20:14daa48ffd4c | 29 | ILI932x(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 240, unsigned int LCDSIZE_Y = 320); |
Geremia | 21:ae0a4eedfc90 | 30 | |
Geremia | 21:ae0a4eedfc90 | 31 | /** Create a BUS display interface |
Geremia | 21:ae0a4eedfc90 | 32 | * @param displayproto BUS_8 or BUS_16 |
Geremia | 21:ae0a4eedfc90 | 33 | * @param buspins array of PinName to group as Bus |
Geremia | 21:ae0a4eedfc90 | 34 | * , i.e. PinName buspins[8]={PC_0,PC_1,PC_2,PC_3,D9,D8,D7,D6}; |
Geremia | 21:ae0a4eedfc90 | 35 | * @param CS pin connected to CS of display |
Geremia | 21:ae0a4eedfc90 | 36 | * @param reset pin connected to RESET of display |
Geremia | 21:ae0a4eedfc90 | 37 | * @param DC pin connected to data/command of display |
Geremia | 21:ae0a4eedfc90 | 38 | * @param WR pin connected to SDI of display |
Geremia | 21:ae0a4eedfc90 | 39 | * @param RD pin connected to RS of display |
Geremia | 21:ae0a4eedfc90 | 40 | * @param name The name used by the parent class to access the interface |
Geremia | 21:ae0a4eedfc90 | 41 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 21:ae0a4eedfc90 | 42 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 21:ae0a4eedfc90 | 43 | */ |
Geremia | 21:ae0a4eedfc90 | 44 | ILI932x(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 240, unsigned int LCDSIZE_Y = 320); |
Geremia | 20:14daa48ffd4c | 45 | |
Geremia | 20:14daa48ffd4c | 46 | /** Create an SPI display interface |
Geremia | 20:14daa48ffd4c | 47 | * @param displayproto SPI_8 or SPI_16 |
Geremia | 20:14daa48ffd4c | 48 | * @param Hz SPI speed in Hz |
Geremia | 20:14daa48ffd4c | 49 | * @param mosi SPI pin |
Geremia | 20:14daa48ffd4c | 50 | * @param miso SPI pin |
Geremia | 20:14daa48ffd4c | 51 | * @param sclk SPI pin |
Geremia | 20:14daa48ffd4c | 52 | * @param CS pin connected to CS of display |
Geremia | 20:14daa48ffd4c | 53 | * @param reset pin connected to RESET of display |
Geremia | 20:14daa48ffd4c | 54 | * @param name The name used by the parent class to access the interface |
Geremia | 20:14daa48ffd4c | 55 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 20:14daa48ffd4c | 56 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 20:14daa48ffd4c | 57 | */ |
Geremia | 20:14daa48ffd4c | 58 | ILI932x(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, const char* name, unsigned int LCDSIZE_X = 240, unsigned int LCDSIZE_Y= 320); |
Geremia | 20:14daa48ffd4c | 59 | |
Geremia | 20:14daa48ffd4c | 60 | |
Geremia | 20:14daa48ffd4c | 61 | |
Geremia | 20:14daa48ffd4c | 62 | protected: |
Geremia | 20:14daa48ffd4c | 63 | |
Geremia | 20:14daa48ffd4c | 64 | |
Geremia | 20:14daa48ffd4c | 65 | /** Init command sequence |
Geremia | 20:14daa48ffd4c | 66 | */ |
Geremia | 20:14daa48ffd4c | 67 | void init9325(); |
Geremia | 30:87855d03d91a | 68 | void init9320(); |
Geremia | 20:14daa48ffd4c | 69 | |
Geremia | 20:14daa48ffd4c | 70 | }; |
Geremia | 20:14daa48ffd4c | 71 | #endif |