keymap_introspection.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. // Combos
  30. #if defined(COMBO_ENABLE)
  31. // Forward declaration of combo_t so we don't need to deal with header reordering
  32. struct combo_t;
  33. typedef struct combo_t combo_t;
  34. // Get the number of combos defined in the user's keymap, stored in firmware rather than any other persistent storage
  35. uint16_t combo_count_raw(void);
  36. // Get the number of combos defined in the user's keymap, potentially stored dynamically
  37. uint16_t combo_count(void);
  38. // Get the keycode for the encoder mapping location, stored in firmware rather than any other persistent storage
  39. combo_t* combo_get_raw(uint16_t combo_idx);
  40. // Get the keycode for the encoder mapping location, potentially stored dynamically
  41. combo_t* combo_get(uint16_t combo_idx);
  42. #endif // defined(COMBO_ENABLE)