[Keyboard] Helix add split common option (#7718)
* is_master, has_usb() move to rev2.[hc] * 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 * add HELIX=scan option into {rev2/pico}/local_features.mk Made DEBUG_MATRIX_SCAN_RATE easy to use. * Changed rules.mk to link "helix/local_drivers/ssd1306.c" only when OLED_ENABLE = yes. * 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 * add matrix_slave_scan_user() to helix/rev2/rev2.c, helix/pico/pico.h * 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 * add '#define DIODE_DIRECTION COL2ROW' into helix/{rev2|pico}/config.h This commit does not change the build result. * update helix readme * keyboards/helix/readme.md * keyboards/helix/pico/keymaps/default/readme.md * keyboards/helix/rev2/keymaps/default/readme.md Co-authored-by: mtei <2170248+mtei@users.noreply.github.com>master
parent
0ba352356d
commit
2d14d12c74
|
@ -6,8 +6,6 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
|
||||||
#ifdef USE_I2C
|
|
||||||
|
|
||||||
// Limits the amount of we wait for any one i2c transaction.
|
// Limits the amount of we wait for any one i2c transaction.
|
||||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
// 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.
|
// 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
|
// Reset everything, so we are ready for the next TWI interrupt
|
||||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define TAPPING_TERM 100
|
#define TAPPING_TERM 100
|
||||||
|
|
||||||
/* Use I2C or Serial */
|
/* Use I2C or Serial */
|
||||||
#define USE_I2C
|
|
||||||
#define USE_SERIAL
|
#define USE_SERIAL
|
||||||
//#define USE_MATRIX_I2C
|
//#define USE_MATRIX_I2C
|
||||||
|
|
||||||
|
@ -60,6 +59,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
||||||
// #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
|
// #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
|
||||||
|
|
||||||
|
/* COL2ROW, ROW2COL*/
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
/* define if matrix has ghost */
|
/* define if matrix has ghost */
|
||||||
//#define MATRIX_HAS_GHOST
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,13 @@ $ make HELIX=no_ani helix/pico/back:default # with backlight without animation
|
||||||
$ make helix/pico/under:default # with underglow
|
$ make helix/pico/under:default # with underglow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
build (experimental use of split_common)
|
||||||
|
```
|
||||||
|
$ make helix/pico/sc:default
|
||||||
|
$ make helix/pico/sc/back:default
|
||||||
|
$ make helix/pico/sc/under:default
|
||||||
|
```
|
||||||
|
|
||||||
flash to keyboard
|
flash to keyboard
|
||||||
```
|
```
|
||||||
$ make helix/pico:default:flash
|
$ make helix/pico:default:flash
|
||||||
|
|
|
@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG
|
||||||
$(info - OLED_ENABLE = $(OLED_ENABLE))
|
$(info - OLED_ENABLE = $(OLED_ENABLE))
|
||||||
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
|
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
|
||||||
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_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 - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
|
||||||
$(info )
|
$(info )
|
||||||
endef
|
endef
|
||||||
|
@ -43,12 +43,34 @@ endef
|
||||||
ifeq ($(findstring ios,$(HELIX)), ios)
|
ifeq ($(findstring ios,$(HELIX)), ios)
|
||||||
IOS_DEVICE_ENABLE = yes
|
IOS_DEVICE_ENABLE = yes
|
||||||
endif
|
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)
|
ifeq ($(findstring verbose,$(HELIX)), verbose)
|
||||||
SHOW_VERBOSE_INFO = yes
|
SHOW_VERBOSE_INFO = yes
|
||||||
endif
|
endif
|
||||||
SHOW_HELIX_OPTIONS = yes
|
SHOW_HELIX_OPTIONS = yes
|
||||||
endif
|
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)
|
# convert Helix-specific options (that represent combinations of standard options)
|
||||||
# into QMK standard options.
|
# into QMK standard options.
|
||||||
|
@ -73,11 +95,13 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(OLED_ENABLE)), yes)
|
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
|
OPT_DEFS += -DOLED_ENABLE
|
||||||
endif
|
ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
|
||||||
|
OPT_DEFS += -DLOCAL_GLCDFONT
|
||||||
ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
|
endif
|
||||||
OPT_DEFS += -DLOCAL_GLCDFONT
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(AUDIO_ENABLE)),yes)
|
ifeq ($(strip $(AUDIO_ENABLE)),yes)
|
||||||
|
@ -92,8 +116,10 @@ endif
|
||||||
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
|
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
|
||||||
$(eval $(call HELIX_CUSTOMISE_MSG))
|
$(eval $(call HELIX_CUSTOMISE_MSG))
|
||||||
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
|
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
|
||||||
$(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
|
$(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
|
||||||
$(info -- OPT_DEFS = $(OPT_DEFS))
|
$(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 -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE))
|
||||||
$(info )
|
$(info )
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -46,7 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
static uint8_t debouncing = DEBOUNCE;
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
||||||
static uint8_t error_count = 0;
|
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 row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_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)
|
void matrix_init(void)
|
||||||
{
|
{
|
||||||
debug_enable = true;
|
split_keyboard_setup();
|
||||||
debug_matrix = true;
|
|
||||||
debug_mouse = true;
|
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
unselect_rows();
|
unselect_rows();
|
||||||
init_cols();
|
init_cols();
|
||||||
|
@ -111,8 +109,6 @@ void matrix_init(void)
|
||||||
matrix_debouncing[i] = 0;
|
matrix_debouncing[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_master = has_usb();
|
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +193,7 @@ int serial_transaction(void) {
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
{
|
{
|
||||||
if (is_master) {
|
if (is_helix_master()) {
|
||||||
matrix_master_scan();
|
matrix_master_scan();
|
||||||
}else{
|
}else{
|
||||||
matrix_slave_scan();
|
matrix_slave_scan();
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "helix.h"
|
#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
|
#ifdef SSD1306OLED
|
||||||
#include "ssd1306.h"
|
#include "ssd1306.h"
|
||||||
|
@ -15,6 +19,23 @@ void led_set_kb(uint8_t usb_led) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
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();
|
matrix_init_user();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
#if defined(DEBUG_MATRIX_SCAN_RATE)
|
||||||
|
debug_enable = true;
|
||||||
|
#endif
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
|
||||||
|
void matrix_slave_scan_user(void) {
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -4,18 +4,16 @@
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifndef SPLIT_KEYBOARD
|
||||||
//rgb led driver
|
extern bool is_helix_master(void);
|
||||||
#include "ws2812.h"
|
#define is_keyboard_master() is_helix_master()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_I2C
|
// Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'.
|
||||||
#include <stddef.h>
|
// But keep 'is_master' for a while for backwards compatibility
|
||||||
#ifdef __AVR__
|
// for the old keymap.c.
|
||||||
#include <avr/io.h>
|
extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
|
||||||
#include <avr/interrupt.h>
|
#define has_usb() is_keyboard_master()
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FLIP_HALF
|
#ifndef FLIP_HALF
|
||||||
// Standard Keymap
|
// Standard Keymap
|
||||||
|
|
|
@ -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
|
|
@ -1,20 +1,5 @@
|
||||||
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
|
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.
|
|
||||||
# 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
|
# Helix Spacific Build Options default values
|
||||||
OLED_ENABLE = no # OLED_ENABLE
|
OLED_ENABLE = no # OLED_ENABLE
|
||||||
LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
|
LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
LED_BACK_ENABLE = yes
|
|
@ -0,0 +1 @@
|
||||||
|
SPLIT_KEYBOARD = yes
|
|
@ -0,0 +1 @@
|
||||||
|
LED_UNDERGLOW_ENABLE = yes
|
|
@ -7,6 +7,7 @@
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
#include "wait.h"
|
||||||
|
|
||||||
#ifdef USE_MATRIX_I2C
|
#ifdef USE_MATRIX_I2C
|
||||||
# include "i2c.h"
|
# include "i2c.h"
|
||||||
|
@ -14,21 +15,65 @@
|
||||||
# include "serial.h"
|
# include "serial.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EE_HANDS
|
||||||
|
# include "eeconfig.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPLIT_USB_TIMEOUT
|
||||||
|
#define SPLIT_USB_TIMEOUT 2500
|
||||||
|
#endif
|
||||||
|
|
||||||
volatile bool isLeftHand = true;
|
volatile bool isLeftHand = true;
|
||||||
|
|
||||||
static void setup_handedness(void) {
|
bool waitForUsb(void) {
|
||||||
#ifdef EE_HANDS
|
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) {
|
||||||
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
|
// This will return true of a USB connection has been established
|
||||||
#else
|
if (UDADDR & _BV(ADDEN)) {
|
||||||
// I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
|
return true;
|
||||||
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
|
}
|
||||||
isLeftHand = !has_usb();
|
wait_ms(100);
|
||||||
#else
|
}
|
||||||
isLeftHand = has_usb();
|
|
||||||
#endif
|
// Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
|
||||||
#endif
|
(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) {
|
static void keyboard_master_setup(void) {
|
||||||
|
|
||||||
#ifdef USE_MATRIX_I2C
|
#ifdef USE_MATRIX_I2C
|
||||||
|
@ -47,24 +92,13 @@ static void keyboard_slave_setup(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_usb(void) {
|
|
||||||
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
|
||||||
_delay_us(5);
|
|
||||||
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
|
||||||
}
|
|
||||||
|
|
||||||
void split_keyboard_setup(void) {
|
void split_keyboard_setup(void) {
|
||||||
setup_handedness();
|
isLeftHand = is_keyboard_left();
|
||||||
|
|
||||||
if (has_usb()) {
|
if (is_helix_master()) {
|
||||||
keyboard_master_setup();
|
keyboard_master_setup();
|
||||||
} else {
|
} else {
|
||||||
keyboard_slave_setup();
|
keyboard_slave_setup();
|
||||||
}
|
}
|
||||||
sei();
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this code runs before the usb and keyboard is initialized
|
|
||||||
void matrix_setup(void) {
|
|
||||||
split_keyboard_setup();
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ extern volatile bool isLeftHand;
|
||||||
void matrix_slave_scan(void);
|
void matrix_slave_scan(void);
|
||||||
|
|
||||||
void split_keyboard_setup(void);
|
void split_keyboard_setup(void);
|
||||||
bool has_usb(void);
|
bool is_helix_master(void);
|
||||||
|
|
||||||
void matrix_master_OLED_init (void);
|
void matrix_master_OLED_init (void);
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ Keyboard Maintainer: [Makoto Kurauchi](https://github.com/MakotoKurauchi/) [@plu
|
||||||
Hardware Supported: Helix PCB Alpha, Beta, Pro Micro
|
Hardware Supported: Helix PCB Alpha, Beta, Pro Micro
|
||||||
Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/), [Little Keyboards](https://littlekeyboards.com/collections/helix)
|
Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix), [Yushakobo Shop](https://yushakobo.jp/shop/), [Little Keyboards](https://littlekeyboards.com/collections/helix)
|
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment):
|
## How to build
|
||||||
|
* [Helix how to Customize and Compile](rev2/keymaps/default/readme.md#customize)
|
||||||
make helix:default
|
* [HelixPico how to Customize and Compile](pico/keymaps/default/readme.md#customize)
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
|
@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define TAPPING_TERM 100
|
#define TAPPING_TERM 100
|
||||||
|
|
||||||
/* Use I2C or Serial */
|
/* Use I2C or Serial */
|
||||||
#define USE_I2C
|
|
||||||
#define USE_SERIAL
|
#define USE_SERIAL
|
||||||
//#define USE_MATRIX_I2C
|
//#define USE_MATRIX_I2C
|
||||||
|
|
||||||
|
@ -68,6 +67,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
||||||
// #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
|
// #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
|
||||||
|
|
||||||
|
/* COL2ROW, ROW2COL*/
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
/* define if matrix has ghost */
|
/* define if matrix has ghost */
|
||||||
//#define MATRIX_HAS_GHOST
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,16 @@ $ make helix/rev2/oled/back:default # with oled and backlight
|
||||||
$ make helix/rev2/oled/under:default # with oled and underglow
|
$ make helix/rev2/oled/under:default # with oled and underglow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
build (experimental use of split_common)
|
||||||
|
```
|
||||||
|
$ make helix/rev2/sc:default
|
||||||
|
$ make helix/rev2/sc/back:default
|
||||||
|
$ make helix/rev2/sc/under:default
|
||||||
|
$ make helix/rev2/sc/oled:default
|
||||||
|
$ make helix/rev2/sc/oledback:default
|
||||||
|
$ make helix/rev2/sc/oledunder:default
|
||||||
|
```
|
||||||
|
|
||||||
flash to keyboard
|
flash to keyboard
|
||||||
```
|
```
|
||||||
$ make helix:default:flash
|
$ make helix:default:flash
|
||||||
|
|
|
@ -9,3 +9,5 @@ OLED_DRIVER_ENABLE = yes
|
||||||
OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
|
OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
|
||||||
# Xulkal specific oled define
|
# Xulkal specific oled define
|
||||||
OPT_DEFS += -DOLED_90ROTATION
|
OPT_DEFS += -DOLED_90ROTATION
|
||||||
|
|
||||||
|
SPLIT_KEYBOARD = yes
|
||||||
|
|
|
@ -10,7 +10,7 @@ define HELIX_CUSTOMISE_MSG
|
||||||
$(info - OLED_ENABLE = $(OLED_ENABLE))
|
$(info - OLED_ENABLE = $(OLED_ENABLE))
|
||||||
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
|
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
|
||||||
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_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 - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE))
|
||||||
$(info )
|
$(info )
|
||||||
endef
|
endef
|
||||||
|
@ -43,12 +43,35 @@ endef
|
||||||
ifeq ($(findstring ios,$(HELIX)), ios)
|
ifeq ($(findstring ios,$(HELIX)), ios)
|
||||||
IOS_DEVICE_ENABLE = yes
|
IOS_DEVICE_ENABLE = yes
|
||||||
endif
|
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)
|
ifeq ($(findstring verbose,$(HELIX)), verbose)
|
||||||
SHOW_VERBOSE_INFO = yes
|
SHOW_VERBOSE_INFO = yes
|
||||||
endif
|
endif
|
||||||
SHOW_HELIX_OPTIONS = yes
|
SHOW_HELIX_OPTIONS = yes
|
||||||
endif
|
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)
|
# convert Helix-specific options (that represent combinations of standard options)
|
||||||
# into QMK standard options.
|
# into QMK standard options.
|
||||||
|
@ -80,18 +103,22 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(OLED_ENABLE)), yes)
|
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
|
OPT_DEFS += -DOLED_ENABLE
|
||||||
endif
|
ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
|
||||||
|
OPT_DEFS += -DLOCAL_GLCDFONT
|
||||||
ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
|
endif
|
||||||
OPT_DEFS += -DLOCAL_GLCDFONT
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
|
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
|
||||||
$(eval $(call HELIX_CUSTOMISE_MSG))
|
$(eval $(call HELIX_CUSTOMISE_MSG))
|
||||||
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
|
ifneq ($(strip $(SHOW_VERBOSE_INFO)),)
|
||||||
$(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
|
$(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE))
|
||||||
$(info -- OPT_DEFS = $(OPT_DEFS))
|
$(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 -- LINK_TIME_OPTIMIZATION_ENABLE = $(LINK_TIME_OPTIMIZATION_ENABLE))
|
||||||
$(info )
|
$(info )
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -47,7 +47,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
static uint8_t debouncing = DEBOUNCE;
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
||||||
static uint8_t error_count = 0;
|
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 row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
|
@ -111,8 +110,6 @@ void matrix_init(void)
|
||||||
matrix_debouncing[i] = 0;
|
matrix_debouncing[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_master = has_usb();
|
|
||||||
|
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +197,7 @@ int serial_transaction(int master_changed) {
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
uint8_t matrix_scan(void)
|
||||||
{
|
{
|
||||||
if (is_master) {
|
if (is_helix_master()) {
|
||||||
matrix_master_scan();
|
matrix_master_scan();
|
||||||
}else{
|
}else{
|
||||||
matrix_slave_scan();
|
matrix_slave_scan();
|
||||||
|
|
|
@ -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
|
|
@ -1,5 +1,9 @@
|
||||||
#include "helix.h"
|
#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
|
#ifdef SSD1306OLED
|
||||||
#include "ssd1306.h"
|
#include "ssd1306.h"
|
||||||
|
@ -15,7 +19,23 @@ void led_set_kb(uint8_t usb_led) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
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();
|
matrix_init_user();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
#if defined(DEBUG_MATRIX_SCAN_RATE)
|
||||||
|
debug_enable = true;
|
||||||
|
#endif
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
|
||||||
|
void matrix_slave_scan_user(void) {
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -4,18 +4,16 @@
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifndef SPLIT_KEYBOARD
|
||||||
//rgb led driver
|
extern bool is_helix_master(void);
|
||||||
#include "ws2812.h"
|
#define is_keyboard_master() is_helix_master()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_I2C
|
// Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'.
|
||||||
#include <stddef.h>
|
// But keep 'is_master' for a while for backwards compatibility
|
||||||
#ifdef __AVR__
|
// for the old keymap.c.
|
||||||
#include <avr/io.h>
|
extern uint8_t is_master; // 'is_master' will be obsolete, it is recommended to use 'is_keyboard_master ()' instead.
|
||||||
#include <avr/interrupt.h>
|
#define has_usb() is_keyboard_master()
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MATRIX_ROWS == 8 // HELIX_ROWS == 4
|
#if MATRIX_ROWS == 8 // HELIX_ROWS == 4
|
||||||
#ifndef FLIP_HALF
|
#ifndef FLIP_HALF
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
|
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.
|
|
||||||
# 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 Spacific Build Options default values
|
||||||
HELIX_ROWS = 5 # Helix Rows is 4 or 5
|
HELIX_ROWS = 5 # Helix Rows is 4 or 5
|
||||||
OLED_ENABLE = no # OLED_ENABLE
|
OLED_ENABLE = no # OLED_ENABLE
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
LED_BACK_ENABLE = yes
|
|
@ -0,0 +1 @@
|
||||||
|
OLED_ENABLE = yes
|
|
@ -0,0 +1,2 @@
|
||||||
|
OLED_ENABLE = yes
|
||||||
|
LED_BACK_ENABLE = yes
|
|
@ -0,0 +1,2 @@
|
||||||
|
OLED_ENABLE = yes
|
||||||
|
LED_UNDERGLOW_ENABLE = yes
|
|
@ -0,0 +1 @@
|
||||||
|
SPLIT_KEYBOARD = yes
|
|
@ -0,0 +1 @@
|
||||||
|
LED_UNDERGLOW_ENABLE = yes
|
|
@ -45,7 +45,7 @@ bool waitForUsb(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__attribute__((weak)) bool is_keyboard_left(void) {
|
bool is_keyboard_left(void) {
|
||||||
#if defined(SPLIT_HAND_PIN)
|
#if defined(SPLIT_HAND_PIN)
|
||||||
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
|
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
|
||||||
setPinInput(SPLIT_HAND_PIN);
|
setPinInput(SPLIT_HAND_PIN);
|
||||||
|
@ -53,13 +53,13 @@ __attribute__((weak)) bool is_keyboard_left(void) {
|
||||||
#elif defined(EE_HANDS)
|
#elif defined(EE_HANDS)
|
||||||
return eeconfig_read_handedness();
|
return eeconfig_read_handedness();
|
||||||
#elif defined(MASTER_RIGHT)
|
#elif defined(MASTER_RIGHT)
|
||||||
return !has_usb();
|
return !is_helix_master();
|
||||||
#endif
|
#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;
|
static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN;
|
||||||
|
|
||||||
// only check once, as this is called often
|
// only check once, as this is called often
|
||||||
|
@ -100,11 +100,10 @@ static void keyboard_slave_setup(void) {
|
||||||
void split_keyboard_setup(void) {
|
void split_keyboard_setup(void) {
|
||||||
isLeftHand = is_keyboard_left();
|
isLeftHand = is_keyboard_left();
|
||||||
|
|
||||||
if (has_usb()) {
|
if (is_helix_master()) {
|
||||||
keyboard_master_setup();
|
keyboard_master_setup();
|
||||||
} else {
|
} else {
|
||||||
keyboard_slave_setup();
|
keyboard_slave_setup();
|
||||||
}
|
}
|
||||||
sei();
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ extern volatile bool isLeftHand;
|
||||||
void matrix_slave_scan(void);
|
void matrix_slave_scan(void);
|
||||||
|
|
||||||
void split_keyboard_setup(void);
|
void split_keyboard_setup(void);
|
||||||
bool has_usb(void);
|
bool is_helix_master(void);
|
||||||
|
|
||||||
void matrix_master_OLED_init (void);
|
void matrix_master_OLED_init (void);
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
rgblight_config_t rgblight_config;
|
rgblight_config_t rgblight_config;
|
||||||
#endif
|
#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 void render_logo(void)
|
||||||
{
|
{
|
||||||
static const char PROGMEM font_logo[] = {
|
static const char PROGMEM font_logo[] = {
|
||||||
|
|
Loading…
Reference in New Issue