Define touchscreen support when in use. (#3296)

This commit is contained in:
Ian Reinhart Geiser 2022-03-31 23:46:39 -04:00 committed by GitHub
parent 7f7175b184
commit 9de61fcf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import esphome.codegen as cg
from esphome.components import display from esphome.components import display
from esphome import automation from esphome import automation
from esphome.const import CONF_ON_TOUCH from esphome.const import CONF_ON_TOUCH
from esphome.core import coroutine_with_priority
CODEOWNERS = ["@jesserockz"] CODEOWNERS = ["@jesserockz"]
DEPENDENCIES = ["display"] DEPENDENCIES = ["display"]
@ -39,3 +40,9 @@ async def register_touchscreen(var, config):
[(TouchPoint, "touch")], [(TouchPoint, "touch")],
config[CONF_ON_TOUCH], config[CONF_ON_TOUCH],
) )
@coroutine_with_priority(100.0)
async def to_code(config):
cg.add_global(touchscreen_ns.using)
cg.add_define("USE_TOUCHSCREEN")

View File

@ -40,6 +40,7 @@
#define USE_SWITCH #define USE_SWITCH
#define USE_TEXT_SENSOR #define USE_TEXT_SENSOR
#define USE_TIME #define USE_TIME
#define USE_TOUCHSCREEN
#define USE_UART_DEBUGGER #define USE_UART_DEBUGGER
#define USE_WIFI #define USE_WIFI