test
Fork of UniGraphic by
Protocols/PAR16.h@5:b222a9461d6b, 2015-02-16 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
Geremia | 4:12ba0ecc2c1f | 1 | #ifndef PAR16_H |
Geremia | 4:12ba0ecc2c1f | 2 | #define PAR16_H |
Geremia | 4:12ba0ecc2c1f | 3 | |
Geremia | 4:12ba0ecc2c1f | 4 | #include "mbed.h" |
Geremia | 4:12ba0ecc2c1f | 5 | #include "Protocols.h" |
Geremia | 4:12ba0ecc2c1f | 6 | //#include "GraphicsDisplay.h" |
Geremia | 4:12ba0ecc2c1f | 7 | |
Geremia | 4:12ba0ecc2c1f | 8 | class PAR16 : public Protocols |
Geremia | 4:12ba0ecc2c1f | 9 | { |
Geremia | 4:12ba0ecc2c1f | 10 | public: |
Geremia | 4:12ba0ecc2c1f | 11 | |
Geremia | 4:12ba0ecc2c1f | 12 | /** Create a PAR16 display interface with a GPIO port and 5 control pins |
Geremia | 4:12ba0ecc2c1f | 13 | * |
Geremia | 4:12ba0ecc2c1f | 14 | * @param port GPIO port to use |
Geremia | 4:12ba0ecc2c1f | 15 | * @param CS pin connected to CS of display |
Geremia | 4:12ba0ecc2c1f | 16 | * @param reset pin connected to RESET of display |
Geremia | 4:12ba0ecc2c1f | 17 | * @param DC pin connected to data/command of display |
Geremia | 4:12ba0ecc2c1f | 18 | * @param WR pin connected to SDI of display |
Geremia | 4:12ba0ecc2c1f | 19 | * @param RD pin connected to RS of display |
Geremia | 4:12ba0ecc2c1f | 20 | */ |
Geremia | 4:12ba0ecc2c1f | 21 | PAR16(PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD); |
Geremia | 4:12ba0ecc2c1f | 22 | |
Geremia | 4:12ba0ecc2c1f | 23 | protected: |
Geremia | 4:12ba0ecc2c1f | 24 | |
Geremia | 4:12ba0ecc2c1f | 25 | /** Send 8bit command to display controller |
Geremia | 4:12ba0ecc2c1f | 26 | * |
Geremia | 4:12ba0ecc2c1f | 27 | * @param cmd: byte to send |
Geremia | 4:12ba0ecc2c1f | 28 | * |
Geremia | 4:12ba0ecc2c1f | 29 | */ |
Geremia | 4:12ba0ecc2c1f | 30 | virtual void wr_cmd8(unsigned char cmd); |
Geremia | 4:12ba0ecc2c1f | 31 | |
Geremia | 4:12ba0ecc2c1f | 32 | /** Send 8bit data to display controller |
Geremia | 4:12ba0ecc2c1f | 33 | * |
Geremia | 4:12ba0ecc2c1f | 34 | * @param data: byte to send |
Geremia | 4:12ba0ecc2c1f | 35 | * |
Geremia | 4:12ba0ecc2c1f | 36 | */ |
Geremia | 4:12ba0ecc2c1f | 37 | virtual void wr_data8(unsigned char data); |
Geremia | 4:12ba0ecc2c1f | 38 | |
Geremia | 4:12ba0ecc2c1f | 39 | /** Send 2x8bit command to display controller |
Geremia | 4:12ba0ecc2c1f | 40 | * |
Geremia | 4:12ba0ecc2c1f | 41 | * @param cmd: halfword to send |
Geremia | 4:12ba0ecc2c1f | 42 | * @note 2cycles using pins[7:0] |
Geremia | 4:12ba0ecc2c1f | 43 | */ |
Geremia | 4:12ba0ecc2c1f | 44 | virtual void wr_cmd16(unsigned short cmd); |
Geremia | 4:12ba0ecc2c1f | 45 | |
Geremia | 4:12ba0ecc2c1f | 46 | /** Send 2x8bit data to display controller |
Geremia | 4:12ba0ecc2c1f | 47 | * |
Geremia | 4:12ba0ecc2c1f | 48 | * @param data: halfword to send |
Geremia | 4:12ba0ecc2c1f | 49 | * @note 2cycles using pins[7:0], only gram write cmd uses pins[15:8] |
Geremia | 4:12ba0ecc2c1f | 50 | */ |
Geremia | 4:12ba0ecc2c1f | 51 | virtual void wr_data16(unsigned short data); |
Geremia | 4:12ba0ecc2c1f | 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 | * @note here using all pins[15:0] |
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 | 4:12ba0ecc2c1f | 61 | * |
Geremia | 4:12ba0ecc2c1f | 62 | * @param data: halfword to send |
Geremia | 4:12ba0ecc2c1f | 63 | * @param count: how many |
Geremia | 4:12ba0ecc2c1f | 64 | * @note here using all pins[15:0] |
Geremia | 4:12ba0ecc2c1f | 65 | */ |
Geremia | 4:12ba0ecc2c1f | 66 | virtual void wr_gram(unsigned short data, unsigned int count); |
Geremia | 4:12ba0ecc2c1f | 67 | |
Geremia | 4:12ba0ecc2c1f | 68 | /** Send array of pixeldata shorts to display controller |
Geremia | 4:12ba0ecc2c1f | 69 | * |
Geremia | 4:12ba0ecc2c1f | 70 | * @param data: unsigned short pixeldata array |
Geremia | 4:12ba0ecc2c1f | 71 | * @param lenght: lenght (in shorts) |
Geremia | 4:12ba0ecc2c1f | 72 | * @note here using all pins[15:0] |
Geremia | 4:12ba0ecc2c1f | 73 | */ |
Geremia | 4:12ba0ecc2c1f | 74 | virtual void wr_grambuf(unsigned short* data, unsigned int lenght); |
Geremia | 4:12ba0ecc2c1f | 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 | 4:12ba0ecc2c1f | 89 | /** HW reset sequence (without display init commands) |
Geremia | 4:12ba0ecc2c1f | 90 | */ |
Geremia | 4:12ba0ecc2c1f | 91 | virtual void hw_reset(); |
Geremia | 4:12ba0ecc2c1f | 92 | |
Geremia | 4:12ba0ecc2c1f | 93 | /** Set ChipSelect high or low |
Geremia | 4:12ba0ecc2c1f | 94 | * @param enable 0/1 |
Geremia | 4:12ba0ecc2c1f | 95 | */ |
Geremia | 4:12ba0ecc2c1f | 96 | virtual void BusEnable(bool enable); |
Geremia | 4:12ba0ecc2c1f | 97 | |
Geremia | 4:12ba0ecc2c1f | 98 | |
Geremia | 4:12ba0ecc2c1f | 99 | |
Geremia | 4:12ba0ecc2c1f | 100 | private: |
Geremia | 4:12ba0ecc2c1f | 101 | |
Geremia | 4:12ba0ecc2c1f | 102 | PortInOut _port; |
Geremia | 4:12ba0ecc2c1f | 103 | DigitalOut _CS; |
Geremia | 4:12ba0ecc2c1f | 104 | DigitalOut _reset; |
Geremia | 4:12ba0ecc2c1f | 105 | DigitalOut _DC; |
Geremia | 4:12ba0ecc2c1f | 106 | DigitalOut _WR; |
Geremia | 4:12ba0ecc2c1f | 107 | DigitalOut _RD; |
Geremia | 4:12ba0ecc2c1f | 108 | |
Geremia | 4:12ba0ecc2c1f | 109 | }; |
Geremia | 4:12ba0ecc2c1f | 110 | #endif |