1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-22 21:22:22 +01:00

Initial ESP32-C3-DevKitM-1 board support (#2062)

Co-authored-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
Stefan Agner
2021-07-26 11:10:56 +02:00
committed by GitHub
parent 159744e09e
commit d9f09a7523
10 changed files with 984 additions and 887 deletions

View File

@@ -4,7 +4,7 @@ import re
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation, pins
from esphome import automation, boards
from esphome.const import (
CONF_ARDUINO_VERSION,
CONF_BOARD,
@@ -50,18 +50,19 @@ VERSION_REGEX = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+(?:[ab]\d+)?$")
CONF_NAME_ADD_MAC_SUFFIX = "name_add_mac_suffix"
def validate_board(value):
def validate_board(value: str):
if CORE.is_esp8266:
board_pins = pins.ESP8266_BOARD_PINS
boardlist = boards.ESP8266_BOARD_PINS.keys()
elif CORE.is_esp32:
board_pins = pins.ESP32_BOARD_PINS
boardlist = list(boards.ESP32_BOARD_PINS.keys())
boardlist += list(boards.ESP32_C3_BOARD_PINS.keys())
else:
raise NotImplementedError
if value not in board_pins:
if value not in boardlist:
raise cv.Invalid(
"Could not find board '{}'. Valid boards are {}".format(
value, ", ".join(sorted(board_pins.keys()))
value, ", ".join(sorted(boardlist))
)
)
return value