main: I2C Port/Pins vereinheitlicht (BSP-Defines) für i2cdev_adopt_bus + SEN5x

This commit is contained in:
2026-02-08 22:15:29 +01:00
parent daa6909f5d
commit 81b5677b5f
2 changed files with 5 additions and 8 deletions
-1
View File
@@ -258,7 +258,6 @@ esp_err_t sen5x_app_init(const sen5x_i2c_cfg_t* cfg) {
ESP_LOGI(TAG, "Initializing SEN5x app...");
// 1) I2C-Subsystem
CHECK_ESP_OR_RET(i2cdev_init());
// 2) HAL-Konfiguration
struct esp32_i2c_config hal_cfg = {
+5 -7
View File
@@ -376,12 +376,10 @@ void app_main(void)
ESP_ERROR_CHECK(i2cdev_init());
// I2C-Bus initialisieren (bsp_i2c.h)
i2c_master_bus_handle_t i2c_bus_handle = bsp_i2c_init();
// Diesen Bus von i2cdev "adoptieren", damit SEN5x denselben Bus nutzt
ESP_ERROR_CHECK(i2cdev_adopt_bus(0, i2c_bus_handle, 18, 19)); // Port 0, SDA=18, SCL=19
ESP_ERROR_CHECK(i2cdev_adopt_bus(I2C_PORT_NUM, i2c_bus_handle,
EXAMPLE_PIN_I2C_SDA, EXAMPLE_PIN_I2C_SCL));
// Restliche Peripherie
bsp_spi_init();
bsp_battery_init();
@@ -456,9 +454,9 @@ void app_main(void)
// SEN5x
const sen5x_i2c_cfg_t cfg = {
.addr = 0x69,
.port = 0,
.sda = 18,
.scl = 19,
.port = I2C_PORT_NUM,
.sda = EXAMPLE_PIN_I2C_SDA,
.scl = EXAMPLE_PIN_I2C_SCL,
.sda_pullup = true,
.scl_pullup = true,
.freq = 400000