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.

Dependents:   Brew

Committer:
Geremia
Date:
Thu Feb 12 22:22:47 2015 +0000
Revision:
0:75ec1b3cde17
Child:
1:ff019d22b275
Initial tests, LCD par and spi ok

Who changed what in which revision?

UserRevisionLine numberNew 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 0:75ec1b3cde17 17 /** Create a PAR_8 display interface
Geremia 0:75ec1b3cde17 18 * @param displayproto PAR_8 or PAR_16
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
Geremia 0:75ec1b3cde17 26 */
Geremia 0:75ec1b3cde17 27 UC1608(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name);
Geremia 0:75ec1b3cde17 28
Geremia 0:75ec1b3cde17 29 /** Create an SPI_8 display interface
Geremia 0:75ec1b3cde17 30 * @param displayproto SPI_8 or SPI_16
Geremia 0:75ec1b3cde17 31 * @param mosi SPI pin
Geremia 0:75ec1b3cde17 32 * @param miso SPI pin
Geremia 0:75ec1b3cde17 33 * @param sclk SPI pin
Geremia 0:75ec1b3cde17 34 * @param CS pin connected to CS of display
Geremia 0:75ec1b3cde17 35 * @param reset pin connected to RESET of display
Geremia 0:75ec1b3cde17 36 * @param DC pin connected to data/command of display
Geremia 0:75ec1b3cde17 37 * @param name The name used by the parent class to access the interface
Geremia 0:75ec1b3cde17 38 */
Geremia 0:75ec1b3cde17 39 UC1608(proto_t displayproto, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char* name);
Geremia 0:75ec1b3cde17 40
Geremia 0:75ec1b3cde17 41 /** set the contrast of the screen
Geremia 0:75ec1b3cde17 42 * @note here overrided because of not standard command
Geremia 0:75ec1b3cde17 43 * @param o contrast 0-63
Geremia 0:75ec1b3cde17 44 */
Geremia 0:75ec1b3cde17 45 virtual void set_contrast(int o);
Geremia 0:75ec1b3cde17 46
Geremia 0:75ec1b3cde17 47 /** Set ChipSelect high or low
Geremia 0:75ec1b3cde17 48 * @note here overriding the std one, cause CS inverted
Geremia 0:75ec1b3cde17 49 * @param enable 0/1
Geremia 0:75ec1b3cde17 50 */
Geremia 0:75ec1b3cde17 51 virtual void BusEnable(bool enable);
Geremia 0:75ec1b3cde17 52
Geremia 0:75ec1b3cde17 53 protected:
Geremia 0:75ec1b3cde17 54
Geremia 0:75ec1b3cde17 55
Geremia 0:75ec1b3cde17 56 /** Init command sequence
Geremia 0:75ec1b3cde17 57 */
Geremia 0:75ec1b3cde17 58 void init();
Geremia 0:75ec1b3cde17 59
Geremia 0:75ec1b3cde17 60 /** set mirror mode
Geremia 0:75ec1b3cde17 61 * @note here overriding the LCD class default one because of not standard commands
Geremia 0:75ec1b3cde17 62 * @param mode NONE, X, Y, XY
Geremia 0:75ec1b3cde17 63 */
Geremia 0:75ec1b3cde17 64 virtual void mirrorXY(mirror_t mode);
Geremia 0:75ec1b3cde17 65
Geremia 0:75ec1b3cde17 66
Geremia 0:75ec1b3cde17 67
Geremia 0:75ec1b3cde17 68
Geremia 0:75ec1b3cde17 69
Geremia 0:75ec1b3cde17 70 };
Geremia 0:75ec1b3cde17 71 #endif