You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

keymap_ex.h 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. Copyright 2013 Kai Ryu <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #ifndef KEYMAP_EX_H
  15. #define KEYMAP_EX_H
  16. #ifdef KEYMAP_EX_ENABLE
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. #define EECONFIG_KEYMAP_EX 0x10
  20. #ifndef FN_ACTIONS_COUNT
  21. #define FN_ACTIONS_COUNT 32
  22. #endif
  23. #ifndef KEYMAPS_COUNT
  24. #define KEYMAPS_COUNT 8
  25. #endif
  26. typedef struct {
  27. uint16_t checksum;
  28. uint16_t fn_actions[FN_ACTIONS_COUNT];
  29. uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS];
  30. } keymap_ex_t;
  31. #define EECONFIG_KEYMAP_DEBUG (EECONFIG_KEYMAP_EX - sizeof(uint16_t))
  32. #define EECONFIG_KEYMAP_CHECKSUM (EECONFIG_KEYMAP_EX)
  33. #define EECONFIG_KEYMAP_FN_ACTIONS (EECONFIG_KEYMAP_EX + sizeof(uint16_t))
  34. #define EECONFIG_KEYMAP_KEYMAPS (EECONFIG_KEYMAP_FN_ACTIONS + sizeof(uint16_t) * FN_ACTIONS_COUNT)
  35. #define KEYS_COUNT (KEYMAPS_COUNT * MATRIX_ROWS * MATRIX_COLS)
  36. #define KEYMAP_SIZE (sizeof(uint16_t) * FN_ACTIONS_COUNT + sizeof(uint8_t) * KEYS_COUNT)
  37. #define FN_ACTION_OFFSET(index) (sizeof(uint16_t) * index)
  38. #define KEY_OFFSET(layer, row, col) (sizeof(uint8_t) * (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col))
  39. void keymap_ex_init(void);
  40. void keymap_ex_disable(void);
  41. bool check_keymap_in_eeprom(void);
  42. void write_keymap_to_eeprom(void);
  43. uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col);
  44. void eeconfig_write_keymap_key(uint8_t layer, uint8_t row, uint8_t col, uint8_t key);
  45. uint8_t eeconfig_read_keymap_key_by_index(uint16_t index);
  46. void eeconfig_write_keymap_key_by_index(uint16_t index, uint8_t key);
  47. uint16_t eeconfig_read_keymap_fn_action(uint8_t index);
  48. void eeconfig_write_keymap_fn_action(uint8_t index, uint16_t fn_action);
  49. const uint8_t* keymaps_pointer(void);
  50. const uint16_t* fn_actions_pointer(void);
  51. uint16_t keys_count(void);
  52. uint16_t fn_actions_count(void);
  53. #endif
  54. #endif