diff options
33 files changed, 248 insertions, 123 deletions
diff --git a/keyboards/helix/local_drivers/i2c.c b/keyboards/helix/local_drivers/i2c.c index 4bee5c639..9221429e9 100644 --- a/keyboards/helix/local_drivers/i2c.c +++ b/keyboards/helix/local_drivers/i2c.c | |||
| @@ -6,8 +6,6 @@ | |||
| 6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
| 7 | #include "i2c.h" | 7 | #include "i2c.h" |
| 8 | 8 | ||
| 9 | #ifdef USE_I2C | ||
| 10 | |||
| 11 | // Limits the amount of we wait for any one i2c transaction. | 9 | // Limits the amount of we wait for any one i2c transaction. |
| 12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | 10 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is |
| 13 | // 9 bits, a single transaction will take around 90μs to complete. | 11 | // 9 bits, a single transaction will take around 90μs to complete. |
| @@ -159,4 +157,3 @@ ISR(TWI_vect) { | |||
| 159 | // Reset everything, so we are ready for the next TWI interrupt | 157 | // Reset everything, so we are ready for the next TWI interrupt |
| 160 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | 158 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); |
| 161 | } | 159 | } |
| 162 | #endif | ||
diff --git a/keyboards/helix/pico/config.h b/keyboards/helix/pico/config.h index 260560f55..05713d760 100644 --- a/keyboards/helix/pico/config.h +++ b/keyboards/helix/pico/config.h | |||
| @@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | #define TAPPING_TERM 100 | 30 | #define TAPPING_TERM 100 |
| 31 | 31 | ||
| 32 | /* Use I2C or Serial */ | 32 | /* Use I2C or Serial */ |
| 33 | #define USE_I2C | ||
| 34 | #define USE_SERIAL | 33 | #define USE_SERIAL |
| 35 | //#define USE_MATRIX_I2C | 34 | //#define USE_MATRIX_I2C |
| 36 | 35 | ||
| @@ -60,6 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 60 | #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } | 59 | #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } |
| 61 | // #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order | 60 | // #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order |
| 62 | 61 | ||
| 62 | /* COL2ROW, ROW2COL*/ | ||
| 63 | #define DIODE_DIRECTION COL2ROW | ||
| 64 | |||
| 63 | /* define if matrix has ghost */ | 65 | /* define if matrix has ghost */ |
| 64 | //#define MATRIX_HAS_GHOST | 66 | //#define MATRIX_HAS_GHOST |
| 65 | 67 | ||
diff --git a/keyboards/helix/pico/keymaps/default/readme.md b/keyboards/helix/pico/keymaps/default/readme.md index 9013e3128..3c097247e 100644 --- a/keyboards/helix/pico/keymaps/default/readme.md +++ b/keyboards/helix/pico/keymaps/default/readme.md | |||
| @@ -120,6 +120,13 @@ $ make HELIX=no_ani helix/pico/back:default # with backlight without animation | |||
| 120 | $ make helix/pico/under:default # with underglow | 120 | $ make helix/pico/under:default # with underglow |
| 121 | ``` | 121 | ``` |
| 122 | 122 | ||
| 123 | build (experimental use of split_common) | ||
| 124 | ``` | ||
| 125 | $ make helix/pico/sc:default | ||
| 126 | $ make helix/pico/sc/back:default | ||
| 127 | $ make helix/pico/sc/under:default | ||
| 128 | ``` | ||
| 129 | |||
| 123 | flash to keyboard | 130 | flash to keyboard |
| 124 | ``` | 131 | ``` |
| 125 | $ make helix/pico:default:flash | 132 | $ make helix/pico:default:flash |
diff --git a/keyboards/helix/pico/local_features.mk b/keyboards/helix/pico/local_features.mk index 47b928647..0277a3d22 100644 --- a/keyboards/helix/pico/local_features.mk +++ b/keyboards/helix/pico/local_features.mk | |||
| @@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG | |||
| 10 | $(info - OLED_ENABLE = $(OLED_ENABLE)) | 10 | $(info - OLED_ENABLE = $(OLED_ENABLE)) |
| 11 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) | 11 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) |
| 12 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) | 12 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) |
| 13 | $(info - LED_ANIMATION = $(LED_ANIMATIONS)) | 13 | $(info - LED_ANIMATIONS = $(LED_ANIMATIONS)) |
| 14 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) | 14 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) |
| 15 | $(info ) | 15 | $(info ) |
| 16 | endef | 16 | endef |
| @@ -43,12 +43,34 @@ endef | |||
| 43 | ifeq ($(findstring ios,$(HELIX)), ios) | 43 | ifeq ($(findstring ios,$(HELIX)), ios) |
| 44 | IOS_DEVICE_ENABLE = yes | 44 | IOS_DEVICE_ENABLE = yes |
| 45 | endif | 45 | endif |
| 46 | ifeq ($(findstring scan,$(HELIX)), scan) | ||
| 47 | # use DEBUG_MATRIX_SCAN_RATE | ||
| 48 | # see docs/newbs_testing_debugging.md | ||
| 49 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE | ||
| 50 | CONSOLE_ENABLE = yes | ||
| 51 | SHOW_VERBOSE_INFO = yes | ||
| 52 | endif | ||
| 46 | ifeq ($(findstring verbose,$(HELIX)), verbose) | 53 | ifeq ($(findstring verbose,$(HELIX)), verbose) |
| 47 | SHOW_VERBOSE_INFO = yes | 54 | SHOW_VERBOSE_INFO = yes |
| 48 | endif | 55 | endif |
| 49 | SHOW_HELIX_OPTIONS = yes | 56 | SHOW_HELIX_OPTIONS = yes |
| 50 | endif | 57 | endif |
| 51 | 58 | ||
| 59 | ifneq ($(strip $(SPLIT_KEYBOARD)), yes) | ||
| 60 | SRC += local_drivers/serial.c | ||
| 61 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 62 | |||
| 63 | # A workaround until #7089 is merged. | ||
| 64 | # serial.c must not be compiled with the -lto option. | ||
| 65 | # The current LIB_SRC has a side effect with the -fno-lto option, so use it. | ||
| 66 | LIB_SRC += local_drivers/serial.c | ||
| 67 | |||
| 68 | CUSTOM_MATRIX = yes | ||
| 69 | |||
| 70 | SRC += pico/matrix.c | ||
| 71 | SRC += pico/split_util.c | ||
| 72 | endif | ||
| 73 | |||
| 52 | ######## | 74 | ######## |
| 53 | # convert Helix-specific options (that represent combinations of standard options) | 75 | # convert Helix-specific options (that represent combinations of standard options) |
| 54 | # into QMK standard options. | 76 | # into QMK standard options. |
| @@ -73,11 +95,13 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes) | |||
| 73 | endif | 95 | endif |
| 74 | 96 | ||
| 75 | ifeq ($(strip $(OLED_ENABLE)), yes) | 97 | ifeq ($(strip $(OLED_ENABLE)), yes) |
| 98 | SRC += local_drivers/i2c.c | ||
| 99 | SRC += local_drivers/ssd1306.c | ||
| 100 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 76 | OPT_DEFS += -DOLED_ENABLE | 101 | OPT_DEFS += -DOLED_ENABLE |
| 77 | endif | 102 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) |
| 78 | 103 | OPT_DEFS += -DLOCAL_GLCDFONT | |
| 79 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | 104 | endif |
| 80 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 81 | endif | 105 | endif |
| 82 | 106 | ||
| 83 | ifeq ($(strip $(AUDIO_ENABLE)),yes) | 107 | ifeq ($(strip $(AUDIO_ENABLE)),yes) |
| @@ -92,8 +116,10 @@ endif | |||
| 92 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) | 116 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) |
| 93 | $(eval $(call HELIX_CUSTOMISE_MSG)) | 117 | $(eval $(call HELIX_CUSTOMISE_MSG)) |
| 94 | ifneq ($(strip $(SHOW_VERBOSE_INFO)),) | 118 | ifneq ($(strip $(SHOW_VERBOSE_INFO)),) |
| 95 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) | 119 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) |
| 96 | $(info -- OPT_DEFS = $(OPT_DEFS)) | 120 | $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE)) |
| 121 | $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE)) | ||
| 122 | $(info -- OPT_DEFS = $(OPT_DEFS)) | ||
| 97 | $(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE)) | 123 | $(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE)) |
| 98 | $(info ) | 124 | $(info ) |
| 99 | endif | 125 | endif |
diff --git a/keyboards/helix/pico/matrix.c b/keyboards/helix/pico/matrix.c index c2940e3b3..a537ef03c 100644 --- a/keyboards/helix/pico/matrix.c +++ b/keyboards/helix/pico/matrix.c | |||
| @@ -46,7 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 46 | static uint8_t debouncing = DEBOUNCE; | 46 | static uint8_t debouncing = DEBOUNCE; |
| 47 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | 47 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; |
| 48 | static uint8_t error_count = 0; | 48 | static uint8_t error_count = 0; |
| 49 | uint8_t is_master = 0 ; | ||
| 50 | 49 | ||
| 51 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | 50 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
| 52 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | 51 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
| @@ -94,9 +93,8 @@ uint8_t matrix_cols(void) | |||
| 94 | 93 | ||
| 95 | void matrix_init(void) | 94 | void matrix_init(void) |
| 96 | { | 95 | { |
| 97 | debug_enable = true; | 96 | split_keyboard_setup(); |
| 98 | debug_matrix = true; | 97 | |
| 99 | debug_mouse = true; | ||
| 100 | // initialize row and col | 98 | // initialize row and col |
| 101 | unselect_rows(); | 99 | unselect_rows(); |
| 102 | init_cols(); | 100 | init_cols(); |
| @@ -111,8 +109,6 @@ void matrix_init(void) | |||
| 111 | matrix_debouncing[i] = 0; | 109 | matrix_debouncing[i] = 0; |
| 112 | } | 110 | } |
| 113 | 111 | ||
| 114 | is_master = has_usb(); | ||
| 115 | |||
| 116 | matrix_init_quantum(); | 112 | matrix_init_quantum(); |
| 117 | } | 113 | } |
| 118 | 114 | ||
| @@ -197,7 +193,7 @@ int serial_transaction(void) { | |||
| 197 | 193 | ||
| 198 | uint8_t matrix_scan(void) | 194 | uint8_t matrix_scan(void) |
| 199 | { | 195 | { |
| 200 | if (is_master) { | 196 | if (is_helix_master()) { |
| 201 | matrix_master_scan(); | 197 | matrix_master_scan(); |
| 202 | }else{ | 198 | }else{ |
| 203 | matrix_slave_scan(); | 199 | matrix_slave_scan(); |
diff --git a/keyboards/helix/pico/pico.c b/keyboards/helix/pico/pico.c index bb8ba9ca2..12b8ae9ef 100644 --- a/keyboards/helix/pico/pico.c +++ b/keyboards/helix/pico/pico.c | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | #include "helix.h" | 1 | #include "helix.h" |
| 2 | 2 | ||
| 3 | // Each keymap.c should use is_keyboard_master() instead of 'is_master'. | ||
| 4 | // But keep 'is_master' for a while for backwards compatibility | ||
| 5 | // for the old keymap.c. | ||
| 6 | uint8_t is_master = false; | ||
| 3 | 7 | ||
| 4 | #ifdef SSD1306OLED | 8 | #ifdef SSD1306OLED |
| 5 | #include "ssd1306.h" | 9 | #include "ssd1306.h" |
| @@ -15,6 +19,23 @@ void led_set_kb(uint8_t usb_led) { | |||
| 15 | #endif | 19 | #endif |
| 16 | 20 | ||
| 17 | void matrix_init_kb(void) { | 21 | void matrix_init_kb(void) { |
| 22 | // Each keymap.c should use is_keyboard_master() instead of is_master. | ||
| 23 | // But keep is_master for a while for backwards compatibility | ||
| 24 | // for the old keymap.c. | ||
| 25 | is_master = is_keyboard_master(); | ||
| 18 | 26 | ||
| 19 | matrix_init_user(); | 27 | matrix_init_user(); |
| 20 | }; | 28 | }; |
| 29 | |||
| 30 | void keyboard_post_init_kb(void) { | ||
| 31 | #if defined(DEBUG_MATRIX_SCAN_RATE) | ||
| 32 | debug_enable = true; | ||
| 33 | #endif | ||
| 34 | keyboard_post_init_user(); | ||
| 35 | } | ||
| 36 | |||
| 37 | #if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED) | ||
| 38 | void matrix_slave_scan_user(void) { | ||
| 39 | matrix_scan_user(); | ||
| 40 | } | ||
| 41 | #endif | ||
diff --git a/keyboards/helix/pico/pico.h b/keyboards/helix/pico/pico.h index 4360be2a9..303fe315e 100644 --- a/keyboards/helix/pico/pico.h +++ b/keyboards/helix/pico/pico.h | |||
| @@ -4,18 +4,16 @@ | |||
| 4 | 4 | ||
| 5 | #include "quantum.h" | 5 | #include "quantum.h" |
| 6 | 6 | ||
| 7 | #ifdef RGBLIGHT_ENABLE | 7 | #ifndef SPLIT_KEYBOARD |
| 8 | //rgb led driver | 8 | extern bool is_helix_master(void); |
| 9 | #include "ws2812.h" | 9 | #define is_keyboard_master() is_helix_master() |
| 10 | #endif | 10 | #endif |
| 11 | 11 | ||
| 12 | #ifdef USE_I2C | 12 | // Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'. |
| 13 | #include <stddef.h> | 13 | // But keep 'is_master' for a while for backwards compatibility |
| 14 | #ifdef __AVR__ | 14 | // for the old keymap.c. |
| 15 | #include <avr/io.h> | 15 | extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead. |
| 16 | #include <avr/interrupt.h> | 16 | #define has_usb() is_keyboard_master() |
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | 17 | ||
| 20 | #ifndef FLIP_HALF | 18 | #ifndef FLIP_HALF |
| 21 | // Standard Keymap | 19 | // Standard Keymap |
diff --git a/keyboards/helix/pico/post_config.h b/keyboards/helix/pico/post_config.h new file mode 100644 index 000000000..dda73d5d2 --- /dev/null +++ b/keyboards/helix/pico/post_config.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #if defined(SPLIT_KEYBOARD) /* if use split_common */ | ||
| 4 | # if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT) | ||
| 5 | # define RGBLIGHT_SPLIT /* helix hardware need this */ | ||
| 6 | # endif | ||
| 7 | #endif | ||
diff --git a/keyboards/helix/pico/rules.mk b/keyboards/helix/pico/rules.mk index d3ad20cca..cb9a70e00 100644 --- a/keyboards/helix/pico/rules.mk +++ b/keyboards/helix/pico/rules.mk | |||
| @@ -1,20 +1,5 @@ | |||
| 1 | KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk | 1 | KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk |
| 2 | 2 | ||
| 3 | SRC += local_drivers/i2c.c | ||
| 4 | SRC += local_drivers/serial.c | ||
| 5 | SRC += local_drivers/ssd1306.c | ||
| 6 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 7 | |||
| 8 | # A workaround until #7089 is merged. | ||
| 9 | # serial.c must not be compiled with the -lto option. | ||
| 10 | # The current LIB_SRC has a side effect with the -fno-lto option, so use it. | ||
| 11 | LIB_SRC += local_drivers/serial.c | ||
| 12 | |||
| 13 | CUSTOM_MATRIX = yes | ||
| 14 | |||
| 15 | SRC += pico/matrix.c | ||
| 16 | SRC += pico/split_util.c | ||
| 17 | |||
| 18 | # Helix Spacific Build Options default values | 3 | # Helix Spacific Build Options default values |
| 19 | OLED_ENABLE = no # OLED_ENABLE | 4 | OLED_ENABLE = no # OLED_ENABLE |
| 20 | LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | 5 | 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 000000000..066fffb74 --- /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 000000000..d38a61809 --- /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 000000000..a37aa6fab --- /dev/null +++ b/keyboards/helix/pico/sc/under/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| LED_UNDERGLOW_ENABLE = yes | |||
diff --git a/keyboards/helix/pico/split_util.c b/keyboards/helix/pico/split_util.c index beb39fa00..c77e63f33 100644 --- a/keyboards/helix/pico/split_util.c +++ b/keyboards/helix/pico/split_util.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "split_util.h" | 7 | #include "split_util.h" |
| 8 | #include "matrix.h" | 8 | #include "matrix.h" |
| 9 | #include "keyboard.h" | 9 | #include "keyboard.h" |
| 10 | #include "wait.h" | ||
| 10 | 11 | ||
| 11 | #ifdef USE_MATRIX_I2C | 12 | #ifdef USE_MATRIX_I2C |
| 12 | # include "i2c.h" | 13 | # include "i2c.h" |
| @@ -14,21 +15,65 @@ | |||
| 14 | # include "serial.h" | 15 | # include "serial.h" |
| 15 | #endif | 16 | #endif |
| 16 | 17 | ||
| 18 | #ifdef EE_HANDS | ||
| 19 | # include "eeconfig.h" | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #ifndef SPLIT_USB_TIMEOUT | ||
| 23 | #define SPLIT_USB_TIMEOUT 2500 | ||
| 24 | #endif | ||
| 25 | |||
| 17 | volatile bool isLeftHand = true; | 26 | volatile bool isLeftHand = true; |
| 18 | 27 | ||
| 19 | static void setup_handedness(void) { | 28 | bool waitForUsb(void) { |
| 20 | #ifdef EE_HANDS | 29 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { |
| 21 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | 30 | // This will return true of a USB connection has been established |
| 22 | #else | 31 | if (UDADDR & _BV(ADDEN)) { |
| 23 | // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c | 32 | return true; |
| 24 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | 33 | } |
| 25 | isLeftHand = !has_usb(); | 34 | wait_ms(100); |
| 26 | #else | 35 | } |
| 27 | isLeftHand = has_usb(); | 36 | |
| 28 | #endif | 37 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow |
| 29 | #endif | 38 | (USBCON &= ~(_BV(USBE) | _BV(OTGPADE))); |
| 39 | |||
| 40 | return false; | ||
| 41 | } | ||
| 42 | |||
| 43 | bool is_keyboard_left(void) { | ||
| 44 | #if defined(SPLIT_HAND_PIN) | ||
| 45 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand | ||
| 46 | setPinInput(SPLIT_HAND_PIN); | ||
| 47 | return readPin(SPLIT_HAND_PIN); | ||
| 48 | #elif defined(EE_HANDS) | ||
| 49 | return eeconfig_read_handedness(); | ||
| 50 | #elif defined(MASTER_RIGHT) | ||
| 51 | return !is_helix_master(); | ||
| 52 | #endif | ||
| 53 | |||
| 54 | return is_helix_master(); | ||
| 30 | } | 55 | } |
| 31 | 56 | ||
| 57 | bool is_helix_master(void) { | ||
| 58 | static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN; | ||
| 59 | |||
| 60 | // only check once, as this is called often | ||
| 61 | if (usbstate == UNKNOWN) { | ||
| 62 | #if defined(SPLIT_USB_DETECT) | ||
| 63 | usbstate = waitForUsb() ? MASTER : SLAVE; | ||
| 64 | #elif defined(__AVR__) | ||
| 65 | USBCON |= (1 << OTGPADE); // enables VBUS pad | ||
| 66 | wait_us(5); | ||
| 67 | |||
| 68 | usbstate = (USBSTA & (1 << VBUS)) ? MASTER : SLAVE; // checks state of VBUS | ||
| 69 | #else | ||
| 70 | usbstate = MASTER; | ||
| 71 | #endif | ||
| 72 | } | ||
| 73 | |||
| 74 | return (usbstate == MASTER); | ||
| 75 | } | ||
| 76 | |||
| 32 | static void keyboard_master_setup(void) { | 77 | static void keyboard_master_setup(void) { |
| 33 | 78 | ||
| 34 | #ifdef USE_MATRIX_I2C | 79 | #ifdef USE_MATRIX_I2C |
| @@ -47,24 +92,13 @@ static void keyboard_slave_setup(void) { | |||
| 47 | #endif | 92 | #endif |
| 48 | } | 93 | } |
| 49 | 94 | ||
| 50 | bool has_usb(void) { | ||
| 51 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
| 52 | _delay_us(5); | ||
| 53 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
| 54 | } | ||
| 55 | |||
| 56 | void split_keyboard_setup(void) { | 95 | void split_keyboard_setup(void) { |
| 57 | setup_handedness(); | 96 | isLeftHand = is_keyboard_left(); |
| 58 | 97 | ||
| 59 | if (has_usb()) { | 98 | if (is_helix_master()) { |
| 60 | keyboard_master_setup(); | 99 | keyboard_master_setup(); |
| 61 | } else { | 100 | } else { |
| 62 | keyboard_slave_setup(); | 101 | keyboard_slave_setup(); |
| 63 | } | 102 | } |
| 64 | sei(); | 103 | sei(); |
| 65 | } | 104 | } |
| 66 | |||
| 67 | // this code runs before the usb and keyboard is initialized | ||
| 68 | void matrix_setup(void) { | ||
| 69 | split_keyboard_setup(); | ||
| 70 | } | ||
diff --git a/keyboards/helix/pico/split_util.h b/keyboards/helix/pico/split_util.h index 687ca19bd..c0ecdb097 100644 --- a/keyboards/helix/pico/split_util.h +++ b/keyboards/helix/pico/split_util.h | |||
| @@ -12,7 +12,7 @@ extern volatile bool isLeftHand; | |||
| 12 | void matrix_slave_scan(void); | 12 | void matrix_slave_scan(void); |
| 13 | 13 | ||
| 14 | void split_keyboard_setup(void); | 14 | void split_keyboard_setup(void); |
| 15 | bool has_usb(void); | 15 | bool is_helix_master(void); |
| 16 | 16 | ||
| 17 | void matrix_master_OLED_init (void); | 17 | void matrix_master_OLED_init (void); |
| 18 | 18 | ||
diff --git a/keyboards/helix/readme.md b/keyboards/helix/readme.md index a99433226..e1161cfdf 100644 --- a/keyboards/helix/readme.md +++ b/keyboards/helix/readme.md | |||
| @@ -9,8 +9,8 @@ Keyboard Maintainer: [Makoto Kurauchi](https://github.com/MakotoKurauchi/) [@plu | |||
| 9 | Hardware Supported: Helix PCB Alpha, Beta, Pro Micro | 9 | Hardware Supported: Helix PCB Alpha, Beta, Pro Micro |
| 10 | Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/), [Little Keyboards](https://littlekeyboards.com/collections/helix) | 10 | Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/), [Little Keyboards](https://littlekeyboards.com/collections/helix) |
| 11 | 11 | ||
| 12 | Make example for this keyboard (after setting up your build environment): | 12 | ## How to build |
| 13 | 13 | * [Helix how to Customize and Compile](rev2/keymaps/default/readme.md#customize) | |
| 14 | make helix:default | 14 | * [HelixPico how to Customize and Compile](pico/keymaps/default/readme.md#customize) |
| 15 | 15 | ||
| 16 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | 16 | See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. |
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h index fe82ce140..467d2d66f 100644 --- a/keyboards/helix/rev2/config.h +++ b/keyboards/helix/rev2/config.h | |||
| @@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | #define TAPPING_TERM 100 | 30 | #define TAPPING_TERM 100 |
| 31 | 31 | ||
| 32 | /* Use I2C or Serial */ | 32 | /* Use I2C or Serial */ |
| 33 | #define USE_I2C | ||
| 34 | #define USE_SERIAL | 33 | #define USE_SERIAL |
| 35 | //#define USE_MATRIX_I2C | 34 | //#define USE_MATRIX_I2C |
| 36 | 35 | ||
| @@ -68,6 +67,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 68 | #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } | 67 | #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } |
| 69 | // #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order | 68 | // #define MATRIX_COL_PINS { B2, B3, B1, F7, F6, F5, F4 } //uncomment this line and comment line above if you need to reverse left-to-right key order |
| 70 | 69 | ||
| 70 | /* COL2ROW, ROW2COL*/ | ||
| 71 | #define DIODE_DIRECTION COL2ROW | ||
| 72 | |||
| 71 | /* define if matrix has ghost */ | 73 | /* define if matrix has ghost */ |
| 72 | //#define MATRIX_HAS_GHOST | 74 | //#define MATRIX_HAS_GHOST |
| 73 | 75 | ||
diff --git a/keyboards/helix/rev2/keymaps/default/readme.md b/keyboards/helix/rev2/keymaps/default/readme.md index c618c4752..1237e5d5b 100644 --- a/keyboards/helix/rev2/keymaps/default/readme.md +++ b/keyboards/helix/rev2/keymaps/default/readme.md | |||
| @@ -137,6 +137,16 @@ $ make helix/rev2/oled/back:default # with oled and backlight | |||
| 137 | $ make helix/rev2/oled/under:default # with oled and underglow | 137 | $ make helix/rev2/oled/under:default # with oled and underglow |
| 138 | ``` | 138 | ``` |
| 139 | 139 | ||
| 140 | build (experimental use of split_common) | ||
| 141 | ``` | ||
| 142 | $ make helix/rev2/sc:default | ||
| 143 | $ make helix/rev2/sc/back:default | ||
| 144 | $ make helix/rev2/sc/under:default | ||
| 145 | $ make helix/rev2/sc/oled:default | ||
| 146 | $ make helix/rev2/sc/oledback:default | ||
| 147 | $ make helix/rev2/sc/oledunder:default | ||
| 148 | ``` | ||
| 149 | |||
| 140 | flash to keyboard | 150 | flash to keyboard |
| 141 | ``` | 151 | ``` |
| 142 | $ make helix:default:flash | 152 | $ make helix:default:flash |
diff --git a/keyboards/helix/rev2/keymaps/xulkal/rules.mk b/keyboards/helix/rev2/keymaps/xulkal/rules.mk index a636b2a61..03800f9bb 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 | |||
| 9 | OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\" | 9 | OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\" |
| 10 | # Xulkal specific oled define | 10 | # Xulkal specific oled define |
| 11 | OPT_DEFS += -DOLED_90ROTATION | 11 | OPT_DEFS += -DOLED_90ROTATION |
| 12 | |||
| 13 | SPLIT_KEYBOARD = yes | ||
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk index 0f4285eea..4b120936d 100644 --- a/keyboards/helix/rev2/local_features.mk +++ b/keyboards/helix/rev2/local_features.mk | |||
| @@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG | |||
| 10 | $(info - OLED_ENABLE = $(OLED_ENABLE)) | 10 | $(info - OLED_ENABLE = $(OLED_ENABLE)) |
| 11 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) | 11 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) |
| 12 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) | 12 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) |
| 13 | $(info - LED_ANIMATION = $(LED_ANIMATIONS)) | 13 | $(info - LED_ANIMATIONS = $(LED_ANIMATIONS)) |
| 14 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) | 14 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) |
| 15 | $(info ) | 15 | $(info ) |
| 16 | endef | 16 | endef |
| @@ -43,12 +43,35 @@ endef | |||
| 43 | ifeq ($(findstring ios,$(HELIX)), ios) | 43 | ifeq ($(findstring ios,$(HELIX)), ios) |
| 44 | IOS_DEVICE_ENABLE = yes | 44 | IOS_DEVICE_ENABLE = yes |
| 45 | endif | 45 | endif |
| 46 | ifeq ($(findstring scan,$(HELIX)), scan) | ||
| 47 | # use DEBUG_MATRIX_SCAN_RATE | ||
| 48 | # see docs/newbs_testing_debugging.md | ||
| 49 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE | ||
| 50 | CONSOLE_ENABLE = yes | ||
| 51 | SHOW_VERBOSE_INFO = yes | ||
| 52 | endif | ||
| 46 | ifeq ($(findstring verbose,$(HELIX)), verbose) | 53 | ifeq ($(findstring verbose,$(HELIX)), verbose) |
| 47 | SHOW_VERBOSE_INFO = yes | 54 | SHOW_VERBOSE_INFO = yes |
| 48 | endif | 55 | endif |
| 49 | SHOW_HELIX_OPTIONS = yes | 56 | SHOW_HELIX_OPTIONS = yes |
| 50 | endif | 57 | endif |
| 51 | 58 | ||
| 59 | ifneq ($(strip $(SPLIT_KEYBOARD)), yes) | ||
| 60 | SRC += local_drivers/serial.c | ||
| 61 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 62 | |||
| 63 | # A workaround until #7089 is merged. | ||
| 64 | # serial.c must not be compiled with the -lto option. | ||
| 65 | # The current LIB_SRC has a side effect with the -fno-lto option, so use it. | ||
| 66 | LIB_SRC += local_drivers/serial.c | ||
| 67 | |||
| 68 | CUSTOM_MATRIX = yes | ||
| 69 | |||
| 70 | SRC += rev2/matrix.c | ||
| 71 | SRC += rev2/split_util.c | ||
| 72 | SRC += rev2/split_scomm.c | ||
| 73 | endif | ||
| 74 | |||
| 52 | ######## | 75 | ######## |
| 53 | # convert Helix-specific options (that represent combinations of standard options) | 76 | # convert Helix-specific options (that represent combinations of standard options) |
| 54 | # into QMK standard options. | 77 | # into QMK standard options. |
| @@ -80,18 +103,22 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes) | |||
| 80 | endif | 103 | endif |
| 81 | 104 | ||
| 82 | ifeq ($(strip $(OLED_ENABLE)), yes) | 105 | ifeq ($(strip $(OLED_ENABLE)), yes) |
| 106 | SRC += local_drivers/i2c.c | ||
| 107 | SRC += local_drivers/ssd1306.c | ||
| 108 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 83 | OPT_DEFS += -DOLED_ENABLE | 109 | OPT_DEFS += -DOLED_ENABLE |
| 84 | endif | 110 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) |
| 85 | 111 | OPT_DEFS += -DLOCAL_GLCDFONT | |
| 86 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | 112 | endif |
| 87 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 88 | endif | 113 | endif |
| 89 | 114 | ||
| 90 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) | 115 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) |
| 91 | $(eval $(call HELIX_CUSTOMISE_MSG)) | 116 | $(eval $(call HELIX_CUSTOMISE_MSG)) |
| 92 | ifneq ($(strip $(SHOW_VERBOSE_INFO)),) | 117 | ifneq ($(strip $(SHOW_VERBOSE_INFO)),) |
| 93 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) | 118 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) |
| 94 | $(info -- OPT_DEFS = $(OPT_DEFS)) | 119 | $(info -- OLED_DRIVER_ENABLE = $(OLED_DRIVER_ENABLE)) |
| 120 | $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE)) | ||
| 121 | $(info -- OPT_DEFS = $(OPT_DEFS)) | ||
| 95 | $(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE)) | 122 | $(info -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE)) |
| 96 | $(info ) | 123 | $(info ) |
| 97 | endif | 124 | endif |
diff --git a/keyboards/helix/rev2/matrix.c b/keyboards/helix/rev2/matrix.c index 70a6cb0a5..050dcac2d 100644 --- a/keyboards/helix/rev2/matrix.c +++ b/keyboards/helix/rev2/matrix.c | |||
| @@ -47,7 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 47 | static uint8_t debouncing = DEBOUNCE; | 47 | static uint8_t debouncing = DEBOUNCE; |
| 48 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | 48 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; |
| 49 | static uint8_t error_count = 0; | 49 | static uint8_t error_count = 0; |
| 50 | uint8_t is_master = 0 ; | ||
| 51 | 50 | ||
| 52 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | 51 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; |
| 53 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | 52 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; |
| @@ -111,8 +110,6 @@ void matrix_init(void) | |||
| 111 | matrix_debouncing[i] = 0; | 110 | matrix_debouncing[i] = 0; |
| 112 | } | 111 | } |
| 113 | 112 | ||
| 114 | is_master = has_usb(); | ||
| 115 | |||
| 116 | matrix_init_quantum(); | 113 | matrix_init_quantum(); |
| 117 | } | 114 | } |
| 118 | 115 | ||
| @@ -200,7 +197,7 @@ int serial_transaction(int master_changed) { | |||
| 200 | 197 | ||
| 201 | uint8_t matrix_scan(void) | 198 | uint8_t matrix_scan(void) |
| 202 | { | 199 | { |
| 203 | if (is_master) { | 200 | if (is_helix_master()) { |
| 204 | matrix_master_scan(); | 201 | matrix_master_scan(); |
| 205 | }else{ | 202 | }else{ |
| 206 | matrix_slave_scan(); | 203 | matrix_slave_scan(); |
diff --git a/keyboards/helix/rev2/post_config.h b/keyboards/helix/rev2/post_config.h new file mode 100644 index 000000000..dda73d5d2 --- /dev/null +++ b/keyboards/helix/rev2/post_config.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #if defined(SPLIT_KEYBOARD) /* if use split_common */ | ||
| 4 | # if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_SPLIT) | ||
| 5 | # define RGBLIGHT_SPLIT /* helix hardware need this */ | ||
| 6 | # endif | ||
| 7 | #endif | ||
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c index abaa02cdb..12b8ae9ef 100644 --- a/keyboards/helix/rev2/rev2.c +++ b/keyboards/helix/rev2/rev2.c | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | #include "helix.h" | 1 | #include "helix.h" |
| 2 | 2 | ||
| 3 | // Each keymap.c should use is_keyboard_master() instead of 'is_master'. | ||
| 4 | // But keep 'is_master' for a while for backwards compatibility | ||
| 5 | // for the old keymap.c. | ||
| 6 | uint8_t is_master = false; | ||
| 3 | 7 | ||
| 4 | #ifdef SSD1306OLED | 8 | #ifdef SSD1306OLED |
| 5 | #include "ssd1306.h" | 9 | #include "ssd1306.h" |
| @@ -15,7 +19,23 @@ void led_set_kb(uint8_t usb_led) { | |||
| 15 | #endif | 19 | #endif |
| 16 | 20 | ||
| 17 | void matrix_init_kb(void) { | 21 | void matrix_init_kb(void) { |
| 22 | // Each keymap.c should use is_keyboard_master() instead of is_master. | ||
| 23 | // But keep is_master for a while for backwards compatibility | ||
| 24 | // for the old keymap.c. | ||
| 25 | is_master = is_keyboard_master(); | ||
| 18 | 26 | ||
| 19 | matrix_init_user(); | 27 | matrix_init_user(); |
| 20 | }; | 28 | }; |
| 21 | 29 | ||
| 30 | void keyboard_post_init_kb(void) { | ||
| 31 | #if defined(DEBUG_MATRIX_SCAN_RATE) | ||
| 32 | debug_enable = true; | ||
| 33 | #endif | ||
| 34 | keyboard_post_init_user(); | ||
| 35 | } | ||
| 36 | |||
| 37 | #if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED) | ||
| 38 | void matrix_slave_scan_user(void) { | ||
| 39 | matrix_scan_user(); | ||
| 40 | } | ||
| 41 | #endif | ||
diff --git a/keyboards/helix/rev2/rev2.h b/keyboards/helix/rev2/rev2.h index 4e69daef5..8b82a4a6e 100644 --- a/keyboards/helix/rev2/rev2.h +++ b/keyboards/helix/rev2/rev2.h | |||
| @@ -4,18 +4,16 @@ | |||
| 4 | 4 | ||
| 5 | #include "quantum.h" | 5 | #include "quantum.h" |
| 6 | 6 | ||
| 7 | #ifdef RGBLIGHT_ENABLE | 7 | #ifndef SPLIT_KEYBOARD |
| 8 | //rgb led driver | 8 | extern bool is_helix_master(void); |
| 9 | #include "ws2812.h" | 9 | #define is_keyboard_master() is_helix_master() |
| 10 | #endif | 10 | #endif |
| 11 | 11 | ||
| 12 | #ifdef USE_I2C | 12 | // Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'. |
| 13 | #include <stddef.h> | 13 | // But keep 'is_master' for a while for backwards compatibility |
| 14 | #ifdef __AVR__ | 14 | // for the old keymap.c. |
| 15 | #include <avr/io.h> | 15 | extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead. |
| 16 | #include <avr/interrupt.h> | 16 | #define has_usb() is_keyboard_master() |
| 17 | #endif | ||
| 18 | #endif | ||
| 19 | 17 | ||
| 20 | #if MATRIX_ROWS == 8 // HELIX_ROWS == 4 | 18 | #if MATRIX_ROWS == 8 // HELIX_ROWS == 4 |
| 21 | #ifndef FLIP_HALF | 19 | #ifndef FLIP_HALF |
diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk index 7357d568c..db584c0b2 100644 --- a/keyboards/helix/rev2/rules.mk +++ b/keyboards/helix/rev2/rules.mk | |||
| @@ -1,21 +1,5 @@ | |||
| 1 | KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk | 1 | KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk |
| 2 | 2 | ||
| 3 | SRC += local_drivers/i2c.c | ||
| 4 | SRC += local_drivers/serial.c | ||
| 5 | SRC += local_drivers/ssd1306.c | ||
| 6 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 7 | |||
| 8 | # A workaround until #7089 is merged. | ||
| 9 | # serial.c must not be compiled with the -lto option. | ||
| 10 | # The current LIB_SRC has a side effect with the -fno-lto option, so use it. | ||
| 11 | LIB_SRC += local_drivers/serial.c | ||
| 12 | |||
| 13 | CUSTOM_MATRIX = yes | ||
| 14 | |||
| 15 | SRC += rev2/matrix.c | ||
| 16 | SRC += rev2/split_util.c | ||
| 17 | SRC += rev2/split_scomm.c | ||
| 18 | |||
| 19 | # Helix Spacific Build Options default values | 3 | # Helix Spacific Build Options default values |
| 20 | HELIX_ROWS = 5 # Helix Rows is 4 or 5 | 4 | HELIX_ROWS = 5 # Helix Rows is 4 or 5 |
| 21 | OLED_ENABLE = no # OLED_ENABLE | 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 000000000..066fffb74 --- /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 000000000..dd68e9d3b --- /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 000000000..645984f86 --- /dev/null +++ b/keyboards/helix/rev2/sc/oledback/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | OLED_ENABLE = yes | ||
| 2 | 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 000000000..e415cbd49 --- /dev/null +++ b/keyboards/helix/rev2/sc/oledunder/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | OLED_ENABLE = yes | ||
| 2 | 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 000000000..d38a61809 --- /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 000000000..a37aa6fab --- /dev/null +++ b/keyboards/helix/rev2/sc/under/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| LED_UNDERGLOW_ENABLE = yes | |||
diff --git a/keyboards/helix/rev2/split_util.c b/keyboards/helix/rev2/split_util.c index 9d31d0dec..ab4031548 100644 --- a/keyboards/helix/rev2/split_util.c +++ b/keyboards/helix/rev2/split_util.c | |||
| @@ -45,7 +45,7 @@ bool waitForUsb(void) { | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | __attribute__((weak)) bool is_keyboard_left(void) { | 48 | bool is_keyboard_left(void) { |
| 49 | #if defined(SPLIT_HAND_PIN) | 49 | #if defined(SPLIT_HAND_PIN) |
| 50 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand | 50 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand |
| 51 | setPinInput(SPLIT_HAND_PIN); | 51 | setPinInput(SPLIT_HAND_PIN); |
| @@ -53,13 +53,13 @@ __attribute__((weak)) bool is_keyboard_left(void) { | |||
| 53 | #elif defined(EE_HANDS) | 53 | #elif defined(EE_HANDS) |
| 54 | return eeconfig_read_handedness(); | 54 | return eeconfig_read_handedness(); |
| 55 | #elif defined(MASTER_RIGHT) | 55 | #elif defined(MASTER_RIGHT) |
| 56 | return !has_usb(); | 56 | return !is_helix_master(); |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | return has_usb(); | 59 | return is_helix_master(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | __attribute__((weak)) bool has_usb(void) { | 62 | bool is_helix_master(void) { |
| 63 | static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN; | 63 | static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN; |
| 64 | 64 | ||
| 65 | // only check once, as this is called often | 65 | // only check once, as this is called often |
| @@ -100,11 +100,10 @@ static void keyboard_slave_setup(void) { | |||
| 100 | void split_keyboard_setup(void) { | 100 | void split_keyboard_setup(void) { |
| 101 | isLeftHand = is_keyboard_left(); | 101 | isLeftHand = is_keyboard_left(); |
| 102 | 102 | ||
| 103 | if (has_usb()) { | 103 | if (is_helix_master()) { |
| 104 | keyboard_master_setup(); | 104 | keyboard_master_setup(); |
| 105 | } else { | 105 | } else { |
| 106 | keyboard_slave_setup(); | 106 | keyboard_slave_setup(); |
| 107 | } | 107 | } |
| 108 | sei(); | 108 | sei(); |
| 109 | } | 109 | } |
| 110 | |||
diff --git a/keyboards/helix/rev2/split_util.h b/keyboards/helix/rev2/split_util.h index 687ca19bd..c0ecdb097 100644 --- a/keyboards/helix/rev2/split_util.h +++ b/keyboards/helix/rev2/split_util.h | |||
| @@ -12,7 +12,7 @@ extern volatile bool isLeftHand; | |||
| 12 | void matrix_slave_scan(void); | 12 | void matrix_slave_scan(void); |
| 13 | 13 | ||
| 14 | void split_keyboard_setup(void); | 14 | void split_keyboard_setup(void); |
| 15 | bool has_usb(void); | 15 | bool is_helix_master(void); |
| 16 | 16 | ||
| 17 | void matrix_master_OLED_init (void); | 17 | void matrix_master_OLED_init (void); |
| 18 | 18 | ||
diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index 448e6ca10..4ed2b9a0b 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c | |||
| @@ -7,11 +7,6 @@ | |||
| 7 | rgblight_config_t rgblight_config; | 7 | rgblight_config_t rgblight_config; |
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | #if KEYBOARD_helix_rev2 | ||
| 11 | extern uint8_t is_master; | ||
| 12 | bool is_keyboard_master(void) { return is_master; } | ||
| 13 | #endif | ||
| 14 | |||
| 15 | static void render_logo(void) | 10 | static void render_logo(void) |
| 16 | { | 11 | { |
| 17 | static const char PROGMEM font_logo[] = { | 12 | static const char PROGMEM font_logo[] = { |
