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/ILI9341.h@21:ae0a4eedfc90, 2015-03-31 (annotated)
- Committer:
- Geremia
- Date:
- Tue Mar 31 21:14:48 2015 +0000
- Revision:
- 21:ae0a4eedfc90
- Parent:
- 18:ffa58f1a680a
Add BUS_8 and BUS_16 (slow as expected)
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 | 18:ffa58f1a680a | 18 | * @param displayproto PAR_8 or PAR_16 |
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 ,const 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 | * @param CS pin connected to CS of display |
Geremia | 21:ae0a4eedfc90 | 35 | * @param reset pin connected to RESET of display |
Geremia | 21:ae0a4eedfc90 | 36 | * @param DC pin connected to data/command of display |
Geremia | 21:ae0a4eedfc90 | 37 | * @param WR pin connected to SDI of display |
Geremia | 21:ae0a4eedfc90 | 38 | * @param RD pin connected to RS of display |
Geremia | 21:ae0a4eedfc90 | 39 | * @param name The name used by the parent class to access the interface |
Geremia | 21:ae0a4eedfc90 | 40 | * @param LCDSIZE_X x size in pixel - optional |
Geremia | 21:ae0a4eedfc90 | 41 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 21:ae0a4eedfc90 | 42 | */ |
Geremia | 21:ae0a4eedfc90 | 43 | ILI9341(proto_t displayproto, PinName* buspins, 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 | 44 | |
Geremia | 2:713844a55c4e | 45 | /** Create an SPI display interface |
Geremia | 18:ffa58f1a680a | 46 | * @param displayproto SPI_8 or SPI_16 |
Geremia | 2:713844a55c4e | 47 | * @param Hz SPI speed in Hz |
Geremia | 2:713844a55c4e | 48 | * @param mosi SPI pin |
Geremia | 2:713844a55c4e | 49 | * @param miso SPI pin |
Geremia | 2:713844a55c4e | 50 | * @param sclk SPI pin |
Geremia | 2:713844a55c4e | 51 | * @param CS pin connected to CS of display |
Geremia | 2:713844a55c4e | 52 | * @param reset pin connected to RESET of display |
Geremia | 2:713844a55c4e | 53 | * @param DC pin connected to data/command of display |
Geremia | 2:713844a55c4e | 54 | * @param name The name used by the parent class to access the interface |
dreschpe | 9:1749ae993cfe | 55 | * @param LCDSIZE_X x size in pixel - optional |
dreschpe | 9:1749ae993cfe | 56 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 2:713844a55c4e | 57 | */ |
dreschpe | 9:1749ae993cfe | 58 | 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 | 59 | |
Geremia | 2:713844a55c4e | 60 | |
Geremia | 2:713844a55c4e | 61 | |
Geremia | 2:713844a55c4e | 62 | protected: |
Geremia | 2:713844a55c4e | 63 | |
Geremia | 2:713844a55c4e | 64 | |
Geremia | 2:713844a55c4e | 65 | /** Init command sequence |
Geremia | 2:713844a55c4e | 66 | */ |
Geremia | 2:713844a55c4e | 67 | void init(); |
Geremia | 2:713844a55c4e | 68 | |
Geremia | 2:713844a55c4e | 69 | |
Geremia | 2:713844a55c4e | 70 | |
Geremia | 2:713844a55c4e | 71 | }; |
Geremia | 2:713844a55c4e | 72 | #endif |