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