mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-12-11 20:31:02 +00:00
Process entire unlock sequence
This commit is contained in:
parent
d19285019d
commit
320f161c72
@ -15,7 +15,9 @@
|
|||||||
#ifndef SECURE_UNLOCK_SEQUENCE
|
#ifndef SECURE_UNLOCK_SEQUENCE
|
||||||
# define SECURE_UNLOCK_SEQUENCE \
|
# define SECURE_UNLOCK_SEQUENCE \
|
||||||
{ \
|
{ \
|
||||||
{ 0, 0 } \
|
{0, 0}, { \
|
||||||
|
0, 1 \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -51,12 +53,17 @@ void secure_activity_event(void) {
|
|||||||
|
|
||||||
void secure_keypress_event(uint8_t row, uint8_t col) {
|
void secure_keypress_event(uint8_t row, uint8_t col) {
|
||||||
static const uint8_t sequence[][2] = SECURE_UNLOCK_SEQUENCE;
|
static const uint8_t sequence[][2] = SECURE_UNLOCK_SEQUENCE;
|
||||||
|
static const uint8_t sequence_len = sizeof(sequence) / sizeof(sequence[0]);
|
||||||
|
|
||||||
// TODO: check keypress is actually part of unlock sequence
|
static uint8_t offset = 0;
|
||||||
uint8_t offset = 0;
|
|
||||||
if ((sequence[offset][0] == row) && (sequence[offset][1] == col)) {
|
if ((sequence[offset][0] == row) && (sequence[offset][1] == col)) {
|
||||||
|
offset++;
|
||||||
|
if (offset == sequence_len) {
|
||||||
|
offset = 0;
|
||||||
secure_unlock();
|
secure_unlock();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
offset = 0;
|
||||||
secure_lock();
|
secure_lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user