這邊用ESP32-S3 試著IDF 6.01編譯hayschan__max6675 發生 幾個錯誤
D:/ESP32_Projects/max6675/managed_components/hayschan__max6675/include/max6675.h:4:10: fatal error: driver/gpio.h: No such file or directory
4 | #include "driver/gpio.h"
| ^~~~~~~~~~~~~~~
-- Build files have been written to: D:/ESP32_Projects/max6675/build/bootloader
ninja: build stopped: subcommand failed.
Compilation failed because max6675.h (in "hayschan__max6675" component) includes driver/gpio.h, provided by esp_driver_gpio component(s).
However, esp_driver_gpio component(s) is not in the requirements list of "hayschan__max6675".
To fix this, add esp_driver_gpio to REQUIRES list of idf_component_register call in D:\ESP32_Projects\max6675\managed_components\hayschan__max6675\CMakeLists.txt.
ninja failed with exit code 1, output of the command is in the D:\ESP32_Projects\max6675\build\log\idf_py_stderr_output_24072 and D:\ESP32_Projects\max6675\build\log\idf_py_stdout_output_24072
建議要如何修正?
源碼是
#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_log.h>
#include <max6675.h>
static const char *TAG = "MAX6675_DEMO";
// 定義 GPIO 引腳
#define SPI_MISO_GPIO 11
#define SPI_SCK_GPIO 12
#define SPI_CS_GPIO 10
void app_main(void)
{
// 1. 初始化 MAX6675 設備結構體
max6675_t dev = {
.spi_dev = NULL,
.miso_gpio = SPI_MISO_GPIO,
.sclk_gpio = SPI_SCK_GPIO,
.cs_gpio = SPI_CS_GPIO
};
// 2. 初始化 MAX6675 驅動
esp_err_t res = max6675_init(&dev);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Could not initialize MAX6675 sensor: %d", res);
return;
}
ESP_LOGI(TAG, "MAX6675 initialized successfully.");
// 3. 循環讀取溫度
while (1) {
float temperature;
res = max6675_get_temperature(&dev, &temperature);
if (res == ESP_OK) {
ESP_LOGI(TAG, "Current Temperature: %.2f °C", temperature);
} else {
ESP_LOGE(TAG, "Could not read temperature from MAX6675: %d", res);
}
// MAX6675 轉換時間約為 0.22 秒,讀取頻率不建議高於 4Hz
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
max6675在IDF 6.01 編譯下要取哪個Componet
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- ESP32-S31
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- ESP32-S31 中文讨论版
- 喵伴 中文讨论版
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 2 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.
Information
Espressif ESP32 ... Available now!