diff options
author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2021-08-24 16:28:26 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 16:28:26 +1000 |
commit | 4e1c5887c5c08ebd2cf7868c8d9292aa728e7bf0 (patch) | |
tree | 24ff5bdf570a6a9f5a77a517005bffbb35e46b22 /users | |
parent | 6fd20acf4be76e7a2bd82d3dfd0a9bcca8c507eb (diff) | |
download | qmk_firmware-4e1c5887c5c08ebd2cf7868c8d9292aa728e7bf0.tar.gz qmk_firmware-4e1c5887c5c08ebd2cf7868c8d9292aa728e7bf0.zip |
[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')
-rw-r--r-- | users/curry/rules.mk | 2 | ||||
-rw-r--r-- | users/drashna/config.h | 2 | ||||
-rw-r--r-- | users/drashna/drashna.c | 5 | ||||
-rw-r--r-- | users/drashna/drashna.h | 2 | ||||
-rw-r--r-- | users/drashna/oled_stuff.c | 2 | ||||
-rw-r--r-- | users/drashna/process_records.c | 2 | ||||
-rw-r--r-- | users/drashna/rules.mk | 2 | ||||
-rw-r--r-- | users/drashna/transport_sync.c | 11 | ||||
-rw-r--r-- | users/ninjonas/oled.c | 20 | ||||
-rw-r--r-- | users/ninjonas/process_records.c | 4 | ||||
-rw-r--r-- | users/ninjonas/process_records.h | 2 | ||||
-rw-r--r-- | users/riblee/riblee.c | 4 | ||||
-rw-r--r-- | users/sethBarberee/sethBarberee.c | 2 | ||||
-rw-r--r-- | users/snowe/oled_setup.c | 4 | ||||
-rw-r--r-- | users/snowe/oled_setup.h | 4 | ||||
-rw-r--r-- | users/snowe/readme_ocean_dream.md | 5 | ||||
-rw-r--r-- | users/snowe/rules.mk | 2 | ||||
-rw-r--r-- | users/snowe/snowe.h | 2 | ||||
-rw-r--r-- | users/tominabox1/rules.mk | 3 | ||||
-rw-r--r-- | users/tominabox1/tominabox1.c | 6 | ||||
-rw-r--r-- | users/xulkal/rules.mk | 2 |
21 files changed, 51 insertions, 37 deletions
diff --git a/users/curry/rules.mk b/users/curry/rules.mk index 87d3b38ead..724f97f5eb 100644 --- a/users/curry/rules.mk +++ b/users/curry/rules.mk @@ -24,7 +24,7 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dances.c endif -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) +ifeq ($(strip $(OLED_ENABLE)), yes) SRC += oled.c endif 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 diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index a3514f54f6..1d88c30579 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -2,7 +2,7 @@ #include <stdio.h> #include "ninjonas.h" -#if defined(OLED_DRIVER_ENABLE) & !defined(KEYBOARD_kyria_rev1) +#if defined(OLED_ENABLE) & !defined(KEYBOARD_kyria_rev1) static uint32_t oled_timer = 0; @@ -49,16 +49,16 @@ void render_layer_state(void) { bool adjust = layer_state_is(_ADJUST); bool numpad = layer_state_is(_NUMPAD); - if(lower){ - oled_write_P(PSTR(" Lower "), true); - } else if(raise){ - oled_write_P(PSTR(" Raise "), true); - } else if(adjust){ - oled_write_P(PSTR(" Adjust "), true); + if(lower){ + oled_write_P(PSTR(" Lower "), true); + } else if(raise){ + oled_write_P(PSTR(" Raise "), true); + } else if(adjust){ + oled_write_P(PSTR(" Adjust "), true); } else if(numpad) { - oled_write_P(PSTR(" Numpad "), true); - } else { - oled_write_P(PSTR(" Default"), false); + oled_write_P(PSTR(" Numpad "), true); + } else { + oled_write_P(PSTR(" Default"), false); } } diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c index a3b8417913..c298227e51 100644 --- a/users/ninjonas/process_records.c +++ b/users/ninjonas/process_records.c @@ -6,7 +6,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE __attribute__((weak)) bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; } #endif @@ -110,7 +110,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) - #ifdef OLED_DRIVER_ENABLE + #ifdef OLED_ENABLE && process_record_oled(keycode, record) #endif ; // Close return diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h index 2e69ca2163..5b901a1659 100644 --- a/users/ninjonas/process_records.h +++ b/users/ninjonas/process_records.h @@ -25,6 +25,6 @@ enum custom_keycodes { bool process_record_secrets(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE bool process_record_oled(uint16_t keycode, keyrecord_t *record); #endif diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c index 6e548f1d8d..6e6a7c23c6 100644 --- a/users/riblee/riblee.c +++ b/users/riblee/riblee.c @@ -173,7 +173,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE static char receive_buffer[128] = {}; static uint8_t receive_buffer_length = 0; @@ -227,4 +227,4 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { #endif -#endif
\ No newline at end of file +#endif diff --git a/users/sethBarberee/sethBarberee.c b/users/sethBarberee/sethBarberee.c index 536f3f921b..c5fceee68d 100644 --- a/users/sethBarberee/sethBarberee.c +++ b/users/sethBarberee/sethBarberee.c @@ -58,7 +58,7 @@ void keyboard_post_init_user(void) __attribute__((weak)) void suspend_power_down_keymap(void) {} void suspend_power_down_user(void) { -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE oled_off(); #endif suspend_power_down_keymap(); diff --git a/users/snowe/oled_setup.c b/users/snowe/oled_setup.c index b3e04df458..3d21ea9f0a 100644 --- a/users/snowe/oled_setup.c +++ b/users/snowe/oled_setup.c @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include QMK_KEYBOARD_H # include "quantum.h" @@ -138,4 +138,4 @@ void oled_task_user(void) { } } -#endif // OLED_DRIVER_ENABLE +#endif // OLED_ENABLE diff --git a/users/snowe/oled_setup.h b/users/snowe/oled_setup.h index 031ce6bd08..7281dcd766 100644 --- a/users/snowe/oled_setup.h +++ b/users/snowe/oled_setup.h @@ -18,7 +18,7 @@ #pragma once #include "quantum.h" -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include "oled_driver.h" # define OLED_RENDER_WPM_COUNTER " WPM: " #endif @@ -27,4 +27,4 @@ #endif #ifdef OCEAN_DREAM_ENABLE # include "ocean_dream.h" -#endif
\ No newline at end of file +#endif diff --git a/users/snowe/readme_ocean_dream.md b/users/snowe/readme_ocean_dream.md index ca15dd47cd..688afc8998 100644 --- a/users/snowe/readme_ocean_dream.md +++ b/users/snowe/readme_ocean_dream.md @@ -41,7 +41,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { ``` 4. In your `rules.mk` to make it easier to turn the animation on/off, add ```makefile -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) +ifeq ($(strip $(OLED_ENABLE)), yes) #... your code here... ifdef OCEAN_DREAM_ENABLE @@ -59,7 +59,8 @@ endif You're done! Now you can enable **Ocean Dream** by simply turning on the OLED feature ```makefile -OLED_DRIVER_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 ``` And if you want to disable it without turning off the OLED Driver you can simply set diff --git a/users/snowe/rules.mk b/users/snowe/rules.mk index a6e152c1cf..f188c90229 100644 --- a/users/snowe/rules.mk +++ b/users/snowe/rules.mk @@ -1,6 +1,6 @@ -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) +ifeq ($(strip $(OLED_ENABLE)), yes) SRC += oled_setup.c ifdef OCEAN_DREAM_ENABLE diff --git a/users/snowe/snowe.h b/users/snowe/snowe.h index 4453b26469..21764ca507 100644 --- a/users/snowe/snowe.h +++ b/users/snowe/snowe.h @@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#if defined(RGB_MATRIX_ENABLE) //# include "rgb_matrix_stuff.h" //#endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include "oled_setup.h" #endif diff --git a/users/tominabox1/rules.mk b/users/tominabox1/rules.mk index a7759f8020..160dcce7b9 100644 --- a/users/tominabox1/rules.mk +++ b/users/tominabox1/rules.mk @@ -11,7 +11,8 @@ ifeq ($(strip $(KEYBOARD)), crkbd/rev1) RGB_MATRIX_ENABLE = yes EXTRAFLAGS += -flto BOOTLOADER = qmk-dfu -OLED_DRIVER_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 endif ifeq ($(strip $(KEYBOARD)), lazydesigners/dimple) diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index 34fe3068ac..e48959be9d 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -172,10 +172,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif if (record->event.pressed) { - #ifdef OLED_DRIVER_ENABLE + #ifdef OLED_ENABLE oled_timer = timer_read(); oled_on(); - #endif // OLED_DRIVER_ENABLE + #endif // OLED_ENABLE switch (keycode) { case KC_BBB: if (record->event.pressed) { @@ -193,7 +193,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #ifdef KEYBOARD_crkbd_rev1 -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE void render_logo(void) { static const char PROGMEM logo[] = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk index 8f8365ea7e..7094191f2f 100644 --- a/users/xulkal/rules.mk +++ b/users/xulkal/rules.mk @@ -27,6 +27,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += custom_rgb.c endif -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) +ifeq ($(strip $(OLED_ENABLE)), yes) SRC += custom_oled.c endif |