keymap.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright 2021 Pascal Pfeil
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include QMK_KEYBOARD_H
  17. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  18. [0] = LAYOUT_numpad_6x4(
  19. KC_ESC, KC_TAB, KC_BSPC, MO(1),
  20. KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
  21. KC_P7, KC_P8, KC_P9,
  22. KC_P4, KC_P5, KC_P6, KC_PPLS,
  23. KC_P1, KC_P2, KC_P3,
  24. KC_P0, KC_PDOT, KC_PENT
  25. ),
  26. /* RGB */
  27. [1] = LAYOUT_numpad_6x4(
  28. RGB_SAI, RGB_VAI, RGB_HUI, _______,
  29. RGB_SAD, RGB_VAD, RGB_HUD, RESET,
  30. RGB_M_X, RGB_M_G, RGB_MOD,
  31. RGB_M_SW,RGB_M_SN,RGB_M_K, RGB_RMOD,
  32. RGB_M_P, RGB_M_B, RGB_M_R,
  33. XXXXXXX, XXXXXXX, RGB_TOG
  34. ),
  35. /* VIA wants four keymaps */
  36. [2] = LAYOUT_numpad_6x4(
  37. _______, _______, _______, _______,
  38. _______, _______, _______, _______,
  39. _______, _______, _______,
  40. _______, _______, _______, _______,
  41. _______, _______, _______,
  42. _______, _______, _______
  43. ),
  44. /* VIA wants four keymaps */
  45. [3] = LAYOUT_numpad_6x4(
  46. _______, _______, _______, _______,
  47. _______, _______, _______, _______,
  48. _______, _______, _______,
  49. _______, _______, _______, _______,
  50. _______, _______, _______,
  51. _______, _______, _______
  52. ),
  53. };
  54. const uint8_t number_leds[] = {8, 9, 10, 11, 12, 13, 15, 16, 17};
  55. const uint8_t number_leds_size = sizeof(number_leds) / sizeof(uint8_t);
  56. bool led_update_user(led_t led_state) {
  57. for (uint8_t i = 0; i < number_leds_size; i++)
  58. if (led_state.num_lock)
  59. // set to whatever the other leds are doing
  60. // this is needed so that upon disabling num lock, the leds don't stay red
  61. rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), numer_leds[i]);
  62. else
  63. rgblight_setrgb_red_at(numer_leds[i]); // set to red
  64. return true;
  65. }