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/UC1608.h@9:1749ae993cfe, 2015-02-17 (annotated)
- Committer:
- dreschpe
- Date:
- Tue Feb 17 22:35:07 2015 +0000
- Revision:
- 9:1749ae993cfe
- Parent:
- 1:ff019d22b275
- 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 | 0:75ec1b3cde17 | 1 | #ifndef MBED_UC1608_H |
Geremia | 0:75ec1b3cde17 | 2 | #define MBED_UC1608_H |
Geremia | 0:75ec1b3cde17 | 3 | |
Geremia | 0:75ec1b3cde17 | 4 | |
Geremia | 0:75ec1b3cde17 | 5 | |
Geremia | 0:75ec1b3cde17 | 6 | #include "mbed.h" |
Geremia | 0:75ec1b3cde17 | 7 | #include "LCD.h" |
Geremia | 0:75ec1b3cde17 | 8 | |
Geremia | 0:75ec1b3cde17 | 9 | /** Class for UC1608 display controller |
Geremia | 0:75ec1b3cde17 | 10 | * to be copypasted and adapted for other controllers |
Geremia | 0:75ec1b3cde17 | 11 | */ |
Geremia | 0:75ec1b3cde17 | 12 | class UC1608 : public LCD |
Geremia | 0:75ec1b3cde17 | 13 | { |
Geremia | 0:75ec1b3cde17 | 14 | |
Geremia | 0:75ec1b3cde17 | 15 | public: |
Geremia | 0:75ec1b3cde17 | 16 | |
Geremia | 1:ff019d22b275 | 17 | /** Create a PAR display interface |
Geremia | 1:ff019d22b275 | 18 | * @param displayproto only supports PAR_8 |
Geremia | 0:75ec1b3cde17 | 19 | * @param port GPIO port name to use |
Geremia | 0:75ec1b3cde17 | 20 | * @param CS pin connected to CS of display |
Geremia | 0:75ec1b3cde17 | 21 | * @param reset pin connected to RESET of display |
Geremia | 0:75ec1b3cde17 | 22 | * @param DC pin connected to data/command of display |
Geremia | 0:75ec1b3cde17 | 23 | * @param WR pin connected to SDI of display |
Geremia | 0:75ec1b3cde17 | 24 | * @param RD pin connected to RS of display |
Geremia | 0:75ec1b3cde17 | 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 | 0:75ec1b3cde17 | 28 | */ |
dreschpe | 9:1749ae993cfe | 29 | UC1608(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 = 120); |
Geremia | 0:75ec1b3cde17 | 30 | |
Geremia | 1:ff019d22b275 | 31 | /** Create an SPI display interface |
Geremia | 1:ff019d22b275 | 32 | * @param displayproto only supports SPI_8 |
Geremia | 1:ff019d22b275 | 33 | * @param Hz SPI speed in Hz |
Geremia | 0:75ec1b3cde17 | 34 | * @param mosi SPI pin |
Geremia | 0:75ec1b3cde17 | 35 | * @param miso SPI pin |
Geremia | 0:75ec1b3cde17 | 36 | * @param sclk SPI pin |
Geremia | 0:75ec1b3cde17 | 37 | * @param CS pin connected to CS of display |
Geremia | 0:75ec1b3cde17 | 38 | * @param reset pin connected to RESET of display |
Geremia | 0:75ec1b3cde17 | 39 | * @param DC pin connected to data/command of display |
Geremia | 0:75ec1b3cde17 | 40 | * @param name The name used by the parent class to access the interface |
dreschpe | 9:1749ae993cfe | 41 | * @param LCDSIZE_X x size in pixel - optional |
dreschpe | 9:1749ae993cfe | 42 | * @param LCDSIZE_Y y size in pixel - optional |
Geremia | 0:75ec1b3cde17 | 43 | */ |
dreschpe | 9:1749ae993cfe | 44 | UC1608(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 = 120); |
Geremia | 0:75ec1b3cde17 | 45 | |
Geremia | 0:75ec1b3cde17 | 46 | /** set the contrast of the screen |
Geremia | 0:75ec1b3cde17 | 47 | * @note here overrided because of not standard command |
Geremia | 0:75ec1b3cde17 | 48 | * @param o contrast 0-63 |
Geremia | 0:75ec1b3cde17 | 49 | */ |
Geremia | 0:75ec1b3cde17 | 50 | virtual void set_contrast(int o); |
Geremia | 0:75ec1b3cde17 | 51 | |
Geremia | 0:75ec1b3cde17 | 52 | /** Set ChipSelect high or low |
Geremia | 0:75ec1b3cde17 | 53 | * @note here overriding the std one, cause CS inverted |
Geremia | 0:75ec1b3cde17 | 54 | * @param enable 0/1 |
Geremia | 0:75ec1b3cde17 | 55 | */ |
Geremia | 0:75ec1b3cde17 | 56 | virtual void BusEnable(bool enable); |
Geremia | 0:75ec1b3cde17 | 57 | |
Geremia | 0:75ec1b3cde17 | 58 | protected: |
Geremia | 0:75ec1b3cde17 | 59 | |
Geremia | 0:75ec1b3cde17 | 60 | |
Geremia | 0:75ec1b3cde17 | 61 | /** Init command sequence |
Geremia | 0:75ec1b3cde17 | 62 | */ |
Geremia | 0:75ec1b3cde17 | 63 | void init(); |
Geremia | 0:75ec1b3cde17 | 64 | |
Geremia | 0:75ec1b3cde17 | 65 | /** set mirror mode |
Geremia | 0:75ec1b3cde17 | 66 | * @note here overriding the LCD class default one because of not standard commands |
Geremia | 0:75ec1b3cde17 | 67 | * @param mode NONE, X, Y, XY |
Geremia | 0:75ec1b3cde17 | 68 | */ |
Geremia | 0:75ec1b3cde17 | 69 | virtual void mirrorXY(mirror_t mode); |
Geremia | 0:75ec1b3cde17 | 70 | |
Geremia | 0:75ec1b3cde17 | 71 | |
Geremia | 0:75ec1b3cde17 | 72 | |
Geremia | 0:75ec1b3cde17 | 73 | |
Geremia | 0:75ec1b3cde17 | 74 | |
Geremia | 0:75ec1b3cde17 | 75 | }; |
Geremia | 0:75ec1b3cde17 | 76 | #endif |