1_常规项目配置
pio run -t menuconfig
设置flash大小
保存配置 S
退出 ESC
idf设置
idf.enableIdfComponentManager
2_BME280_I2C
移植目标仓库
https://github.com/akurczyk/bme280_esp32_driver
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "bme280.h"
void delay_sec(int time)
{
vTaskDelay(time * 1000 / portTICK_PERIOD_MS);
}
void app_main()
{
bme280_config_t bme0 = {
.sda_pin = GPIO_NUM_21,
.scl_pin = GPIO_NUM_22,
.i2c_instance = I2C_NUM_0
};
bme280_setup(&bme0);
for (;;)
{
bme280_measurement_t reading;
bme280_make_measurement(&bme0, &reading);
bme280_print_measurement(&reading);
delay_sec(10);
}
}
3_ST7789_SPI_1.54
移植目标仓库
https://github.com/nopnop2002/esp-idf-st7789
spiffs_create_partition_image(storage ../font FLASH_IN_PROJECT)
board_build.partitions = partitions_example.csv
pio run -t menuconfig