[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:
		
							parent
							
								
									6fd20acf4b
								
							
						
					
					
						commit
						4e1c5887c5
					
				
					 500 changed files with 1579 additions and 1387 deletions
				
			
		| 
						 | 
				
			
			@ -27,7 +27,8 @@ RGB_MATRIX_ENABLE = yes
 | 
			
		|||
RGB_MATRIX_DRIVER = WS2812
 | 
			
		||||
SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
 | 
			
		||||
 | 
			
		||||
OLED_DRIVER_ENABLE = yes    # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = yes
 | 
			
		||||
OLED_DRIVER = SSD1306    # Enable the OLED Driver
 | 
			
		||||
 | 
			
		||||
ENCODER_ENABLE = yes
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,4 +43,4 @@ OPT_DEFS += -Ikeyboards/rgbkb/common
 | 
			
		|||
# matrix optimisations
 | 
			
		||||
SRC += matrix.c
 | 
			
		||||
 | 
			
		||||
DEFAULT_FOLDER = rgbkb/mun/rev1
 | 
			
		||||
DEFAULT_FOLDER = rgbkb/mun/rev1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		|||
    )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
void oled_task_user(void) {
 | 
			
		||||
    // Host Keyboard Layer Status
 | 
			
		||||
    oled_write_P(PSTR("RGBKB Pan\n"), false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,8 @@ RGB_MATRIX_ENABLE = yes
 | 
			
		|||
RGB_MATRIX_DRIVER = WS2812
 | 
			
		||||
WS2812_DRIVER = bitbang
 | 
			
		||||
ENCODER_ENABLE = yes
 | 
			
		||||
OLED_DRIVER_ENABLE = yes
 | 
			
		||||
OLED_ENABLE = yes
 | 
			
		||||
OLED_DRIVER = SSD1306
 | 
			
		||||
 | 
			
		||||
# RGB layout selection
 | 
			
		||||
RGB_ENCODERS = yes # For RGB encoders, solder on both WS2811 chips
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -196,7 +196,7 @@ void matrix_init_user(void) {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
// OLED Driver Logic
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
  if (!is_keyboard_master())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
LED_MIRRORED            = no        # Mirror LEDs across halves (enable DIP 1 on slave, and DIP 2 and 3 on master)
 | 
			
		||||
 | 
			
		||||
# Misc
 | 
			
		||||
OLED_DRIVER_ENABLE      = yes       # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE     = yes       # Enable the OLED Driver
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -261,7 +261,7 @@ void matrix_init_user(void) {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
// OLED Driver Logic
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
  if (!has_usb())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -298,7 +298,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// OLED Driver Logic
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
  if (is_keyboard_master())
 | 
			
		||||
    return OLED_ROTATION_270;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ RGBLIGHT_FULL_POWER = no    # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
 | 
			
		||||
OLED_DRIVER_ENABLE = no     # Enable the OLED Driver (+5000)
 | 
			
		||||
OLED_ENABLE = no     # Enable the OLED Driver (+5000)
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ FULLHAND_ENABLE         = no        # Enables the additional 24 Full Hand LEDs
 | 
			
		|||
SF_ENABLE               = no        # Enables the additional 38 Starfighter LEDs
 | 
			
		||||
 | 
			
		||||
# Misc
 | 
			
		||||
OLED_DRIVER_ENABLE      = yes       # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE     = yes       # Enable the OLED Driver
 | 
			
		||||
 | 
			
		||||
# Not using the encoder for rev1
 | 
			
		||||
ifeq ($(strip $(KEYBOARD)), rgbkb/sol/rev1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -279,7 +279,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
// OLED Driver Logic
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
  if (is_keyboard_master())
 | 
			
		||||
    return OLED_ROTATION_270;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,8 @@ OLED_ENABLE = no            # OLED_ENABLE
 | 
			
		|||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
DEFAULT_FOLDER = rgbkb/sol/rev1
 | 
			
		||||
ENCODER_ENABLE = no
 | 
			
		||||
OLED_DRIVER_ENABLE = yes
 | 
			
		||||
OLED_ENABLE = yes
 | 
			
		||||
OLED_DRIVER = SSD1306
 | 
			
		||||
 | 
			
		||||
# Do not edit past here
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -51,4 +52,4 @@ endif
 | 
			
		|||
 | 
			
		||||
ifeq ($(strip $(LED_MIRRORED)), yes)
 | 
			
		||||
    OPT_DEFS += -DLED_MIRRORED
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,5 +25,5 @@ RGBLIGHT_FULL_POWER     = no        # Allow maximum RGB brightness for RGBLIGHT
 | 
			
		|||
IOS_DEVICE_ENABLE       = no        # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
 | 
			
		||||
# Misc
 | 
			
		||||
OLED_DRIVER_ENABLE      = no        # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE     = no        # Enable the OLED Driver
 | 
			
		||||
SWAP_HANDS_ENABLE       = no        # Enable one-hand typing
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#define ENCODERS_PAD_A { D2 }
 | 
			
		||||
#define ENCODERS_PAD_B { D6 }
 | 
			
		||||
#else
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
    #error Extra encoders cannot be enabled at the same time as the OLED Driver as they use the same pins.
 | 
			
		||||
#endif
 | 
			
		||||
#define ENCODERS_PAD_A { D2, D1, B0 }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ ifeq ($(strip $(EXTRA_ENCODERS_ENABLE)), yes)
 | 
			
		|||
    OPT_DEFS += -DEXTRA_ENCODERS_ENABLE
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
 | 
			
		||||
ifeq ($(strip $(OLED_ENABLE)), yes)
 | 
			
		||||
    ifeq ($(strip $(ENCODER_ENABLE)), yes)
 | 
			
		||||
        ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
 | 
			
		||||
            ifneq ($(strip $(RGB_OLED_MENU)), no)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,8 +27,8 @@ SF_ENABLE               = no        # Enables the additional 38 Starfighter LEDs
 | 
			
		|||
IOS_DEVICE_ENABLE       = no        # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
 | 
			
		||||
# Misc
 | 
			
		||||
OLED_DRIVER_ENABLE      = no        # Enable the OLED Driver
 | 
			
		||||
EXTRA_ENCODERS_ENABLE   = no        # Enables 3 encoders per side (up from 1, not compatible with OLED_DRIVER_ENABLE)
 | 
			
		||||
OLED_ENABLE     = no        # Enable the OLED Driver
 | 
			
		||||
EXTRA_ENCODERS_ENABLE   = no        # Enables 3 encoders per side (up from 1, not compatible with OLED_ENABLE)
 | 
			
		||||
SWAP_HANDS_ENABLE       = no        # Enable one-hand typing
 | 
			
		||||
LTO_ENABLE = yes # Enable Link Time Optimizations greatly reducing firmware size by disabling the old Macros and Functions features
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if OLED_DRIVER_ENABLE
 | 
			
		||||
#if OLED_ENABLE
 | 
			
		||||
const char* layer_name_user(uint32_t layer) {
 | 
			
		||||
  switch (layer) {
 | 
			
		||||
    case _QWERTY:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
#include "rev2.h"
 | 
			
		||||
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
#include "split_util.h"
 | 
			
		||||
#include "oled_driver.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
ENCODER_ENABLE = yes
 | 
			
		||||
 | 
			
		||||
OLED_DRIVER_ENABLE = no
 | 
			
		||||
OLED_ENABLE = no
 | 
			
		||||
 | 
			
		||||
# Setup so that OLED can be turned on/off easily
 | 
			
		||||
ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
 | 
			
		||||
ifeq ($(strip $(OLED_ENABLE)), yes)
 | 
			
		||||
  # Custom local font file
 | 
			
		||||
  OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = yes        # Enable rotary encoder
 | 
			
		||||
OLED_DRIVER_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
LTO_ENABLE = no      # Enable optimizations to reduce firmware size. Also disables action macros and functions.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,8 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = yes        # Enable rotary encoder (+90)
 | 
			
		||||
OLED_DRIVER_ENABLE = yes    # Enable the OLED Driver (+5000)
 | 
			
		||||
OLED_ENABLE = yes
 | 
			
		||||
OLED_DRIVER = SSD1306    # Enable the OLED Driver (+5000)
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = yes        # Enable rotary encoder
 | 
			
		||||
OLED_DRIVER_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
LTO_ENABLE = no      # Enable optimizations to reduce firmware size. Also disables action macros and functions.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
// SSD1306 OLED driver logic
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
static void render_logo(void) {
 | 
			
		||||
  static const char PROGMEM rgbkb_logo[] = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,8 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = yes        # Enable rotary encoder
 | 
			
		||||
OLED_DRIVER_ENABLE = yes    # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = yes
 | 
			
		||||
OLED_DRIVER = SSD1306    # Enable the OLED Driver
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
LTO_ENABLE = yes     # Enable optimizations to reduce firmware size. Also disables action macros and functions.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = yes        # Enable rotary encoder
 | 
			
		||||
OLED_DRIVER_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
 | 
			
		||||
# Do not edit past here
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ RGBLIGHT_FULL_POWER = yes   # Allow maximum RGB brightness. Otherwise, limited t
 | 
			
		|||
UNICODE_ENABLE = no         # Unicode
 | 
			
		||||
SWAP_HANDS_ENABLE = no      # Enable one-hand typing
 | 
			
		||||
ENCODER_ENABLE = no         # Enable rotary encoder
 | 
			
		||||
OLED_DRIVER_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
OLED_ENABLE = no     # Enable the OLED Driver
 | 
			
		||||
IOS_DEVICE_ENABLE = no      # Limit max brightness to connect to IOS device (iPad,iPhone)
 | 
			
		||||
LTO_ENABLE = no      # Enable optimizations to reduce firmware size. Also disables action macros and functions.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue