You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

  1. // Copyright 2022 Nick Brassel (@tzarc)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. // Pull the actual keymap code so that we can inspect stuff from it
  4. #include KEYMAP_C
  5. // Allow for keymap or userspace rules.mk to specify an alternate location for the keymap array
  6. #ifdef INTROSPECTION_KEYMAP_C
  7. # include INTROSPECTION_KEYMAP_C
  8. #endif // INTROSPECTION_KEYMAP_C
  9. #include "keymap_introspection.h"
  10. #define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t))))
  11. uint8_t keymap_layer_count(void) {
  12. return NUM_KEYMAP_LAYERS;
  13. }
  14. #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
  15. # define NUM_ENCODERMAP_LAYERS ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t))))
  16. uint8_t encodermap_layer_count(void) {
  17. return NUM_ENCODERMAP_LAYERS;
  18. }
  19. _Static_assert(NUM_KEYMAP_LAYERS == NUM_ENCODERMAP_LAYERS, "Number of encoder_map layers doesn't match the number of keymap layers");
  20. #endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)