Wake from S3 using any key

This commit is contained in:
Tim Crawford
2020-02-20 13:51:09 -07:00
parent 0379c6ed35
commit 3014fb3a41
3 changed files with 24 additions and 0 deletions

View File

@ -5,6 +5,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>
bool kbscan_enabled = false;
@ -29,6 +30,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20
bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}
switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {

View File

@ -6,6 +6,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>
bool kbscan_enabled = false;
@ -30,6 +31,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20
bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}
switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {

View File

@ -6,6 +6,7 @@
#include <board/kbscan.h>
#include <board/keymap.h>
#include <board/pmc.h>
#include <board/power.h>
#include <common/debug.h>
bool kbscan_enabled = false;
@ -30,6 +31,13 @@ void kbscan_init(void) {
#define DEBOUNCE_DELAY 20
bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
if (pressed &&
(power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3)) {
gpio_set(&SWI_N, false);
delay_ticks(10); //TODO: find correct delay
gpio_set(&SWI_N, true);
}
switch (key & KT_MASK) {
case (KT_NORMAL):
if (kbscan_enabled) {