From bf72482f043193223c1f6255c145fc2aa849da13 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Thu, 5 Dec 2019 21:22:10 +0900
Subject: [PATCH 1/7] is_master, has_usb() move to rev2.[hc]
---
keyboards/helix/rev2/matrix.c | 5 +----
keyboards/helix/rev2/rev2.c | 14 ++++++++++++++
keyboards/helix/rev2/rev2.h | 11 +++++++++++
keyboards/helix/rev2/split_util.c | 11 +++++------
keyboards/helix/rev2/split_util.h | 2 +-
5 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/keyboards/helix/rev2/matrix.c b/keyboards/helix/rev2/matrix.c
index 70a6cb0a5e00..050dcac2d203 100644
--- a/keyboards/helix/rev2/matrix.c
+++ b/keyboards/helix/rev2/matrix.c
@@ -47,7 +47,6 @@ along with this program. If not, see .
static uint8_t debouncing = DEBOUNCE;
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
static uint8_t error_count = 0;
-uint8_t is_master = 0 ;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
@@ -111,8 +110,6 @@ void matrix_init(void)
matrix_debouncing[i] = 0;
}
- is_master = has_usb();
-
matrix_init_quantum();
}
@@ -200,7 +197,7 @@ int serial_transaction(int master_changed) {
uint8_t matrix_scan(void)
{
- if (is_master) {
+ if (is_helix_master()) {
matrix_master_scan();
}else{
matrix_slave_scan();
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c
index abaa02cdb131..fa14bdaa7afa 100644
--- a/keyboards/helix/rev2/rev2.c
+++ b/keyboards/helix/rev2/rev2.c
@@ -1,5 +1,9 @@
#include "helix.h"
+// Each keymap.c should use is_keyboard_master() instead of 'is_master'.
+// But keep 'is_master' for a while for backwards compatibility
+// for the old keymap.c.
+uint8_t is_master = false;
#ifdef SSD1306OLED
#include "ssd1306.h"
@@ -15,7 +19,17 @@ void led_set_kb(uint8_t usb_led) {
#endif
void matrix_init_kb(void) {
+ // Each keymap.c should use is_keyboard_master() instead of is_master.
+ // But keep is_master for a while for backwards compatibility
+ // for the old keymap.c.
+ is_master = is_keyboard_master();
matrix_init_user();
};
+void keyboard_post_init_kb(void) {
+#if defined(DEBUG_MATRIX_SCAN_RATE)
+ debug_enable = true;
+#endif
+ keyboard_post_init_user();
+}
diff --git a/keyboards/helix/rev2/rev2.h b/keyboards/helix/rev2/rev2.h
index 4e69daef509c..4f156ad08829 100644
--- a/keyboards/helix/rev2/rev2.h
+++ b/keyboards/helix/rev2/rev2.h
@@ -4,6 +4,17 @@
#include "quantum.h"
+#ifndef SPLIT_KEYBOARD
+ extern bool is_helix_master(void);
+ #define is_keyboard_master() is_helix_master()
+#endif
+
+// Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'.
+// But keep 'is_master' for a while for backwards compatibility
+// for the old keymap.c.
+extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
+#define has_usb() is_keyboard_master()
+
#ifdef RGBLIGHT_ENABLE
//rgb led driver
#include "ws2812.h"
diff --git a/keyboards/helix/rev2/split_util.c b/keyboards/helix/rev2/split_util.c
index 89df43e2773a..50f06961e834 100644
--- a/keyboards/helix/rev2/split_util.c
+++ b/keyboards/helix/rev2/split_util.c
@@ -41,7 +41,7 @@ bool waitForUsb(void) {
}
-__attribute__((weak)) bool is_keyboard_left(void) {
+bool is_keyboard_left(void) {
#if defined(SPLIT_HAND_PIN)
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
setPinInput(SPLIT_HAND_PIN);
@@ -49,13 +49,13 @@ __attribute__((weak)) bool is_keyboard_left(void) {
#elif defined(EE_HANDS)
return eeconfig_read_handedness();
#elif defined(MASTER_RIGHT)
- return !has_usb();
+ return !is_helix_master();
#endif
- return has_usb();
+ return is_helix_master();
}
-__attribute__((weak)) bool has_usb(void) {
+bool is_helix_master(void) {
static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN;
// only check once, as this is called often
@@ -96,11 +96,10 @@ static void keyboard_slave_setup(void) {
void split_keyboard_setup(void) {
isLeftHand = is_keyboard_left();
- if (has_usb()) {
+ if (is_helix_master()) {
keyboard_master_setup();
} else {
keyboard_slave_setup();
}
sei();
}
-
diff --git a/keyboards/helix/rev2/split_util.h b/keyboards/helix/rev2/split_util.h
index 687ca19bd3e5..c0ecdb097412 100644
--- a/keyboards/helix/rev2/split_util.h
+++ b/keyboards/helix/rev2/split_util.h
@@ -12,7 +12,7 @@ extern volatile bool isLeftHand;
void matrix_slave_scan(void);
void split_keyboard_setup(void);
-bool has_usb(void);
+bool is_helix_master(void);
void matrix_master_OLED_init (void);
From 35ad4d4e662772105cab45dffe83af8fadf197a5 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Mon, 9 Dec 2019 20:32:40 +0900
Subject: [PATCH 2/7] Do recent helix/rev2 changes to helix/pico as well.
helix/pico/matrix.c: remove 'is_master'
helix/pico/pico.c: add 'is_master'
helix/pico/pico.h: add 'has_usb()' macro
helix/pico/split_util.c: remove 'setup_handedness()' 'has_usb()', add 'is_helix_master()' etc
---
keyboards/helix/pico/matrix.c | 10 ++--
keyboards/helix/pico/pico.c | 15 ++++++
keyboards/helix/pico/pico.h | 11 +++++
keyboards/helix/pico/split_util.c | 82 ++++++++++++++++++++++---------
keyboards/helix/pico/split_util.h | 2 +-
5 files changed, 88 insertions(+), 32 deletions(-)
diff --git a/keyboards/helix/pico/matrix.c b/keyboards/helix/pico/matrix.c
index c2940e3b3e61..a537ef03c442 100644
--- a/keyboards/helix/pico/matrix.c
+++ b/keyboards/helix/pico/matrix.c
@@ -46,7 +46,6 @@ along with this program. If not, see .
static uint8_t debouncing = DEBOUNCE;
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
static uint8_t error_count = 0;
-uint8_t is_master = 0 ;
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
@@ -94,9 +93,8 @@ uint8_t matrix_cols(void)
void matrix_init(void)
{
- debug_enable = true;
- debug_matrix = true;
- debug_mouse = true;
+ split_keyboard_setup();
+
// initialize row and col
unselect_rows();
init_cols();
@@ -111,8 +109,6 @@ void matrix_init(void)
matrix_debouncing[i] = 0;
}
- is_master = has_usb();
-
matrix_init_quantum();
}
@@ -197,7 +193,7 @@ int serial_transaction(void) {
uint8_t matrix_scan(void)
{
- if (is_master) {
+ if (is_helix_master()) {
matrix_master_scan();
}else{
matrix_slave_scan();
diff --git a/keyboards/helix/pico/pico.c b/keyboards/helix/pico/pico.c
index bb8ba9ca2b4d..fa14bdaa7afa 100644
--- a/keyboards/helix/pico/pico.c
+++ b/keyboards/helix/pico/pico.c
@@ -1,5 +1,9 @@
#include "helix.h"
+// Each keymap.c should use is_keyboard_master() instead of 'is_master'.
+// But keep 'is_master' for a while for backwards compatibility
+// for the old keymap.c.
+uint8_t is_master = false;
#ifdef SSD1306OLED
#include "ssd1306.h"
@@ -15,6 +19,17 @@ void led_set_kb(uint8_t usb_led) {
#endif
void matrix_init_kb(void) {
+ // Each keymap.c should use is_keyboard_master() instead of is_master.
+ // But keep is_master for a while for backwards compatibility
+ // for the old keymap.c.
+ is_master = is_keyboard_master();
matrix_init_user();
};
+
+void keyboard_post_init_kb(void) {
+#if defined(DEBUG_MATRIX_SCAN_RATE)
+ debug_enable = true;
+#endif
+ keyboard_post_init_user();
+}
diff --git a/keyboards/helix/pico/pico.h b/keyboards/helix/pico/pico.h
index 4360be2a9c1f..dff871fc5ab6 100644
--- a/keyboards/helix/pico/pico.h
+++ b/keyboards/helix/pico/pico.h
@@ -4,6 +4,17 @@
#include "quantum.h"
+#ifndef SPLIT_KEYBOARD
+ extern bool is_helix_master(void);
+ #define is_keyboard_master() is_helix_master()
+#endif
+
+// Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'.
+// But keep 'is_master' for a while for backwards compatibility
+// for the old keymap.c.
+extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
+#define has_usb() is_keyboard_master()
+
#ifdef RGBLIGHT_ENABLE
//rgb led driver
#include "ws2812.h"
diff --git a/keyboards/helix/pico/split_util.c b/keyboards/helix/pico/split_util.c
index beb39fa00591..c77e63f33c47 100644
--- a/keyboards/helix/pico/split_util.c
+++ b/keyboards/helix/pico/split_util.c
@@ -7,6 +7,7 @@
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
+#include "wait.h"
#ifdef USE_MATRIX_I2C
# include "i2c.h"
@@ -14,21 +15,65 @@
# include "serial.h"
#endif
+#ifdef EE_HANDS
+# include "eeconfig.h"
+#endif
+
+#ifndef SPLIT_USB_TIMEOUT
+ #define SPLIT_USB_TIMEOUT 2500
+#endif
+
volatile bool isLeftHand = true;
-static void setup_handedness(void) {
- #ifdef EE_HANDS
- isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
- #else
- // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
- #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
- isLeftHand = !has_usb();
- #else
- isLeftHand = has_usb();
- #endif
- #endif
+bool waitForUsb(void) {
+ for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) {
+ // This will return true of a USB connection has been established
+ if (UDADDR & _BV(ADDEN)) {
+ return true;
+ }
+ wait_ms(100);
+ }
+
+ // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
+ (USBCON &= ~(_BV(USBE) | _BV(OTGPADE)));
+
+ return false;
+}
+
+bool is_keyboard_left(void) {
+#if defined(SPLIT_HAND_PIN)
+ // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
+ setPinInput(SPLIT_HAND_PIN);
+ return readPin(SPLIT_HAND_PIN);
+#elif defined(EE_HANDS)
+ return eeconfig_read_handedness();
+#elif defined(MASTER_RIGHT)
+ return !is_helix_master();
+#endif
+
+ return is_helix_master();
}
+bool is_helix_master(void) {
+ static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN;
+
+ // only check once, as this is called often
+ if (usbstate == UNKNOWN) {
+#if defined(SPLIT_USB_DETECT)
+ usbstate = waitForUsb() ? MASTER : SLAVE;
+#elif defined(__AVR__)
+ USBCON |= (1 << OTGPADE); // enables VBUS pad
+ wait_us(5);
+
+ usbstate = (USBSTA & (1 << VBUS)) ? MASTER : SLAVE; // checks state of VBUS
+#else
+ usbstate = MASTER;
+#endif
+ }
+
+ return (usbstate == MASTER);
+ }
+
static void keyboard_master_setup(void) {
#ifdef USE_MATRIX_I2C
@@ -47,24 +92,13 @@ static void keyboard_slave_setup(void) {
#endif
}
-bool has_usb(void) {
- USBCON |= (1 << OTGPADE); //enables VBUS pad
- _delay_us(5);
- return (USBSTA & (1<
Date: Thu, 14 Nov 2019 16:27:32 +0900
Subject: [PATCH 3/7] add HELIX=scan option into {rev2/pico}/local_features.mk
Made DEBUG_MATRIX_SCAN_RATE easy to use.
---
keyboards/helix/pico/local_features.mk | 17 +++++++++++++----
keyboards/helix/rev2/local_features.mk | 17 +++++++++++++----
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/keyboards/helix/pico/local_features.mk b/keyboards/helix/pico/local_features.mk
index 47b928647b22..cd8b573fef0e 100644
--- a/keyboards/helix/pico/local_features.mk
+++ b/keyboards/helix/pico/local_features.mk
@@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG
$(info - OLED_ENABLE = $(OLED_ENABLE))
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
- $(info - LED_ANIMATION = $(LED_ANIMATIONS))
+ $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
$(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
$(info )
endef
@@ -43,8 +43,15 @@ endef
ifeq ($(findstring ios,$(HELIX)), ios)
IOS_DEVICE_ENABLE = yes
endif
+ ifeq ($(findstring scan,$(HELIX)), scan)
+ # use DEBUG_MATRIX_SCAN_RATE
+ # see docs/newbs_testing_debugging.md
+ OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
+ CONSOLE_ENABLE = yes
+ SHOW_VERBOSE_INFO = yes
+ endif
ifeq ($(findstring verbose,$(HELIX)), verbose)
- SHOW_VERBOSE_INFO = yes
+ SHOW_VERBOSE_INFO = yes
endif
SHOW_HELIX_OPTIONS = yes
endif
@@ -92,8 +99,10 @@ endif
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
$(eval $(call HELIX_CUSTOMISE_MSG))
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
- $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
- $(info -- OPT_DEFS = $(OPT_DEFS))
+ $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
+ $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE))
+ $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE))
+ $(info -- OPT_DEFS = $(OPT_DEFS))
$(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE))
$(info )
endif
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index 0f4285eea952..f550eb9c16b0 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG
$(info - OLED_ENABLE = $(OLED_ENABLE))
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
- $(info - LED_ANIMATION = $(LED_ANIMATIONS))
+ $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
$(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
$(info )
endef
@@ -43,8 +43,15 @@ endef
ifeq ($(findstring ios,$(HELIX)), ios)
IOS_DEVICE_ENABLE = yes
endif
+ ifeq ($(findstring scan,$(HELIX)), scan)
+ # use DEBUG_MATRIX_SCAN_RATE
+ # see docs/newbs_testing_debugging.md
+ OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
+ CONSOLE_ENABLE = yes
+ SHOW_VERBOSE_INFO = yes
+ endif
ifeq ($(findstring verbose,$(HELIX)), verbose)
- SHOW_VERBOSE_INFO = yes
+ SHOW_VERBOSE_INFO = yes
endif
SHOW_HELIX_OPTIONS = yes
endif
@@ -90,8 +97,10 @@ endif
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
$(eval $(call HELIX_CUSTOMISE_MSG))
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
- $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
- $(info -- OPT_DEFS = $(OPT_DEFS))
+ $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
+ $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE))
+ $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE))
+ $(info -- OPT_DEFS = $(OPT_DEFS))
$(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE))
$(info )
endif
From 6fe75645632be32f7f46b91fb75a6406368c3a73 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Tue, 10 Dec 2019 11:34:30 +0900
Subject: [PATCH 4/7] Changed rules.mk to link "helix/local_drivers/ssd1306.c"
only when OLED_ENABLE = yes.
---
keyboards/helix/local_drivers/i2c.c | 3 ---
keyboards/helix/pico/config.h | 1 -
keyboards/helix/pico/local_features.mk | 10 ++++++----
keyboards/helix/pico/pico.h | 13 -------------
keyboards/helix/pico/rules.mk | 2 --
keyboards/helix/rev2/config.h | 1 -
keyboards/helix/rev2/local_features.mk | 10 ++++++----
keyboards/helix/rev2/rev2.h | 13 -------------
keyboards/helix/rev2/rules.mk | 2 --
9 files changed, 12 insertions(+), 43 deletions(-)
diff --git a/keyboards/helix/local_drivers/i2c.c b/keyboards/helix/local_drivers/i2c.c
index 4bee5c639829..9221429e96f0 100644
--- a/keyboards/helix/local_drivers/i2c.c
+++ b/keyboards/helix/local_drivers/i2c.c
@@ -6,8 +6,6 @@
#include
#include "i2c.h"
-#ifdef USE_I2C
-
// Limits the amount of we wait for any one i2c transaction.
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
// 9 bits, a single transaction will take around 90μs to complete.
@@ -159,4 +157,3 @@ ISR(TWI_vect) {
// Reset everything, so we are ready for the next TWI interrupt
TWCR |= (1<.
#define TAPPING_TERM 100
/* Use I2C or Serial */
-#define USE_I2C
#define USE_SERIAL
//#define USE_MATRIX_I2C
diff --git a/keyboards/helix/pico/local_features.mk b/keyboards/helix/pico/local_features.mk
index cd8b573fef0e..9e6490d5120c 100644
--- a/keyboards/helix/pico/local_features.mk
+++ b/keyboards/helix/pico/local_features.mk
@@ -80,11 +80,13 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
+ SRC += local_drivers/i2c.c
+ SRC += local_drivers/ssd1306.c
+ KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
OPT_DEFS += -DOLED_ENABLE
-endif
-
-ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DLOCAL_GLCDFONT
+ ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
+ OPT_DEFS += -DLOCAL_GLCDFONT
+ endif
endif
ifeq ($(strip $(AUDIO_ENABLE)),yes)
diff --git a/keyboards/helix/pico/pico.h b/keyboards/helix/pico/pico.h
index dff871fc5ab6..303fe315ea59 100644
--- a/keyboards/helix/pico/pico.h
+++ b/keyboards/helix/pico/pico.h
@@ -15,19 +15,6 @@
extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
#define has_usb() is_keyboard_master()
-#ifdef RGBLIGHT_ENABLE
-//rgb led driver
-#include "ws2812.h"
-#endif
-
-#ifdef USE_I2C
-#include
-#ifdef __AVR__
- #include
- #include
-#endif
-#endif
-
#ifndef FLIP_HALF
// Standard Keymap
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
diff --git a/keyboards/helix/pico/rules.mk b/keyboards/helix/pico/rules.mk
index d3ad20ccad89..f694784a36e1 100644
--- a/keyboards/helix/pico/rules.mk
+++ b/keyboards/helix/pico/rules.mk
@@ -1,8 +1,6 @@
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
-SRC += local_drivers/i2c.c
SRC += local_drivers/serial.c
-SRC += local_drivers/ssd1306.c
KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
# A workaround until #7089 is merged.
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h
index fe82ce140fb8..65f6135718e2 100644
--- a/keyboards/helix/rev2/config.h
+++ b/keyboards/helix/rev2/config.h
@@ -30,7 +30,6 @@ along with this program. If not, see .
#define TAPPING_TERM 100
/* Use I2C or Serial */
-#define USE_I2C
#define USE_SERIAL
//#define USE_MATRIX_I2C
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index f550eb9c16b0..d182754b9bf9 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -87,11 +87,13 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
+ SRC += local_drivers/i2c.c
+ SRC += local_drivers/ssd1306.c
+ KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
OPT_DEFS += -DOLED_ENABLE
-endif
-
-ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DLOCAL_GLCDFONT
+ ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
+ OPT_DEFS += -DLOCAL_GLCDFONT
+ endif
endif
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
diff --git a/keyboards/helix/rev2/rev2.h b/keyboards/helix/rev2/rev2.h
index 4f156ad08829..8b82a4a6eea0 100644
--- a/keyboards/helix/rev2/rev2.h
+++ b/keyboards/helix/rev2/rev2.h
@@ -15,19 +15,6 @@
extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
#define has_usb() is_keyboard_master()
-#ifdef RGBLIGHT_ENABLE
-//rgb led driver
-#include "ws2812.h"
-#endif
-
-#ifdef USE_I2C
-#include
-#ifdef __AVR__
- #include
- #include
-#endif
-#endif
-
#if MATRIX_ROWS == 8 // HELIX_ROWS == 4
#ifndef FLIP_HALF
// Standard Keymap
diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk
index 7357d568c690..caa39a0a274e 100644
--- a/keyboards/helix/rev2/rules.mk
+++ b/keyboards/helix/rev2/rules.mk
@@ -1,8 +1,6 @@
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
-SRC += local_drivers/i2c.c
SRC += local_drivers/serial.c
-SRC += local_drivers/ssd1306.c
KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
# A workaround until #7089 is merged.
From 934e0cd925ee3aa7e622dbc397cbe48bbbe1e204 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Tue, 10 Dec 2019 11:54:28 +0900
Subject: [PATCH 5/7] Added option to use split_common for helix/rev2,
helix/pico keyboard.
how to build:
### build helix/pico (HelixPico) with helix current codes
$ make helix/pico:KEY_MAP
$ make helix/pico/back:KEY_MAP
### build helix/rev2 (Helix or Helix beta) with helix current codes
$ make helix:KEY_MAP
$ make helix/rev2/back:KEY_MAP
$ make helix/rev2/under:KEY_MAP
$ make helix/rev2/oled:KEY_MAP
$ make helix/rev2/oled/back:KEY_MAP
$ make helix/rev2/oled/under:KEY_MAP
### build helix/pico (HelixPico) with split_common codes
$ make helix/pico/sc:KEY_MAP
$ make helix/pico/sc/back:KEY_MAP
$ make helix/pico/sc/under:KEY_MAP
### build helix/rev2 (Helix) with split_common codes
$ make helix/rev2/sc:KEY_MAP
$ make helix/rev2/sc/back:KEY_MAP
$ make helix/rev2/sc/under:KEY_MAP
$ make helix/rev2/sc/oled:KEY_MAP
$ make helix/rev2/sc/oledback:KEY_MAP
$ make helix/rev2/sc/oledunder:KEY_MAP
---
keyboards/helix/pico/local_features.mk | 15 +++++++++++++++
keyboards/helix/pico/post_config.h | 7 +++++++
keyboards/helix/pico/rules.mk | 13 -------------
keyboards/helix/pico/sc/back/rules.mk | 1 +
keyboards/helix/pico/sc/rules.mk | 1 +
keyboards/helix/pico/sc/under/rules.mk | 1 +
keyboards/helix/rev2/local_features.mk | 16 ++++++++++++++++
keyboards/helix/rev2/post_config.h | 7 +++++++
keyboards/helix/rev2/rules.mk | 14 --------------
keyboards/helix/rev2/sc/back/rules.mk | 1 +
keyboards/helix/rev2/sc/oled/rules.mk | 1 +
keyboards/helix/rev2/sc/oledback/rules.mk | 2 ++
keyboards/helix/rev2/sc/oledunder/rules.mk | 2 ++
keyboards/helix/rev2/sc/rules.mk | 1 +
keyboards/helix/rev2/sc/under/rules.mk | 1 +
15 files changed, 56 insertions(+), 27 deletions(-)
create mode 100644 keyboards/helix/pico/post_config.h
create mode 100644 keyboards/helix/pico/sc/back/rules.mk
create mode 100644 keyboards/helix/pico/sc/rules.mk
create mode 100644 keyboards/helix/pico/sc/under/rules.mk
create mode 100644 keyboards/helix/rev2/post_config.h
create mode 100644 keyboards/helix/rev2/sc/back/rules.mk
create mode 100644 keyboards/helix/rev2/sc/oled/rules.mk
create mode 100644 keyboards/helix/rev2/sc/oledback/rules.mk
create mode 100644 keyboards/helix/rev2/sc/oledunder/rules.mk
create mode 100644 keyboards/helix/rev2/sc/rules.mk
create mode 100644 keyboards/helix/rev2/sc/under/rules.mk
diff --git a/keyboards/helix/pico/local_features.mk b/keyboards/helix/pico/local_features.mk
index 9e6490d5120c..0277a3d227c0 100644
--- a/keyboards/helix/pico/local_features.mk
+++ b/keyboards/helix/pico/local_features.mk
@@ -56,6 +56,21 @@ endef
SHOW_HELIX_OPTIONS = yes
endif
+ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
+ SRC += local_drivers/serial.c
+ KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
+
+ # A workaround until #7089 is merged.
+ # serial.c must not be compiled with the -lto option.
+ # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
+ LIB_SRC += local_drivers/serial.c
+
+ CUSTOM_MATRIX = yes
+
+ SRC += pico/matrix.c
+ SRC += pico/split_util.c
+endif
+
########
# convert Helix-specific options (that represent combinations of standard options)
# into QMK standard options.
diff --git a/keyboards/helix/pico/post_config.h b/keyboards/helix/pico/post_config.h
new file mode 100644
index 000000000000..dda73d5d22be
--- /dev/null
+++ b/keyboards/helix/pico/post_config.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#if defined(SPLIT_KEYBOARD) /* if use split_common */
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT)
+# define RGBLIGHT_SPLIT /* helix hardware need this */
+# endif
+#endif
diff --git a/keyboards/helix/pico/rules.mk b/keyboards/helix/pico/rules.mk
index f694784a36e1..cb9a70e00e30 100644
--- a/keyboards/helix/pico/rules.mk
+++ b/keyboards/helix/pico/rules.mk
@@ -1,18 +1,5 @@
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
-SRC += local_drivers/serial.c
-KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
-
-# A workaround until #7089 is merged.
-# serial.c must not be compiled with the -lto option.
-# The current LIB_SRC has a side effect with the -fno-lto option, so use it.
-LIB_SRC += local_drivers/serial.c
-
-CUSTOM_MATRIX = yes
-
-SRC += pico/matrix.c
-SRC += pico/split_util.c
-
# Helix Spacific Build Options default values
OLED_ENABLE = no # OLED_ENABLE
LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
diff --git a/keyboards/helix/pico/sc/back/rules.mk b/keyboards/helix/pico/sc/back/rules.mk
new file mode 100644
index 000000000000..066fffb74af2
--- /dev/null
+++ b/keyboards/helix/pico/sc/back/rules.mk
@@ -0,0 +1 @@
+LED_BACK_ENABLE = yes
diff --git a/keyboards/helix/pico/sc/rules.mk b/keyboards/helix/pico/sc/rules.mk
new file mode 100644
index 000000000000..d38a61809075
--- /dev/null
+++ b/keyboards/helix/pico/sc/rules.mk
@@ -0,0 +1 @@
+SPLIT_KEYBOARD = yes
diff --git a/keyboards/helix/pico/sc/under/rules.mk b/keyboards/helix/pico/sc/under/rules.mk
new file mode 100644
index 000000000000..a37aa6fab370
--- /dev/null
+++ b/keyboards/helix/pico/sc/under/rules.mk
@@ -0,0 +1 @@
+LED_UNDERGLOW_ENABLE = yes
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index d182754b9bf9..4b120936dedd 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -56,6 +56,22 @@ endef
SHOW_HELIX_OPTIONS = yes
endif
+ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
+ SRC += local_drivers/serial.c
+ KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
+
+ # A workaround until #7089 is merged.
+ # serial.c must not be compiled with the -lto option.
+ # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
+ LIB_SRC += local_drivers/serial.c
+
+ CUSTOM_MATRIX = yes
+
+ SRC += rev2/matrix.c
+ SRC += rev2/split_util.c
+ SRC += rev2/split_scomm.c
+endif
+
########
# convert Helix-specific options (that represent combinations of standard options)
# into QMK standard options.
diff --git a/keyboards/helix/rev2/post_config.h b/keyboards/helix/rev2/post_config.h
new file mode 100644
index 000000000000..dda73d5d22be
--- /dev/null
+++ b/keyboards/helix/rev2/post_config.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#if defined(SPLIT_KEYBOARD) /* if use split_common */
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT)
+# define RGBLIGHT_SPLIT /* helix hardware need this */
+# endif
+#endif
diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk
index caa39a0a274e..db584c0b23ba 100644
--- a/keyboards/helix/rev2/rules.mk
+++ b/keyboards/helix/rev2/rules.mk
@@ -1,19 +1,5 @@
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
-SRC += local_drivers/serial.c
-KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
-
-# A workaround until #7089 is merged.
-# serial.c must not be compiled with the -lto option.
-# The current LIB_SRC has a side effect with the -fno-lto option, so use it.
-LIB_SRC += local_drivers/serial.c
-
-CUSTOM_MATRIX = yes
-
-SRC += rev2/matrix.c
-SRC += rev2/split_util.c
-SRC += rev2/split_scomm.c
-
# Helix Spacific Build Options default values
HELIX_ROWS = 5 # Helix Rows is 4 or 5
OLED_ENABLE = no # OLED_ENABLE
diff --git a/keyboards/helix/rev2/sc/back/rules.mk b/keyboards/helix/rev2/sc/back/rules.mk
new file mode 100644
index 000000000000..066fffb74af2
--- /dev/null
+++ b/keyboards/helix/rev2/sc/back/rules.mk
@@ -0,0 +1 @@
+LED_BACK_ENABLE = yes
diff --git a/keyboards/helix/rev2/sc/oled/rules.mk b/keyboards/helix/rev2/sc/oled/rules.mk
new file mode 100644
index 000000000000..dd68e9d3b090
--- /dev/null
+++ b/keyboards/helix/rev2/sc/oled/rules.mk
@@ -0,0 +1 @@
+OLED_ENABLE = yes
diff --git a/keyboards/helix/rev2/sc/oledback/rules.mk b/keyboards/helix/rev2/sc/oledback/rules.mk
new file mode 100644
index 000000000000..645984f865ad
--- /dev/null
+++ b/keyboards/helix/rev2/sc/oledback/rules.mk
@@ -0,0 +1,2 @@
+OLED_ENABLE = yes
+LED_BACK_ENABLE = yes
diff --git a/keyboards/helix/rev2/sc/oledunder/rules.mk b/keyboards/helix/rev2/sc/oledunder/rules.mk
new file mode 100644
index 000000000000..e415cbd49208
--- /dev/null
+++ b/keyboards/helix/rev2/sc/oledunder/rules.mk
@@ -0,0 +1,2 @@
+OLED_ENABLE = yes
+LED_UNDERGLOW_ENABLE = yes
diff --git a/keyboards/helix/rev2/sc/rules.mk b/keyboards/helix/rev2/sc/rules.mk
new file mode 100644
index 000000000000..d38a61809075
--- /dev/null
+++ b/keyboards/helix/rev2/sc/rules.mk
@@ -0,0 +1 @@
+SPLIT_KEYBOARD = yes
diff --git a/keyboards/helix/rev2/sc/under/rules.mk b/keyboards/helix/rev2/sc/under/rules.mk
new file mode 100644
index 000000000000..a37aa6fab370
--- /dev/null
+++ b/keyboards/helix/rev2/sc/under/rules.mk
@@ -0,0 +1 @@
+LED_UNDERGLOW_ENABLE = yes
From 0d4bfc16014591612fd1a10259c10ebfc5ae5488 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Sun, 15 Dec 2019 03:08:38 +0900
Subject: [PATCH 6/7] add matrix_slave_scan_user() to helix/rev2/rev2.c,
helix/pico/pico.h
---
keyboards/helix/pico/pico.c | 6 ++++++
keyboards/helix/rev2/rev2.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/keyboards/helix/pico/pico.c b/keyboards/helix/pico/pico.c
index fa14bdaa7afa..12b8ae9efa99 100644
--- a/keyboards/helix/pico/pico.c
+++ b/keyboards/helix/pico/pico.c
@@ -33,3 +33,9 @@ void keyboard_post_init_kb(void) {
#endif
keyboard_post_init_user();
}
+
+#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
+void matrix_slave_scan_user(void) {
+ matrix_scan_user();
+}
+#endif
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c
index fa14bdaa7afa..12b8ae9efa99 100644
--- a/keyboards/helix/rev2/rev2.c
+++ b/keyboards/helix/rev2/rev2.c
@@ -33,3 +33,9 @@ void keyboard_post_init_kb(void) {
#endif
keyboard_post_init_user();
}
+
+#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
+void matrix_slave_scan_user(void) {
+ matrix_scan_user();
+}
+#endif
From c7530f67edbd5c8c567c1335df7a6ac57f60fc64 Mon Sep 17 00:00:00 2001
From: mtei <2170248+mtei@users.noreply.github.com>
Date: Sun, 15 Dec 2019 19:34:45 +0900
Subject: [PATCH 7/7] Changed 'helix:xulkal' to always use split_common and
removed ad hoc code.
Added the following line to 'helix/rev2/keymaps/xulkal/rules.mk':
SPLIT_KEYBOARD = yes
Removed the following ad hoc code from 'users/xulkal/custom_oled.c':
#if KEYBOARD_helix_rev2
extern uint8_t is_master;
bool is_keyboard_master(void) { return is_master; }
#endif
---
keyboards/helix/rev2/keymaps/xulkal/rules.mk | 2 ++
users/xulkal/custom_oled.c | 5 -----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/keyboards/helix/rev2/keymaps/xulkal/rules.mk b/keyboards/helix/rev2/keymaps/xulkal/rules.mk
index a636b2a619ef..03800f9bb95b 100644
--- a/keyboards/helix/rev2/keymaps/xulkal/rules.mk
+++ b/keyboards/helix/rev2/keymaps/xulkal/rules.mk
@@ -9,3 +9,5 @@ OLED_DRIVER_ENABLE = yes
OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
# Xulkal specific oled define
OPT_DEFS += -DOLED_90ROTATION
+
+SPLIT_KEYBOARD = yes
diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c
index 448e6ca107e5..4ed2b9a0b094 100644
--- a/users/xulkal/custom_oled.c
+++ b/users/xulkal/custom_oled.c
@@ -7,11 +7,6 @@
rgblight_config_t rgblight_config;
#endif
-#if KEYBOARD_helix_rev2
-extern uint8_t is_master;
-bool is_keyboard_master(void) { return is_master; }
-#endif
-
static void render_logo(void)
{
static const char PROGMEM font_logo[] = {