UniGraphics Library Fork to support mbed os 6.3 Release for ILI9341

Dependents:   TFT_ILI9341_UniGraphic TFT_ILI9341_os6

Committer:
amouroug
Date:
Tue Oct 06 05:07:55 2020 +0000
Revision:
0:bb2bda4f5846
Unigraphics Library Fork to support mbed-os 6.3 for ILI9341;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amouroug 0:bb2bda4f5846 1 #ifndef PAR8_H
amouroug 0:bb2bda4f5846 2 #define PAR8_H
amouroug 0:bb2bda4f5846 3
amouroug 0:bb2bda4f5846 4 #include "mbed.h"
amouroug 0:bb2bda4f5846 5 #include "Protocols.h"
amouroug 0:bb2bda4f5846 6
amouroug 0:bb2bda4f5846 7 #if DEVICE_PORTINOUT
amouroug 0:bb2bda4f5846 8 //#include "GraphicsDisplay.h"
amouroug 0:bb2bda4f5846 9
amouroug 0:bb2bda4f5846 10 /** Parallel 8bit interface
amouroug 0:bb2bda4f5846 11 */
amouroug 0:bb2bda4f5846 12 class PAR8 : public Protocols
amouroug 0:bb2bda4f5846 13 {
amouroug 0:bb2bda4f5846 14 public:
amouroug 0:bb2bda4f5846 15
amouroug 0:bb2bda4f5846 16 /** Create a PAR8 display interface with a GPIO port and 5 control pins
amouroug 0:bb2bda4f5846 17 *
amouroug 0:bb2bda4f5846 18 * @param port GPIO port to use
amouroug 0:bb2bda4f5846 19 * @param CS pin connected to CS of display
amouroug 0:bb2bda4f5846 20 * @param reset pin connected to RESET of display
amouroug 0:bb2bda4f5846 21 * @param DC pin connected to data/command of display
amouroug 0:bb2bda4f5846 22 * @param WR pin connected to SDI of display
amouroug 0:bb2bda4f5846 23 * @param RD pin connected to RS of display
amouroug 0:bb2bda4f5846 24 */
amouroug 0:bb2bda4f5846 25 PAR8(PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD);
amouroug 0:bb2bda4f5846 26
amouroug 0:bb2bda4f5846 27 protected:
amouroug 0:bb2bda4f5846 28
amouroug 0:bb2bda4f5846 29 /** Send 8bit command to display controller
amouroug 0:bb2bda4f5846 30 *
amouroug 0:bb2bda4f5846 31 * @param cmd: byte to send
amouroug 0:bb2bda4f5846 32 *
amouroug 0:bb2bda4f5846 33 */
amouroug 0:bb2bda4f5846 34 virtual void wr_cmd8(unsigned char cmd);
amouroug 0:bb2bda4f5846 35
amouroug 0:bb2bda4f5846 36 /** Send 8bit data to display controller
amouroug 0:bb2bda4f5846 37 *
amouroug 0:bb2bda4f5846 38 * @param data: byte to send
amouroug 0:bb2bda4f5846 39 *
amouroug 0:bb2bda4f5846 40 */
amouroug 0:bb2bda4f5846 41 virtual void wr_data8(unsigned char data);
amouroug 0:bb2bda4f5846 42
amouroug 0:bb2bda4f5846 43 /** Send 2x8bit command to display controller
amouroug 0:bb2bda4f5846 44 *
amouroug 0:bb2bda4f5846 45 * @param cmd: halfword to send
amouroug 0:bb2bda4f5846 46 *
amouroug 0:bb2bda4f5846 47 */
amouroug 0:bb2bda4f5846 48 virtual void wr_cmd16(unsigned short cmd);
amouroug 0:bb2bda4f5846 49
amouroug 0:bb2bda4f5846 50 /** Send 2x8bit data to display controller
amouroug 0:bb2bda4f5846 51 *
amouroug 0:bb2bda4f5846 52 * @param data: halfword to send
amouroug 0:bb2bda4f5846 53 *
amouroug 0:bb2bda4f5846 54 */
amouroug 0:bb2bda4f5846 55 virtual void wr_data16(unsigned short data);
amouroug 0:bb2bda4f5846 56
amouroug 0:bb2bda4f5846 57 /** Send 16bit pixeldata to display controller
amouroug 0:bb2bda4f5846 58 *
amouroug 0:bb2bda4f5846 59 * @param data: halfword to send
amouroug 0:bb2bda4f5846 60 *
amouroug 0:bb2bda4f5846 61 */
amouroug 0:bb2bda4f5846 62 virtual void wr_gram(unsigned short data);
amouroug 0:bb2bda4f5846 63
amouroug 0:bb2bda4f5846 64 /** Send same 16bit pixeldata to display controller multiple times
amouroug 0:bb2bda4f5846 65 *
amouroug 0:bb2bda4f5846 66 * @param data: halfword to send
amouroug 0:bb2bda4f5846 67 * @param count: how many
amouroug 0:bb2bda4f5846 68 *
amouroug 0:bb2bda4f5846 69 */
amouroug 0:bb2bda4f5846 70 virtual void wr_gram(unsigned short data, unsigned int count);
amouroug 0:bb2bda4f5846 71
amouroug 0:bb2bda4f5846 72 /** Send array of pixeldata shorts to display controller
amouroug 0:bb2bda4f5846 73 *
amouroug 0:bb2bda4f5846 74 * @param data: unsigned short pixeldata array
amouroug 0:bb2bda4f5846 75 * @param lenght: lenght (in shorts)
amouroug 0:bb2bda4f5846 76 *
amouroug 0:bb2bda4f5846 77 */
amouroug 0:bb2bda4f5846 78 virtual void wr_grambuf(unsigned short* data, unsigned int lenght);
amouroug 0:bb2bda4f5846 79
amouroug 0:bb2bda4f5846 80 /** Read 16bit pixeldata from display controller (with dummy cycle)
amouroug 0:bb2bda4f5846 81 *
amouroug 0:bb2bda4f5846 82 * @param convert true/false. Convert 18bit to 16bit, some controllers returns 18bit
amouroug 0:bb2bda4f5846 83 * @returns 16bit color
amouroug 0:bb2bda4f5846 84 */
amouroug 0:bb2bda4f5846 85 virtual unsigned short rd_gram(bool convert);
amouroug 0:bb2bda4f5846 86
amouroug 0:bb2bda4f5846 87 /** Read 4x8bit register data (with dummy cycle)
amouroug 0:bb2bda4f5846 88 * @param reg the register to read
amouroug 0:bb2bda4f5846 89 * @returns data as uint
amouroug 0:bb2bda4f5846 90 *
amouroug 0:bb2bda4f5846 91 */
amouroug 0:bb2bda4f5846 92 virtual unsigned int rd_reg_data32(unsigned char reg);
amouroug 0:bb2bda4f5846 93
amouroug 0:bb2bda4f5846 94 /** Read 3x8bit ExtendedCommands register data
amouroug 0:bb2bda4f5846 95 * @param reg the register to read
amouroug 0:bb2bda4f5846 96 * @returns data as uint
amouroug 0:bb2bda4f5846 97 * @note EXTC regs (0xB0 to 0xFF) are read/write registers, for Parallel mode directly accessible in both directions
amouroug 0:bb2bda4f5846 98 */
amouroug 0:bb2bda4f5846 99 virtual unsigned int rd_extcreg_data32(unsigned char reg, unsigned char SPIreadenablecmd);
amouroug 0:bb2bda4f5846 100
amouroug 0:bb2bda4f5846 101 /** ILI932x specific, does a dummy read cycle, number of bits is protocol dependent
amouroug 0:bb2bda4f5846 102 * for PAR protocols: a signle RD bit toggle
amouroug 0:bb2bda4f5846 103 * for SPI8: 8clocks
amouroug 0:bb2bda4f5846 104 * for SPI16: 16 clocks
amouroug 0:bb2bda4f5846 105 */
amouroug 0:bb2bda4f5846 106 virtual void dummyread ();
amouroug 0:bb2bda4f5846 107
amouroug 0:bb2bda4f5846 108 /** ILI932x specific, select register for a successive write or read
amouroug 0:bb2bda4f5846 109 *
amouroug 0:bb2bda4f5846 110 * @param reg register to be selected
amouroug 0:bb2bda4f5846 111 * @param forread false = a write next (default), true = a read next
amouroug 0:bb2bda4f5846 112 * @note forread only used by SPI protocols
amouroug 0:bb2bda4f5846 113 */
amouroug 0:bb2bda4f5846 114 virtual void reg_select(unsigned char reg, bool forread =false);
amouroug 0:bb2bda4f5846 115
amouroug 0:bb2bda4f5846 116 /** ILI932x specific, write register with data
amouroug 0:bb2bda4f5846 117 *
amouroug 0:bb2bda4f5846 118 * @param reg register to write
amouroug 0:bb2bda4f5846 119 * @param data 16bit data
amouroug 0:bb2bda4f5846 120 */
amouroug 0:bb2bda4f5846 121 virtual void reg_write(unsigned char reg, unsigned short data);
amouroug 0:bb2bda4f5846 122
amouroug 0:bb2bda4f5846 123 /** ILI932x specific, read register
amouroug 0:bb2bda4f5846 124 *
amouroug 0:bb2bda4f5846 125 * @param reg register to be read
amouroug 0:bb2bda4f5846 126 * @returns 16bit register value
amouroug 0:bb2bda4f5846 127 */
amouroug 0:bb2bda4f5846 128 virtual unsigned short reg_read(unsigned char reg);
amouroug 0:bb2bda4f5846 129
amouroug 0:bb2bda4f5846 130 /** HW reset sequence (without display init commands)
amouroug 0:bb2bda4f5846 131 */
amouroug 0:bb2bda4f5846 132 virtual void hw_reset();
amouroug 0:bb2bda4f5846 133
amouroug 0:bb2bda4f5846 134 /** Set ChipSelect high or low
amouroug 0:bb2bda4f5846 135 * @param enable 0/1
amouroug 0:bb2bda4f5846 136 */
amouroug 0:bb2bda4f5846 137 virtual void BusEnable(bool enable);
amouroug 0:bb2bda4f5846 138
amouroug 0:bb2bda4f5846 139
amouroug 0:bb2bda4f5846 140
amouroug 0:bb2bda4f5846 141 private:
amouroug 0:bb2bda4f5846 142
amouroug 0:bb2bda4f5846 143 PortInOut _port;
amouroug 0:bb2bda4f5846 144 DigitalOut _CS;
amouroug 0:bb2bda4f5846 145 DigitalOut _reset;
amouroug 0:bb2bda4f5846 146 DigitalOut _DC;
amouroug 0:bb2bda4f5846 147 DigitalOut _WR;
amouroug 0:bb2bda4f5846 148 DigitalOut _RD;
amouroug 0:bb2bda4f5846 149
amouroug 0:bb2bda4f5846 150 };
amouroug 0:bb2bda4f5846 151 #endif
amouroug 0:bb2bda4f5846 152
amouroug 0:bb2bda4f5846 153 #endif