forked from kofal.net/zmk
feat: Add soft on/off support.
Initial work on a soft on/off support for ZMK. Triggering soft off puts the device into deep sleep with only a specific GPIO pin configured to wake the device, avoiding waking from other key presses in the matrix like the normal deep sleep. Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
committed by
Pete Johanson
parent
58ccc5970d
commit
adb3a13dc5
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/bluetooth/addr.h>
|
||||
#include <zephyr/drivers/kscan.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
@@ -75,6 +76,11 @@ int zmk_kscan_init(const struct device *dev) {
|
||||
|
||||
kscan_config(dev, zmk_kscan_callback);
|
||||
kscan_enable_callback(dev);
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
if (pm_device_wakeup_is_capable(dev)) {
|
||||
pm_device_wakeup_enable(dev, true);
|
||||
}
|
||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user