mirror of
https://github.com/esphome/esphome.git
synced 2024-12-02 11:44:13 +01:00
28 lines
787 B
Python
28 lines
787 B
Python
import esphome.config_validation as cv
|
|
import esphome.codegen as cg
|
|
|
|
CODEOWNERS = ["@esphome/core"]
|
|
|
|
CONF_IMPLEMENTATION = "implementation"
|
|
IMPLEMENTATION_LWIP_TCP = "lwip_tcp"
|
|
IMPLEMENTATION_BSD_SOCKETS = "bsd_sockets"
|
|
|
|
CONFIG_SCHEMA = cv.Schema(
|
|
{
|
|
cv.SplitDefault(
|
|
CONF_IMPLEMENTATION,
|
|
esp8266=IMPLEMENTATION_LWIP_TCP,
|
|
esp32=IMPLEMENTATION_BSD_SOCKETS,
|
|
): cv.one_of(
|
|
IMPLEMENTATION_LWIP_TCP, IMPLEMENTATION_BSD_SOCKETS, lower=True, space="_"
|
|
),
|
|
}
|
|
)
|
|
|
|
|
|
async def to_code(config):
|
|
impl = config[CONF_IMPLEMENTATION]
|
|
if impl == IMPLEMENTATION_LWIP_TCP:
|
|
cg.add_define("USE_SOCKET_IMPL_LWIP_TCP")
|
|
elif impl == IMPLEMENTATION_BSD_SOCKETS:
|
|
cg.add_define("USE_SOCKET_IMPL_BSD_SOCKETS")
|