forked from zmkfirmware/zmk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luke Roberts
committed
Jul 21, 2022
1 parent
f68692e
commit 78714c5
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c | ||
index d2ca14dc..9619fcf7 100644 | ||
--- a/app/src/ext_power_generic.c | ||
+++ b/app/src/ext_power_generic.c | ||
@@ -13,6 +13,9 @@ | ||
#include <settings/settings.h> | ||
#include <drivers/gpio.h> | ||
#include <drivers/ext_power.h> | ||
+#include <drivers/display.h> | ||
+ | ||
+#define ZMK_DISPLAY_NAME CONFIG_LVGL_DISPLAY_DEV_NAME | ||
|
||
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) | ||
|
||
@@ -59,6 +62,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; | ||
@@ -68,6 +81,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(); | ||
} | ||
|
||
@@ -80,6 +94,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(); | ||
} | ||
|