logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap_introspection.h (5223B)


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