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