diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index aab09cecbbc..80675482913 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -14,6 +14,9 @@ #include #include #include +#include + +#define ZMK_DISPLAY_NAME CONFIG_LVGL_DISPLAY_DEV_NAME #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) @@ -57,6 +60,16 @@ int ext_power_save_state() { #endif } +static void drivers_update_power_state(bool power) { + LOG_DBG("drivers_update_power_state: %s", power?"true":"false"); + static const struct device *display; + display = device_get_binding(ZMK_DISPLAY_NAME); + + if (display != NULL) { + display_update_ext_power(display, power); + } +} + static int ext_power_generic_enable(const struct device *dev) { struct ext_power_generic_data *data = dev->data; const struct ext_power_generic_config *config = dev->config; @@ -66,6 +79,7 @@ static int ext_power_generic_enable(const struct device *dev) { return -EIO; } data->status = true; + drivers_update_power_state(true); return ext_power_save_state(); } @@ -78,6 +92,8 @@ static int ext_power_generic_disable(const struct device *dev) { return -EIO; } data->status = false; + + drivers_update_power_state(false); return ext_power_save_state(); }