main: I2C Port/Pins vereinheitlicht (BSP-Defines) für i2cdev_adopt_bus + SEN5x
This commit is contained in:
+5
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user