Skip to content

Commit

Permalink
initialise conf struct
Browse files Browse the repository at this point in the history
as proposed in espressif/arduino-esp32#4776. Fixes `i2c_param_config` Errors with `esp-idf > 2020r3-8.4.0`
  • Loading branch information
LFSaw authored Mar 27, 2021
1 parent e26708f commit 99ff436
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/AC101.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ esp_err_t AC101::InitI2C(void)
{
i2c_port_t i2c_master_port = (i2c_port_t) I2C_MASTER_NUM;
i2c_config_t conf;
memset(&conf, 0, sizeof(i2c_config_t)); //Might require to #include "string.h"
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = (gpio_num_t) I2C_MASTER_SDA_IO;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
Expand Down Expand Up @@ -376,4 +377,4 @@ esp_err_t AC101::ReadReg_Full(uint8_t reg, uint8_t* data_rd, size_t size)
ret |= i2c_master_cmd_begin((i2c_port_t) I2C_MASTER_NUM, cmd, 1000 / portTICK_RATE_MS);
i2c_cmd_link_delete(cmd);
return ret;
}
}

0 comments on commit 99ff436

Please sign in to comment.