logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

keymap.c (953B)


  1. #include QMK_KEYBOARD_H
  2. enum layers {
  3. _MAIN,
  4. };
  5. bool 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. return true;
  38. }
  39. //
  40. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
  41. [_MAIN] = LAYOUT_ortho_1x5(
  42. KC_A, KC_B, KC_C, KC_D, KC_E
  43. )
  44. };