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
SSD1306.h
00001 #ifndef MBED_SSD1306_H 00002 #define MBED_SSD1306_H 00003 00004 #include "mbed.h" 00005 #include "LCD.h" 00006 00007 /** Class for SSD1306 display controller 00008 * to be copypasted and adapted for other controllers 00009 */ 00010 class SSD1306 : public LCD 00011 { 00012 00013 public: 00014 00015 /** Create a PAR display interface 00016 * @param displayproto only supports PAR_8 00017 * @param port GPIO port name to use 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 * @param name The name used by the parent class to access the interface 00024 * @param LCDSIZE_X x size in pixel - optional 00025 * @param LCDSIZE_Y y size in pixel - optional 00026 */ 00027 SSD1306(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char* name, unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 64); 00028 00029 /** Create an SPI display interface 00030 * @param displayproto SPI_8 or SPI_16 00031 * @param Hz SPI speed in Hz 00032 * @param mosi SPI pin 00033 * @param miso SPI pin 00034 * @param sclk SPI pin 00035 * @param CS pin connected to CS of display 00036 * @param reset pin connected to RESET of display 00037 * @param DC pin connected to data/command of display 00038 * @param name The name used by the parent class to access the interface 00039 * @param LCDSIZE_X x size in pixel - optional 00040 * @param LCDSIZE_Y y size in pixel - optional 00041 */ 00042 SSD1306(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char* name , unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 64); 00043 00044 /** Create an I2C display interface 00045 * @param displayproto I2C_ 00046 * @param Hz I2C speed in Hz 00047 * @param address I2C address 00048 * @param sda I2C pin 00049 * @param scl I2C pin 00050 * @param name The name used by the parent class to access the interface 00051 * @param LCDSIZE_X x size in pixel - optional 00052 * @param LCDSIZE_Y y size in pixel - optional 00053 */ 00054 SSD1306(proto_t displayproto, int Hz, int address, PinName sda, PinName scl, PinName reset, const char* name , unsigned int LCDSIZE_X = 128, unsigned int LCDSIZE_Y = 64); 00055 00056 00057 00058 /** set the contrast of the screen 00059 * @note here overrided because of not standard value range 00060 * @param o contrast 0-255 00061 */ 00062 virtual void set_contrast(int o); 00063 00064 /** set automatc horizontal scroll mode 00065 * @param l_r direction - left = 0, right = 1 00066 * @param s_page start page 00067 * @param e_page end page 00068 * @param speed time between horizontal shift. 0 slow .. 7 fast 00069 */ 00070 void horizontal_scroll(int l_r,int s_page,int e_page,int speed); 00071 00072 /** automatic horizontal + vertical scroll mode 00073 * @param l_r direction - left = 0, right = 1 00074 * @param s_page start page 00075 * @param e_page end page 00076 * @param v_off vertical offset for scroll 00077 * @param speed time between horizontal shift. 0 slow .. 7 fast 00078 */ 00079 void horiz_vert_scroll(int l_r,int s_page,int e_page,int v_off,int speed); 00080 00081 /** end scroll mode 00082 * 00083 */ 00084 void end_scroll(void); 00085 protected: 00086 00087 00088 /** Init command sequence 00089 */ 00090 void init(); 00091 00092 /** set mirror mode 00093 * @note here overriding the LCD class default one because of not standard commands 00094 * @param mode NONE, X, Y, XY 00095 */ 00096 virtual void mirrorXY(mirror_t mode); 00097 00098 }; 00099 00100 00101 #endif
Generated on Tue Jul 12 2022 18:00:35 by 1.7.2