[Keyboard] Fix compilation issues for Pearlboards (#15562)

master
Drashna Jaelre 2021-12-23 16:38:53 -08:00 committed by GitHub
parent d563ab052e
commit db149052c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 30 deletions

View File

@ -17,7 +17,11 @@
#include "pandora.h" #include "pandora.h"
// Encoder rotate function // Encoder rotate function
bool encoder_update_user(uint8_t index, bool clockwise) { #ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) {
return false;
}
/* First encoder */ /* First encoder */
if (index == 0) { if (index == 0) {
if (clockwise) { if (clockwise) {
@ -28,8 +32,13 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
return true; return true;
} }
#endif
// Encoder click function // Encoder click function
bool dip_switch_update_user(uint8_t index, bool active) { #ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) { return false; }
switch (index) { switch (index) {
/* First encoder */ /* First encoder */
case 0: case 0:
@ -40,3 +49,4 @@ bool dip_switch_update_user(uint8_t index, bool active) {
} }
return true; return true;
} }
#endif

View File

@ -17,8 +17,11 @@
#include "zeus.h" #include "zeus.h"
// Encoder rotate function // Encoder rotate function
bool encoder_update_user(uint8_t index, bool clockwise) { #ifdef ENCODER_ENABLE
/* First encoder */ bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) {
return false;
} /* First encoder */
if (index == 0) { if (index == 0) {
if (clockwise) { if (clockwise) {
tap_code(KC_AUDIO_VOL_UP); tap_code(KC_AUDIO_VOL_UP);
@ -28,3 +31,4 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
return true; return true;
} }
#endif

View File

@ -17,31 +17,39 @@
#include "zeuspad.h" #include "zeuspad.h"
// Encoder rotate function // Encoder rotate function
bool encoder_update_user(uint8_t index, bool clockwise) { #ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) {
return false;
}
/* First encoder */ /* First encoder */
if (index == 0) { if (index == 0) {
if (clockwise) { if (clockwise) {
tap_code(KC_AUDIO_VOL_UP); tap_code_delay(KC_AUDIO_VOL_UP, 10);
} else { } else {
tap_code(KC_AUDIO_VOL_DOWN); tap_code_delay(KC_AUDIO_VOL_DOWN, 10);
} }
} }
return true; return true;
} }
#endif
//21 characters max // 21 characters max
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { bool oled_task_kb(void) {
oled_write_P(PSTR("ZEUSPAD BY KOOBACZECH"), false); if (oled_task_user()) {
// Keyboard Layer Status return false;
oled_write_P(PSTR("LAYER: "), false); }
oled_write_P(PSTR("ZEUSPAD BY KOOBACZECH"), false);
// Keyboard Layer Status
oled_write_P(PSTR("LAYER: "), false);
switch (get_highest_layer(layer_state)) { switch (get_highest_layer(layer_state)) {
case 1: case 1:
oled_write_ln_P(PSTR("FN"), false); oled_write_ln_P(PSTR("FN"), false);
break; break;
default: default:
oled_write_ln_P(PSTR("Default"), false); oled_write_ln_P(PSTR("Default"), false);
} }
// Keyboard Locking Status // Keyboard Locking Status
led_t led_state = host_keyboard_led_state(); led_t led_state = host_keyboard_led_state();
@ -50,18 +58,18 @@ void oled_task_user(void) {
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
switch (rgblight_is_enabled() ? 1 : 2) { switch (rgblight_is_enabled() ? 1 : 2) {
case 1: case 1:
// Or use the write_ln shortcut over adding '\n' to the end of your string // Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_P(PSTR("RGB"), false); oled_write_P(PSTR("RGB"), false);
static char led_buf[30]; static char led_buf[30];
snprintf(led_buf, sizeof(led_buf) - 1, "\nMODE:%2d BRIGHT:%2d/10", snprintf(led_buf, sizeof(led_buf) - 1, "\nMODE:%2d BRIGHT:%2d/10", (uint8_t)(rgblight_get_mode()), (uint8_t)(rgblight_get_val() / 25.5));
(uint8_t)(rgblight_get_mode()), oled_write(led_buf, false);
(uint8_t)(rgblight_get_val()/25.5)); break;
oled_write(led_buf, false); default:
break; oled_write_ln_P(PSTR(""), false);
default: oled_write_P(PSTR("\n"), false);
oled_write_ln_P(PSTR(""), false);
oled_write_P(PSTR("\n"), false);
} }
return true;
} }
#endif #endif