Configuring of I2C fails
Posted: Fri Nov 15, 2024 9:37 pm
Hi,
I use ESP-IDF and the Espressif-IDE (Eclipse plugin). I succesfully compiled and ran the i2c_tools example.
Now I am trying to develop my own application. I have a component MPU9250 with a source file MPU9250_fckx.cpp.
Parts of my code:
The definition of i2c_master_bus_config_t i2c_bus_config is (apart from the names of the right hand sides) identical as the code in the i2c_tools example (cmd_i2ctools.c)
Upon compilation of my own code I get the error:
error: either all initializer clauses should be designated or none of them should be
.flags.enable_internal_pullup = true,
This is very puzzling.
Can anyone help?
Thanks
I use ESP-IDF and the Espressif-IDE (Eclipse plugin). I succesfully compiled and ran the i2c_tools example.
Now I am trying to develop my own application. I have a component MPU9250 with a source file MPU9250_fckx.cpp.
Parts of my code:
Code: Select all
#include "driver/i2c_master.h"
#include "esp_err.h"
#include "esp_log.h"
#include "MPU9250_fckx.h"
#include <math.h>
.....
void MPU9250_fckx::i2c_init() {
ESP_LOGI(TAG,"Hello i2c_init!");
printf("Hello i2c_init!\n");
//i2c_config_t conf;
i2c_master_bus_config_t i2c_bus_config = {
.clk_source = I2C_CLK_SRC_DEFAULT,
.i2c_port = I2C_NUM_0,
.scl_io_num = SCL_PIN, //i2c_gpio_scl,
.sda_io_num = SDA_PIN, //i2c_gpio_sda,
.glitch_ignore_cnt = 7,
.flags.enable_internal_pullup = true,
};
Code: Select all
i2c_master_bus_config_t i2c_bus_config = {
.clk_source = I2C_CLK_SRC_DEFAULT,
.i2c_port = i2c_port,
.scl_io_num = i2c_gpio_scl,
.sda_io_num = i2c_gpio_sda,
.glitch_ignore_cnt = 7,
.flags.enable_internal_pullup = true,
};
error: either all initializer clauses should be designated or none of them should be
.flags.enable_internal_pullup = true,
This is very puzzling.
Can anyone help?
Thanks