main: I2C Port/Pins vereinheitlicht (BSP-Defines) für i2cdev_adopt_bus + SEN5x
This commit is contained in:
@@ -258,7 +258,6 @@ esp_err_t sen5x_app_init(const sen5x_i2c_cfg_t* cfg) {
|
|||||||
ESP_LOGI(TAG, "Initializing SEN5x app...");
|
ESP_LOGI(TAG, "Initializing SEN5x app...");
|
||||||
|
|
||||||
// 1) I2C-Subsystem
|
// 1) I2C-Subsystem
|
||||||
CHECK_ESP_OR_RET(i2cdev_init());
|
|
||||||
|
|
||||||
// 2) HAL-Konfiguration
|
// 2) HAL-Konfiguration
|
||||||
struct esp32_i2c_config hal_cfg = {
|
struct esp32_i2c_config hal_cfg = {
|
||||||
|
|||||||
+5
-7
@@ -376,12 +376,10 @@ void app_main(void)
|
|||||||
|
|
||||||
ESP_ERROR_CHECK(i2cdev_init());
|
ESP_ERROR_CHECK(i2cdev_init());
|
||||||
|
|
||||||
// I2C-Bus initialisieren (bsp_i2c.h)
|
|
||||||
i2c_master_bus_handle_t i2c_bus_handle = bsp_i2c_init();
|
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(I2C_PORT_NUM, i2c_bus_handle,
|
||||||
ESP_ERROR_CHECK(i2cdev_adopt_bus(0, i2c_bus_handle, 18, 19)); // Port 0, SDA=18, SCL=19
|
EXAMPLE_PIN_I2C_SDA, EXAMPLE_PIN_I2C_SCL));
|
||||||
|
|
||||||
// Restliche Peripherie
|
// Restliche Peripherie
|
||||||
bsp_spi_init();
|
bsp_spi_init();
|
||||||
bsp_battery_init();
|
bsp_battery_init();
|
||||||
@@ -456,9 +454,9 @@ void app_main(void)
|
|||||||
// SEN5x
|
// SEN5x
|
||||||
const sen5x_i2c_cfg_t cfg = {
|
const sen5x_i2c_cfg_t cfg = {
|
||||||
.addr = 0x69,
|
.addr = 0x69,
|
||||||
.port = 0,
|
.port = I2C_PORT_NUM,
|
||||||
.sda = 18,
|
.sda = EXAMPLE_PIN_I2C_SDA,
|
||||||
.scl = 19,
|
.scl = EXAMPLE_PIN_I2C_SCL,
|
||||||
.sda_pullup = true,
|
.sda_pullup = true,
|
||||||
.scl_pullup = true,
|
.scl_pullup = true,
|
||||||
.freq = 400000
|
.freq = 400000
|
||||||
|
|||||||
Reference in New Issue
Block a user