Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c .

pull/5020/head
mtei 6 years ago
parent 95388ef883
commit 0bf81a4723

@ -36,12 +36,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//#define RGBLIGHT_EFFECT_SNAKE
//#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
//#define RGBLIGHT_EFFECT_RGB_TEST
//#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#endif
#endif /* CONFIG_USER_H */

@ -29,10 +29,12 @@ extern uint8_t is_master;
// entirely and just use numbers.
enum layer_number {
_QWERTY = 0,
#if 0
_COLEMAK,
_DVORAK,
_EUCALYN,
_KEYPAD,
#endif
_AUX,
_KAUX,
_LOWER,
@ -91,6 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \
),
#if 0
/* Colemak
* ,-----------------------------------------. ,-----------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
@ -111,7 +114,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LSFT, Z, X, C, V, B, GRV, QUOT, K, M, COMM, DOT, SLSH, RSFT, \
LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \
),
#endif
/* Dvorak
* ,-----------------------------------------. ,-----------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
@ -125,6 +128,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
* `-------------------------------------------------------------------------------------------------'
*/
#if 0
[_DVORAK] = LAYOUT_kc( \
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \
TAB, QUOT, COMM, DOT, P, Y, F, G, C, R, L, BSLS, \
@ -132,7 +136,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LSFT, SCLN, Q, J, K, X, GRV, SLSH, B, M, W, V, Z, RSFT, \
LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \
),
#endif
/* Eucalyn (http://eucalyn.hatenadiary.jp/entry/about-eucalyn-layout)
* ,-----------------------------------------. ,-----------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
@ -146,6 +150,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
* `-------------------------------------------------------------------------------------------------'
*/
#if 0
[_EUCALYN] = LAYOUT_kc( \
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \
TAB, Q, W, COMM, DOT, SCLN, M, R, D, Y, P, BSLS, \
@ -153,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LSFT, Z, X, C, V, F, GRV, QUOT, B, H, J, L, SLSH, RSFT, \
LOWER, LOWER, CAPS, LALT, LGUI, SPC, RABS, RAEN, SPC, RGUI, RALT, APP,LOWER, LOWER \
),
#endif
/* Keypad
* ,-----------------------------------------. ,-----------------------------------------.
* | Tab | / | * | Del | F1 | F6 | | F1 | F6 | Del | Tab | / | * |
@ -167,6 +172,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | 0 | , | . | Enter| F5 | F10 | F12 | F12 | F5 | F10 | Enter| 0 | , | . |
* `-------------------------------------------------------------------------------------------------'
*/
#if 0
[_KEYPAD] = LAYOUT_kc( \
TAB, PSLS, PAST, DEL, F1, F6, F1, F6, DEL, TAB, PSLS, PAST, \
KP_7, KP_8, KP_9, BSPC, F2, F7, F2, F7, BSPC, KP_7, KP_8, KP_9, \
@ -174,7 +180,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KP_1, KP_2, KP_3, PPLS, F4, F9, F11, F11, F4, F9, PPLS, KP_1, KP_2, KP_3, \
KP_0, COMM, PDOT, PENT, F5, F10, FF12, FF12, F5, F10, PENT, KP_0, COMM, PDOT \
),
#endif
/* AUX modifier key layer
* ,-----------------------------------------. ,-----------------------------------------.
* | | | | | | | | | | | | | |
@ -188,6 +194,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | 00 | | | | | | | | | | | 00 | |
* `-------------------------------------------------------------------------------------------------'
*/
#if 0
[_KAUX] = LAYOUT_kc( \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
@ -195,7 +202,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____,ZERO2, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ZERO2,____ \
),
#endif
/* Keypad function layer
* ,-----------------------------------------. ,-----------------------------------------.
* | | | | Pause| ScrLk| PtrSc| | PtrSc| ScrLk| Pause| | | |
@ -293,6 +300,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | BS | Enter| | | | | | | |
* `-------------------------------------------------------------------------------------------------'
*/
#if 0
[_AUX] = LAYOUT_kc( \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
@ -300,6 +308,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, BSPC, RAEN, ____, ____, ____, ____, ____, ____, ____ \
)
#endif
};
#else
@ -337,14 +346,19 @@ void update_base_layer(int base)
if( current_default_layer != base ) {
eeconfig_update_default_layer(1UL<<base);
default_layer_set(1UL<<base);
#if 0
layer_off(_AUX);
layer_off(_KAUX);
} else {
#endif
}
#if 0
else {
if( base < _KEYPAD )
layer_invert(_AUX);
else
layer_invert(_KAUX);
}
#endif
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
@ -359,6 +373,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
case COLEMAK:
#if 0
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
@ -366,8 +381,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_base_layer(_COLEMAK);
}
return false;
#endif
break;
case DVORAK:
#if 0
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
@ -375,8 +392,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_base_layer(_DVORAK);
}
return false;
#endif
break;
case EUCALYN:
#if 0
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
@ -384,8 +403,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_base_layer(_EUCALYN);
}
return false;
#endif
break;
case KEYPAD:
#if 0
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
@ -393,6 +414,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_base_layer(_KEYPAD);
}
return false;
#endif
break;
case KC_ZERO2:
if (record->event.pressed) {
@ -511,6 +533,7 @@ static void render_logo(struct CharacterMatrix *matrix) {
}
static const char Qwerty_name[] PROGMEM = " Qwerty";
#if 0
static const char Colemak_name[] PROGMEM = " Colemak";
static const char Dvorak_name[] PROGMEM = " Dvorak";
static const char Eucalyn_name[] PROGMEM = " Eucalyn";
@ -518,6 +541,7 @@ static const char Keypad_name[] PROGMEM = " Keypad";
static const char AUX_name[] PROGMEM = ":AUX";
static const char KAUX_name[] PROGMEM = ":00";
#endif
static const char Padfunc_name[] PROGMEM = ":PadFunc";
static const char Lower_name[] PROGMEM = ":Func";
static const char Raise_name[] PROGMEM = ":Extra";
@ -525,12 +549,14 @@ static const char Adjust_name[] PROGMEM = ":Adjust";
static const char *layer_names[] = {
[_QWERTY] = Qwerty_name,
#if 0
[_COLEMAK] = Colemak_name,
[_DVORAK] = Dvorak_name,
[_EUCALYN]= Eucalyn_name,
[_KEYPAD] = Keypad_name,
[_AUX] = AUX_name,
[_KAUX] = KAUX_name,
#endif
[_LOWER] = Lower_name,
[_RAISE] = Raise_name,
[_PADFUNC]= Padfunc_name,

@ -20,6 +20,8 @@ UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
SWAP_HANDS_ENABLE = no # Enable one-hand typing
RGBLIGHT_SPLIT = no
RGBLIGHT_SPLIT_XA = no
define HELIX_CUSTOMISE_MSG
$(info Helix customize)
@ -28,6 +30,8 @@ define HELIX_CUSTOMISE_MSG
$(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
$(info - LED_ANIMATION=$(LED_ANIMATIONS))
$(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
$(info - RGBLIGHT_SPLIT=$(RGBLIGHT_SPLIT))
$(info - RGBLIGHT_SPLIT_XA=$(RGBLIGHT_SPLIT_XA))
endef
# Helix keyboard customize
@ -56,6 +60,12 @@ Link_Time_Optimization = no # if firmware size over limit, try this option
## make HELIX=oled,back,ios helix:five_rows
##
ifneq ($(strip $(HELIX)),)
ifeq ($(findstring split,$(HELIX)), split)
RGBLIGHT_SPLIT = yes
endif
ifeq ($(findstring splitxa,$(HELIX)), splitxa)
RGBLIGHT_SPLIT_XA = yes
endif
ifeq ($(findstring oled,$(HELIX)), oled)
OLED_ENABLE = yes
endif
@ -114,6 +124,14 @@ ifeq ($(strip $(OLED_ENABLE)), yes)
OPT_DEFS += -DOLED_ENABLE
endif
ifeq ($(strip $(RGBLIGHT_SPLIT)), yes)
OPT_DEFS += -DRGBLIGHT_SPLIT
endif
ifeq ($(strip $(RGBLIGHT_SPLIT_XA)), yes)
OPT_DEFS += -DRGBLIGHT_SPLIT_NO_ANIMATION_SYNC
endif
ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
OPT_DEFS += -DLOCAL_GLCDFONT
endif

@ -203,12 +203,16 @@ uint8_t matrix_scan(void)
{
if (is_master) {
matrix_master_scan();
serial_update_rgb();
}else{
matrix_slave_scan();
#ifndef RGBLIGHT_SPLIT
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
memcpy(&matrix[offset],
(void *)serial_master_buffer, sizeof(serial_master_buffer));
#endif
matrix_scan_quantum();
serial_sync_rgb();
}
return 1;
}
@ -220,22 +224,25 @@ uint8_t matrix_master_scan(void) {
int mchanged = 1;
#ifndef KEYBOARD_helix_rev1
#ifndef RGBLIGHT_SPLIT
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
#ifdef USE_MATRIX_I2C
#endif
#ifdef USE_MATRIX_I2C
// for (int i = 0; i < ROWS_PER_HAND; ++i) {
/* i2c_slave_buffer[i] = matrix[offset+i]; */
// i2c_slave_buffer[i] = matrix[offset+i];
// }
#else // USE_SERIAL
#else // USE_SERIAL
#ifndef RGBLIGHT_SPLIT
#ifdef SERIAL_USE_MULTI_TRANSACTION
mchanged = memcmp((void *)serial_master_buffer,
&matrix[offset], sizeof(serial_master_buffer));
#endif
memcpy((void *)serial_master_buffer,
&matrix[offset], sizeof(serial_master_buffer));
#endif
#endif
#endif /* RGBLIGHT_SPLIT */
#endif /*USE_MATRIX_I2C*/
#endif /*KEYBOARD_helix_rev1*/
#ifdef USE_MATRIX_I2C
if( i2c_transaction() ) {

@ -12,8 +12,14 @@
#endif
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
#ifndef RGBLIGHT_SPLIT
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
#endif
#ifdef RGBLIGHT_SPLIT
rgblight_syncinfo_t volatile serial_master_rgb = {};
#endif
uint8_t volatile status_com = 0;
uint8_t volatile status_rgb = 0;
uint8_t volatile status1 = 0;
uint8_t slave_buffer_change_count = 0;
uint8_t s_change_old = 0xff;
@ -26,18 +32,28 @@ SSTD_t transactions[] = {
0, NULL,
sizeof(slave_buffer_change_count), &slave_buffer_change_count,
},
#define PUT_MASTER_GET_SLAVE_STATUS 1
/* master buffer changed need send, and recive slave_buffer_change_count */
{ (uint8_t *)&status_com,
sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
sizeof(slave_buffer_change_count), &slave_buffer_change_count,
},
#define GET_SLAVE_BUFFER 2
#define GET_SLAVE_BUFFER 1
/* recive serial_slave_buffer */
{ (uint8_t *)&status1,
0, NULL,
sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
},
#ifndef RGBLIGHT_SPLIT
#define PUT_MASTER_GET_SLAVE_STATUS 2
/* master buffer changed need send, and recive slave_buffer_change_count */
{ (uint8_t *)&status_com,
sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
sizeof(slave_buffer_change_count), &slave_buffer_change_count,
}
#endif
#ifdef RGBLIGHT_SPLIT
#define PUT_MASTER_RGB_STATUS 2
/* master rgb status changed need send */
{ (uint8_t *)&status_rgb,
sizeof(serial_master_rgb), (uint8_t *)&serial_master_rgb,
0, NULL
}
#endif
};
void serial_master_init(void)
@ -56,8 +72,9 @@ void serial_slave_init(void)
int serial_update_buffers(int master_update)
{
int status, smatstatus;
#ifndef RGBLIGHT_SPLIT
static int need_retry = 0;
#endif
if( s_change_old != s_change_new ) {
smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
if( smatstatus == TRANSACTION_END ) {
@ -74,6 +91,7 @@ int serial_update_buffers(int master_update)
smatstatus = TRANSACTION_END; // dummy status
}
#ifndef RGBLIGHT_SPLIT
if( !master_update && !need_retry) {
status = soft_serial_transaction(GET_SLAVE_STATUS);
} else {
@ -85,8 +103,43 @@ int serial_update_buffers(int master_update)
} else {
need_retry = 1;
}
#else
status = soft_serial_transaction(GET_SLAVE_STATUS);
if( status == TRANSACTION_END ) {
s_change_new = slave_buffer_change_count;
}
#endif
return smatstatus;
}
int serial_update_rgb(void)
{
#ifdef RGBLIGHT_SPLIT
int status;
if (rgblight_get_change_flags()) {
rgblight_get_syncinfo((rgblight_syncinfo_t *)&serial_master_rgb);
status = soft_serial_transaction(PUT_MASTER_RGB_STATUS);
if (status == TRANSACTION_END) {
rgblight_clear_change_flags();
}
return status;
} else {
return TRANSACTION_END;
}
#else
return TRANSACTION_END;
#endif
}
void serial_sync_rgb(void)
{
#ifdef RGBLIGHT_SPLIT
if( status_rgb == TRANSACTION_ACCEPTED ) {
rgblight_update_sync((rgblight_syncinfo_t *)&serial_master_rgb, false);
status_rgb = TRANSACTION_END;
}
#endif
}
#endif // SERIAL_USE_MULTI_TRANSACTION
#endif /* USE_SERIAL */

@ -1,6 +1,10 @@
#ifndef SPLIT_COMM_H
#define SPLIT_COMM_H
#ifdef RGBLIGHT_SPLIT
#include <rgblight.h>
#endif
#ifndef SERIAL_USE_MULTI_TRANSACTION
/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
#include "serial.h"
@ -12,13 +16,16 @@
#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
#ifndef RGBLIGHT_SPLIT
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
#endif
extern uint8_t slave_buffer_change_count;
void serial_master_init(void);
void serial_slave_init(void);
int serial_update_buffers(int master_changed);
int serial_update_rgb(void);
void serial_sync_rgb(void);
#endif
#endif /* SPLIT_COMM_H */

@ -68,3 +68,9 @@ void split_keyboard_setup(void) {
void matrix_setup(void) {
split_keyboard_setup();
}
#ifdef RGBLIGHT_SPLIT
bool is_keyboard_master(void) {
return isLeftHand;
}
#endif

Loading…
Cancel
Save