keymap.c 1000 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include QMK_KEYBOARD_H
  2. #define _MAIN 0
  3. bool encoder_update_user(uint8_t index, bool clockwise) {
  4. if (index == 0) { /* First encoder*/
  5. if (clockwise) {
  6. tap_code(KC_VOLU);
  7. } else {
  8. tap_code(KC_VOLD);
  9. }
  10. } else if (index == 1) { /* Second encoder*/
  11. if (clockwise) {
  12. tap_code(KC_3);
  13. } else {
  14. tap_code(KC_4);
  15. }
  16. } else if (index == 2) { /* Third encoder*/
  17. if (clockwise) {
  18. tap_code(KC_5);
  19. } else {
  20. tap_code(KC_6);
  21. }
  22. } else if (index == 3) { /* Fourth encoder*/
  23. if (clockwise) {
  24. tap_code(KC_7);
  25. } else {
  26. tap_code(KC_8);
  27. }
  28. } else if (index == 4) { /* Fifth encoder*/
  29. if (clockwise) {
  30. tap_code(KC_9);
  31. } else {
  32. tap_code(KC_0);
  33. }
  34. }
  35. return true;
  36. }
  37. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
  38. [_MAIN] = LAYOUT_ortho_1x5(
  39. KC_MUTE, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_STOP
  40. )
  41. };