Add compiler_support.h
(#25274)
This commit is contained in:
parent
fa24b0fcce
commit
955809bd5a
36 changed files with 142 additions and 81 deletions
|
@ -13,6 +13,7 @@
|
|||
# include INTROSPECTION_KEYMAP_C
|
||||
#endif // INTROSPECTION_KEYMAP_C
|
||||
|
||||
#include "compiler_support.h"
|
||||
#include "keymap_introspection.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -30,9 +31,9 @@ __attribute__((weak)) uint8_t keymap_layer_count(void) {
|
|||
}
|
||||
|
||||
#ifdef DYNAMIC_KEYMAP_ENABLE
|
||||
_Static_assert(NUM_KEYMAP_LAYERS_RAW <= MAX_LAYER, "Number of keymap layers exceeds maximum set by DYNAMIC_KEYMAP_LAYER_COUNT");
|
||||
STATIC_ASSERT(NUM_KEYMAP_LAYERS_RAW <= MAX_LAYER, "Number of keymap layers exceeds maximum set by DYNAMIC_KEYMAP_LAYER_COUNT");
|
||||
#else
|
||||
_Static_assert(NUM_KEYMAP_LAYERS_RAW <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT");
|
||||
STATIC_ASSERT(NUM_KEYMAP_LAYERS_RAW <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT");
|
||||
#endif
|
||||
|
||||
uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column) {
|
||||
|
@ -61,7 +62,7 @@ __attribute__((weak)) uint8_t encodermap_layer_count(void) {
|
|||
return encodermap_layer_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(NUM_KEYMAP_LAYERS_RAW == NUM_ENCODERMAP_LAYERS_RAW, "Number of encoder_map layers doesn't match the number of keymap layers");
|
||||
STATIC_ASSERT(NUM_KEYMAP_LAYERS_RAW == NUM_ENCODERMAP_LAYERS_RAW, "Number of encoder_map layers doesn't match the number of keymap layers");
|
||||
|
||||
uint16_t keycode_at_encodermap_location_raw(uint8_t layer_num, uint8_t encoder_idx, bool clockwise) {
|
||||
if (layer_num < NUM_ENCODERMAP_LAYERS_RAW && encoder_idx < NUM_ENCODERS) {
|
||||
|
@ -106,7 +107,7 @@ __attribute__((weak)) uint16_t combo_count(void) {
|
|||
return combo_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(key_combos) <= (QK_KB), "Number of combos is abnormally high. Are you using SAFE_RANGE in an enum for combos?");
|
||||
STATIC_ASSERT(ARRAY_SIZE(key_combos) <= (QK_KB), "Number of combos is abnormally high. Are you using SAFE_RANGE in an enum for combos?");
|
||||
|
||||
combo_t* combo_get_raw(uint16_t combo_idx) {
|
||||
if (combo_idx >= combo_count_raw()) {
|
||||
|
@ -133,7 +134,7 @@ __attribute__((weak)) uint16_t tap_dance_count(void) {
|
|||
return tap_dance_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(tap_dance_actions) <= (QK_TAP_DANCE_MAX - QK_TAP_DANCE), "Number of tap dance actions exceeds maximum. Are you using SAFE_RANGE in tap dance enum?");
|
||||
STATIC_ASSERT(ARRAY_SIZE(tap_dance_actions) <= (QK_TAP_DANCE_MAX - QK_TAP_DANCE), "Number of tap dance actions exceeds maximum. Are you using SAFE_RANGE in tap dance enum?");
|
||||
|
||||
tap_dance_action_t* tap_dance_get_raw(uint16_t tap_dance_idx) {
|
||||
if (tap_dance_idx >= tap_dance_count_raw()) {
|
||||
|
@ -161,7 +162,7 @@ __attribute__((weak)) uint16_t key_override_count(void) {
|
|||
return key_override_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(key_overrides) <= (QK_KB), "Number of key overrides is abnormally high. Are you using SAFE_RANGE in an enum for key overrides?");
|
||||
STATIC_ASSERT(ARRAY_SIZE(key_overrides) <= (QK_KB), "Number of key overrides is abnormally high. Are you using SAFE_RANGE in an enum for key overrides?");
|
||||
|
||||
const key_override_t* key_override_get_raw(uint16_t key_override_idx) {
|
||||
if (key_override_idx >= key_override_count_raw()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue