Make it 'flashable'
This commit is contained in:
parent
793eb33f67
commit
f11a189e31
4 changed files with 25 additions and 6 deletions
|
@ -2,6 +2,10 @@
|
|||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
|
||||
# Disable C++ thread-safe statics to avoid pthread dependency
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-threadsafe-statics>)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/components")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
|
3
Makefile
3
Makefile
|
@ -12,3 +12,6 @@ build:
|
|||
# idf.py reconfigure
|
||||
# idf.py defconfig
|
||||
idf.py build
|
||||
|
||||
flash:
|
||||
idf.py -p /dev/ttyUSB0 flash monitor
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
idf_component_register(
|
||||
SRCS "bme680_esp8266.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES bme68x esp8266
|
||||
REQUIRES bme68x esp8266 pthread
|
||||
# PRIV_REQUIRES driver
|
||||
)
|
||||
|
|
|
@ -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 ------------- */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue