qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

keymap_introspection.h (5223B)


      1 // Copyright 2022 Nick Brassel (@tzarc)
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 #pragma once
      4 
      5 #include <stdint.h>
      6 #include <stdbool.h>
      7 
      8 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      9 // Key mapping
     10 
     11 // Get the number of layers defined in the keymap, stored in firmware rather than any other persistent storage
     12 uint8_t keymap_layer_count_raw(void);
     13 // Get the number of layers defined in the keymap, potentially stored dynamically
     14 uint8_t keymap_layer_count(void);
     15 
     16 // Get the keycode for the keymap location, stored in firmware rather than any other persistent storage
     17 uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column);
     18 // Get the keycode for the keymap location, potentially stored dynamically
     19 uint16_t keycode_at_keymap_location(uint8_t layer_num, uint8_t row, uint8_t column);
     20 
     21 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     22 // Encoder mapping
     23 
     24 #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
     25 
     26 // Get the number of layers defined in the encoder map, stored in firmware rather than any other persistent storage
     27 uint8_t encodermap_layer_count_raw(void);
     28 // Get the number of layers defined in the encoder map, potentially stored dynamically
     29 uint8_t encodermap_layer_count(void);
     30 
     31 // Get the keycode for the encoder mapping location, stored in firmware rather than any other persistent storage
     32 uint16_t keycode_at_encodermap_location_raw(uint8_t layer_num, uint8_t encoder_idx, bool clockwise);
     33 // Get the keycode for the encoder mapping location, potentially stored dynamically
     34 uint16_t keycode_at_encodermap_location(uint8_t layer_num, uint8_t encoder_idx, bool clockwise);
     35 
     36 #endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
     37 
     38 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     39 // Dip Switch mapping
     40 
     41 #if defined(DIP_SWITCH_ENABLE) && defined(DIP_SWITCH_MAP_ENABLE)
     42 
     43 // Get the keycode for the dip_switch mapping location, stored in firmware rather than any other persistent storage
     44 uint16_t keycode_at_dip_switch_map_location_raw(uint8_t switch_idx, bool on);
     45 // Get the keycode for the dip_switch mapping location, potentially stored dynamically
     46 uint16_t keycode_at_dip_switch_map_location(uint8_t switch_idx, bool on);
     47 
     48 #endif // defined(DIP_SWITCH_ENABLE) && defined(DIP_SWITCH_MAP_ENABLE)
     49 
     50 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     51 // Combos
     52 
     53 #if defined(COMBO_ENABLE)
     54 
     55 // Forward declaration of combo_t so we don't need to deal with header reordering
     56 struct combo_t;
     57 typedef struct combo_t combo_t;
     58 
     59 // Get the number of combos defined in the user's keymap, stored in firmware rather than any other persistent storage
     60 uint16_t combo_count_raw(void);
     61 // Get the number of combos defined in the user's keymap, potentially stored dynamically
     62 uint16_t combo_count(void);
     63 
     64 // Get the combo definition, stored in firmware rather than any other persistent storage
     65 combo_t* combo_get_raw(uint16_t combo_idx);
     66 // Get the combo definition, potentially stored dynamically
     67 combo_t* combo_get(uint16_t combo_idx);
     68 
     69 #endif // defined(COMBO_ENABLE)
     70 
     71 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     72 // Tap Dance
     73 
     74 #if defined(TAP_DANCE_ENABLE)
     75 
     76 // Forward declaration of tap_dance_action_t so we don't need to deal with header reordering
     77 struct tap_dance_action_t;
     78 typedef struct tap_dance_action_t tap_dance_action_t;
     79 
     80 // Get the number of tap dances defined in the user's keymap, stored in firmware rather than any other persistent storage
     81 uint16_t tap_dance_count_raw(void);
     82 // Get the number of tap dances defined in the user's keymap, potentially stored dynamically
     83 uint16_t tap_dance_count(void);
     84 
     85 // Get the tap dance definitions, stored in firmware rather than any other persistent storage
     86 tap_dance_action_t* tap_dance_get_raw(uint16_t tap_dance_idx);
     87 // Get the tap dance definitions, potentially stored dynamically
     88 tap_dance_action_t* tap_dance_get(uint16_t tap_dance_idx);
     89 
     90 #endif // defined(TAP_DANCE_ENABLE)
     91 
     92 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     93 // Key Overrides
     94 
     95 #if defined(KEY_OVERRIDE_ENABLE)
     96 
     97 // Forward declaration of key_override_t so we don't need to deal with header reordering
     98 struct key_override_t;
     99 typedef struct key_override_t key_override_t;
    100 
    101 // Get the number of key overrides defined in the user's keymap, stored in firmware rather than any other persistent storage
    102 uint16_t key_override_count_raw(void);
    103 // Get the number of key overrides defined in the user's keymap, potentially stored dynamically
    104 uint16_t key_override_count(void);
    105 
    106 // Get the key override definitions, stored in firmware rather than any other persistent storage
    107 const key_override_t* key_override_get_raw(uint16_t key_override_idx);
    108 // Get the key override definitions, potentially stored dynamically
    109 const key_override_t* key_override_get(uint16_t key_override_idx);
    110 
    111 #endif // defined(KEY_OVERRIDE_ENABLE)