mirror of
https://github.com/nopnop2002/esp-idf-ssd1306.git
synced 2024-10-03 18:18:47 -04:00
Changed config variable determination to macro variable determination
This commit is contained in:
parent
53bf6d2db7
commit
9ae36e05f6
@ -1,4 +1,17 @@
|
|||||||
set(COMPONENT_SRCS "main.c")
|
set(srcs "main.c")
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS "")
|
|
||||||
|
# get IDF version for comparison
|
||||||
|
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}")
|
||||||
|
|
||||||
|
if(idf_version VERSION_GREATER_EQUAL "5.2")
|
||||||
|
if(CONFIG_LEGACY_DRIVER)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D LEGACY_DRIVER")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D NEW_DRIVER")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D LEGACY_DRIVER")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_component_register(SRCS "${srcs}" INCLUDE_DIRS ".")
|
||||||
|
|
||||||
register_component()
|
|
||||||
|
@ -49,7 +49,7 @@ void app_main(void)
|
|||||||
i2c_port_t i2c_num = I2C_NUM_1;
|
i2c_port_t i2c_num = I2C_NUM_1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_LEGACY_DRIVER
|
#ifdef LEGACY_DRIVER
|
||||||
ESP_LOGI(tag, "I2C_LEGACY_DRIVER");
|
ESP_LOGI(tag, "I2C_LEGACY_DRIVER");
|
||||||
// install i2c master driver
|
// install i2c master driver
|
||||||
i2c_config_t i2c_config = {
|
i2c_config_t i2c_config = {
|
||||||
@ -65,7 +65,9 @@ void app_main(void)
|
|||||||
|
|
||||||
// add new device to i2c bus
|
// add new device to i2c bus
|
||||||
i2c_device_add(&dev, i2c_num, CONFIG_RESET_GPIO);
|
i2c_device_add(&dev, i2c_num, CONFIG_RESET_GPIO);
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_DRIVER
|
||||||
ESP_LOGI(tag, "I2C_NEW_DRIVER");
|
ESP_LOGI(tag, "I2C_NEW_DRIVER");
|
||||||
// install i2c master driver
|
// install i2c master driver
|
||||||
i2c_master_bus_config_t i2c_mst_config = {
|
i2c_master_bus_config_t i2c_mst_config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user