UniGraphic-Fork for ST7920-LCD-controller and SH1106. Tested with 128x64 LCD with SPI and 128x64-OLED with IIC
Dependents: UniGraphic-St7920-Test AfficheurUTILECO
Fork of UniGraphic by
PAR16.h
00001 #ifndef PAR16_H 00002 #define PAR16_H 00003 00004 #include "mbed.h" 00005 #include "Protocols.h " 00006 00007 #if DEVICE_PORTINOUT 00008 00009 //#include "GraphicsDisplay.h" 00010 00011 /** Parallel 16bit interface 00012 */ 00013 class PAR16 : public Protocols 00014 { 00015 public: 00016 00017 /** Create a PAR16 display interface with a GPIO port and 5 control pins 00018 * 00019 * @param port GPIO port to use 00020 * @param CS pin connected to CS of display 00021 * @param reset pin connected to RESET of display 00022 * @param DC pin connected to data/command of display 00023 * @param WR pin connected to SDI of display 00024 * @param RD pin connected to RS of display 00025 */ 00026 PAR16(PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD); 00027 00028 protected: 00029 00030 /** Send 8bit command to display controller 00031 * 00032 * @param cmd: byte to send 00033 * 00034 */ 00035 virtual void wr_cmd8(unsigned char cmd); 00036 00037 /** Send 8bit data to display controller 00038 * 00039 * @param data: byte to send 00040 * 00041 */ 00042 virtual void wr_data8(unsigned char data); 00043 00044 /** Send 2x8bit command to display controller 00045 * 00046 * @param cmd: halfword to send 00047 * @note 2cycles using pins[7:0] 00048 */ 00049 virtual void wr_cmd16(unsigned short cmd); 00050 00051 /** Send 2x8bit data to display controller 00052 * 00053 * @param data: halfword to send 00054 * @note 2cycles using pins[7:0], only gram write cmd uses pins[15:8] 00055 */ 00056 virtual void wr_data16(unsigned short data); 00057 00058 /** Send 16bit pixeldata to display controller 00059 * 00060 * @param data: halfword to send 00061 * @note here using all pins[15:0] 00062 */ 00063 virtual void wr_gram(unsigned short data); 00064 00065 /** Send same 16bit pixeldata to display controller multiple times 00066 * 00067 * @param data: halfword to send 00068 * @param count: how many 00069 * @note here using all pins[15:0] 00070 */ 00071 virtual void wr_gram(unsigned short data, unsigned int count); 00072 00073 /** Send array of pixeldata shorts to display controller 00074 * 00075 * @param data: unsigned short pixeldata array 00076 * @param lenght: lenght (in shorts) 00077 * @note here using all pins[15:0] 00078 */ 00079 virtual void wr_grambuf(unsigned short* data, unsigned int lenght); 00080 00081 /** Read 16bit pixeldata from display controller (with dummy cycle) 00082 * 00083 * @param convert true/false. Convert 18bit to 16bit, some controllers returns 18bit 00084 * @returns 16bit color 00085 */ 00086 virtual unsigned short rd_gram(bool convert); 00087 00088 /** Read 4x8bit register data (with dummy cycle) 00089 * @param reg the register to read 00090 * @returns data as uint 00091 * 00092 */ 00093 virtual unsigned int rd_reg_data32(unsigned char reg); 00094 00095 /** Read 3x8bit ExtendedCommands register data 00096 * @param reg the register to read 00097 * @returns data as uint 00098 * @note EXTC regs (0xB0 to 0xFF) are read/write registers, for Parallel mode directly accessible in both directions 00099 */ 00100 virtual unsigned int rd_extcreg_data32(unsigned char reg, unsigned char SPIreadenablecmd); 00101 00102 /** ILI932x specific, does a dummy read cycle, number of bits is protocol dependent 00103 * for PAR protocols: a signle RD bit toggle 00104 * for SPI8: 8clocks 00105 * for SPI16: 16 clocks 00106 */ 00107 virtual void dummyread (); 00108 00109 /** ILI932x specific, select register for a successive write or read 00110 * 00111 * @param reg register to be selected 00112 * @param forread false = a write next (default), true = a read next 00113 * @note forread only used by SPI protocols 00114 */ 00115 virtual void reg_select(unsigned char reg, bool forread =false); 00116 00117 /** ILI932x specific, write register with data 00118 * 00119 * @param reg register to write 00120 * @param data 16bit data 00121 */ 00122 virtual void reg_write(unsigned char reg, unsigned short data); 00123 00124 /** ILI932x specific, read register 00125 * 00126 * @param reg register to be read 00127 * @returns 16bit register value 00128 */ 00129 virtual unsigned short reg_read(unsigned char reg); 00130 00131 /** HW reset sequence (without display init commands) 00132 */ 00133 virtual void hw_reset(); 00134 00135 /** Set ChipSelect high or low 00136 * @param enable 0/1 00137 */ 00138 virtual void BusEnable(bool enable); 00139 00140 00141 00142 private: 00143 00144 PortInOut _port; 00145 DigitalOut _CS; 00146 DigitalOut _reset; 00147 DigitalOut _DC; 00148 DigitalOut _WR; 00149 DigitalOut _RD; 00150 00151 }; 00152 #endif 00153 00154 #endif
Generated on Tue Jul 12 2022 18:00:35 by 1.7.2