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