[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>
This commit is contained in:
Xelus22 2021-08-24 16:28:26 +10:00 committed by GitHub
parent 2460b0ea85
commit 3b5759ee2b
42 changed files with 121 additions and 113 deletions

View file

@ -76,7 +76,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
#endif #endif
/* oled stuff :) */ /* oled stuff :) */
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
uint16_t startup_timer; uint16_t startup_timer;
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {

View file

@ -92,7 +92,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
#endif #endif
/* oled stuff :) */ /* oled stuff :) */
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
uint16_t startup_timer = 0; uint16_t startup_timer = 0;
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {

View file

@ -54,7 +54,7 @@ static void render_logo(void) {
oled_write_P(qmk_logo, false); oled_write_P(qmk_logo, false);
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); } void oled_task_user(void) { render_logo(); }
#endif #endif

View file

@ -62,7 +62,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void render_layer_state(void) { void render_layer_state(void) {
oled_write_ln(PSTR("LAYER"), false); oled_write_ln(PSTR("LAYER"), false);

View file

@ -1 +1,3 @@
VIA_ENABLE = yes VIA_ENABLE = yes
OLED_ENABLE = yes
# OLED_DRIVER = not a real thing

View file

@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
#define OLED_DISPLAY_128X64 #define OLED_DISPLAY_128X64
#define OLED_TIMEOUT 400000 #define OLED_TIMEOUT 400000
#endif #endif

View file

@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
static void render_logo(void) { static void render_logo(void) {
static const char PROGMEM qmk_logo[] = { static const char PROGMEM qmk_logo[] = {

View file

@ -84,7 +84,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
static void render_qmk_logo(void) { static void render_qmk_logo(void) {
static const char PROGMEM qmk_logo[] = { static const char PROGMEM qmk_logo[] = {

View file

@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) if (is_keyboard_master())
return OLED_ROTATION_180; return OLED_ROTATION_180;

View file

@ -1,4 +1,5 @@
OLED_DRIVER_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306
VIA_ENABLE = yes VIA_ENABLE = yes
EXTRAKEY_ENABLE = yes EXTRAKEY_ENABLE = yes
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes

View file

@ -69,7 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
#include <stdio.h> #include <stdio.h>
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
@ -173,4 +173,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return true; return true;
} }
#endif // OLED_DRIVER_ENABLE #endif // OLED_ENABLE

View file

@ -1,5 +1,6 @@
MOUSEKEY_ENABLE = no # Mouse keys MOUSEKEY_ENABLE = no # Mouse keys
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
VIA_ENABLE = yes # Enable VIA VIA_ENABLE = yes # Enable VIA
OLED_DRIVER_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes LTO_ENABLE = yes

View file

@ -57,7 +57,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; }

View file

@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______) _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0; return OLED_ROTATION_0;

View file

@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0; return OLED_ROTATION_0;

View file

@ -61,7 +61,7 @@ void keyboard_post_init_user(void) {
// Rev3 and above only // Rev3 and above only
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false); oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false);
} }

View file

@ -61,7 +61,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return true; return true;
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0; return OLED_ROTATION_0;

View file

@ -46,7 +46,7 @@ static void render_logo(void) {
oled_write_P(qmk_logo, false); oled_write_P(qmk_logo, false);
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); } void oled_task_user(void) { render_logo(); }
#endif #endif

View file

@ -63,7 +63,7 @@ static void render_logo(void) {
oled_write_P(qmk_logo, false); oled_write_P(qmk_logo, false);
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { render_logo(); } void oled_task_user(void) { render_logo(); }
#endif #endif

View file

@ -49,7 +49,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return true; return true;
} }
#ifdef OLED_DRIVER_ENABLE //Special thanks to Sickbabies for this great OLED widget! #ifdef OLED_ENABLE //Special thanks to Sickbabies for this great OLED widget!
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_90; // rotates for proper orientation return OLED_ROTATION_90; // rotates for proper orientation
} }

View file

@ -120,7 +120,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master()) if (!is_keyboard_master())
@ -215,12 +215,12 @@ void oled_task_user(void) {
render_logo(); render_logo();
} }
} }
#endif // OLED_DRIVER_ENABLE #endif // OLED_ENABLE
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
set_keylog(keycode, record); set_keylog(keycode, record);
#endif #endif
// set_timelog(); // set_timelog();

View file

@ -1,4 +1,5 @@
VIA_ENABLE = yes VIA_ENABLE = yes
OLED_DRIVER_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306
MOUSEKEY_ENABLE = yes MOUSEKEY_ENABLE = yes
EXTRAKEY_ENABLE = yes EXTRAKEY_ENABLE = yes

View file

@ -61,7 +61,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
#endif #endif
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180; // flips the display 180 degrees if offhand return OLED_ROTATION_180; // flips the display 180 degrees if offhand
} }

View file

@ -93,7 +93,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
#endif #endif
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; // flips the display 270 degrees return OLED_ROTATION_270; // flips the display 270 degrees
} }

View file

@ -88,7 +88,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void suspend_power_down_user(void) { void suspend_power_down_user(void) {
oled_off(); oled_off();
} }

View file

