avalanche.c 607 B

12345678910111213141516171819202122232425
  1. // Copyright 2022 Vitaly Volkov (@vlkv)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "avalanche.h"
  4. #ifdef ENCODER_ENABLE
  5. bool encoder_update_kb(uint8_t index, bool clockwise) {
  6. if (!encoder_update_user(index, clockwise)) { return false; }
  7. if (index == 0) {
  8. if (clockwise) {
  9. tap_code_delay(KC_VOLU, 10);
  10. } else {
  11. tap_code_delay(KC_VOLD, 10);
  12. }
  13. } else if (index == 1) { /* Second encoder */
  14. if (clockwise) {
  15. tap_code(KC_PGUP);
  16. } else {
  17. tap_code(KC_PGDN);
  18. }
  19. }
  20. return true;
  21. }
  22. #endif