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
UniGraphic for La Suno Version.
To go with La Suno, WatchDog Reset functions were added in ILI9341.
Protocols/Protocols.h@3:48f3282c2be8, 2015-02-14 (annotated)
- Committer:
- Geremia
- Date:
- Sat Feb 14 17:42:21 2015 +0000
- Revision:
- 3:48f3282c2be8
- Parent:
- 1:ff019d22b275
- Child:
- 4:12ba0ecc2c1f
small things
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:48f3282c2be8 | 8 | //#define USE_CS |
Geremia | 3:48f3282c2be8 | 9 | |
Geremia | 0:75ec1b3cde17 | 10 | /** Protocol types |
Geremia | 0:75ec1b3cde17 | 11 | */ |
Geremia | 0:75ec1b3cde17 | 12 | enum proto_t { |
Geremia | 0:75ec1b3cde17 | 13 | PAR_8 /**< Parallel 8bit, pins 0 to 7 */ |
Geremia | 0:75ec1b3cde17 | 14 | ,PAR_16 /**< Parallel 16bit, pins 0 to 15 */ |
Geremia | 0:75ec1b3cde17 | 15 | ,SPI_8 /**< SPI 8bit */ |
Geremia | 0:75ec1b3cde17 | 16 | ,SPI_16 /**< SPI 16bit */ |
Geremia | 0:75ec1b3cde17 | 17 | }; |
Geremia | 0:75ec1b3cde17 | 18 | |
Geremia | 0:75ec1b3cde17 | 19 | |
Geremia | 0:75ec1b3cde17 | 20 | /** Abstract class for spi and parallel protocols |
Geremia | 0:75ec1b3cde17 | 21 | */ |
Geremia | 0:75ec1b3cde17 | 22 | class Protocols |
Geremia | 0:75ec1b3cde17 | 23 | { |
Geremia | 0:75ec1b3cde17 | 24 | public: |
Geremia | 0:75ec1b3cde17 | 25 | |
Geremia | 1:ff019d22b275 | 26 | /** Send 8bit command to display controller |
Geremia | 0:75ec1b3cde17 | 27 | * |
Geremia | 0:75ec1b3cde17 | 28 | * @param cmd: byte to send |
Geremia | 0:75ec1b3cde17 | 29 | * |
Geremia | 0:75ec1b3cde17 | 30 | */ |
Geremia | 1:ff019d22b275 | 31 | virtual void wr_cmd8(unsigned char cmd) = 0; |
Geremia | 0:75ec1b3cde17 | 32 | |
Geremia | 1:ff019d22b275 | 33 | /** Send 8bit data to display controller |
Geremia | 0:75ec1b3cde17 | 34 | * |
Geremia | 1:ff019d22b275 | 35 | * @param data: byte to send |
Geremia | 0:75ec1b3cde17 | 36 | * |
Geremia | 0:75ec1b3cde17 | 37 | */ |
Geremia | 1:ff019d22b275 | 38 | virtual void wr_data8(unsigned char data) = 0; |
Geremia | 0:75ec1b3cde17 | 39 | |
Geremia | 1:ff019d22b275 | 40 | /** Send same 8bit data to display controller multiple times |
Geremia | 0:75ec1b3cde17 | 41 | * |
Geremia | 1:ff019d22b275 | 42 | * @param data: byte to send |
Geremia | 0:75ec1b3cde17 | 43 | * @param count: how many |
Geremia | 0:75ec1b3cde17 | 44 | * |
Geremia | 0:75ec1b3cde17 | 45 | */ |
Geremia | 1:ff019d22b275 | 46 | virtual void wr_data8(unsigned char data, unsigned int count) = 0; |
Geremia | 0:75ec1b3cde17 | 47 | |
Geremia | 0:75ec1b3cde17 | 48 | /** Send array of data bytes to display controller |
Geremia | 0:75ec1b3cde17 | 49 | * |
Geremia | 1:ff019d22b275 | 50 | * @param data: unsigned char data array |
Geremia | 1:ff019d22b275 | 51 | * @param lenght: lenght |
Geremia | 1:ff019d22b275 | 52 | * |
Geremia | 1:ff019d22b275 | 53 | */ |
Geremia | 1:ff019d22b275 | 54 | virtual void wr_data8buf(unsigned char* data, unsigned int lenght) = 0; |
Geremia | 1:ff019d22b275 | 55 | |
Geremia | 1:ff019d22b275 | 56 | /** Send 16bit command to display controller |
Geremia | 1:ff019d22b275 | 57 | * |
Geremia | 1:ff019d22b275 | 58 | * @param cmd: halfword to send |
Geremia | 1:ff019d22b275 | 59 | * |
Geremia | 1:ff019d22b275 | 60 | */ |
Geremia | 1:ff019d22b275 | 61 | virtual void wr_cmd16(unsigned short cmd) = 0; |
Geremia | 1:ff019d22b275 | 62 | |
Geremia | 1:ff019d22b275 | 63 | /** Send 16bit data to display controller |
Geremia | 1:ff019d22b275 | 64 | * |
Geremia | 1:ff019d22b275 | 65 | * @param data: halfword to send |
Geremia | 0:75ec1b3cde17 | 66 | * |
Geremia | 0:75ec1b3cde17 | 67 | */ |
Geremia | 1:ff019d22b275 | 68 | virtual void wr_data16(unsigned short data) = 0; |
Geremia | 1:ff019d22b275 | 69 | |
Geremia | 1:ff019d22b275 | 70 | /** Send same 16bit data to display controller multiple times |
Geremia | 1:ff019d22b275 | 71 | * |
Geremia | 1:ff019d22b275 | 72 | * @param data: halfword to send |
Geremia | 1:ff019d22b275 | 73 | * @param count: how many |
Geremia | 1:ff019d22b275 | 74 | * |
Geremia | 1:ff019d22b275 | 75 | */ |
Geremia | 1:ff019d22b275 | 76 | virtual void wr_data16(unsigned short data, unsigned int count) = 0; |
Geremia | 1:ff019d22b275 | 77 | |
Geremia | 1:ff019d22b275 | 78 | /** Send array of data shorts to display controller |
Geremia | 1:ff019d22b275 | 79 | * |
Geremia | 1:ff019d22b275 | 80 | * @param data: unsigned short data array |
Geremia | 1:ff019d22b275 | 81 | * @param lenght: lenght (in shorts) |
Geremia | 1:ff019d22b275 | 82 | * |
Geremia | 1:ff019d22b275 | 83 | */ |
Geremia | 1:ff019d22b275 | 84 | virtual void wr_data16buf(unsigned short* data, unsigned int lenght) = 0; |
Geremia | 0:75ec1b3cde17 | 85 | |
Geremia | 0:75ec1b3cde17 | 86 | /** HW reset sequence (without display init commands) |
Geremia | 0:75ec1b3cde17 | 87 | */ |
Geremia | 0:75ec1b3cde17 | 88 | virtual void hw_reset() = 0; |
Geremia | 0:75ec1b3cde17 | 89 | |
Geremia | 0:75ec1b3cde17 | 90 | /** Set ChipSelect high or low |
Geremia | 0:75ec1b3cde17 | 91 | * @param enable 0/1 |
Geremia | 0:75ec1b3cde17 | 92 | */ |
Geremia | 0:75ec1b3cde17 | 93 | virtual void BusEnable(bool enable) = 0; |
Geremia | 0:75ec1b3cde17 | 94 | |
Geremia | 0:75ec1b3cde17 | 95 | }; |
Geremia | 0:75ec1b3cde17 | 96 | #endif |