qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

rev8.c (857B)


      1 // Copyright 2023 Danny Nguyen (danny@keeb.io)
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 
      4 #include "quantum.h"
      5 
      6 #ifdef ENCODER_ENABLE
      7 bool encoder_update_kb(uint8_t index, bool clockwise) {
      8     if (!encoder_update_user(index, clockwise)) { return false; }
      9     if (index == 0) {
     10         if (clockwise) {
     11             tap_code(KC_VOLU);
     12         } else {
     13             tap_code(KC_VOLD);
     14         }
     15     } else if (index == 1) {
     16         if (clockwise) {
     17             tap_code(KC_PGDN);
     18         } else {
     19             tap_code(KC_PGUP);
     20         }
     21     } else if (index == 2) {
     22         if (clockwise) {
     23             tap_code(KC_VOLU);
     24         } else {
     25             tap_code(KC_VOLD);
     26         }
     27     } else if (index == 3) {
     28         if (clockwise) {
     29             tap_code(KC_PGDN);
     30         } else {
     31             tap_code(KC_PGUP);
     32         }
     33     }
     34     return false;
     35 }
     36 #endif