[Core] Change OLED task function to be boolean (#14864)

* [Core] Add kb level callbacks to OLED driver

* Update keyboards and keymaps

* Update docs

* Update userspace configs

* Add fix for my keymap ...

* update lefty
This commit is contained in:
Drashna Jaelre 2021-11-01 15:42:50 -07:00 committed by GitHub
parent 5dab3a7bc6
commit 44c20e7743
40 changed files with 104 additions and 57 deletions

View file

@ -168,7 +168,7 @@ static void render_rgbled_status(void) {
oled_write_ln_P(PSTR("\n"), false);
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
static bool finished_timer = false;
if (!finished_timer && (timer_elapsed(startup_timer) < 1000)) {
render_logo();
@ -181,5 +181,6 @@ void oled_task_user(void) {
render_rgbled_status();
render_logo_font();
}
return false;
}
#endif

View file

@ -175,7 +175,7 @@ static void render_layer(void) {
oled_write_P(logo[3][2], false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
static bool finished_timer = false;
if (!finished_timer && (timer_elapsed(startup_timer) < 3000)) {
render_logo();
@ -186,6 +186,7 @@ void oled_task_user(void) {
}
render_layer();
}
return false;
}
#endif

View file

@ -55,7 +55,10 @@ static void render_logo(void) {
}
#ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); }
bool oled_task_user(void) {
render_logo();
return false;
}
#endif
bool encoder_update_user(uint8_t index, bool clockwise) {

View file

@ -89,10 +89,11 @@ void render_mod_status(uint8_t modifiers) {
oled_write_ln(PSTR(" "), false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_layer_state();
render_keylock_status(host_keyboard_led_state());
render_mod_status(get_mods()|get_oneshot_mods());
return false;
}
#endif

View file

@ -67,12 +67,13 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return rotation;
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
print_status_narrow();
} else {
render_logo();
}
return false;
}
#endif

View file

@ -99,7 +99,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return isLeftHand ? OLED_ROTATION_180 : OLED_ROTATION_0;
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);
@ -123,5 +123,6 @@ void oled_task_user(void) {
} else {
render_qmk_logo();
}
return false;
}
#endif

View file

@ -92,13 +92,14 @@ static void render_status(void) {
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
render_status();
} else {
render_logo();
oled_scroll_left();
}
return false;
}
#endif

View file

