From caa875699862213a6802253c507ccc556255ff5e Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sun, 24 Nov 2024 21:39:01 +0100 Subject: [PATCH] I2C board settings updated (#86) --- Boards/M5stackCore2/Source/M5stackCore2.cpp | 4 +- Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp | 4 +- .../WaveshareS3Touch/waveshare_s3_touch.cpp | 41 ++++++++++++++++++- Boards/YellowBoard/yellow_board.cpp | 2 + 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Boards/M5stackCore2/Source/M5stackCore2.cpp b/Boards/M5stackCore2/Source/M5stackCore2.cpp index ace841be..66591747 100644 --- a/Boards/M5stackCore2/Source/M5stackCore2.cpp +++ b/Boards/M5stackCore2/Source/M5stackCore2.cpp @@ -7,8 +7,8 @@ extern const tt::hal::Configuration m5stack_core2 = { .sdcard = &m5stack_sdcard, .power = &m5stack_power, .i2c = { - // Internal tt::hal::i2c::Configuration { + .name = "Internal", .port = I2C_NUM_0, .initMode = tt::hal::i2c::InitByExternal, .canReinit = false, @@ -26,8 +26,8 @@ extern const tt::hal::Configuration m5stack_core2 = { .clk_flags = 0 } }, - // External (Grove) tt::hal::i2c::Configuration { + .name = "External", // (Grove) .port = I2C_NUM_1, .initMode = tt::hal::i2c::InitByExternal, .canReinit = true, diff --git a/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp b/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp index 200289de..68805008 100644 --- a/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp +++ b/Boards/M5stackCoreS3/Source/M5stackCoreS3.cpp @@ -9,8 +9,8 @@ const tt::hal::Configuration m5stack_cores3 = { .sdcard = &m5stack_sdcard, .power = &m5stack_power, .i2c = { - // Internal tt::hal::i2c::Configuration { + .name = "Internal", .port = I2C_NUM_0, .initMode = tt::hal::i2c::InitByExternal, .canReinit = false, @@ -28,8 +28,8 @@ const tt::hal::Configuration m5stack_cores3 = { .clk_flags = 0 } }, - // External (Grove) tt::hal::i2c::Configuration { + .name = "External", // Grove .port = I2C_NUM_1, .initMode = tt::hal::i2c::InitByExternal, .canReinit = true, diff --git a/Boards/WaveshareS3Touch/waveshare_s3_touch.cpp b/Boards/WaveshareS3Touch/waveshare_s3_touch.cpp index dfd272a1..ca84f83c 100644 --- a/Boards/WaveshareS3Touch/waveshare_s3_touch.cpp +++ b/Boards/WaveshareS3Touch/waveshare_s3_touch.cpp @@ -10,5 +10,44 @@ extern const tt::hal::Configuration waveshare_s3_touch = { .display = { .setBacklightDuty = nullptr }, .sdcard = nullptr, .power = nullptr, - .i2c = {} + .i2c = { + tt::hal::i2c::Configuration { + .name = "First", + .port = I2C_NUM_0, + .initMode = tt::hal::i2c::InitDisabled, + .canReinit = true, + .hasMutableConfiguration = true, + .timeout = 1000, + .config = (i2c_config_t) { + .mode = I2C_MODE_MASTER, + .sda_io_num = GPIO_NUM_NC, + .scl_io_num = GPIO_NUM_NC, + .sda_pullup_en = true, + .scl_pullup_en = true, + .master = { + .clk_speed = 400000 + }, + .clk_flags = 0 + } + }, + tt::hal::i2c::Configuration { + .name = "Second", + .port = I2C_NUM_1, + .initMode = tt::hal::i2c::InitDisabled, + .canReinit = true, + .hasMutableConfiguration = true, + .timeout = 1000, + .config = (i2c_config_t) { + .mode = I2C_MODE_MASTER, + .sda_io_num = GPIO_NUM_NC, + .scl_io_num = GPIO_NUM_NC, + .sda_pullup_en = true, + .scl_pullup_en = true, + .master = { + .clk_speed = 400000 + }, + .clk_flags = 0 + } + } + } }; diff --git a/Boards/YellowBoard/yellow_board.cpp b/Boards/YellowBoard/yellow_board.cpp index 4c37cd12..ff99ccf3 100644 --- a/Boards/YellowBoard/yellow_board.cpp +++ b/Boards/YellowBoard/yellow_board.cpp @@ -16,6 +16,7 @@ const tt::hal::Configuration yellow_board_24inch_cap = { .power = nullptr, .i2c = { tt::hal::i2c::Configuration { + .name = "First", .port = I2C_NUM_0, .initMode = tt::hal::i2c::InitDisabled, .canReinit = true, @@ -34,6 +35,7 @@ const tt::hal::Configuration yellow_board_24inch_cap = { } }, tt::hal::i2c::Configuration { + .name = "Second", .port = I2C_NUM_1, .initMode = tt::hal::i2c::InitDisabled, .canReinit = true,