keymap.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. Copyright 2012-2016 Jun Wako <wakojun@gmail.com>
  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_H
  15. #define KEYMAP_H
  16. #include <stdint.h>
  17. #include <stdbool.h>
  18. #include "action.h"
  19. #if defined(__AVR__)
  20. # include <avr/pgmspace.h>
  21. #elif defined PROTOCOL_CHIBIOS
  22. // We need to ensure that chibios is include before redefining reset
  23. # include "ch.h"
  24. #endif
  25. #include "keycode.h"
  26. #include "action_macro.h"
  27. #include "report.h"
  28. #include "host.h"
  29. // #include "print.h"
  30. #include "debug.h"
  31. #include "keycode_config.h"
  32. // ChibiOS uses RESET in its FlagStatus enumeration
  33. // Therefore define it as QK_RESET here, to avoid name collision
  34. #if defined(PROTOCOL_CHIBIOS)
  35. # define RESET QK_RESET
  36. #endif
  37. // Gross hack, remove me and change RESET keycode to QK_BOOT
  38. #if defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)
  39. # undef RESET
  40. #endif
  41. #include "quantum_keycodes.h"
  42. // translates key to keycode
  43. uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
  44. // translates function id to action
  45. uint16_t keymap_function_id_to_action(uint16_t function_id);
  46. extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
  47. extern const uint16_t fn_actions[];
  48. #endif