encoder.c 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* My (demuredemeanor) sofle RGB conf
  2. * Based on Josef Adamcik's work
  3. */
  4. //Setting up what encoder rotation does. If your encoder can be pressed as a button, that function can be set in Via.
  5. #ifdef ENCODER_ENABLE
  6. void encoder_update_user(uint8_t index, bool clockwise) {
  7. if (index == 0) {
  8. if (clockwise) {
  9. if (shift_held) {
  10. tap_code(KC_BRIGHTNESS_UP);
  11. } else {
  12. tap_code(KC_VOLU);
  13. }
  14. } else {
  15. if (shift_held) {
  16. tap_code(KC_BRIGHTNESS_DOWN);
  17. } else {
  18. tap_code(KC_VOLD);
  19. }
  20. }
  21. } else if (index == 1) {
  22. if (clockwise) {
  23. if (shift_held) {
  24. tap_code(KC_PGDOWN);
  25. } else {
  26. tap_code(KC_DOWN);
  27. }
  28. } else {
  29. if (shift_held) {
  30. tap_code(KC_PGUP);
  31. } else {
  32. tap_code(KC_UP);
  33. }
  34. }
  35. }
  36. }
  37. #endif