Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ezSBC_MPU9250 Test_OLED_Display untodoenuno OledI2CDisplay ... more
Fork of Adafruit_GFX by
Adafruit_UC1601S.h
00001 /********************************************************************* 00002 This is a library for our Monochrome OLEDs based on SSD1306 drivers 00003 00004 00005 Adafruit invests time and resources providing this open source code, 00006 please support Adafruit and open-source hardware by purchasing 00007 products from Adafruit! 00008 00009 Written by Limor Fried/Ladyada for Adafruit Industries. 00010 BSD license, check license.txt for more information 00011 All text above, and the splash screen must be included in any redistribution 00012 *********************************************************************/ 00013 00014 /* 00015 * Modified by JojoS for use in mbed 00016 */ 00017 00018 #ifndef _ADAFRUIT_UC1601S_H_ 00019 #define _ADAFRUIT_UC1601S_H_ 00020 00021 #include "mbed.h" 00022 #include "Adafruit_GFX.h" 00023 00024 #include <vector> 00025 #include <algorithm> 00026 00027 /** The pure base class for the UC1601S display driver. 00028 * 00029 * You should derive from this for a new transport interface type, 00030 * such as the SPI and I2C drivers. 00031 */ 00032 00033 #define LCD_SET_COLUMN_ADDR_LSB 0x00 00034 #define LCD_SET_COLUMN_ADDR_MSB 0x10 00035 #define LCD_SET_TEMP_COMP 0x24 00036 #define LCD_SET_POWER_CTRL 0x28 00037 #define LCD_SET_LINE_ADDR 0x40 00038 #define LCD_SET_PAGE_ADDR 0xB0 00039 #define LCD_SET_BIAS 0x81 00040 #define LCD_SET_BIAS_RATIO 0xE8 00041 #define LCD_SET_PARTITIAL_CTRL 0x84 00042 #define LCD_ENABLE_DISPLAY 0xAE 00043 #define LCD_ENABLE_ALL 0xA5 00044 #define LCD_INVERT_DISPLAY 0xA6 00045 #define LCD_SYSTEM_RESET 0xE2 00046 #define LCD_SET_RAM_ADDRESS_CTRL 0x88 00047 #define LCD_SET_FRAME_RATE 0xA0 00048 #define LCD_SET_MAPPING_CTRL 0xC0 00049 #define LCD_SET_COM_END 0xF1 00050 00051 00052 class Adafruit_UC1601S : public Adafruit_GFX 00053 { 00054 public: 00055 Adafruit_UC1601S(PinName reset, uint8_t rawHeight = 22, uint8_t rawWidth = 132, bool flipVertical=false); 00056 00057 // start sequence 00058 void begin(); 00059 00060 // These must be implemented in the derived transport driver 00061 virtual void command(uint8_t c) = 0; 00062 virtual void data(const uint8_t *c, int count) = 0; 00063 virtual void drawPixel(int16_t x, int16_t y, uint16_t color); 00064 00065 /// Clear the display buffer 00066 void clearDisplay(void); 00067 virtual void invertDisplay(bool i); 00068 void flipVertical(bool flip); 00069 00070 /// Cause the display to be updated with the buffer content. 00071 void display(); 00072 /// Fill the buffer with the AdaFruit splash screen. 00073 virtual void splash(); 00074 00075 protected: 00076 virtual void sendDisplayBuffer() = 0; 00077 DigitalOut _reset; 00078 bool _flipVertical; 00079 00080 // the memory buffer for the LCD 00081 std::vector<uint8_t> buffer; 00082 }; 00083 00084 00085 00086 /** This is the I2C UC1601S display driver transport class 00087 * 00088 */ 00089 00090 #define I2C_ADDRESS_CMD (0x38 << 1) 00091 #define I2C_ADDRESS_DATA (0x39 << 1) 00092 00093 class Adafruit_UC1601S_I2c : public Adafruit_UC1601S 00094 { 00095 public: 00096 /** Create a SSD1306 I2C transport display driver instance with the specified RST pin name, the I2C address, as well as the display dimensions 00097 * 00098 * Required parameters 00099 * @param i2c - A reference to an initialized I2C object 00100 * @param RST - The Reset pin name 00101 * 00102 * Optional parameters 00103 * @param i2cAddress - The i2c address of the display 00104 * @param rawHeight - The vertical number of pixels for the display, defaults to 22 00105 * @param rawWidth - The horizonal number of pixels for the display, defaults to 128 00106 */ 00107 Adafruit_UC1601S_I2c(I2C &i2c, PinName reset, uint8_t i2cAddress = I2C_ADDRESS_CMD, uint8_t rawHeight = 22, uint8_t rawWidth = 132, bool flipVertical = false); 00108 00109 virtual void command(uint8_t c); 00110 virtual void data(const uint8_t *c, int count); 00111 00112 protected: 00113 virtual void sendDisplayBuffer(); 00114 I2C &mi2c; 00115 uint8_t mi2cAddress; 00116 }; 00117 00118 #endif
Generated on Thu Jul 14 2022 22:51:53 by
