geist.c 700 B

123456789101112131415161718192021
  1. // Copyright 2022 QMK
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "quantum.h"
  4. // This will be overridden by encoder map in all default keymaps, but serves as a catch-all for user keymaps that may omit the map.
  5. #if defined (ENCODER_ENABLE) && !defined (ENCODER_MAP_ENABLE)
  6. bool encoder_update_kb(uint8_t index, bool clockwise) {
  7. if (!encoder_update_user(index, clockwise)) {
  8. return false; /* Don't process further events if user function exists and returns false */
  9. }
  10. if (index == 0) { /* First encoder */
  11. if (clockwise) {
  12. tap_code_delay(KC_VOLU, 10);
  13. } else {
  14. tap_code_delay(KC_VOLD, 10);
  15. }
  16. }
  17. return true;
  18. }
  19. #endif