1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/quantum/keymap_introspection.c
James Young efdd4f4d50
Clean-up of #define _ADJUST 16 instances (#18182)
* enum layer_names: 40percentclub/nori default keymap

* enum layer_names: ergotravel default keymap

* enum layer_names: handwired/atreus50 default keymap

* enum layer_names: handwired/ortho5x13 default keymap

* enum layer_names: keebio/levinson default keymap

* enum layer_names: keebio/nyquist default keymap

* enum layer_names: keebio/rorschach default keymap

* enum layer_names: keebio/viterbi default keymap

* enum layer_names: keebio/wavelet default keymap

* enum layer_names: lets_split default keymap

* enum layer_names: maple_computing/launchpad reference keymaps

Update `default` and `default_rgb` keymaps.

* enum layer_names: maple_computing/minidox default keymap

* enum layer_names: miniaxe reference keymaps

Update `default` and `underglow` keymaps.

* enum layer_names: omkbd/ergodash/mini default keymap

* enum layer_names: omkbd/ergodash/rev1 default keymap

* enum layer_names: orthodox default keymap

* enum layer_names: unikeyboard/divergetm2 default keymap

* enum layer_names: woodkeys/scarletbandana default keymap

* add _Static_assert to keymap_introspection.c
2022-08-27 23:13:44 -07:00

33 lines
1.1 KiB
C

// Copyright 2022 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
// Pull the actual keymap code so that we can inspect stuff from it
#include KEYMAP_C
// Allow for keymap or userspace rules.mk to specify an alternate location for the keymap array
#ifdef INTROSPECTION_KEYMAP_C
# include INTROSPECTION_KEYMAP_C
#endif // INTROSPECTION_KEYMAP_C
#include "keymap_introspection.h"
#define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t))))
uint8_t keymap_layer_count(void) {
return NUM_KEYMAP_LAYERS;
}
_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT");
#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
# define NUM_ENCODERMAP_LAYERS ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t))))
uint8_t encodermap_layer_count(void) {
return NUM_ENCODERMAP_LAYERS;
}
_Static_assert(NUM_KEYMAP_LAYERS == NUM_ENCODERMAP_LAYERS, "Number of encoder_map layers doesn't match the number of keymap layers");
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)