From e511999e916b5ba5a9bd76ac3ad991bbd365474a Mon Sep 17 00:00:00 2001 From: Edward Hesketh Date: Fri, 30 Aug 2024 22:35:27 +0100 Subject: [PATCH] feat: add key index generator function --- include/squirrel_keymap.h | 1 + src/squirrel_keymap.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/squirrel_keymap.h b/include/squirrel_keymap.h index bba0f71..c982e69 100644 --- a/include/squirrel_keymap.h +++ b/include/squirrel_keymap.h @@ -2,6 +2,7 @@ #define SQUIRREL_KEYMAP_H #include "squirrel_key.h" +int key_index_from_xy(int x, int y, int width); struct key nop(void); struct key keyboard(uint8_t keycode); struct key keyboard_modifier(uint8_t modifier); diff --git a/src/squirrel_keymap.c b/src/squirrel_keymap.c index ada945f..4cbc6ce 100644 --- a/src/squirrel_keymap.c +++ b/src/squirrel_keymap.c @@ -2,6 +2,8 @@ #include "squirrel_quantum.h" #include +int key_index_from_xy(int x, int y, int width) { return y * width + x; } + struct key nop(void) { return (struct key){ .pressed = key_nop,