keymap.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include QMK_KEYBOARD_H
  2. #include "led.h"
  3. #ifdef RGBLIGHT_ENABLE
  4. #include "rgblight.h"
  5. #endif
  6. // Each layer gets a name for readability, which is then used in the keymap matrix below.
  7. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
  8. // Layer names don't all need to be of the same length, obviously, and you can also skip them
  9. // entirely and just use numbers.
  10. #define _BL 0
  11. #define _FL 1
  12. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  13. /* Keymap _BL: (Base Layer) Default Layer
  14. * ,-------------------.
  15. * |Esc |TAB | FN | BS |
  16. * |----|----|----|----|
  17. * | NL | / | * | - |
  18. * |----|----|----|----|
  19. * | 7 | 8 | 9 | |
  20. * |----|----|----| + |
  21. * | 4 | 5 | 6 | |
  22. * |----|----|----|----|
  23. * | 1 | 2 | 3 | |
  24. * |----|----|----| En |
  25. * | 0 | . | |
  26. * `-------------------'
  27. */
  28. [_BL] = LAYOUT_numpad_6x4(
  29. KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \
  30. KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
  31. KC_P7, KC_P8, KC_P9, \
  32. KC_P4, KC_P5, KC_P6, KC_PPLS, \
  33. KC_P1, KC_P2, KC_P3, \
  34. KC_P0, KC_PDOT, KC_PENT),
  35. /* Keymap _FL: Function Layer
  36. * ,-------------------.
  37. * |RGBT|TAB | FN | BS |
  38. * |----|----|----|----|
  39. * |RGBM|RGBP|BTOG| - |
  40. * |----|----|----|----|
  41. * |HUD |HUI |BON | |
  42. * |----|----|----| + |
  43. * |SAD |SAI |BOFF| |
  44. * |----|----|----|----|
  45. * |VAD |VAS | 3 | |
  46. * |----|----|----| En |
  47. * | 0 |RST | |
  48. * `-------------------'
  49. */
  50. [_FL] = LAYOUT_numpad_6x4(
  51. RGB_TOG, KC_TAB, KC_TRNS, KC_BSPC, \
  52. RGB_MOD, RGB_M_P, BL_TOGG, KC_PMNS, \
  53. RGB_HUD, RGB_HUI, BL_ON, \
  54. RGB_SAD, RGB_SAI, BL_OFF, KC_PPLS, \
  55. RGB_VAD, RGB_VAI, KC_P3, \
  56. KC_P0, RESET, KC_PENT),
  57. };
  58. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  59. switch (keycode) {
  60. case BL_TOGG:
  61. if (record->event.pressed) {
  62. cospad_bl_led_togg();
  63. }
  64. return false;
  65. case BL_ON:
  66. if (record->event.pressed) {
  67. cospad_bl_led_on();
  68. }
  69. return false;
  70. case BL_OFF:
  71. if(record->event.pressed) {
  72. cospad_bl_led_off();
  73. }
  74. return false;
  75. default:
  76. return true;
  77. }
  78. }