keymap.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include QMK_KEYBOARD_H
  2. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  3. /*
  4. * ,-----------------------,
  5. * | 7 | 8 | 9 | / |
  6. * |-----+-----+-----+-----|
  7. * | 4 | 5 | 6 | * |
  8. * |-----+-----+-----+-----|
  9. * | 1 | 2 | 3 | - |
  10. * |-----+-----+-----+-----|
  11. * | 0 | . | = | + |
  12. * `-----------------------'
  13. */
  14. LAYOUT_ortho_4x4(
  15. KC_P7, KC_P8, KC_P9, KC_PSLS,
  16. KC_P4, KC_P5, KC_P6, KC_PAST,
  17. KC_P1, KC_P2, KC_P3, KC_PMNS,
  18. KC_P0, KC_PDOT, KC_PEQL, KC_PPLS
  19. )
  20. };
  21. // Set led state during powerup
  22. void keyboard_post_init_user(void) {
  23. writePinHigh(LED_RED);
  24. }
  25. void encoder_update_user(uint8_t index, bool clockwise) {
  26. /*
  27. Rev1.1 Rev1
  28. ,-----------------------, ,-----------------------,
  29. | E1 | E2 | E3 | E4 | | E1 | | | E2 |
  30. |-----+-----+-----+-----| |-----+-----+-----+-----|
  31. | | | | E3 | | | | | |
  32. |-----+-----+-----+-----| |-----+-----+-----+-----|
  33. | | | | E2 | | | | | |
  34. |-----+-----+-----+-----| |-----+-----+-----+-----|
  35. | | | | E1 | | | | | |
  36. `-----------------------' `-----------------------'
  37. */
  38. // First encoder (E1)
  39. if (index == 0) {
  40. if (clockwise) {
  41. tap_code(KC_F17);
  42. } else {
  43. tap_code(KC_F18);
  44. }
  45. // Second encoder (E2)
  46. } else if (index == 1) {
  47. if (clockwise) {
  48. tap_code(KC_F19);
  49. } else {
  50. tap_code(KC_F20);
  51. }
  52. // Third encoder (E3)
  53. } else if (index == 2) {
  54. if (clockwise) {
  55. tap_code(KC_F21);
  56. } else {
  57. tap_code(KC_F22);
  58. }
  59. // Forth encoder (E4)
  60. } else if (index == 3) {
  61. if (clockwise) {
  62. tap_code(KC_F23);
  63. } else {
  64. tap_code(KC_F24);
  65. }
  66. }
  67. }