From 5a669e8170d3525f96bfb2b4c7004d22d254f942 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Sat, 22 May 2021 18:11:14 +0100 Subject: [PATCH] #91: allow set up of all keys at once --- esp32/main/keyboard.c | 10 ++++++++++ esp32/main/keyboard.h | 1 + 2 files changed, 11 insertions(+) diff --git a/esp32/main/keyboard.c b/esp32/main/keyboard.c index 65a604fc..6f567f96 100644 --- a/esp32/main/keyboard.c +++ b/esp32/main/keyboard.c @@ -57,6 +57,16 @@ void keyboard__release(uint8_t key) keyboard__update(); } +/** + * \ingroup keyboard + * \brief Set all keys on keyboard. + */ +void keyboard__set(uint64_t k) +{ + keys = k; + keyboard__update(); +} + static struct { const char *name; uint8_t value; diff --git a/esp32/main/keyboard.h b/esp32/main/keyboard.h index 7f3157b5..74f30be0 100644 --- a/esp32/main/keyboard.h +++ b/esp32/main/keyboard.h @@ -6,6 +6,7 @@ void keyboard__init(void); void keyboard__press(uint8_t key); void keyboard__release(uint8_t key); +void keyboard__set(uint64_t k); uint8_t keyboard__get_key_by_name(const char *name); const char *keyboard__get_name_by_key(const uint8_t key);