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 GraphicsDisplay

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 /** @file Protocols.h
Geremia 0:75ec1b3cde17 2 */
Geremia 0:75ec1b3cde17 3 #ifndef Protocols_H
Geremia 0:75ec1b3cde17 4 #define Protocols_H
Geremia 0:75ec1b3cde17 5
Geremia 0:75ec1b3cde17 6 #include "mbed.h"
Geremia 0:75ec1b3cde17 7
Geremia 0:75ec1b3cde17 8 /** Protocol types
Geremia 0:75ec1b3cde17 9 */
Geremia 0:75ec1b3cde17 10 enum proto_t {
Geremia 0:75ec1b3cde17 11 PAR_8 /**< Parallel 8bit, pins 0 to 7 */
Geremia 0:75ec1b3cde17 12 ,PAR_16 /**< Parallel 16bit, pins 0 to 15 */
Geremia 0:75ec1b3cde17 13 ,SPI_8 /**< SPI 8bit */
Geremia 0:75ec1b3cde17 14 ,SPI_16 /**< SPI 16bit */
Geremia 0:75ec1b3cde17 15 };
Geremia 0:75ec1b3cde17 16
Geremia 0:75ec1b3cde17 17
Geremia 0:75ec1b3cde17 18 /** Abstract class for spi and parallel protocols
Geremia 0:75ec1b3cde17 19 */
Geremia 0:75ec1b3cde17 20 class Protocols
Geremia 0:75ec1b3cde17 21 {
Geremia 0:75ec1b3cde17 22 public:
Geremia 0:75ec1b3cde17 23
Geremia 0:75ec1b3cde17 24 /** Send command byte to display controller
Geremia 0:75ec1b3cde17 25 *
Geremia 0:75ec1b3cde17 26 * @param cmd: byte to send
Geremia 0:75ec1b3cde17 27 *
Geremia 0:75ec1b3cde17 28 */
Geremia 0:75ec1b3cde17 29 virtual void wr_cmd(unsigned char cmd) = 0;
Geremia 0:75ec1b3cde17 30
Geremia 0:75ec1b3cde17 31 /** Send data byte to display controller
Geremia 0:75ec1b3cde17 32 *
Geremia 0:75ec1b3cde17 33 * @param data8: byte to send
Geremia 0:75ec1b3cde17 34 *
Geremia 0:75ec1b3cde17 35 */
Geremia 0:75ec1b3cde17 36 virtual void wr_data8(unsigned char data8) = 0;
Geremia 0:75ec1b3cde17 37
Geremia 0:75ec1b3cde17 38 /** Send same data byte to display controller multiple times
Geremia 0:75ec1b3cde17 39 *
Geremia 0:75ec1b3cde17 40 * @param data8: byte to send
Geremia 0:75ec1b3cde17 41 * @param count: how many
Geremia 0:75ec1b3cde17 42 *
Geremia 0:75ec1b3cde17 43 */
Geremia 0:75ec1b3cde17 44 virtual void wr_data8(unsigned char data8, unsigned int count) = 0;
Geremia 0:75ec1b3cde17 45
Geremia 0:75ec1b3cde17 46 /** Send array of data bytes to display controller
Geremia 0:75ec1b3cde17 47 *
Geremia 0:75ec1b3cde17 48 * @param data8: unsigned char data array
Geremia 0:75ec1b3cde17 49 * @param lenght: lenght of array
Geremia 0:75ec1b3cde17 50 *
Geremia 0:75ec1b3cde17 51 */
Geremia 0:75ec1b3cde17 52 virtual void wr_data8buf(unsigned char* data8, unsigned int lenght) = 0;
Geremia 0:75ec1b3cde17 53
Geremia 0:75ec1b3cde17 54 /** HW reset sequence (without display init commands)
Geremia 0:75ec1b3cde17 55 */
Geremia 0:75ec1b3cde17 56 virtual void hw_reset() = 0;
Geremia 0:75ec1b3cde17 57
Geremia 0:75ec1b3cde17 58 /** Set ChipSelect high or low
Geremia 0:75ec1b3cde17 59 * @param enable 0/1
Geremia 0:75ec1b3cde17 60 */
Geremia 0:75ec1b3cde17 61 virtual void BusEnable(bool enable) = 0;
Geremia 0:75ec1b3cde17 62
Geremia 0:75ec1b3cde17 63 };
Geremia 0:75ec1b3cde17 64 #endif