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:   afero_poc15_180216 afero_poc15_180223 afero_poc15_180302 afero_poc15_180403R ... more

Fork of UniGraphic by GraphicsDisplay

UniGraphic for La Suno Version.
To go with La Suno, WatchDog Reset functions were added in ILI9341.

Committer:
Geremia
Date:
Sun Feb 15 20:06:07 2015 +0000
Revision:
4:12ba0ecc2c1f
Parent:
3:48f3282c2be8
Child:
5:b222a9461d6b
Added PAR16, separated 16bit writes for cmd parameters and pixeldata

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Geremia 4:12ba0ecc2c1f 1 /* mbed UniGraphic library - Abstract protocol class
Geremia 4:12ba0ecc2c1f 2 * Copyright (c) 2015 Giuliano Dianda
Geremia 4:12ba0ecc2c1f 3 * Released under the MIT License: http://mbed.org/license/mit
Geremia 4:12ba0ecc2c1f 4 */
Geremia 4:12ba0ecc2c1f 5
Geremia 0:75ec1b3cde17 6 /** @file Protocols.h
Geremia 0:75ec1b3cde17 7 */
Geremia 0:75ec1b3cde17 8 #ifndef Protocols_H
Geremia 0:75ec1b3cde17 9 #define Protocols_H
Geremia 0:75ec1b3cde17 10
Geremia 0:75ec1b3cde17 11 #include "mbed.h"
Geremia 0:75ec1b3cde17 12
Geremia 3:48f3282c2be8 13 //#define USE_CS
Geremia 3:48f3282c2be8 14
Geremia 0:75ec1b3cde17 15 /** Protocol types
Geremia 0:75ec1b3cde17 16 */
Geremia 0:75ec1b3cde17 17 enum proto_t {
Geremia 0:75ec1b3cde17 18 PAR_8 /**< Parallel 8bit, pins 0 to 7 */
Geremia 0:75ec1b3cde17 19 ,PAR_16 /**< Parallel 16bit, pins 0 to 15 */
Geremia 0:75ec1b3cde17 20 ,SPI_8 /**< SPI 8bit */
Geremia 0:75ec1b3cde17 21 ,SPI_16 /**< SPI 16bit */
Geremia 0:75ec1b3cde17 22 };
Geremia 0:75ec1b3cde17 23
Geremia 0:75ec1b3cde17 24
Geremia 0:75ec1b3cde17 25 /** Abstract class for spi and parallel protocols
Geremia 0:75ec1b3cde17 26 */
Geremia 0:75ec1b3cde17 27 class Protocols
Geremia 0:75ec1b3cde17 28 {
Geremia 0:75ec1b3cde17 29 public:
Geremia 0:75ec1b3cde17 30
Geremia 1:ff019d22b275 31 /** Send 8bit command to display controller
Geremia 0:75ec1b3cde17 32 *
Geremia 0:75ec1b3cde17 33 * @param cmd: byte to send
Geremia 0:75ec1b3cde17 34 *
Geremia 0:75ec1b3cde17 35 */
Geremia 1:ff019d22b275 36 virtual void wr_cmd8(unsigned char cmd) = 0;
Geremia 0:75ec1b3cde17 37
Geremia 1:ff019d22b275 38 /** Send 8bit data to display controller
Geremia 0:75ec1b3cde17 39 *
Geremia 1:ff019d22b275 40 * @param data: byte to send
Geremia 0:75ec1b3cde17 41 *
Geremia 0:75ec1b3cde17 42 */
Geremia 1:ff019d22b275 43 virtual void wr_data8(unsigned char data) = 0;
Geremia 0:75ec1b3cde17 44
Geremia 4:12ba0ecc2c1f 45 /** Send 2x8bit command to display controller
Geremia 1:ff019d22b275 46 *
Geremia 1:ff019d22b275 47 * @param cmd: halfword to send
Geremia 1:ff019d22b275 48 *
Geremia 1:ff019d22b275 49 */
Geremia 1:ff019d22b275 50 virtual void wr_cmd16(unsigned short cmd) = 0;
Geremia 1:ff019d22b275 51
Geremia 4:12ba0ecc2c1f 52 /** Send 2x8bit data to display controller
Geremia 1:ff019d22b275 53 *
Geremia 1:ff019d22b275 54 * @param data: halfword to send
Geremia 0:75ec1b3cde17 55 *
Geremia 0:75ec1b3cde17 56 */
Geremia 1:ff019d22b275 57 virtual void wr_data16(unsigned short data) = 0;
Geremia 1:ff019d22b275 58
Geremia 4:12ba0ecc2c1f 59 /** Send 16bit pixeldata to display controller
Geremia 4:12ba0ecc2c1f 60 *
Geremia 4:12ba0ecc2c1f 61 * @param data: halfword to send
Geremia 4:12ba0ecc2c1f 62 *
Geremia 4:12ba0ecc2c1f 63 */
Geremia 4:12ba0ecc2c1f 64 virtual void wr_gram(unsigned short data) = 0;
Geremia 4:12ba0ecc2c1f 65
Geremia 4:12ba0ecc2c1f 66 /** Send same 16bit pixeldata to display controller multiple times
Geremia 1:ff019d22b275 67 *
Geremia 1:ff019d22b275 68 * @param data: halfword to send
Geremia 1:ff019d22b275 69 * @param count: how many
Geremia 1:ff019d22b275 70 *
Geremia 1:ff019d22b275 71 */
Geremia 4:12ba0ecc2c1f 72 virtual void wr_gram(unsigned short data, unsigned int count) = 0;
Geremia 1:ff019d22b275 73
Geremia 4:12ba0ecc2c1f 74 /** Send array of pixeldata shorts to display controller
Geremia 1:ff019d22b275 75 *
Geremia 4:12ba0ecc2c1f 76 * @param data: unsigned short pixeldata array
Geremia 1:ff019d22b275 77 * @param lenght: lenght (in shorts)
Geremia 1:ff019d22b275 78 *
Geremia 1:ff019d22b275 79 */
Geremia 4:12ba0ecc2c1f 80 virtual void wr_grambuf(unsigned short* data, unsigned int lenght) = 0;
Geremia 0:75ec1b3cde17 81
Geremia 0:75ec1b3cde17 82 /** HW reset sequence (without display init commands)
Geremia 0:75ec1b3cde17 83 */
Geremia 0:75ec1b3cde17 84 virtual void hw_reset() = 0;
Geremia 0:75ec1b3cde17 85
Geremia 0:75ec1b3cde17 86 /** Set ChipSelect high or low
Geremia 0:75ec1b3cde17 87 * @param enable 0/1
Geremia 0:75ec1b3cde17 88 */
Geremia 0:75ec1b3cde17 89 virtual void BusEnable(bool enable) = 0;
Geremia 0:75ec1b3cde17 90
Geremia 0:75ec1b3cde17 91 };
Geremia 0:75ec1b3cde17 92 #endif