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 <florian.fleissner@inpartik.de>
pull/735/head
Florian Fleissner 5 years ago
parent c590bea35b
commit 686044264e

@ -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_;

@ -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__ \

Loading…
Cancel
Save