mirror of
https://github.com/nopnop2002/esp-idf-ssd1306.git
synced 2024-10-03 18:18:47 -04:00
Added option to force legacy i2c driver
This commit is contained in:
parent
8e2fc78391
commit
3994b245b9
10
README.md
10
README.md
@ -120,12 +120,20 @@ Therefore, the maximum i2c clock frequency is 400KHz.
|
||||
The i2c clock frequency used by this project is 400KHz.
|
||||
|
||||
# I2C Port selection
|
||||
![config-i2c-port](https://github.com/nopnop2002/esp-idf-ssd1306/assets/6020549/7a7de5ec-ef20-42ac-ba70-73ba74a762a7)
|
||||
![config-i2c-port](https://github.com/user-attachments/assets/477bdf29-7492-4256-bc9e-e3ff363cddcc)
|
||||
|
||||
The ESP32 XTENSA series has two I2C Ports.
|
||||
You can use these two ports freely.
|
||||
If you use this module at the same time as another I2C device using I2C port 0, you must change it to I2C port 1.
|
||||
|
||||
# Force legacy i2c driver
|
||||
xtensa's ESP32 has two i2c buses: I2C_NUM_0/1.
|
||||
I2C_NUM_0/1 are initialized independently, but legacy i2c drivers and new i2c drivers cannot be mixed.
|
||||
If I2C_NUM_0 is initialized with the legacy i2c driver, I2C_NUM_1 must also be initialized with the legacy i2c driver.
|
||||
If you use the SSD1306 at the same time as an I2C device that uses a legacy I2C driver, you must initialize the SSD1306 with the legacy I2C driver.
|
||||
Enabling this will use the legacy i2c driver even after ESP-IDF V5.2.
|
||||
![config-i2c-driver](https://github.com/user-attachments/assets/d07076d0-1c94-43d1-aa5a-aec810d2f7bc)
|
||||
|
||||
---
|
||||
|
||||
# SPI Clock speed
|
||||
|
@ -4,7 +4,11 @@ set(component_srcs "ssd1306.c" "ssd1306_spi.c")
|
||||
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
|
||||
|
||||
if(idf_version VERSION_GREATER_EQUAL "5.2")
|
||||
list(APPEND component_srcs "ssd1306_i2c_new.c")
|
||||
if(CONFIG_LEGACY_DRIVER)
|
||||
list(APPEND component_srcs "ssd1306_i2c_legacy.c")
|
||||
else()
|
||||
list(APPEND component_srcs "ssd1306_i2c_new.c")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND component_srcs "ssd1306_i2c_legacy.c")
|
||||
endif()
|
||||
|
@ -158,6 +158,13 @@ menu "SSD1306 Configuration"
|
||||
Use I2C_PORT_1.
|
||||
endchoice
|
||||
|
||||
config LEGACY_DRIVER
|
||||
depends on I2C_INTERFACE
|
||||
bool "Force legacy i2c driver"
|
||||
default false
|
||||
help
|
||||
Force legacy i2c driver.
|
||||
|
||||
choice SPI_HOST
|
||||
depends on SPI_INTERFACE
|
||||
prompt "SPI peripheral that controls this bus"
|
||||
|
Loading…
Reference in New Issue
Block a user