fix: improper usage of keyboard/user-level functions (#22652)
This commit is contained in:
parent
05d2b7e2ac
commit
49527afc6a
6 changed files with 182 additions and 161 deletions
|
@ -17,7 +17,9 @@
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
// Tested and verified working on ext65rev2
|
// Tested and verified working on ext65rev2
|
||||||
void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
|
void matrix_io_delay(void) {
|
||||||
|
__asm__ volatile("nop\nnop\nnop\n");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
void board_init(void) {
|
void board_init(void) {
|
||||||
|
@ -55,21 +57,26 @@ void render_mod_status(uint8_t modifiers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_task_kb(void) {
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
render_layer_state();
|
render_layer_state();
|
||||||
render_keylock_status(host_keyboard_led_state());
|
render_keylock_status(host_keyboard_led_state());
|
||||||
render_mod_status(get_mods() | get_oneshot_mods());
|
render_mod_status(get_mods() | get_oneshot_mods());
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void keyboard_pre_init_user(void) {
|
void keyboard_pre_init_kb(void) {
|
||||||
// Call the keyboard pre init code.
|
// Call the keyboard pre init code.
|
||||||
// Set our LED pins as output
|
// Set our LED pins as output
|
||||||
setPinOutput(B4);
|
setPinOutput(B4);
|
||||||
setPinOutput(B3);
|
setPinOutput(B3);
|
||||||
setPinOutput(A15);
|
setPinOutput(A15);
|
||||||
setPinOutput(A14);
|
setPinOutput(A14);
|
||||||
|
|
||||||
|
keyboard_pre_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_kb(led_t led_state) {
|
bool led_update_kb(led_t led_state) {
|
||||||
|
@ -94,4 +101,3 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||||
return layer_state_set_user(state);
|
return layer_state_set_user(state);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
char wpm_str[10];
|
char wpm_str[10];
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Right encoder
|
// Right encoder
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -138,7 +141,10 @@ static void render_anim(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to draw on to the oled screen
|
// Used to draw on to the oled screen
|
||||||
bool oled_task_user(void) {
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
render_anim(); // renders pixelart
|
render_anim(); // renders pixelart
|
||||||
|
|
||||||
oled_set_cursor(0, 0); // sets cursor to (row, column) using charactar spacing (5 rows on 128x32 screen, anything more will overflow back to the top)
|
oled_set_cursor(0, 0); // sets cursor to (row, column) using charactar spacing (5 rows on 128x32 screen, anything more will overflow back to the top)
|
||||||
|
@ -150,6 +156,6 @@ bool oled_task_user(void) {
|
||||||
oled_set_cursor(0, 1);
|
oled_set_cursor(0, 1);
|
||||||
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
|
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
bool oled_task_kb(void) {
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
led_t led_usb_state = host_keyboard_led_state();
|
led_t led_usb_state = host_keyboard_led_state();
|
||||||
|
|
||||||
render_bongocat();
|
render_bongocat();
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
/* Encoders */
|
/* Encoders */
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_MNXT);
|
tap_code(KC_MNXT);
|
||||||
|
@ -33,6 +35,6 @@
|
||||||
tap_code(KC_VOLD);
|
tap_code(KC_VOLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -237,12 +237,15 @@ oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_task_kb(void) {
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
render_animation();
|
render_animation();
|
||||||
render_status();
|
render_status();
|
||||||
|
|
||||||
oled_write_ln_P(PSTR("WPM:"), false);
|
oled_write_ln_P(PSTR("WPM:"), false);
|
||||||
oled_write_ln(get_u8_str(get_current_wpm(), '0'), false);
|
oled_write_ln(get_u8_str(get_current_wpm(), '0'), false);
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
// Defines names for use in layer keycodes and the keymap
|
// Defines names for use in layer keycodes and the keymap
|
||||||
enum layer_names {
|
enum layer_names {
|
||||||
_QWERTY = 0,
|
_QWERTY,
|
||||||
_LOWER,
|
_LOWER,
|
||||||
_RAISE,
|
_RAISE,
|
||||||
_ADJUST
|
_ADJUST
|
||||||
|
@ -27,7 +27,6 @@ enum layer_names {
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
|
|
||||||
void render_status(void) {
|
void render_status(void) {
|
||||||
|
|
||||||
// Render to mode icon
|
// Render to mode icon
|
||||||
static const char os_logo[][2][3] PROGMEM = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
|
static const char os_logo[][2][3] PROGMEM = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
|
||||||
if (is_mac_mode()) {
|
if (is_mac_mode()) {
|
||||||
|
@ -72,7 +71,6 @@ void render_status(void) {
|
||||||
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void render_logo(void) {
|
static void render_logo(void) {
|
||||||
static const char PROGMEM qmk_logo[] = {
|
static const char PROGMEM qmk_logo[] = {
|
||||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
|
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||||
|
@ -106,13 +104,16 @@ static void render_rgbled_status(bool full) {
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_task_user(void) {
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
render_status();
|
render_status();
|
||||||
} else {
|
} else {
|
||||||
render_logo();
|
render_logo();
|
||||||
render_rgbled_status(true);
|
render_rgbled_status(true);
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue