esp-idf-ssd1306/README.md

129 lines
4.9 KiB
Markdown
Raw Normal View History

2019-04-17 10:15:52 -04:00
# esp-idf-ssd1306
2021-01-29 21:01:13 -05:00
SSD1306/SH1106 driver for esp-idf
2019-04-19 21:00:50 -04:00
2019-07-11 11:30:32 -04:00
I used [this](https://github.com/yanbe/ssd1306-esp-idf-i2c) repository as a reference.
I used [this](https://github.com/dhepper/font8x8) font file.
2019-04-21 00:28:48 -04:00
# Software requirements
2023-01-29 00:54:57 -05:00
esp-idf v4.4/v5.0/v5.1.
2023-01-29 22:05:45 -05:00
__Note for ESP32C2.__
2023-01-29 00:54:57 -05:00
ESP-IDF V5.0 ESP32C2 i2c driver has a bug.
2023-06-19 08:03:09 -04:00
ESP-IDF V5.1 is required when using i2c of ESP32C2.
2022-06-06 22:52:21 -04:00
# Installation
2020-12-06 04:11:27 -05:00
```
git clone https://github.com/nopnop2002/esp-idf-ssd1306
2022-04-26 02:21:29 -04:00
cd esp-idf-ssd1306/TextDemo/
2023-01-29 00:54:57 -05:00
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3}
2021-07-26 20:34:50 -04:00
idf.py menuconfig
idf.py flash
```
2022-11-05 21:25:51 -04:00
__Note for ESP32C3__
2022-01-07 06:29:05 -05:00
For some reason, there are development boards that cannot use GPIO06, GPIO08, GPIO09, GPIO19 for SPI clock pins.
According to the ESP32C3 specifications, these pins can also be used as SPI clocks.
I used a raw ESP-C3-13 to verify that these pins could be used as SPI clocks.
2021-09-17 22:31:50 -04:00
2021-07-26 20:34:50 -04:00
# Configuration
2019-04-19 20:44:55 -04:00
You have to set this config value with menuconfig.
2020-02-06 17:18:59 -05:00
- CONFIG_INTERFACE
- CONFIG_PANEL
2021-01-30 11:23:39 -05:00
- CONFIG_OFFSETX
2021-04-23 21:15:14 -04:00
- CONFIG_FLIP
2020-02-06 17:18:59 -05:00
- CONFIG_SDA_GPIO
- CONFIG_SCL_GPIO
- CONFIG_RESET_GPIO
2020-12-06 04:11:27 -05:00
- CONFIG_MOSI_GPIO
- CONFIG_SCLK_GPIO
2020-02-06 17:18:59 -05:00
- CONFIG_CS_GPIO
- CONFIG_DC_GPIO
2019-04-19 20:44:55 -04:00
2019-04-19 21:08:43 -04:00
2020-12-06 04:11:27 -05:00
![config-main](https://user-images.githubusercontent.com/6020549/101276030-7387f980-37ed-11eb-85af-3babe939f0a1.jpg)
2019-04-19 20:44:55 -04:00
---
2021-01-29 20:57:39 -05:00
# Generic SSD1306 128x32 i2c
2019-04-19 20:44:55 -04:00
![128x32](https://user-images.githubusercontent.com/6020549/56449097-6d12e880-6350-11e9-8edd-7a8fc5eaeedc.JPG)
2021-04-23 21:15:14 -04:00
![config-128x32_i2c](https://user-images.githubusercontent.com/6020549/115942099-79a01d80-a4e3-11eb-9274-8746920fca78.jpg)
2019-04-19 20:44:55 -04:00
2021-01-29 20:57:39 -05:00
# Generic SSD1306 128x64 i2c
2019-04-19 20:44:55 -04:00
![128x64](https://user-images.githubusercontent.com/6020549/56449101-7dc35e80-6350-11e9-8579-32fff38369c0.JPG)
2021-07-26 20:39:18 -04:00
![config-128x64_i2c](https://user-images.githubusercontent.com/6020549/127076697-385ecafa-ccb7-4511-a862-70a6143930dd.jpg)
2019-04-19 20:44:55 -04:00
2021-01-29 20:57:39 -05:00
# Generic SH1106 128x64 i2c
2021-01-29 21:01:13 -05:00
__Hardware scroll Not support__
Left:1.3 inch SH1106
2021-01-29 21:02:37 -05:00
Right:0.96 inch SSD1306
2021-01-29 21:01:13 -05:00
2021-01-29 20:57:39 -05:00
![SH1106_i2c](https://user-images.githubusercontent.com/6020549/106342871-09b83780-62e6-11eb-999c-912f0e0c9f0f.JPG)
2021-07-26 20:47:44 -04:00
![config-sh1106_i2c](https://user-images.githubusercontent.com/6020549/127077379-ad688621-999e-475e-b1fe-c093d7599783.jpg)
2021-01-29 20:57:39 -05:00
2021-01-30 11:26:28 -05:00
# 128x64 TTGO
2021-07-26 20:56:09 -04:00
Unlike other ESP32 development boards, the RTC_CLOCK crystal on this board uses a 26MHz one.
2021-07-30 01:47:36 -04:00
You need to change the RTC CLOCK frequency to 26MHz using menuconfig.
2019-04-19 20:44:55 -04:00
![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)
2022-11-19 18:29:48 -05:00
![config-128x64_TTGO](https://user-images.githubusercontent.com/6020549/202875582-493856ce-5f24-4965-a17f-4419120b113d.jpg)
2019-04-19 20:44:55 -04:00
2021-01-30 11:26:28 -05:00
# 128x64 ESP-WROOM-32
2019-05-02 04:17:33 -04:00
![ESP32-OLED-2](https://user-images.githubusercontent.com/6020549/57063327-d229ef00-6cfd-11e9-98ab-8448e14d81e2.JPG)
2022-06-12 03:45:28 -04:00
![config-ESP-WROOM-32](https://user-images.githubusercontent.com/6020549/173222738-35269c7f-a184-4623-8faf-27f98bd958cb.jpg)
2021-01-29 20:57:39 -05:00
---
# Generic SSD1306 128x32 SPI
![128x32_spi](https://user-images.githubusercontent.com/6020549/106338743-ef775d00-62d7-11eb-8e0c-42c09e6045b9.JPG)
2022-11-18 17:50:20 -05:00
![config-128x32_spi](https://user-images.githubusercontent.com/6020549/202815621-f9d0d2c8-3b72-41bb-bf2e-59f984177f03.jpg)
2019-05-02 04:17:33 -04:00
2021-01-29 20:57:39 -05:00
# Generic SSD1306 128x64 SPI
2020-12-06 04:14:27 -05:00
D0 is SCLK.
D1 is MOSI.
2019-04-19 20:44:55 -04:00
2019-04-27 00:13:57 -04:00
![128x64_spi](https://user-images.githubusercontent.com/6020549/56844607-ee88ee80-68ed-11e9-9b20-ab5e7e0d2a99.JPG)
2022-11-18 17:50:20 -05:00
![config-128x64_spi](https://user-images.githubusercontent.com/6020549/202815721-189f9abe-7195-43de-b1c9-b4d1fd40af86.jpg)
2019-04-19 20:44:55 -04:00
2021-01-29 20:57:39 -05:00
# Generic SH1106 128x64 SPI
2021-01-29 21:01:13 -05:00
__Hardware scroll Not support__
Left:1.3 inch SH1106
2021-01-29 21:02:37 -05:00
Right:0.96 inch SSD1306
2021-01-29 20:57:39 -05:00
![SH1106_spi](https://user-images.githubusercontent.com/6020549/106343561-58b39c00-62e9-11eb-8ce7-913bf15cb803.JPG)
2022-11-18 17:50:20 -05:00
![config-sh1106_spi](https://user-images.githubusercontent.com/6020549/202815762-f2431f59-8d21-4b9b-a822-330cb2bc9afd.jpg)
---
# SPI BUS selection
![config-spi-bus](https://user-images.githubusercontent.com/6020549/202815807-6c2df14f-f38e-4032-94fb-da1723607279.jpg)
The ESP32 series has three SPI BUSs.
SPI1_HOST is used for communication with Flash memory.
You can use SPI2_HOST and SPI3_HOST freely.
When you use SDSPI(SD Card via SPI), SDSPI uses SPI2_HOST BUS.
When using this module at the same time as SDSPI or other SPI device using SPI2_HOST, it needs to be changed to SPI3_HOST.
When you don't use SDSPI, both SPI2_HOST and SPI3_HOST will work.
Previously it was called HSPI_HOST / VSPI_HOST, but now it is called SPI2_HOST / SPI3_HOST.
2021-01-30 11:23:39 -05:00
2021-04-23 21:15:14 -04:00
---
# Flip upside down
![config_flip](https://user-images.githubusercontent.com/6020549/115942179-e3b8c280-a4e3-11eb-9b08-8eb830c9f7f4.jpg)
![ssd1306_flip](https://user-images.githubusercontent.com/6020549/115942191-f0d5b180-a4e3-11eb-879e-e7be89eb3e50.JPG)
2021-01-29 18:51:53 -05:00