2022-02-12 10:02:30 +06:00
|
|
|
// Copyright 2022 Cole Smith <cole@boadsource.xyz>
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2023-07-16 19:42:56 +06:00
|
|
|
#include "quantum.h"
|
2024-07-11 01:19:06 +06:00
|
|
|
#include "lib/oled.h"
|
2022-02-12 10:02:30 +06:00
|
|
|
|
2022-07-13 11:20:38 +06:00
|
|
|
#ifdef ENCODER_ENABLE
|
|
|
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|
|
|
if (!encoder_update_user(index, clockwise)) { return false; }
|
|
|
|
if (index == 0) {
|
|
|
|
if (clockwise) {
|
|
|
|
tap_code(KC_VOLU);
|
|
|
|
} else {
|
|
|
|
tap_code(KC_VOLD);
|
|
|
|
}
|
|
|
|
} else if (index == 1) {
|
|
|
|
if (clockwise) {
|
|
|
|
tap_code(KC_PGDN);
|
|
|
|
} else {
|
|
|
|
tap_code(KC_PGUP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2022-02-12 10:02:30 +06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef OLED_ENABLE
|
|
|
|
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
2024-07-11 01:19:06 +06:00
|
|
|
if (!is_keyboard_master()) {
|
|
|
|
return OLED_ROTATION_180;
|
2022-02-12 10:02:30 +06:00
|
|
|
}
|
2024-07-11 01:19:06 +06:00
|
|
|
return rotation;
|
2022-02-12 10:02:30 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
bool oled_task_kb(void) {
|
2024-07-11 01:19:06 +06:00
|
|
|
if (!oled_task_user()) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-02-12 10:02:30 +06:00
|
|
|
if (is_keyboard_master()) {
|
2024-07-11 01:19:06 +06:00
|
|
|
render_layer_state();
|
2022-02-12 10:02:30 +06:00
|
|
|
} else {
|
2024-07-11 01:19:06 +06:00
|
|
|
oled_write_raw_P(bs_logo_img, sizeof(bs_logo_img));
|
2022-02-12 10:02:30 +06:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|