@ -76,7 +76,7 @@ void matrix_scan_user(void) {
} }
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
uint32_t anim_timer = 0; uint32_t anim_timer = 0;
uint32_t anim_sleep = 0; uint32_t anim_sleep = 0;
uint8_t current_frame = 0; uint8_t current_frame = 0;

View file

@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
// Host Keyboard Layer Status // Host Keyboard Layer Status
oled_write_P(PSTR("* R A R T A N D *\n Powered by QMK\nLayer: "), false); oled_write_P(PSTR("* R A R T A N D *\n Powered by QMK\nLayer: "), false);

View file

@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
// Host Keyboard Layer Status // Host Keyboard Layer Status
oled_write_P(PSTR("* R A R T L I C E *\n Powered by QMK\nLayer: "), false); oled_write_P(PSTR("* R A R T L I C E *\n Powered by QMK\nLayer: "), false);

View file

@ -54,7 +54,7 @@ bool encoder_update_user(uint8_t index, bool clockwise){
return true; return true;
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
static void render_logo(void) { static void render_logo(void) {
static const char PROGMEM qmk_logo[] = { static const char PROGMEM qmk_logo[] = {

View file

@ -43,10 +43,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// based on https://github.com/qmk/qmk_firmware/blob/master/keyboards/kyria/keymaps/j-inc/keymap.c // based on https://github.com/qmk/qmk_firmware/blob/master/keyboards/kyria/keymaps/j-inc/keymap.c
// In your rules.mk make sure you have: // In your rules.mk make sure you have:
// OLED_DRIVER_ENABLE = yes // OLED_ENABLE = yes
// WPM_ENABLE = yes // WPM_ENABLE = yes
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
// WPM-responsive animation stuff here // WPM-responsive animation stuff here
# define IDLE_FRAMES 5 # define IDLE_FRAMES 5
# define IDLE_SPEED 20 // below this wpm value your animation will idle # define IDLE_SPEED 20 // below this wpm value your animation will idle

View file

@ -1,5 +1,5 @@
VIA_ENABLE = yes VIA_ENABLE = yes
OLED_DRIVER_ENABLE = no OLED_ENABLE = no
WPM_ENABLE = no WPM_ENABLE = no
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
LTO_ENABLE = no LTO_ENABLE = no

View file

@ -69,7 +69,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return true; return true;
} }
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180; return OLED_ROTATION_180;

View file

@ -17,7 +17,7 @@
//Sets up what the OLED screens display. //Sets up what the OLED screens display.
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
static void render_logo(void) { static void render_logo(void) {
static const char PROGMEM qmk_logo[] = { static const char PROGMEM qmk_logo[] = {

View file

@ -1,4 +1,5 @@
OLED_DRIVER_ENABLE = yes OLED_ENABLE = yes
OLED_DRIVER = SSD1306
ENCODER_ENABLE = yes ENCODER_ENABLE = yes
CONSOLE_ENABLE = no CONSOLE_ENABLE = no
EXTRAKEY_ENABLE = yes EXTRAKEY_ENABLE = yes

View file

@ -190,7 +190,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}; };
#endif #endif
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
if (is_keyboard_master()) { if (is_keyboard_master()) {
// QMK Logo and version information // QMK Logo and version information

View file

@ -1,4 +1,5 @@
OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays OLED_ENABLE = yes
OLED_DRIVER = SSD1306 # Enables the use of OLED displays
ENCODER_ENABLE = yes # Enables the use of one or more encoders ENCODER_ENABLE = yes # Enables the use of one or more encoders
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
VIA_ENABLE = yes VIA_ENABLE = yes

View file

@ -53,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; return OLED_ROTATION_270;
} }

View file

@ -1,2 +1,3 @@
VIA_ENABLE = yes VIA_ENABLE = yes
OLED_DRIVER_ENABLE = yes # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C OLED_ENABLE = yes
OLED_DRIVER = SSD1306 # Enable Support for SSD1306 or SH1106 OLED Displays; Communicating over I2C

View file

@ -85,7 +85,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
oled_write_P(PSTR("M0lly\n"),false); oled_write_P(PSTR("M0lly\n"),false);

View file

@ -97,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
), ),
}; };
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
void oled_task_user(void) { void oled_task_user(void) {
oled_write_P(PSTR("TKC1800\n"),false); oled_write_P(PSTR("TKC1800\n"),false);
// Host Keyboard Layer Status // Host Keyboard Layer Status

View file

@ -150,7 +150,7 @@ void matrix_scan_user(void) {
} }
// 0.91" OLED, 128x32 resolution // 0.91" OLED, 128x32 resolution
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180; return OLED_ROTATION_180;
} }

View file

@ -1,5 +1,5 @@
RGBLIGHT_ENABLE = yes # Enable keyboard RGB Underglow RGBLIGHT_ENABLE = yes # Enable keyboard RGB Underglow
AUDIO_ENABLE = no # Enable Audio output AUDIO_ENABLE = no # Enable Audio output
OLED_DRIVER_ENABLE = no # Enable OLED Display OLED_ENABLE = no # Enable OLED Display
VIA_ENABLE = yes # Enable VIA support VIA_ENABLE = yes # Enable VIA support
LTO_ENABLE = yes # CFLAGS=flto LTO_ENABLE = yes # CFLAGS=flto