Skip to content

Commit

Permalink
try to get secondary oled working
Browse files Browse the repository at this point in the history
  • Loading branch information
timbrown5 committed Jan 28, 2025
1 parent b0e8ad3 commit f73c948
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
7 changes: 4 additions & 3 deletions keyboards/young_man_diy/sofle/f072_onboard/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@
"split_count": [36, 36]
},
"split": {


"enabled": true,
"matrix_pins": {
"right": {
Expand All @@ -134,7 +132,10 @@
},
"transport": {
"sync": {
"matrix_state": true
"matrix_state": true,
"oled": true,
"modifiers": true,
"wpm": true
},
"watchdog": true
}
Expand Down
35 changes: 25 additions & 10 deletions keyboards/young_man_diy/sofle/f072_onboard/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#include QMK_KEYBOARD_H

enum Layers {
_BASE,
_LOWER,
_RAISE,
_ADJUST,
};

#ifdef OLED_ENABLE
static void render_logo(void) {
static const char PROGMEM qmk_logo[] = {
Expand All @@ -13,33 +20,41 @@ static void render_logo(void) {

static void render_status(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer\n"), false);
oled_write_P(PSTR("-----\n"), false);
switch (get_highest_layer(layer_state)) {
case 0:
case _BASE:
oled_write_P(PSTR("Base \n"), false);
break;
case 1:
case _LOWER:
oled_write_P(PSTR("Lower\n"), false);
break;
case 2:
case _RAISE:
oled_write_P(PSTR("Raise\n"), false);
break;
case _ADJUST:
oled_write_P(PSTR("Adjust\n"), false);
break;
default:
oled_write_P(PSTR("Undef\n"), false);
}
oled_write_P(PSTR("Layer\n"), false);
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}

bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}

if (is_keyboard_master()) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo();
}
if (is_keyboard_master()) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo();
}

return true;
return true;
}
#endif

0 comments on commit f73c948

Please sign in to comment.