esp32 - I2C
Posted: Fri Jun 18, 2021 3:34 pm
hello
i am trying to run the next example from the i2c api datasheet @ docs.espressif.com - API I2C.
#include ""driver/i2c.h""
#define I2C_SCL_IO 22
#define I2C_SDA_IO 21
#define I2C_FREQ_HZ 100000
#define I2C_PORT_NUM I2C_NUM_0
#define I2C_TX_BUF_DISABLE 0
#define I2C_RX_BUF_DISABLE 0
#define I2C_FREQ_HZ 100000
int i2c_master_port = I2C_PORT_NUM;
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_SDA_IO,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_io_num = I2C_SCL_IO,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = I2C_FREQ_HZ,
};
in the arduino , when Verify/Compile i got the next error:
ESP32-MQTT-ESP32:71:1: error: expected primary-expression before '.' token
.master.clk_speed = I2C_FREQ_HZ,
Does someone has any idea what is wrong?
thanks
i am trying to run the next example from the i2c api datasheet @ docs.espressif.com - API I2C.
#include ""driver/i2c.h""
#define I2C_SCL_IO 22
#define I2C_SDA_IO 21
#define I2C_FREQ_HZ 100000
#define I2C_PORT_NUM I2C_NUM_0
#define I2C_TX_BUF_DISABLE 0
#define I2C_RX_BUF_DISABLE 0
#define I2C_FREQ_HZ 100000
int i2c_master_port = I2C_PORT_NUM;
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_SDA_IO,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_io_num = I2C_SCL_IO,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.master.clk_speed = I2C_FREQ_HZ,
};
in the arduino , when Verify/Compile i got the next error:
ESP32-MQTT-ESP32:71:1: error: expected primary-expression before '.' token
.master.clk_speed = I2C_FREQ_HZ,
Does someone has any idea what is wrong?
thanks