keymap.c 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include QMK_KEYBOARD_H
  2. enum layers {
  3. _MAIN,
  4. };
  5. void encoder_update_user(uint8_t index, bool clockwise) {
  6. if (index == 0) { /* First encoder*/
  7. if (clockwise) {
  8. tap_code(KC_1);
  9. } else {
  10. tap_code(KC_2);
  11. }
  12. } else if (index == 1) { /* Second encoder*/
  13. if (clockwise) {
  14. tap_code(KC_3);
  15. } else {
  16. tap_code(KC_4);
  17. }
  18. } else if (index == 2) { /* Third encoder*/
  19. if (clockwise) {
  20. tap_code(KC_5);
  21. } else {
  22. tap_code(KC_6);
  23. }
  24. } else if (index == 3) { /* Fourth encoder*/
  25. if (clockwise) {
  26. tap_code(KC_7);
  27. } else {
  28. tap_code(KC_8);
  29. }
  30. } else if (index == 4) { /* Fifth encoder*/
  31. if (clockwise) {
  32. tap_code(KC_9);
  33. } else {
  34. tap_code(KC_0);
  35. }
  36. }
  37. }
  38. //
  39. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
  40. [_MAIN] = LAYOUT_ortho_1x5(
  41. KC_A, KC_B, KC_C, KC_D, KC_E
  42. )
  43. };