Simplify I2C and SPI code (#237)

This commit is contained in:
Ken Van Hoeylandt
2025-02-26 17:47:19 +01:00
committed by GitHub
parent b85ef7a2e7
commit 83a82be901
16 changed files with 46 additions and 133 deletions
+4 -8
View File
@@ -22,8 +22,7 @@ const tt::hal::Configuration cyd_2432S024c_config = {
.name = "First",
.port = I2C_NUM_0,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_33,
@@ -40,8 +39,7 @@ const tt::hal::Configuration cyd_2432S024c_config = {
.name = "Second",
.port = I2C_NUM_1,
.initMode = tt::hal::i2c::InitMode::Disabled,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_NC,
@@ -76,8 +74,7 @@ const tt::hal::Configuration cyd_2432S024c_config = {
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
tt::hal::spi::Configuration {
@@ -100,8 +97,7 @@ const tt::hal::Configuration cyd_2432S024c_config = {
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = nullptr
},
}
@@ -25,8 +25,7 @@ extern const Configuration crowpanel_advance_28 = {
.name = "Main",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_15,
@@ -62,8 +61,7 @@ extern const Configuration crowpanel_advance_28 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
// SD card
@@ -87,8 +85,7 @@ extern const Configuration crowpanel_advance_28 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = nullptr // No custom lock needed
}
},
@@ -25,8 +25,7 @@ extern const Configuration crowpanel_advance_35 = {
.name = "Main",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_15,
@@ -62,8 +61,7 @@ extern const Configuration crowpanel_advance_35 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
// SD card
@@ -87,8 +85,7 @@ extern const Configuration crowpanel_advance_35 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = nullptr // No custom lock needed
}
},
@@ -27,8 +27,7 @@ extern const Configuration crowpanel_basic_28 = {
.name = "Main",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_22,
@@ -64,8 +63,7 @@ extern const Configuration crowpanel_basic_28 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
// SD card
@@ -89,8 +87,7 @@ extern const Configuration crowpanel_basic_28 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = nullptr // No custom lock needed
}
},
@@ -27,8 +27,7 @@ extern const Configuration crowpanel_basic_35 = {
.name = "Main",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_22,
@@ -64,8 +63,7 @@ extern const Configuration crowpanel_basic_35 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
// SD card
@@ -89,8 +87,7 @@ extern const Configuration crowpanel_basic_35 = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = nullptr // No custom lock needed
}
},
+3 -6
View File
@@ -24,8 +24,7 @@ extern const Configuration lilygo_tdeck = {
.name = "Internal",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_18,
@@ -42,8 +41,7 @@ extern const Configuration lilygo_tdeck = {
.name = "External",
.port = I2C_NUM_1,
.initMode = i2c::InitMode::Disabled,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_43,
@@ -78,8 +76,7 @@ extern const Configuration lilygo_tdeck = {
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}
},
+3 -6
View File
@@ -19,8 +19,7 @@ extern const tt::hal::Configuration m5stack_core2 = {
.name = "Internal",
.port = I2C_NUM_0,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = false, // Might be set to try after trying out what it does AXP and screen
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_21,
@@ -37,8 +36,7 @@ extern const tt::hal::Configuration m5stack_core2 = {
.name = "External", // (Grove)
.port = I2C_NUM_1,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_32,
@@ -73,8 +71,7 @@ extern const tt::hal::Configuration m5stack_core2 = {
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}
}
@@ -18,8 +18,7 @@ const tt::hal::Configuration m5stack_cores3 = {
.name = "Internal",
.port = I2C_NUM_0,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_12,
@@ -36,8 +35,7 @@ const tt::hal::Configuration m5stack_cores3 = {
.name = "External", // Grove
.port = I2C_NUM_1,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_2,
@@ -72,8 +70,7 @@ const tt::hal::Configuration m5stack_cores3 = {
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}
}
+2 -4
View File
@@ -39,8 +39,7 @@ extern const Configuration hardware = {
.name = "Internal",
.port = I2C_NUM_0,
.initMode = i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = 1,
@@ -57,8 +56,7 @@ extern const Configuration hardware = {
.name = "External",
.port = I2C_NUM_1,
.initMode = i2c::InitMode::ByTactility,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = 3,
+3 -6
View File
@@ -20,8 +20,7 @@ extern const tt::hal::Configuration unPhone = {
.name = "Internal",
.port = I2C_NUM_0,
.initMode = tt::hal::i2c::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_3,
@@ -38,8 +37,7 @@ extern const tt::hal::Configuration unPhone = {
.name = "Unused",
.port = I2C_NUM_1,
.initMode = tt::hal::i2c::InitMode::Disabled,
.canReinit = true,
.hasMutableConfiguration = true,
.isMutable = true,
.config = (i2c_config_t) {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_NC,
@@ -74,8 +72,7 @@ extern const tt::hal::Configuration unPhone = {
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.canReinit = false,
.hasMutableConfiguration = false,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
}
}