summary refs log tree commit diff
path: root/users/drashna
diff options
context:
space:
mode:
authorXelus22 <17491233+Xelus22@users.noreply.github.com>2021-08-24 16:28:26 +1000
committerGitHub <noreply@github.com>2021-08-24 16:28:26 +1000
commit4e1c5887c5c08ebd2cf7868c8d9292aa728e7bf0 (patch)
tree24ff5bdf570a6a9f5a77a517005bffbb35e46b22 /users/drashna
parent6fd20acf4be76e7a2bd82d3dfd0a9bcca8c507eb (diff)
[Core] Refactor OLED to allow easy addition of other types (#13454)
* add docs

* core changes

* update keyboards to new OLED

* updated users to new OLED

* update layouts to new OLED

* fixup docs

* drashna's suggestion

* fix up docs

* new keyboards with oled

* core split changes

* remaining keyboard files

* Fix The Helix keyboards oled options

* reflect develop

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: mtei <2170248+mtei@users.noreply.github.com>
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h2
-rw-r--r--users/drashna/drashna.c5
-rw-r--r--users/drashna/drashna.h2
-rw-r--r--users/drashna/oled_stuff.c2
-rw-r--r--users/drashna/process_records.c2
-rw-r--r--users/drashna/rules.mk2
-rw-r--r--users/drashna/transport_sync.c11
7 files changed, 19 insertions, 7 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index c8007a61b8..75e1c11c6d 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -140,7 +140,7 @@
 #    define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE
 #endif  // RGB_MATRIX_ENABLE
 
-#ifdef OLED_DRIVER_ENABLE
+#ifdef OLED_ENABLE
 #    ifdef SPLIT_KEYBOARD
 #        define OLED_UPDATE_INTERVAL 60
 #    else
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 27b9b5bc99..13421f39d7 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -114,8 +114,9 @@ void                       shutdown_user(void) {
 }
 
 __attribute__((weak)) void suspend_power_down_keymap(void) {}
-void                       suspend_power_down_user(void) {
-#ifdef OLED_DRIVER_ENABLE
+
+void suspend_power_down_user(void) {
+#ifdef OLED_ENABLE
     oled_off();
 #endif
     suspend_power_down_keymap();
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 0ae5f779ae..a1fa3ffa92 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -29,7 +29,7 @@
 #if defined(RGB_MATRIX_ENABLE)
 #    include "rgb_matrix_stuff.h"
 #endif
-#if defined(OLED_DRIVER_ENABLE)
+#if defined(OLED_ENABLE)
 #    include "oled_stuff.h"
 #endif
 #if defined(PIMORONI_TRACKBALL_ENABLE)
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
index 0d63c38fa4..debcdcfbe0 100644
--- a/users/drashna/oled_stuff.c
+++ b/users/drashna/oled_stuff.c
@@ -70,7 +70,7 @@ void add_keylog(uint16_t keycode) {
 
 bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
     if (record->event.pressed) {
-#ifdef OLED_DRIVER_ENABLE
+#ifdef OLED_ENABLE
         oled_timer = timer_read32();
         add_keylog(keycode);
 #endif
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index f5e6a867ae..900b6da15e 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -29,7 +29,7 @@ bool                       process_record_user(uint16_t keycode, keyrecord_t *re
 #ifdef KEYLOGGER_ENABLE
     uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
 #endif  // KEYLOGGER_ENABLE
-#ifdef OLED_DRIVER_ENABLE
+#ifdef OLED_ENABLE
     process_record_user_oled(keycode, record);
 #endif  // OLED
 
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 02a75a7b74..dbacae1d56 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -64,7 +64,7 @@ ifeq ($(strip $(PROTOCOL)), VUSB)
 endif
 
 CUSTOM_OLED_DRIVER ?= yes
-ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
+ifeq ($(strip $(OLED_ENABLE)), yes)
     ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes)
         SRC += oled_stuff.c
         OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c
index fdd596c04c..38434751e6 100644
--- a/users/drashna/transport_sync.c
+++ b/users/drashna/transport_sync.c
@@ -71,6 +71,10 @@ void keyboard_post_init_transport_sync(void) {
 
 void user_transport_update(void) {
     if (is_keyboard_master()) {
+#    ifdef OLED_ENABLE
+        user_state.oled_on = is_oled_on();
+#    endif
+
         transport_keymap_config    = keymap_config.raw;
         transport_userspace_config = userspace_config.raw;
 #ifdef AUDIO_ENABLE
@@ -85,6 +89,13 @@ void user_transport_update(void) {
 #endif
 
     } else {
+#    ifdef OLED_ENABLE
+        if (user_state.oled_on) {
+            oled_on();
+        } else {
+            oled_off();
+        }
+#    endif
         keymap_config.raw    = transport_keymap_config;
         userspace_config.raw = transport_userspace_config;
 #ifdef UNICODE_ENABLE