From a7a15cb01f45449f6f84c6f718ca4db8c9834918 Mon Sep 17 00:00:00 2001 From: Edward Hesketh Date: Fri, 30 Aug 2024 22:58:09 +0100 Subject: [PATCH] feat: new_layer function --- include/squirrel_keymap.h | 3 ++- src/squirrel_keymap.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/squirrel_keymap.h b/include/squirrel_keymap.h index c982e69..b9e0dcb 100644 --- a/include/squirrel_keymap.h +++ b/include/squirrel_keymap.h @@ -2,7 +2,8 @@ #define SQUIRREL_KEYMAP_H #include "squirrel_key.h" -int key_index_from_xy(int x, int y, int width); +void new_layer(int layer, struct key *keys, int key_count); + 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 4cbc6ce..d37dcf0 100644 --- a/src/squirrel_keymap.c +++ b/src/squirrel_keymap.c @@ -2,7 +2,11 @@ #include "squirrel_quantum.h" #include -int key_index_from_xy(int x, int y, int width) { return y * width + x; } +void new_layer(int layer, struct key *keys, int key_count) { + for (int i = 0; i < key_count; i++) { + layers[layer].keys[i] = keys[i]; + } +} struct key nop(void) { return (struct key){