2021-11-16 02:05:15 +01:00
|
|
|
/* Copyright 2020 David Philip Barr <@davidphilipbarr>
|
|
|
|
* Copyright 2021 @filterpaper
|
2021-11-29 09:18:33 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2021-11-16 02:05:15 +01:00
|
|
|
*/
|
|
|
|
|
2023-02-19 08:55:12 +01:00
|
|
|
#include "quantum.h"
|
2021-11-16 02:05:15 +01:00
|
|
|
|
|
|
|
#ifdef ENCODER_ENABLE
|
|
|
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|
|
|
if (!encoder_update_user(index, clockwise)) { return false; }
|
2021-11-29 09:18:33 +01:00
|
|
|
if (index == 0) {
|
2021-11-16 02:05:15 +01:00
|
|
|
if (clockwise) {
|
2022-03-08 05:09:54 +01:00
|
|
|
tap_code_delay(KC_VOLU, 10);
|
2021-11-29 09:18:33 +01:00
|
|
|
} else {
|
2022-03-08 05:09:54 +01:00
|
|
|
tap_code_delay(KC_VOLD, 10);
|
2021-11-16 02:05:15 +01:00
|
|
|
}
|
2021-11-29 09:18:33 +01:00
|
|
|
} else if (index == 1) {
|
2021-11-16 02:05:15 +01:00
|
|
|
if (clockwise) {
|
2021-11-29 09:18:33 +01:00
|
|
|
tap_code(KC_MNXT);
|
2021-11-16 02:05:15 +01:00
|
|
|
} else {
|
2021-11-29 09:18:33 +01:00
|
|
|
tap_code(KC_MPRV);
|
2021-11-16 02:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|