Skip to content

Instantly share code, notes, and snippets.

View IvanLi-CN's full-sized avatar

Ivan Li IvanLi-CN

View GitHub Profile
@herzig
herzig / esp-idf_i2c_scan
Created August 9, 2019 10:12
esp32 i2c scan (esp-idf)
// setup i2c master
static esp_err_t i2c_master_init()
{
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = I2C_SDA_PIN;
conf.scl_io_num = I2C_SCL_PIN;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = I2C_MASTER_FREQ_HZ;