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