@ -158,13 +158,14 @@ void oled_render_logo(void) {
oled_write_P(crkbd_logo, false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
oled_render_layer_state();
oled_render_keylog();
} else {
oled_render_logo();
}
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

View file

@ -67,7 +67,7 @@ static void render_logo(void) {
oled_write_raw_P(ducky_logo, LOGO_SIZE);
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_logo();
return false;
}

View file

@ -96,7 +96,7 @@ static void render_anim(void) {
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_anim();
oled_set_cursor(0,6);
oled_write_P(PSTR("DUCK\nBOARD\n"), false);
@ -119,6 +119,7 @@ void oled_task_user(void) {
oled_write_P(PSTR("FN2\n"), false);
break;
}
return false;
}
#endif

View file

@ -119,7 +119,8 @@ static void render_anim(void){
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_anim();
return false;
}
#endif

View file

@ -99,7 +99,8 @@ static void render_anim(void){
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_anim();
return false;
}
#endif

View file

@ -101,12 +101,13 @@ static void render_rgbled_status(bool full) {
#endif
}
void oled_task_user(void) {
bool oled_task_user(void) {
if(is_keyboard_master()){
render_status();
}else{
render_logo();
render_rgbled_status(true);
}
return false;
}
#endif

View file

@ -101,12 +101,13 @@ static void render_rgbled_status(bool full) {
#endif
}
void oled_task_user(void) {
bool oled_task_user(void) {
if(is_keyboard_master()){
render_status();
}else{
render_logo();
render_rgbled_status(true);
}
return false;
}
#endif

View file

@ -62,8 +62,9 @@ void keyboard_post_init_user(void) {
// Rev3 and above only
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false);
return false;
}
#endif

View file

@ -140,7 +140,8 @@ static void render_anim(void){
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_anim();
return false;
}
#endif

View file

@ -47,7 +47,10 @@ static void render_logo(void) {
}
#ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); }
bool oled_task_user(void) {
render_logo();
return false;
}
#endif
bool encoder_update_user(uint8_t index, bool clockwise) {

View file

@ -64,7 +64,10 @@ static void render_logo(void) {
}
#ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); }
bool oled_task_user(void) {
render_logo();
return false;
}
#endif
bool encoder_update_user(uint8_t index, bool clockwise) {

View file

@ -144,13 +144,14 @@ void render_mod_status(uint8_t modifiers) {
oled_write_ln_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_lechiffre_logo();
oled_set_cursor(0,3);
// render_layer_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
render_mod_status(get_mods()|get_oneshot_mods());
render_keylock_status(host_keyboard_led_state());
render_keylogger_status();
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

View file

@ -186,7 +186,7 @@ const char *read_keylogs(void) {
}
//new
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);
@ -214,6 +214,7 @@ void oled_task_user(void) {
} else {
render_logo();
}
return false;
}
#endif // OLED_ENABLE

View file

@ -76,7 +76,8 @@ static void render_name(void) {
oled_write_P(mercutio_name, false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_name();
return false;
}
#endif

View file

@ -113,7 +113,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
oled_write_P(logo_4, false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
render_logo();
oled_set_cursor(0,6);
@ -141,5 +141,6 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif

View file

@ -173,7 +173,7 @@ static void print_status_narrow(void) {
// WPM counter End
}
void oled_task_user(void) {
bool oled_task_user(void) {
current_wpm = get_current_wpm();
if (is_keyboard_master()) {
print_status_narrow();
@ -182,6 +182,7 @@ void oled_task_user(void) {
render_logo();
//print_status_narrow();
}
return false;
}
#endif

View file

@ -101,12 +101,12 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}
void oled_task_user(void) {
bool oled_task_user(void) {
oled_write_ln_P(PSTR(" - PistachioPro -"), false);
print_airstate();
print_keylog();
return;
return false;
}
/* Encoder */
@ -138,4 +138,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
}

View file

@ -1,19 +1,19 @@
/* Copyright HarshitGoel96 2020
* With permission from mattdibi, the original maintainer of the Redox hardware.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
// Each layer gets a name for readability, which is then used in the keymap matrix below.
@ -131,12 +131,13 @@ static void render_status(void){
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo(); // Renders a static logo
oled_scroll_left(); // Turns on scrolling
}
return false;
}
#endif

View file

@ -87,7 +87,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
char wpm[10];
void oled_task_user(void) {
bool oled_task_user(void) {
sprintf(wpm, "WPM: %03d", get_current_wpm());
// Host Keyboard Layer Status
@ -113,4 +113,5 @@ void oled_task_user(void) {
}
oled_write_P(PSTR(" "), false);
oled_write(wpm, false);
return false;
}

View file

@ -132,7 +132,7 @@ static void render_pattern(void) {
}
}
void oled_task_user(void) {
bool oled_task_user(void) {
// Render Herringbone pattern
render_pattern();
oled_render();
@ -146,5 +146,6 @@ void oled_task_user(void) {
oled_set_cursor(0, 2);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
oled_render();
return false;
}
#endif

View file

@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("* R A R T A N D *\n Powered by QMK\nLayer: "), false);
@ -74,5 +74,6 @@ void oled_task_user(void) {
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif

View file

@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("* R A R T L I C E *\n Powered by QMK\nLayer: "), false);
@ -76,5 +76,6 @@ void oled_task_user(void) {
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif

View file

@ -230,7 +230,7 @@ static void render_touch(void)
oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_left()) {
render_icon();
oled_write_P(PSTR(" "), false);
@ -245,6 +245,7 @@ void oled_task_user(void) {
oled_write_P(PSTR(" "), false);
render_rgb_menu();
}
return false;
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {

View file

@ -209,7 +209,7 @@ static void render_logo(uint8_t startX, uint8_t startY)
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; }
void oled_task_user(void)
bool oled_task_user(void)
{
// Playing the animation
if((timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) && (splash_dur_counter < SPLASH_DUR))
@ -348,6 +348,7 @@ void oled_task_user(void)
}
return false;
}
// Process the extra/extended keycode functionality

View file

@ -145,7 +145,7 @@ static void render_anim(void) {
}
// Used to draw on to the oled screen
void oled_task_user(void) {
bool oled_task_user(void) {
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)
@ -160,5 +160,6 @@ void oled_task_user(void) {
led_t led_state = host_keyboard_led_state(); // caps lock stuff, prints CAPS on new line if caps led is on
oled_set_cursor(0, 1);
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
return false;
}
#endif

View file

@ -174,7 +174,7 @@ void draw_brightness_icon(int key_position, int row) {
oled_write_P(ICON_BRIGHTNESS_1, false);
}
void oled_task_user(void) {
bool oled_task_user(void) {
// Host Keyboard Layer Status
static const char PROGMEM ICON_LAYER[] = {0x80, 0x81, 0x82, 0x83, 0};
static const char PROGMEM ICON_ENCODER[] = {0x84, 0x85, 0x86, 0x87, 0};
@ -229,6 +229,7 @@ void oled_task_user(void) {
break;
}
return false;
}
#endif

View file

@ -73,12 +73,13 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return rotation;
}
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
print_status_narrow();
} else {
render_logo();
}
return false;
}
#endif

View file

@ -191,7 +191,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
#endif
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
if (is_keyboard_master()) {
// QMK Logo and version information
// clang-format off
@ -244,5 +244,6 @@ void oled_task_user(void) {
// clang-format on
oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
}
return false;
}
#endif

View file

@ -58,7 +58,8 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}
void oled_task_user(void) {
bool oled_task_user(void) {
oled_write_P(PSTR("OWO\nWhat's\nthis?"), false);
return false;
}
#endif

View file

@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
oled_write_P(PSTR("M0lly\n"),false);
// Layer Status
@ -115,5 +115,7 @@ void oled_task_user(void) {
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif

View file

@ -98,7 +98,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef OLED_ENABLE
void oled_task_user(void) {
bool oled_task_user(void) {
oled_write_P(PSTR("TKC1800\n"),false);
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);
@ -126,5 +126,7 @@ void oled_task_user(void) {
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif

View file

@ -273,7 +273,7 @@ static void render_light_logo(void) {
oled_write_raw_P(light_logo, sizeof(light_logo));
}
void oled_task_user(void) {
bool oled_task_user(void) {
switch (get_highest_layer(layer_state)) {
case 0:
render_rocket_logo();
@ -289,5 +289,6 @@ void oled_task_user(void) {
oled_write_ln_P(PSTR(" UND"), false);
break;
}
return false;
}
#endif

View file

@ -122,7 +122,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; // flips the display 270 degrees
}
void oled_task_user(void) {
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
@ -159,5 +159,7 @@ void oled_task_user(void) {
(uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
}
#endif