logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (3852B)


  1. /*
  2. Copyright 2021 talsu <talsu84@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. #include QMK_KEYBOARD_H
  15. enum kmac_pad_keycodes {
  16. MD_BOOT = SAFE_RANGE,
  17. MCR1,
  18. MCR2,
  19. MCR3,
  20. MCR4,
  21. MCR5,
  22. MCR6,
  23. MCR7,
  24. MCR8,
  25. MCR9,
  26. MCR10,
  27. MCR11,
  28. MCR12
  29. };
  30. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  31. [0] = LAYOUT( /* Base */
  32. TG(1),
  33. KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
  34. KC_P7, KC_P8, KC_P9, KC_PPLS,
  35. KC_P4, KC_P5, KC_P6,
  36. KC_P1, KC_P2, KC_P3, KC_PENT,
  37. KC_P0, KC_PDOT ),
  38. [1] = LAYOUT( /* FN */
  39. KC_TRNS,
  40. MCR1, MCR2, MCR3, KC_TRNS,
  41. MCR4, MCR5, MCR6, KC_TRNS,
  42. MCR7, MCR8, MCR9,
  43. MCR10, MCR11, MCR12, KC_TRNS,
  44. KC_TRNS, MD_BOOT )
  45. };
  46. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  47. switch (keycode) {
  48. case MD_BOOT:
  49. {
  50. static uint32_t key_timer;
  51. if (record->event.pressed) {
  52. key_timer = timer_read32();
  53. } else {
  54. if (timer_elapsed32(key_timer) >= 2000) {
  55. reset_keyboard();
  56. }
  57. }
  58. return false;
  59. }
  60. case MCR1:
  61. if (record->event.pressed) {
  62. SEND_STRING("Macro 1");
  63. }
  64. return false;
  65. case MCR2:
  66. if (record->event.pressed) {
  67. SEND_STRING("Macro 2");
  68. }
  69. return false;
  70. case MCR3:
  71. if (record->event.pressed) {
  72. SEND_STRING("Macro 3");
  73. }
  74. return false;
  75. case MCR4:
  76. if (record->event.pressed) {
  77. SEND_STRING("Macro 4");
  78. }
  79. return false;
  80. case MCR5:
  81. if (record->event.pressed) {
  82. SEND_STRING("Macro 5");
  83. }
  84. return false;
  85. case MCR6:
  86. if (record->event.pressed) {
  87. SEND_STRING("Macro 6");
  88. }
  89. return false;
  90. case MCR7:
  91. if (record->event.pressed) {
  92. SEND_STRING("Macro 7");
  93. }
  94. return false;
  95. case MCR8:
  96. if (record->event.pressed) {
  97. SEND_STRING("Macro 8");
  98. }
  99. return false;
  100. case MCR9:
  101. if (record->event.pressed) {
  102. SEND_STRING("Macro 9");
  103. }
  104. return false;
  105. case MCR10:
  106. if (record->event.pressed) {
  107. SEND_STRING("Macro 10");
  108. }
  109. return false;
  110. case MCR11:
  111. if (record->event.pressed) {
  112. SEND_STRING("Macro 12");
  113. }
  114. return false;
  115. case MCR12:
  116. if (record->event.pressed) {
  117. SEND_STRING("Macro 12");
  118. }
  119. return false;
  120. default:
  121. return true;
  122. }
  123. }
  124. bool led_update_user(led_t led_state) {
  125. gpio_write_pin(B1, led_state.num_lock);
  126. return false;
  127. }
  128. layer_state_t layer_state_set_user(layer_state_t state) {
  129. gpio_write_pin(B3, !IS_LAYER_ON_STATE(state, 0));
  130. return state;
  131. }