From 686044264e8815ffd1bf769e52e6ae6318753102 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Wed, 27 Nov 2019 11:36:43 +0100 Subject: [PATCH] Made the keymap a constexpr array This enables compile time exploration of the keymap from all code that is part of the sketch's compilation unit. Signed-off-by: Florian Fleissner --- src/kaleidoscope/layers.cpp | 2 +- src/kaleidoscope/layers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index ac59b49b..f3efb80e 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -33,7 +33,7 @@ __attribute__((weak)) uint8_t layer_count = 0; __attribute__((weak)) -extern const Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] = {}; +extern constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] = {}; namespace kaleidoscope { uint32_t Layer_::layer_state_; diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 0cf7d196..aaa6762f 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -26,7 +26,7 @@ // file (*.ino) to define the keymap[] array that holds the user's // layers. It also computes the number of layers in that keymap. #define KEYMAPS(layers...) __NL__ \ - const Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { layers }; __NL__ \ + constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { layers }; __NL__ \ uint8_t layer_count __NL__ \ = sizeof(keymaps_linear) / sizeof(*keymaps_linear); __NL__ \ __NL__ \