Make it 'flashable'

This commit is contained in:
Artur Gurgul 2025-09-16 10:27:08 -05:00
parent 793eb33f67
commit f11a189e31
4 changed files with 25 additions and 6 deletions

View file

@ -5,6 +5,6 @@
idf_component_register(
SRCS "bme680_esp8266.c"
INCLUDE_DIRS "."
REQUIRES bme68x esp8266
REQUIRES bme68x esp8266 pthread
# PRIV_REQUIRES driver
)

View file

@ -16,16 +16,28 @@
/* --------- ESP8266 I2C init (note: clk_stretch_tick field) --------- */
static void i2c_init(void)
{
// i2c_config_t conf = {
// .mode = I2C_MODE_MASTER,
// .sda_io_num = I2C_SDA_PIN,
// .scl_io_num = I2C_SCL_PIN,
// .sda_pullup_en = GPIO_PULLUP_ENABLE,
// .scl_pullup_en = GPIO_PULLUP_ENABLE,
// .clk_stretch_tick = 300, // reasonable default on ESP8266
// };
// i2c_param_config(I2C_PORT, &conf);
// i2c_driver_install(I2C_PORT, conf.mode); // ESP8266 signature: (port, mode)
i2c_config_t conf = {
.mode = I2C_MODE_MASTER,
.sda_io_num = I2C_SDA_PIN,
.scl_io_num = I2C_SCL_PIN,
.sda_io_num = GPIO_NUM_0,
.scl_io_num = GPIO_NUM_2,
.sda_pullup_en = GPIO_PULLUP_ENABLE,
.scl_pullup_en = GPIO_PULLUP_ENABLE,
.clk_stretch_tick = 300, // reasonable default on ESP8266
.clk_stretch_tick = 300, // try 300..1000
};
i2c_param_config(I2C_PORT, &conf);
i2c_driver_install(I2C_PORT, conf.mode); // ESP8266 signature: (port, mode)
ESP_ERROR_CHECK(i2c_param_config(I2C_PORT, &conf));
ESP_ERROR_CHECK(i2c_driver_install(I2C_PORT, conf.mode));
}
/* ------------- BME68x I2C read/write helpers ------------- */