Keyboard firmwares for Atmel AVR and Cortex-M
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

keymap.c 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright 2013 Jun Wako <[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. #include "keymap.h"
  15. #include "report.h"
  16. #include "keycode.h"
  17. /* layer */
  18. uint8_t default_layer = 0;
  19. uint8_t current_layer = 0;
  20. #ifndef NO_LEGACY_KEYMAP_SUPPORT
  21. /* legacy support with weak reference */
  22. __attribute__ ((weak))
  23. action_t keymap_get_action(uint8_t layer, uint8_t row, uint8_t col)
  24. {
  25. /* convert from legacy keycode to action */
  26. uint8_t key = keymap_get_keycode(layer, row, col);
  27. action_t action;
  28. switch (key) {
  29. case KC_A ... KC_EXSEL:
  30. action.code = ACTION_KEY(key);
  31. break;
  32. case KC_LCTRL ... KC_LGUI:
  33. action.code = ACTION_LMOD(key);
  34. break;
  35. case KC_RCTRL ... KC_RGUI:
  36. action.code = ACTION_RMOD(key);
  37. break;
  38. case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
  39. action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(key));
  40. break;
  41. case KC_AUDIO_MUTE ... KC_WWW_FAVORITES:
  42. action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(key));
  43. break;
  44. case KC_MS_UP ... KC_MS_ACCEL2:
  45. action.code = ACTION_MOUSEKEY(key);
  46. break;
  47. case KC_FN0 ... KC_FN31:
  48. {
  49. uint8_t layer = keymap_fn_layer(FN_INDEX(key));
  50. uint8_t code = keymap_fn_keycode(FN_INDEX(key));
  51. action.code = ACTION_LAYER_SET_TAP_KEY(layer, code);
  52. }
  53. break;
  54. case KC_NO ... KC_UNDEFINED:
  55. default:
  56. action.code = ACTION_NO;
  57. break;
  58. }
  59. return action;
  60. }
  61. #endif
  62. __attribute__ ((weak))
  63. void keymap_call_function(keyrecord_t *event, uint8_t id)
  64. {
  65. }