Skip to content

Commit a9689ad

Browse files
Wakeup LPME-IO on master key press event
1 parent 94eb2d2 commit a9689ad

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

tmk_core/protocol/nrf/lpme.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,23 @@ static matrix_row_t lpme_read_row(lpme_config_t const * const config, uint8_t ro
150150
}
151151

152152
extern const uint8_t MAINTASK_INTERVAL;
153-
uint32_t lpme_scan(lpme_config_t const * const config, matrix_row_t *rows)
154-
{
153+
uint32_t lpme_scan(lpme_config_t const *const config, matrix_row_t *rows,
154+
bool wakeup) {
155155
uint32_t change = 0;
156156
static uint32_t run_mode = 0;
157157
static uint32_t sleep_counter = 0;
158158
static uint32_t sleep_enter_counter = 0;
159159
const uint32_t sleep_enter_threthold1 = 10000 / MAINTASK_INTERVAL;
160160
const uint32_t sleep1_interval = 60 / MAINTASK_INTERVAL;
161161
const uint32_t sleep_enter_threthold2 = 30000 / MAINTASK_INTERVAL;
162-
const uint32_t sleep2_interval = 120 / MAINTASK_INTERVAL;
162+
const uint32_t sleep2_interval = 90 / MAINTASK_INTERVAL;
163+
164+
if (wakeup) {
165+
run_mode = 0;
166+
sleep_enter_counter = 0;
167+
sleep_counter = 0;
168+
dprint("LPME wake up\n");
169+
}
163170

164171
if (run_mode == 0) {
165172
} else if (run_mode == 1) {
@@ -228,4 +235,3 @@ uint32_t lpme_scan(lpme_config_t const * const config, matrix_row_t *rows)
228235

229236
return change;
230237
}
231-

tmk_core/protocol/nrf/lpme.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ typedef struct {
1818
} lpme_config_t;
1919

2020
void lpme_init(lpme_config_t const *const config);
21-
uint32_t lpme_scan(lpme_config_t const *const config, matrix_row_t *rows);
21+
uint32_t lpme_scan(lpme_config_t const *const config, matrix_row_t *rows,
22+
bool wakeup);

tmk_core/protocol/nrf/matrix_lpme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static uint32_t scan_col2row(matrix_row_t *matrix_raw)
112112
uint32_t change = matrix_func_col2row.scan(matrix_raw);
113113

114114
uint8_t matrix_offset_slave = config->matrix.is_left_hand ? config->matrix.device_rows : 0;
115-
change |= lpme_scan(&lpme_config, &matrix_raw[matrix_offset_slave]);
115+
change |= lpme_scan(&lpme_config, &matrix_raw[matrix_offset_slave], change);
116116

117117
return change;
118118
}
@@ -152,7 +152,7 @@ static uint32_t scan_row2col(matrix_row_t *matrix_raw)
152152
uint32_t change = matrix_func_row2col.scan(matrix_raw);
153153

154154
uint8_t matrix_offset_slave = config->matrix.is_left_hand ? config->matrix.device_rows : 0;
155-
change |= lpme_scan(&lpme_config, &matrix_raw[matrix_offset_slave]);
155+
change |= lpme_scan(&lpme_config, &matrix_raw[matrix_offset_slave], change);
156156

157157
return change;
158158
}

0 commit comments

Comments
 (0)