2_ESP-IDF_常规项目配置,BME280_I2C,ST7789_SPI_1.54

784 阅读1分钟

1_常规项目配置

image.png

pio run -t menuconfig

设置flash大小

image.png

image.png

保存配置 S

退出 ESC

idf设置

idf.enableIdfComponentManager

2_BME280_I2C


移植目标仓库

https://github.com/akurczyk/bme280_esp32_driver

image.png

#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);
    }
}

录屏_serials_20210528153836.gif

3_ST7789_SPI_1.54


移植目标仓库

https://github.com/nopnop2002/esp-idf-st7789

image.png

spiffs_create_partition_image(storage ../font FLASH_IN_PROJECT)

image.png

board_build.partitions = partitions_example.csv

image.png

image.png

pio run -t menuconfig

image.png