1
0

keymap_introspection.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 keycode for the encoder mapping location, stored in firmware rather than any other persistent storage
  47. combo_t* combo_get_raw(uint16_t combo_idx);
  48. // Get the keycode for the encoder mapping location, potentially stored dynamically
  49. combo_t* combo_get(uint16_t combo_idx);
  50. #endif // defined(COMBO_ENABLE)