mirror of
https://github.com/nopnop2002/esp-idf-ssd1306.git
synced 2024-10-03 18:18:47 -04:00
Added support for SH1106
This commit is contained in:
parent
ad1cd5745c
commit
cdb8fb6810
49
README.md
49
README.md
@ -27,6 +27,7 @@ idf.py flash
|
||||
You have to set this config value with menuconfig.
|
||||
- CONFIG_INTERFACE
|
||||
- CONFIG_PANEL
|
||||
- CONFIG_OFFSETXL
|
||||
- CONFIG_SDA_GPIO
|
||||
- CONFIG_SCL_GPIO
|
||||
- CONFIG_RESET_GPIO
|
||||
@ -40,44 +41,66 @@ You have to set this config value with menuconfig.
|
||||
|
||||
---
|
||||
|
||||
# Generic 128x32 i2c
|
||||
# Generic SSD1306 128x32 i2c
|
||||
|
||||
![128x32](https://user-images.githubusercontent.com/6020549/56449097-6d12e880-6350-11e9-8edd-7a8fc5eaeedc.JPG)
|
||||
![config-128x32_i2c](https://user-images.githubusercontent.com/6020549/101276039-85699c80-37ed-11eb-8cc5-07426c60e7de.jpg)
|
||||
![config-128x32_i2c](https://user-images.githubusercontent.com/6020549/106342620-04a6b880-62e5-11eb-927d-f933c783d1a1.jpg)
|
||||
|
||||
---
|
||||
|
||||
# Generic 128x64 i2c
|
||||
# Generic SSD1306 128x64 i2c
|
||||
|
||||
![128x64](https://user-images.githubusercontent.com/6020549/56449101-7dc35e80-6350-11e9-8579-32fff38369c0.JPG)
|
||||
![config-128x64_i2c](https://user-images.githubusercontent.com/6020549/101276050-961a1280-37ed-11eb-8b85-b8e1de585832.jpg)
|
||||
![config-128x64_i2c](https://user-images.githubusercontent.com/6020549/106342623-08d2d600-62e5-11eb-888c-a8784e6c2f3f.jpg)
|
||||
|
||||
---
|
||||
|
||||
# 128x64 TTGO
|
||||
# Generic SH1106 128x64 i2c
|
||||
__Hardware scroll Not support__
|
||||
![SH1106_i2c](https://user-images.githubusercontent.com/6020549/106342871-09b83780-62e6-11eb-999c-912f0e0c9f0f.JPG)
|
||||
![config-sh1106_i2c](https://user-images.githubusercontent.com/6020549/106342655-2738d180-62e5-11eb-8be8-90466bbbba63.jpg)
|
||||
|
||||
---
|
||||
|
||||
# 128x64 TTGO i2c
|
||||
|
||||
![ESP32-TTGO-1](https://user-images.githubusercontent.com/6020549/56449111-9764a600-6350-11e9-9902-e2ad1c4aefb0.JPG)
|
||||
![ESP32-TTGO-2](https://user-images.githubusercontent.com/6020549/56449116-9a5f9680-6350-11e9-86ec-e06648118add.JPG)
|
||||
![128x64_Reset](https://user-images.githubusercontent.com/6020549/56449118-9e8bb400-6350-11e9-9b90-1eb1f9fa8e99.JPG)
|
||||
![config-128x64_TTGO](https://user-images.githubusercontent.com/6020549/101276064-b8139500-37ed-11eb-8e10-59447903cb80.jpg)
|
||||
![config-128x64_TTGO](https://user-images.githubusercontent.com/6020549/106342639-18521f00-62e5-11eb-8afa-126cd781eb0e.jpg)
|
||||
|
||||
---
|
||||
|
||||
# 128x64 ESP-WROOM-32
|
||||
# 128x64 ESP-WROOM-32 i2c
|
||||
|
||||
![ESP32-OLED-2](https://user-images.githubusercontent.com/6020549/57063327-d229ef00-6cfd-11e9-98ab-8448e14d81e2.JPG)
|
||||
![config-ESP-WROOM-32](https://user-images.githubusercontent.com/6020549/101276069-c5c91a80-37ed-11eb-98bf-c32207d3346f.jpg)
|
||||
![config-ESP-WROOM-32](https://user-images.githubusercontent.com/6020549/106342643-1c7e3c80-62e5-11eb-9764-6d820513733d.jpg)
|
||||
|
||||
---
|
||||
|
||||
# Generic 128x64 SPI
|
||||
# Generic SSD1306 128x32 SPI
|
||||
D0 is SCLK.
|
||||
D1 is MOSI.
|
||||
|
||||
![128x32_spi](https://user-images.githubusercontent.com/6020549/106338743-ef775d00-62d7-11eb-8e0c-42c09e6045b9.JPG)
|
||||
![config-128x32_spi](https://user-images.githubusercontent.com/6020549/106342629-0c665d00-62e5-11eb-8f91-436a9bbc6e63.jpg)
|
||||
|
||||
---
|
||||
|
||||
# Generic SSD1306 128x64 SPI
|
||||
D0 is SCLK.
|
||||
D1 is MOSI.
|
||||
|
||||
![128x64_spi](https://user-images.githubusercontent.com/6020549/56844607-ee88ee80-68ed-11e9-9b20-ab5e7e0d2a99.JPG)
|
||||
![config-128x64_spi](https://user-images.githubusercontent.com/6020549/103490209-9396f100-4e5d-11eb-9da0-0762e6f70da4.jpg)
|
||||
![config-128x64_spi](https://user-images.githubusercontent.com/6020549/106342634-125c3e00-62e5-11eb-83aa-45fdf5420d4c.jpg)
|
||||
|
||||
# Generic 128x32 SPI
|
||||
---
|
||||
|
||||
# Generic SH1106 128x64 SPI
|
||||
D0 is SCLK.
|
||||
D1 is MOSI.
|
||||
__Hardware scroll Not support__
|
||||
|
||||
![SH1106_spi](https://user-images.githubusercontent.com/6020549/106343561-58b39c00-62e9-11eb-8ce7-913bf15cb803.JPG)
|
||||
![config-128x32_spi](https://user-images.githubusercontent.com/6020549/106342629-0c665d00-62e5-11eb-8f91-436a9bbc6e63.jpg)
|
||||
|
||||
![128x32_spi](https://user-images.githubusercontent.com/6020549/106338743-ef775d00-62d7-11eb-8e0c-42c09e6045b9.JPG)
|
||||
![config-128x32_spi](https://user-images.githubusercontent.com/6020549/106338858-3bc29d00-62d8-11eb-8d3b-8f9fed719c56.jpg)
|
||||
|
@ -31,6 +31,13 @@ menu "SSD1306 Configuration"
|
||||
Panel is 128x64.
|
||||
endchoice
|
||||
|
||||
config OFFSETX
|
||||
int "GRAM X OFFSET"
|
||||
range 0 99
|
||||
default 0
|
||||
help
|
||||
When your TFT have offset(X), set it.
|
||||
|
||||
config SCL_GPIO
|
||||
depends on I2C_INTERFACE
|
||||
int "SCL GPIO number"
|
||||
|
@ -53,7 +53,7 @@ void i2c_init(SSD1306_t * dev, int width, int height) {
|
||||
i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_DATA_STREAM, true); // 40
|
||||
i2c_master_write_byte(cmd, OLED_CMD_SET_SEGMENT_REMAP, true); // A1
|
||||
i2c_master_write_byte(cmd, OLED_CMD_SET_COM_SCAN_MODE, true); // C8
|
||||
i2c_master_write_byte(cmd, OLED_CMD_DISPLAY_NORMAL, true); // A6
|
||||
//i2c_master_write_byte(cmd, OLED_CMD_DISPLAY_NORMAL, true); // A6
|
||||
i2c_master_write_byte(cmd, OLED_CMD_SET_DISPLAY_CLK_DIV, true); // D5
|
||||
i2c_master_write_byte(cmd, 0x80, true);
|
||||
i2c_master_write_byte(cmd, OLED_CMD_SET_COM_PIN_MAP, true); // DA
|
||||
@ -95,8 +95,9 @@ void i2c_display_image(SSD1306_t * dev, int page, int seg, uint8_t * images, int
|
||||
if (page >= dev->_pages) return;
|
||||
if (seg >= dev->_width) return;
|
||||
|
||||
uint8_t columLow = seg & 0x0F;
|
||||
uint8_t columHigh = (seg >> 4) & 0x0F;
|
||||
int _seg = seg + CONFIG_OFFSETX;
|
||||
uint8_t columLow = _seg & 0x0F;
|
||||
uint8_t columHigh = (_seg >> 4) & 0x0F;
|
||||
|
||||
cmd = i2c_cmd_link_create();
|
||||
i2c_master_start(cmd);
|
||||
|
@ -116,7 +116,7 @@ void spi_init(SSD1306_t * dev, int width, int height)
|
||||
spi_master_write_command(dev, OLED_CONTROL_BYTE_DATA_STREAM); // 40
|
||||
spi_master_write_command(dev, OLED_CMD_SET_SEGMENT_REMAP); // A1
|
||||
spi_master_write_command(dev, OLED_CMD_SET_COM_SCAN_MODE); // C8
|
||||
spi_master_write_command(dev, OLED_CMD_DISPLAY_NORMAL); // A6
|
||||
//spi_master_write_command(dev, OLED_CMD_DISPLAY_NORMAL); // A6
|
||||
spi_master_write_command(dev, OLED_CMD_SET_DISPLAY_CLK_DIV); // D5
|
||||
spi_master_write_command(dev, 0x80);
|
||||
spi_master_write_command(dev, OLED_CMD_SET_COM_PIN_MAP); // DA
|
||||
@ -147,8 +147,9 @@ void spi_display_image(SSD1306_t * dev, int page, int seg, uint8_t * images, int
|
||||
if (page >= dev->_pages) return;
|
||||
if (seg >= dev->_width) return;
|
||||
|
||||
uint8_t columLow = seg & 0x0F;
|
||||
uint8_t columHigh = (seg >> 4) & 0x0F;
|
||||
int _seg = seg + CONFIG_OFFSETX;
|
||||
uint8_t columLow = _seg & 0x0F;
|
||||
uint8_t columHigh = (_seg >> 4) & 0x0F;
|
||||
|
||||
// Set Lower Column Start Address for Page Addressing Mode
|
||||
spi_master_write_command(dev, (0x00 + columLow));
|
||||
|
Loading…
Reference in New Issue
Block a user