mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
[nrf52] allow to build for non nrf52840 boards (#17373)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
@@ -233,7 +233,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
),
|
||||
cv.Optional(KEY_BOOTLOADER): cv.one_of(*BOOTLOADERS, lower=True),
|
||||
cv.Optional(CONF_DFU): _dfu_schema,
|
||||
cv.Optional(CONF_DCDC, default=True): cv.boolean,
|
||||
cv.Optional(CONF_DCDC): cv.boolean,
|
||||
cv.Optional(CONF_REG0): cv.Schema(
|
||||
{
|
||||
cv.Required(CONF_VOLTAGE): cv.All(
|
||||
@@ -367,16 +367,17 @@ async def to_code(config: ConfigType) -> None:
|
||||
if dfu_config := config.get(CONF_DFU):
|
||||
CORE.add_job(_dfu_to_code, dfu_config)
|
||||
framework_ver: cv.Version = CORE.data[KEY_CORE][KEY_FRAMEWORK_VERSION]
|
||||
if framework_ver < cv.Version(2, 9, 2):
|
||||
zephyr_add_prj_conf("BOARD_ENABLE_DCDC", config[CONF_DCDC])
|
||||
else:
|
||||
zephyr_add_overlay(
|
||||
f"""
|
||||
®1 {{
|
||||
regulator-initial-mode = <{"NRF5X_REG_MODE_DCDC" if config[CONF_DCDC] else "NRF5X_REG_MODE_LDO"}>;
|
||||
}};
|
||||
"""
|
||||
)
|
||||
if CONF_DCDC in config:
|
||||
if framework_ver < cv.Version(2, 9, 2):
|
||||
zephyr_add_prj_conf("BOARD_ENABLE_DCDC", config[CONF_DCDC])
|
||||
else:
|
||||
zephyr_add_overlay(
|
||||
f"""
|
||||
®1 {{
|
||||
regulator-initial-mode = <{"NRF5X_REG_MODE_DCDC" if config[CONF_DCDC] else "NRF5X_REG_MODE_LDO"}>;
|
||||
}};
|
||||
"""
|
||||
)
|
||||
|
||||
if reg0_config := config.get(CONF_REG0):
|
||||
value = VOLTAGE_LEVELS.index(reg0_config[CONF_VOLTAGE])
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
nrf52:
|
||||
@@ -0,0 +1,16 @@
|
||||
esphome:
|
||||
name: componenttestnrf52
|
||||
friendly_name: $component_name
|
||||
|
||||
nrf52:
|
||||
board: bbc_microbit
|
||||
|
||||
logger:
|
||||
level: VERY_VERBOSE
|
||||
hardware_uart: UART0
|
||||
|
||||
packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_test_file: $component_test_file
|
||||
Reference in New Issue
Block a user