preonic.c
505 bytes
1#include "quantum.h"
2
3#ifdef ENCODER_ENABLE
4bool encoder_update_kb(uint8_t index, bool clockwise) {
5 if (!encoder_update_user(index, clockwise)) { return false; }
6 if (get_highest_layer(layer_state) > 0) {
7 if (clockwise) {
8 tap_code_delay(KC_VOLU, 10);
9 } else {
10 tap_code_delay(KC_VOLD, 10);
11 }
12 } else {
13 if (clockwise) {
14 tap_code(KC_PGDN);
15 } else {
16 tap_code(KC_PGUP);
17 }
18 }
19 return true;
20}
21#endif