.

Committer:
Geremia
Date:
Mon Feb 16 00:52:24 2015 +0000
Revision:
5:b222a9461d6b
Parent:
4:12ba0ecc2c1f
Child:
6:8356d48a07db
Added pixelread for TFTs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Geremia 0:75ec1b3cde17 1 #ifndef PAR8_H
Geremia 0:75ec1b3cde17 2 #define PAR8_H
Geremia 0:75ec1b3cde17 3
Geremia 0:75ec1b3cde17 4 #include "mbed.h"
Geremia 0:75ec1b3cde17 5 #include "Protocols.h"
Geremia 0:75ec1b3cde17 6 //#include "GraphicsDisplay.h"
Geremia 0:75ec1b3cde17 7
Geremia 0:75ec1b3cde17 8 class PAR8 : public Protocols
Geremia 0:75ec1b3cde17 9 {
Geremia 0:75ec1b3cde17 10 public:
Geremia 0:75ec1b3cde17 11
Geremia 0:75ec1b3cde17 12 /** Create a PAR8 display interface with a GPIO port and 5 control pins
Geremia 0:75ec1b3cde17 13 *
Geremia 0:75ec1b3cde17 14 * @param port GPIO port to use
Geremia 0:75ec1b3cde17 15 * @param CS pin connected to CS of display
Geremia 0:75ec1b3cde17 16 * @param reset pin connected to RESET of display
Geremia 0:75ec1b3cde17 17 * @param DC pin connected to data/command of display
Geremia 0:75ec1b3cde17 18 * @param WR pin connected to SDI of display
Geremia 0:75ec1b3cde17 19 * @param RD pin connected to RS of display
Geremia 0:75ec1b3cde17 20 */
Geremia 0:75ec1b3cde17 21 PAR8(PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD);
Geremia 0:75ec1b3cde17 22
Geremia 0:75ec1b3cde17 23 protected:
Geremia 0:75ec1b3cde17 24
Geremia 1:ff019d22b275 25 /** Send 8bit command to display controller
Geremia 0:75ec1b3cde17 26 *
Geremia 0:75ec1b3cde17 27 * @param cmd: byte to send
Geremia 0:75ec1b3cde17 28 *
Geremia 0:75ec1b3cde17 29 */
Geremia 1:ff019d22b275 30 virtual void wr_cmd8(unsigned char cmd);
Geremia 0:75ec1b3cde17 31
Geremia 1:ff019d22b275 32 /** Send 8bit data to display controller
Geremia 0:75ec1b3cde17 33 *
Geremia 1:ff019d22b275 34 * @param data: byte to send
Geremia 0:75ec1b3cde17 35 *
Geremia 0:75ec1b3cde17 36 */
Geremia 1:ff019d22b275 37 virtual void wr_data8(unsigned char data);
Geremia 0:75ec1b3cde17 38
Geremia 4:12ba0ecc2c1f 39 /** Send 2x8bit command to display controller
Geremia 1:ff019d22b275 40 *
Geremia 1:ff019d22b275 41 * @param cmd: halfword to send
Geremia 1:ff019d22b275 42 *
Geremia 1:ff019d22b275 43 */
Geremia 1:ff019d22b275 44 virtual void wr_cmd16(unsigned short cmd);
Geremia 1:ff019d22b275 45
Geremia 4:12ba0ecc2c1f 46 /** Send 2x8bit data to display controller
Geremia 1:ff019d22b275 47 *
Geremia 1:ff019d22b275 48 * @param data: halfword to send
Geremia 1:ff019d22b275 49 *
Geremia 1:ff019d22b275 50 */
Geremia 1:ff019d22b275 51 virtual void wr_data16(unsigned short data);
Geremia 1:ff019d22b275 52
Geremia 4:12ba0ecc2c1f 53 /** Send 16bit pixeldata to display controller
Geremia 4:12ba0ecc2c1f 54 *
Geremia 4:12ba0ecc2c1f 55 * @param data: halfword to send
Geremia 4:12ba0ecc2c1f 56 *
Geremia 4:12ba0ecc2c1f 57 */
Geremia 4:12ba0ecc2c1f 58 virtual void wr_gram(unsigned short data);
Geremia 4:12ba0ecc2c1f 59
Geremia 4:12ba0ecc2c1f 60 /** Send same 16bit pixeldata to display controller multiple times
Geremia 1:ff019d22b275 61 *
Geremia 1:ff019d22b275 62 * @param data: halfword to send
Geremia 1:ff019d22b275 63 * @param count: how many
Geremia 1:ff019d22b275 64 *
Geremia 1:ff019d22b275 65 */
Geremia 4:12ba0ecc2c1f 66 virtual void wr_gram(unsigned short data, unsigned int count);
Geremia 1:ff019d22b275 67
Geremia 4:12ba0ecc2c1f 68 /** Send array of pixeldata shorts to display controller
Geremia 1:ff019d22b275 69 *
Geremia 4:12ba0ecc2c1f 70 * @param data: unsigned short pixeldata array
Geremia 1:ff019d22b275 71 * @param lenght: lenght (in shorts)
Geremia 1:ff019d22b275 72 *
Geremia 1:ff019d22b275 73 */
Geremia 4:12ba0ecc2c1f 74 virtual void wr_grambuf(unsigned short* data, unsigned int lenght);
Geremia 0:75ec1b3cde17 75
Geremia 5:b222a9461d6b 76 /** Read 4x8bit data from display controller (with dummy cycle)
Geremia 5:b222a9461d6b 77 *
Geremia 5:b222a9461d6b 78 * @returns data as uint
Geremia 5:b222a9461d6b 79 *
Geremia 5:b222a9461d6b 80 */
Geremia 5:b222a9461d6b 81 virtual unsigned int rd_data32_wdummy();
Geremia 5:b222a9461d6b 82
Geremia 5:b222a9461d6b 83 /** Read 16bit pixeldata from display controller (with dummy cycle)
Geremia 5:b222a9461d6b 84 *
Geremia 5:b222a9461d6b 85 * @returns 16bit color
Geremia 5:b222a9461d6b 86 */
Geremia 5:b222a9461d6b 87 virtual unsigned short rd_gram();
Geremia 5:b222a9461d6b 88
Geremia 0:75ec1b3cde17 89 /** HW reset sequence (without display init commands)
Geremia 0:75ec1b3cde17 90 */
Geremia 0:75ec1b3cde17 91 virtual void hw_reset();
Geremia 0:75ec1b3cde17 92
Geremia 0:75ec1b3cde17 93 /** Set ChipSelect high or low
Geremia 0:75ec1b3cde17 94 * @param enable 0/1
Geremia 0:75ec1b3cde17 95 */
Geremia 0:75ec1b3cde17 96 virtual void BusEnable(bool enable);
Geremia 0:75ec1b3cde17 97
Geremia 0:75ec1b3cde17 98
Geremia 0:75ec1b3cde17 99
Geremia 0:75ec1b3cde17 100 private:
Geremia 0:75ec1b3cde17 101
Geremia 0:75ec1b3cde17 102 PortInOut _port;
Geremia 0:75ec1b3cde17 103 DigitalOut _CS;
Geremia 0:75ec1b3cde17 104 DigitalOut _reset;
Geremia 0:75ec1b3cde17 105 DigitalOut _DC;
Geremia 0:75ec1b3cde17 106 DigitalOut _WR;
Geremia 0:75ec1b3cde17 107 DigitalOut _RD;
Geremia 0:75ec1b3cde17 108
Geremia 0:75ec1b3cde17 109 };
Geremia 0:75ec1b3cde17 110 #endif