mirror of
https://github.com/esphome/esphome.git
synced 2025-09-07 05:42:20 +01:00
ESP-IDF support and generic target platforms (#2303)
* Socket refactor and SSL * esp-idf temp * Fixes * Echo component and noise * Add noise API transport support * Updates * ESP-IDF * Complete * Fixes * Fixes * Versions update * New i2c APIs * Complete i2c refactor * SPI migration * Revert ESP Preferences migration, too complex for now * OTA support * Remove echo again * Remove ssl again * GPIOFlags updates * Rename esphal and ICACHE_RAM_ATTR * Make ESP32 arduino compilable again * Fix GPIO flags * Complete pin registry refactor and fixes * Fixes to make test1 compile * Remove sdkconfig file * Ignore sdkconfig file * Fixes in reviewing * Make test2 compile * Make test4 compile * Make test5 compile * Run clang-format * Fix lint errors * Use esp-idf APIs instead of btStart * Another round of fixes * Start implementing ESP8266 * Make test3 compile * Guard esp8266 code * Lint * Reformat * Fixes * Fixes v2 * more fixes * ESP-IDF tidy target * Convert ARDUINO_ARCH_ESPxx * Update WiFiSignalSensor * Update time ifdefs * OTA needs millis from hal * RestartSwitch needs delay from hal * ESP-IDF Uart * Fix OTA blank password * Allow setting sdkconfig * Fix idf partitions and allow setting sdkconfig from yaml * Re-add read/write compat APIs and fix esp8266 uart * Fix esp8266 store log strings in flash * Fix ESP32 arduino preferences not initialized * Update ifdefs * Change how sdkconfig change is detected * Add checks to ci-custom and fix them * Run clang-format * Add esp-idf clang-tidy target and fix errors * Fixes from clang-tidy idf round 2 * Fixes from compiling tests with esp-idf * Run clang-format * Switch test5.yaml to esp-idf * Implement ESP8266 Preferences * Lint * Re-do PIO package version selection a bit * Fix arduinoespressif32 package version * Fix unit tests * Lint * Lint fixes * Fix readv/writev not defined * Fix graphing component * Re-add all old options from core/config.py Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -9,16 +9,16 @@ from esphome.const import (
|
||||
CONF_PIN,
|
||||
CONF_SCL,
|
||||
CONF_SDA,
|
||||
ESP_PLATFORM_ESP32,
|
||||
CONF_DATA_PINS,
|
||||
CONF_RESET_PIN,
|
||||
CONF_RESOLUTION,
|
||||
CONF_BRIGHTNESS,
|
||||
CONF_CONTRAST,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.components.esp32 import add_idf_sdkconfig_option
|
||||
|
||||
ESP_PLATFORMS = [ESP_PLATFORM_ESP32]
|
||||
DEPENDENCIES = ["api"]
|
||||
DEPENDENCIES = ["esp32", "api"]
|
||||
|
||||
esp32_camera_ns = cg.esphome_ns.namespace("esp32_camera")
|
||||
ESP32Camera = esp32_camera_ns.class_("ESP32Camera", cg.PollingComponent, cg.Nameable)
|
||||
@@ -68,13 +68,15 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
cv.GenerateID(): cv.declare_id(ESP32Camera),
|
||||
cv.Required(CONF_NAME): cv.string,
|
||||
cv.Optional(CONF_DISABLED_BY_DEFAULT, default=False): cv.boolean,
|
||||
cv.Required(CONF_DATA_PINS): cv.All([pins.input_pin], cv.Length(min=8, max=8)),
|
||||
cv.Required(CONF_VSYNC_PIN): pins.input_pin,
|
||||
cv.Required(CONF_HREF_PIN): pins.input_pin,
|
||||
cv.Required(CONF_PIXEL_CLOCK_PIN): pins.input_pin,
|
||||
cv.Required(CONF_DATA_PINS): cv.All(
|
||||
[pins.internal_gpio_input_pin_number], cv.Length(min=8, max=8)
|
||||
),
|
||||
cv.Required(CONF_VSYNC_PIN): pins.internal_gpio_input_pin_number,
|
||||
cv.Required(CONF_HREF_PIN): pins.internal_gpio_input_pin_number,
|
||||
cv.Required(CONF_PIXEL_CLOCK_PIN): pins.internal_gpio_input_pin_number,
|
||||
cv.Required(CONF_EXTERNAL_CLOCK): cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_PIN): pins.output_pin,
|
||||
cv.Required(CONF_PIN): pins.internal_gpio_input_pin_number,
|
||||
cv.Optional(CONF_FREQUENCY, default="20MHz"): cv.All(
|
||||
cv.frequency, cv.one_of(20e6, 10e6)
|
||||
),
|
||||
@@ -82,12 +84,12 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
),
|
||||
cv.Required(CONF_I2C_PINS): cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_SDA): pins.output_pin,
|
||||
cv.Required(CONF_SCL): pins.output_pin,
|
||||
cv.Required(CONF_SDA): pins.internal_gpio_output_pin_number,
|
||||
cv.Required(CONF_SCL): pins.internal_gpio_output_pin_number,
|
||||
}
|
||||
),
|
||||
cv.Optional(CONF_RESET_PIN): pins.output_pin,
|
||||
cv.Optional(CONF_POWER_DOWN_PIN): pins.output_pin,
|
||||
cv.Optional(CONF_RESET_PIN): pins.internal_gpio_output_pin_number,
|
||||
cv.Optional(CONF_POWER_DOWN_PIN): pins.internal_gpio_output_pin_number,
|
||||
cv.Optional(CONF_MAX_FRAMERATE, default="10 fps"): cv.All(
|
||||
cv.framerate, cv.Range(min=0, min_included=False, max=60)
|
||||
),
|
||||
@@ -146,3 +148,8 @@ async def to_code(config):
|
||||
|
||||
cg.add_define("USE_ESP32_CAMERA")
|
||||
cg.add_build_flag("-DBOARD_HAS_PSRAM")
|
||||
|
||||
if CORE.using_esp_idf:
|
||||
cg.add_library("espressif/esp32-camera", "1.0.0")
|
||||
add_idf_sdkconfig_option("CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC", True)
|
||||
add_idf_sdkconfig_option("CONFIG_ESP32_SPIRAM_SUPPORT", True)
|
||||
|
@@ -1,7 +1,10 @@
|
||||
#ifdef USE_ESP32
|
||||
|
||||
#include "esp32_camera.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/hal.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include <freertos/task.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace esp32_camera {
|
||||
@@ -42,7 +45,9 @@ void ESP32Camera::dump_config() {
|
||||
auto conf = this->config_;
|
||||
ESP_LOGCONFIG(TAG, "ESP32 Camera:");
|
||||
ESP_LOGCONFIG(TAG, " Name: %s", this->name_.c_str());
|
||||
#ifdef USE_ARDUINO
|
||||
ESP_LOGCONFIG(TAG, " Board Has PSRAM: %s", YESNO(psramFound()));
|
||||
#endif // USE_ARDUINO
|
||||
ESP_LOGCONFIG(TAG, " Data Pins: D0:%d D1:%d D2:%d D3:%d D4:%d D5:%d D6:%d D7:%d", conf.pin_d0, conf.pin_d1,
|
||||
conf.pin_d2, conf.pin_d3, conf.pin_d4, conf.pin_d5, conf.pin_d6, conf.pin_d7);
|
||||
ESP_LOGCONFIG(TAG, " VSYNC Pin: %d", conf.pin_vsync);
|
||||
|
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef USE_ESP32
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include <esp_camera.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/queue.h>
|
||||
|
||||
namespace esphome {
|
||||
namespace esp32_camera {
|
||||
|
Reference in New Issue
Block a user