aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2020-12-15 11:14:52 +0000
committerQMK Bot <hello@qmk.fm>2020-12-15 11:14:52 +0000
commitc1b8b811ed78a465f06c41bdf69fb8d816d96b7d (patch)
treea8bc4b10904e5391138e17f741268eab1c0ecb35
parent9a04739b9866876bcee0ee13590488eb85891598 (diff)
parent0831a3181a51cf190aabcea504c1be2752bbc2be (diff)
downloadqmk_firmware-c1b8b811ed78a465f06c41bdf69fb8d816d96b7d.tar.gz
qmk_firmware-c1b8b811ed78a465f06c41bdf69fb8d816d96b7d.zip
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--keyboards/helix/rev2/config.h2
-rw-r--r--keyboards/helix/rev2/keymaps/default/keymap.c174
-rw-r--r--keyboards/helix/rev2/keymaps/default/oled_display.c228
-rw-r--r--keyboards/helix/rev2/keymaps/default/rules.mk12
-rw-r--r--keyboards/helix/rev2/keymaps/led_test/oled_display.c1
-rw-r--r--keyboards/helix/rev2/keymaps/led_test/rules.mk4
-rw-r--r--keyboards/helix/rev2/local_features.mk156
-rw-r--r--keyboards/helix/rev2/readme.md13
-rw-r--r--keyboards/helix/rev2/rev2.c17
-rw-r--r--keyboards/helix/rev2/rev2.h3
-rw-r--r--keyboards/helix/rev2/rules.mk5
-rw-r--r--keyboards/helix/rev3_4rows/rev3_4rows.c16
-rw-r--r--keyboards/helix/rev3_5rows/rev3_5rows.c16
13 files changed, 414 insertions, 233 deletions
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h
index f85896fbe..e4ddf9498 100644
--- a/keyboards/helix/rev2/config.h
+++ b/keyboards/helix/rev2/config.h
@@ -48,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
48 #define SSD1306OLED 48 #define SSD1306OLED
49#endif 49#endif
50 50
51#define OLED_UPDATE_INTERVAL 50
52
51/* Select rows configuration */ 53/* Select rows configuration */
52// Rows are 4 or 5 54// Rows are 4 or 5
53// #define HELIX_ROWS 5 see ./rules.mk 55// #define HELIX_ROWS 5 see ./rules.mk
diff --git a/keyboards/helix/rev2/keymaps/default/keymap.c b/keyboards/helix/rev2/keymaps/default/keymap.c
index c575287ee..d5209d853 100644
--- a/keyboards/helix/rev2/keymaps/default/keymap.c
+++ b/keyboards/helix/rev2/keymaps/default/keymap.c
@@ -1,3 +1,19 @@
1/* Copyright 2020 yushakobo
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
2#include "bootloader.h" 18#include "bootloader.h"
3#ifdef PROTOCOL_LUFA 19#ifdef PROTOCOL_LUFA
@@ -7,17 +23,6 @@
7#ifdef AUDIO_ENABLE 23#ifdef AUDIO_ENABLE
8 #include "audio.h" 24 #include "audio.h"
9#endif 25#endif
10#ifdef SSD1306OLED
11 #include "ssd1306.h"
12#endif
13
14
15#ifdef RGBLIGHT_ENABLE
16//Following line allows macro to read current RGB settings
17extern rgblight_config_t rgblight_config;
18#endif
19
20extern uint8_t is_master;
21 26
22// Each layer gets a name for readability, which is then used in the keymap matrix below. 27// Each layer gets a name for readability, which is then used in the keymap matrix below.
23// The underscores don't mean anything - you can have a layer called STUFF or any other name. 28// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@@ -420,16 +425,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
420 if (record->event.pressed) { 425 if (record->event.pressed) {
421 rgblight_mode(RGB_current_mode); 426 rgblight_mode(RGB_current_mode);
422 rgblight_step(); 427 rgblight_step();
423 RGB_current_mode = rgblight_config.mode; 428 RGB_current_mode = rgblight_get_mode();
424 } 429 }
425 #endif 430 #endif
426 return false; 431 return false;
427 break; 432 break;
428 case EISU: 433 case EISU:
429 if (record->event.pressed) { 434 if (record->event.pressed) {
430 if(keymap_config.swap_lalt_lgui==false){ 435 if (is_mac_mode()) {
431 register_code(KC_LANG2); 436 register_code(KC_LANG2);
432 }else{ 437 } else {
433 SEND_STRING(SS_LALT("`")); 438 SEND_STRING(SS_LALT("`"));
434 } 439 }
435 } else { 440 } else {
@@ -439,9 +444,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
439 break; 444 break;
440 case KANA: 445 case KANA:
441 if (record->event.pressed) { 446 if (record->event.pressed) {
442 if(keymap_config.swap_lalt_lgui==false){ 447 if (is_mac_mode()) {
443 register_code(KC_LANG1); 448 register_code(KC_LANG1);
444 }else{ 449 } else {
445 SEND_STRING(SS_LALT("`")); 450 SEND_STRING(SS_LALT("`"));
446 } 451 }
447 } else { 452 } else {
@@ -454,7 +459,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
454 if (record->event.pressed) { 459 if (record->event.pressed) {
455 eeconfig_update_rgblight_default(); 460 eeconfig_update_rgblight_default();
456 rgblight_enable(); 461 rgblight_enable();
457 RGB_current_mode = rgblight_config.mode; 462 RGB_current_mode = rgblight_get_mode();
458 } 463 }
459 #endif 464 #endif
460 break; 465 break;
@@ -462,12 +467,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
462 return true; 467 return true;
463} 468}
464 469
470#ifdef SSD1306OLED
471 #include "ssd1306.h"
472#endif
473
465void matrix_init_user(void) { 474void matrix_init_user(void) {
466 #ifdef AUDIO_ENABLE 475 #ifdef AUDIO_ENABLE
467 startup_user(); 476 startup_user();
468 #endif 477 #endif
469 #ifdef RGBLIGHT_ENABLE 478 #ifdef RGBLIGHT_ENABLE
470 RGB_current_mode = rgblight_config.mode; 479 RGB_current_mode = rgblight_get_mode();
471 #endif 480 #endif
472 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h 481 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
473 #ifdef SSD1306OLED 482 #ifdef SSD1306OLED
@@ -500,132 +509,3 @@ void music_scale_user(void)
500} 509}
501 510
502#endif 511#endif
503
504
505//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
506#ifdef SSD1306OLED
507
508void matrix_scan_user(void) {
509 iota_gfx_task(); // this is what updates the display continuously
510}
511
512void matrix_update(struct CharacterMatrix *dest,
513 const struct CharacterMatrix *source) {
514 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
515 memcpy(dest->display, source->display, sizeof(dest->display));
516 dest->dirty = true;
517 }
518}
519
520//assign the right code to your layers for OLED display
521#define L_BASE 0
522#define L_LOWER (1<<_LOWER)
523#define L_RAISE (1<<_RAISE)
524#define L_ADJUST (1<<_ADJUST)
525#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
526
527static void render_logo(struct CharacterMatrix *matrix) {
528
529 static const char helix_logo[] PROGMEM ={
530 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
531 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
532 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
533 0};
534 matrix_write_P(matrix, helix_logo);
535 //matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
536}
537
538static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
539#ifdef RGBLIGHT_ENABLE
540 char buf[30];
541 if (RGBLIGHT_MODES > 1 && rgblight_config.enable) {
542 if (full) {
543 snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
544 rgblight_config.mode,
545 rgblight_config.hue/RGBLIGHT_HUE_STEP,
546 rgblight_config.sat/RGBLIGHT_SAT_STEP,
547 rgblight_config.val/RGBLIGHT_VAL_STEP);
548 } else {
549 snprintf(buf, sizeof(buf), "[%2d] ",rgblight_config.mode);
550 }
551 matrix_write(matrix, buf);
552 }
553#endif
554}
555
556static void render_layer_status(struct CharacterMatrix *matrix) {
557 // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
558 char buf[10];
559 matrix_write_P(matrix, PSTR("Layer: "));
560 switch (layer_state) {
561 case L_BASE:
562 matrix_write_P(matrix, PSTR("Default"));
563 break;
564 case L_RAISE:
565 matrix_write_P(matrix, PSTR("Raise"));
566 break;
567 case L_LOWER:
568 matrix_write_P(matrix, PSTR("Lower"));
569 break;
570 case L_ADJUST:
571 case L_ADJUST_TRI:
572 matrix_write_P(matrix, PSTR("Adjust"));
573 break;
574 default:
575 matrix_write_P(matrix, PSTR("Undef-"));
576 snprintf(buf,sizeof(buf), "%ld", layer_state);
577 matrix_write(matrix, buf);
578 }
579}
580
581void render_status(struct CharacterMatrix *matrix) {
582
583 // Render to mode icon
584 static const char os_logo[][2][3] PROGMEM ={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
585 if(keymap_config.swap_lalt_lgui==false){
586 matrix_write_P(matrix, os_logo[0][0]);
587 matrix_write_P(matrix, PSTR("\n"));
588 matrix_write_P(matrix, os_logo[0][1]);
589 }else{
590 matrix_write_P(matrix, os_logo[1][0]);
591 matrix_write_P(matrix, PSTR("\n"));
592 matrix_write_P(matrix, os_logo[1][1]);
593 }
594
595 matrix_write_P(matrix, PSTR(" "));
596 render_layer_status(matrix);
597 matrix_write_P(matrix, PSTR("\n"));
598
599 // Host Keyboard LED Status
600 matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
601 PSTR("NUMLOCK") : PSTR(" "));
602 matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
603 PSTR("CAPS") : PSTR(" "));
604 matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
605 PSTR("SCLK") : PSTR(" "));
606 matrix_write_P(matrix, PSTR("\n"));
607 render_rgbled_status(true, matrix);
608}
609
610
611void iota_gfx_task_user(void) {
612 struct CharacterMatrix matrix;
613
614#if DEBUG_TO_SCREEN
615 if (debug_enable) {
616 return;
617 }
618#endif
619
620 matrix_clear(&matrix);
621 if(is_master){
622 render_status(&matrix);
623 }else{
624 render_logo(&matrix);
625 render_rgbled_status(false, &matrix);
626 render_layer_status(&matrix);
627 }
628 matrix_update(&display, &matrix);
629}
630
631#endif
diff --git a/keyboards/helix/rev2/keymaps/default/oled_display.c b/keyboards/helix/rev2/keymaps/default/oled_display.c
new file mode 100644
index 000000000..502b62c3c
--- /dev/null
+++ b/keyboards/helix/rev2/keymaps/default/oled_display.c
@@ -0,0 +1,228 @@
1/* Copyright 2020 yushakobo
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <stdio.h>
18#include <string.h>
19#include QMK_KEYBOARD_H
20
21#ifdef SSD1306OLED
22 #include "ssd1306.h"
23#endif
24
25// Each layer gets a name for readability, which is then used in the keymap matrix below.
26// The underscores don't mean anything - you can have a layer called STUFF or any other name.
27// Layer names don't all need to be of the same length, obviously, and you can also skip them
28// entirely and just use numbers.
29enum layer_number {
30 _QWERTY = 0,
31 _COLEMAK,
32 _DVORAK,
33 _LOWER,
34 _RAISE,
35 _ADJUST
36};
37
38//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
39#if defined(SSD1306OLED) || defined(OLED_DRIVER_ENABLE)
40
41# if defined(OLED_DRIVER_ENABLE)
42oled_rotation_t oled_init_user(oled_rotation_t rotation) {
43 if (is_keyboard_master()) {
44 return OLED_ROTATION_0;
45 } else {
46 return OLED_ROTATION_180;
47 }
48}
49# else
50# define oled_write(data,flag) matrix_write(matrix, data)
51# define oled_write_P(data,flag) matrix_write_P(matrix, data)
52# endif
53
54# ifdef SSD1306OLED
55void matrix_scan_user(void) {
56 iota_gfx_task(); // this is what updates the display continuously
57}
58
59void matrix_update(struct CharacterMatrix *dest,
60 const struct CharacterMatrix *source) {
61 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
62 memcpy(dest->display, source->display, sizeof(dest->display));
63 dest->dirty = true;
64 }
65}
66# endif
67
68//assign the right code to your layers for OLED display
69#define L_BASE 0
70#define L_LOWER (1<<_LOWER)
71#define L_RAISE (1<<_RAISE)
72#define L_ADJUST (1<<_ADJUST)
73#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
74
75# ifdef SSD1306OLED
76static void render_logo(struct CharacterMatrix *matrix) {
77# else
78static void render_logo(void) {
79# endif
80
81 static const char helix_logo[] PROGMEM ={
82 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
83 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
84 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
85 0};
86 oled_write_P(helix_logo, false);
87}
88
89# ifdef SSD1306OLED
90static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
91# else
92static void render_rgbled_status(bool full) {
93# endif
94# ifdef RGBLIGHT_ENABLE
95 char buf[30];
96 if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
97 if (full) {
98 snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
99 rgblight_get_mode(),
100 rgblight_get_hue()/RGBLIGHT_HUE_STEP,
101 rgblight_get_sat()/RGBLIGHT_SAT_STEP,
102 rgblight_get_val()/RGBLIGHT_VAL_STEP);
103 } else {
104 snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
105 }
106 oled_write(buf, false);
107 }
108# endif
109}
110
111# ifdef SSD1306OLED
112static void render_layer_status(struct CharacterMatrix *matrix) {
113# else
114static void render_layer_status(void) {
115# endif
116 // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
117 char buf[10];
118 oled_write_P(PSTR("Layer: "), false);
119 switch (layer_state) {
120 case L_BASE:
121 oled_write_P(PSTR("Default"), false);
122 break;
123 case L_RAISE:
124 oled_write_P(PSTR("Raise"), false);
125 break;
126 case L_LOWER:
127 oled_write_P(PSTR("Lower"), false);
128 break;
129 case L_ADJUST:
130 case L_ADJUST_TRI:
131 oled_write_P(PSTR("Adjust"), false);
132 break;
133 default:
134 oled_write_P(PSTR("Undef-"), false);
135 snprintf(buf,sizeof(buf), "%ld", layer_state);
136 oled_write(buf, false);
137 }
138}
139
140# ifdef SSD1306OLED
141void render_status(struct CharacterMatrix *matrix) {
142# else
143void render_status(void) {
144# endif
145 // Render to mode icon
146 static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
147 if (is_mac_mode()) {
148 oled_write_P(os_logo[0][0], false);
149 oled_write_P(PSTR("\n"), false);
150 oled_write_P(os_logo[0][1], false);
151 } else {
152 oled_write_P(os_logo[1][0], false);
153 oled_write_P(PSTR("\n"), false);
154 oled_write_P(os_logo[1][1], false);
155 }
156
157 oled_write_P(PSTR(" "), false);
158# ifdef SSD1306OLED
159 render_layer_status(matrix);
160# else
161 render_layer_status();
162# endif
163 oled_write_P(PSTR("\n"), false);
164
165 // Host Keyboard LED Status
166 led_t led_state = host_keyboard_led_state();
167 oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
168 oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
169 oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
170 oled_write_P(PSTR("\n"), false);
171# ifdef SSD1306OLED
172 render_rgbled_status(true, matrix);
173# else
174 render_rgbled_status(true);
175 oled_write_P(PSTR("\n"), false);
176# endif
177}
178
179
180# ifdef SSD1306OLED
181# if OLED_UPDATE_INTERVAL > 0
182uint16_t oled_update_timeout;
183# endif
184
185void iota_gfx_task_user(void) {
186 struct CharacterMatrix matrix;
187
188# if DEBUG_TO_SCREEN
189 if (debug_enable) {
190 return;
191 }
192# endif
193
194#if OLED_UPDATE_INTERVAL > 0
195 if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) {
196 return;
197 }
198 oled_update_timeout = timer_read();
199#endif
200 matrix_clear(&matrix);
201 if (is_keyboard_master()) {
202 render_status(&matrix);
203 } else {
204 render_logo(&matrix);
205 render_rgbled_status(false, &matrix);
206 render_layer_status(&matrix);
207 }
208 matrix_update(&display, &matrix);
209}
210# else
211void oled_task_user(void) {
212
213# if DEBUG_TO_SCREEN
214 if (debug_enable) {
215 return;
216 }
217# endif
218
219 if (is_keyboard_master()) {
220 render_status();
221 } else {
222 render_logo();
223 render_rgbled_status(false);
224 render_layer_status();
225 }
226}
227# endif
228#endif
diff --git a/keyboards/helix/rev2/keymaps/default/rules.mk b/keyboards/helix/rev2/keymaps/default/rules.mk
index 9801648de..206e836ec 100644
--- a/keyboards/helix/rev2/keymaps/default/rules.mk
+++ b/keyboards/helix/rev2/keymaps/default/rules.mk
@@ -18,6 +18,18 @@ LTO_ENABLE = no # if firmware size over limit, try this option
18# LED_ANIMATIONS = yes # LED animations 18# LED_ANIMATIONS = yes # LED animations
19# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 19# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
20 20
21# OLED_ENABLE が yes のとき
22# OLED_SELECT が core ならば QMK 標準の oled_dirver.c を使用します。
23# OLED_SELECT が core 以外ならば従来どおり helix/local_drivers/ssd1306.c を使用します。
24# If OLED_ENABLE is 'yes'
25# If OLED_SELECT is 'core', use QMK standard oled_dirver.c.
26# If OLED_SELECT is other than 'core', use helix/local_drivers/ssd1306.c.
27OLED_SELECT = core
28
29ifeq ($(strip $(OLED_ENABLE)), yes)
30 SRC += oled_display.c
31endif
32
21# convert Helix-specific options (that represent combinations of standard options) 33# convert Helix-specific options (that represent combinations of standard options)
22# into QMK standard options. 34# into QMK standard options.
23include $(strip $(KEYBOARD_LOCAL_FEATURES_MK)) 35include $(strip $(KEYBOARD_LOCAL_FEATURES_MK))
diff --git a/keyboards/helix/rev2/keymaps/led_test/oled_display.c b/keyboards/helix/rev2/keymaps/led_test/oled_display.c
new file mode 100644
index 000000000..3261b6c58
--- /dev/null
+++ b/keyboards/helix/rev2/keymaps/led_test/oled_display.c
@@ -0,0 +1 @@
#include "../default/oled_display.c"
diff --git a/keyboards/helix/rev2/keymaps/led_test/rules.mk b/keyboards/helix/rev2/keymaps/led_test/rules.mk
index cc6d56811..8b590eee8 100644
--- a/keyboards/helix/rev2/keymaps/led_test/rules.mk
+++ b/keyboards/helix/rev2/keymaps/led_test/rules.mk
@@ -18,6 +18,10 @@ LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
18LED_ANIMATIONS = yes # LED animations 18LED_ANIMATIONS = yes # LED animations
19# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 19# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
20 20
21OLED_SELECT = core
22ifeq ($(strip $(OLED_ENABLE)), yes)
23 SRC += oled_display.c
24endif
21SRC += led_test_init.c 25SRC += led_test_init.c
22 26
23# convert Helix-specific options (that represent combinations of standard options) 27# convert Helix-specific options (that represent combinations of standard options)
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index 1d0b55cbf..ce3853a02 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -10,6 +10,7 @@ KEYBOARD_LOCAL_FEATURES_MK :=
10define HELIX_CUSTOMISE_MSG 10define HELIX_CUSTOMISE_MSG
11 $(info Helix Spacific Build Options) 11 $(info Helix Spacific Build Options)
12 $(info - OLED_ENABLE = $(OLED_ENABLE)) 12 $(info - OLED_ENABLE = $(OLED_ENABLE))
13 $(info - OLED_SELECT = $(OLED_SELECT))
13 $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) 14 $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
14 $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) 15 $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
15 $(info - LED_ANIMATIONS = $(LED_ANIMATIONS)) 16 $(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
@@ -20,9 +21,10 @@ endef
20define HELIX_HELP_MSG 21define HELIX_HELP_MSG
21 $(info Helix keyboard convenient command line option) 22 $(info Helix keyboard convenient command line option)
22 $(info - make HELIX=<options> helix:<keymap>) 23 $(info - make HELIX=<options> helix:<keymap>)
23 $(info - option= oled | no-oled | back | no-back | under | na | no-ani) 24 $(info - option= oled | core-oled | local-oled | no-oled )
24 $(info - ios | sc | split-common | scan | verbose) 25 $(info - back | no-back | under | na | no-ani )
25 $(info - ex.) 26 $(info - ios | sc | split-common | scan | verbose)
27 $(info - eg.)
26 $(info - make HELIX=no-oled helix:<keymap>) 28 $(info - make HELIX=no-oled helix:<keymap>)
27 $(info - make HELIX=oled,no-back helix:<keymap>) 29 $(info - make HELIX=oled,no-back helix:<keymap>)
28 $(info - make HELIX=oled,under helix:<keymap>) 30 $(info - make HELIX=oled,under helix:<keymap>)
@@ -32,65 +34,76 @@ define HELIX_HELP_MSG
32endef 34endef
33 35
34 ifneq ($(strip $(HELIX)),) 36 ifneq ($(strip $(HELIX)),)
37 define HELIX_OPTION_PARSE
38 # parce 'oled' 'back' 'under' 'ios' etc.
39 $(if $(SHOW_PARCE),$(info parse .$1.)) #debug
40
41 ifeq ($(strip $1),help)
42 HELP=on
43 endif
44 ifneq ($(filter nooled no-oled,$(strip $1)),)
45 OLED_ENABLE = no
46 endif
47 ifeq ($(strip $1),oled)
48 OLED_ENABLE = yes
49 endif
50 ifneq ($(filter core-oled core_oled newoled new-oled olednew oled-new,$(strip $1)),)
51 OLED_ENABLE = yes
52 OLED_SELECT = core
53 endif
54 ifneq ($(filter local-oled local_oled oldoled old-oled oledold oled-old,$(strip $1)),)
55 OLED_ENABLE = yes
56 OLED_SELECT = local
57 endif
58 ifneq ($(filter noback no-back nounder no-under,$(strip $1)),)
59 LED_BACK_ENABLE = no
60 LED_UNDERGLOW_ENABLE = no
61 endif
62 ifeq ($(strip $1),back)
63 LED_BACK_ENABLE = yes
64 LED_UNDERGLOW_ENABLE = no
65 endif
66 ifeq ($(strip $1),under)
67 LED_BACK_ENABLE = no
68 LED_UNDERGLOW_ENABLE = yes
69 endif
70 ifneq ($(filter na no_ani no-ani,$(strip $1)),)
71 LED_ANIMATIONS = no
72 endif
73 ifeq ($(strip $1),ios)
74 IOS_DEVICE_ENABLE = yes
75 endif
76 ifneq ($(filter sc split-common split_common,$(strip $1)),)
77 SPLIT_KEYBOARD = yes
78 endif
79 ifneq ($(filter nosc no-sc no-split-common no-split_common,$(strip $1)),)
80 SPLIT_KEYBOARD = no
81 endif
82 ifeq ($(strip $1),scan)
83 # use DEBUG_MATRIX_SCAN_RATE
84 # see docs/newbs_testing_debugging.md
85 OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
86 CONSOLE_ENABLE = yes
87 SHOW_VERBOSE_INFO = yes
88 endif
89 ifeq ($(strip $1),verbose)
90 SHOW_VERBOSE_INFO = yes
91 endif
92 ifeq ($(strip $1),lto)
93 LTO_ENABLE = yes
94 endif
95 ifneq ($(filter nolto no-lto no_lto,$(strip $1)),)
96 LTO_ENABLE = no
97 endif
98 endef # end of HELIX_OPTION_PARSE
99
35 COMMA=, 100 COMMA=,
36 helix_option := $(subst $(COMMA), , $(HELIX)) 101 $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(HELIX)), \
37 ifneq ($(filter help,$(helix_option)),) 102 $(call HELIX_OPTION_PARSE,$(A_OPTION_NAME))))
38 $(eval $(call HELIX_HELP_MSG)) 103
39 $(error ) 104 ifeq ($(strip $(HELP)),on)
40 endif 105 $(eval $(call HELIX_HELP_MSG))
41 ifneq ($(filter nooled,$(helix_option)),) 106 $(error )
42 OLED_ENABLE = no
43 else ifneq ($(filter no-oled,$(helix_option)),)
44 OLED_ENABLE = no
45 else ifneq ($(filter oled,$(helix_option)),)
46 OLED_ENABLE = yes
47 endif
48 ifneq ($(filter noback,$(helix_option)),)
49 LED_BACK_ENABLE = no
50 LED_UNDERGLOW_ENABLE = no
51 else ifneq ($(filter no-back,$(helix_option)),)
52 LED_BACK_ENABLE = no
53 LED_UNDERGLOW_ENABLE = no
54 else ifneq ($(filter nounder,$(helix_option)),)
55 LED_BACK_ENABLE = no
56 LED_UNDERGLOW_ENABLE = no
57 else ifneq ($(filter no-under,$(helix_option)),)
58 LED_BACK_ENABLE = no
59 LED_UNDERGLOW_ENABLE = no
60 else ifneq ($(filter back,$(helix_option)),)
61 LED_BACK_ENABLE = yes
62 LED_UNDERGLOW_ENABLE = no
63 else ifneq ($(filter under,$(helix_option)),)
64 LED_BACK_ENABLE = no
65 LED_UNDERGLOW_ENABLE = yes
66 endif
67 ifneq ($(filter na,$(helix_option)),)
68 LED_ANIMATIONS = no
69 endif
70 ifneq ($(filter no_ani,$(helix_option)),)
71 LED_ANIMATIONS = no
72 endif
73 ifneq ($(filter no-ani,$(helix_option)),)
74 LED_ANIMATIONS = no
75 endif
76 ifneq ($(filter ios,$(helix_option)),)
77 IOS_DEVICE_ENABLE = yes
78 endif
79 ifneq ($(filter sc,$(helix_option)),)
80 SPLIT_KEYBOARD = yes
81 endif
82 ifneq ($(filter split-common,$(helix_option)),)
83 SPLIT_KEYBOARD = yes
84 endif
85 ifneq ($(filter scan,$(helix_option)),)
86 # use DEBUG_MATRIX_SCAN_RATE
87 # see docs/newbs_testing_debugging.md
88 OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
89 CONSOLE_ENABLE = yes
90 SHOW_VERBOSE_INFO = yes
91 endif
92 ifeq ($(filter verbose,$(helix_option)), verbose)
93 SHOW_VERBOSE_INFO = yes
94 endif 107 endif
95 SHOW_HELIX_OPTIONS = yes 108 SHOW_HELIX_OPTIONS = yes
96 endif 109 endif
@@ -142,12 +155,21 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
142endif 155endif
143 156
144ifeq ($(strip $(OLED_ENABLE)), yes) 157ifeq ($(strip $(OLED_ENABLE)), yes)
145 SRC += local_drivers/i2c.c 158 ifeq ($(strip $(OLED_SELECT)),core)
146 SRC += local_drivers/ssd1306.c 159 OLED_DRIVER_ENABLE = yes
147 KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers 160 ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
148 OPT_DEFS += -DOLED_ENABLE 161 OPT_DEFS += -DOLED_FONT_H=\<helixfont.h\>
149 ifeq ($(strip $(LOCAL_GLCDFONT)), yes) 162 else
150 OPT_DEFS += -DLOCAL_GLCDFONT 163 OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
164 endif
165 else
166 SRC += local_drivers/i2c.c
167 SRC += local_drivers/ssd1306.c
168 KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
169 OPT_DEFS += -DOLED_ENABLE
170 ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
171 OPT_DEFS += -DLOCAL_GLCDFONT
172 endif
151 endif 173 endif
152endif 174endif
153 175
diff --git a/keyboards/helix/rev2/readme.md b/keyboards/helix/rev2/readme.md
new file mode 100644
index 000000000..e6a6f2e95
--- /dev/null
+++ b/keyboards/helix/rev2/readme.md
@@ -0,0 +1,13 @@
1# Helix rev2
2
3A compact split ortholinear keyboard.
4
5* Keyboard Maintainer: [yushakobo](https://github.com/yushakobo)
6* Hardware Supported: Helix rev2 PCBs, Pro Micro
7* Hardware Availability: [PCB & Case Data](https://github.com/MakotoKurauchi/helix)
8
9Make example for this keyboard (after setting up your build environment):
10
11 make helix/rev2:default:flash
12
13See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c
index 12b8ae9ef..d2b3143d8 100644
--- a/keyboards/helix/rev2/rev2.c
+++ b/keyboards/helix/rev2/rev2.c
@@ -18,13 +18,28 @@ void led_set_kb(uint8_t usb_led) {
18} 18}
19#endif 19#endif
20 20
21bool is_mac_mode(void) {
22 // This is the opposite of the QMK standard, but we'll leave it for backwards compatibility.
23 return keymap_config.swap_lalt_lgui == false;
24}
25
26void set_mac_mode_kb(bool macmode) {
27 /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI)/AG_SWAP(=MAGIC_SWAP_ALT_GUI) keys.
28 * see
29 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124
30 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81
31 */
32 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode;
33 eeconfig_update_keymap(keymap_config.raw);
34}
35
21void matrix_init_kb(void) { 36void matrix_init_kb(void) {
22 // Each keymap.c should use is_keyboard_master() instead of is_master. 37 // Each keymap.c should use is_keyboard_master() instead of is_master.
23 // But keep is_master for a while for backwards compatibility 38 // But keep is_master for a while for backwards compatibility
24 // for the old keymap.c. 39 // for the old keymap.c.
25 is_master = is_keyboard_master(); 40 is_master = is_keyboard_master();
26 41
27 matrix_init_user(); 42 matrix_init_user();
28}; 43};
29 44
30void keyboard_post_init_kb(void) { 45void keyboard_post_init_kb(void) {
diff --git a/keyboards/helix/rev2/rev2.h b/keyboards/helix/rev2/rev2.h
index 42f215fdf..bab841fe3 100644
--- a/keyboards/helix/rev2/rev2.h
+++ b/keyboards/helix/rev2/rev2.h
@@ -2,6 +2,9 @@
2 2
3#include "helix.h" 3#include "helix.h"
4 4
5bool is_mac_mode(void);
6void set_mac_mode_kb(bool macmode);
7
5#ifndef SPLIT_KEYBOARD 8#ifndef SPLIT_KEYBOARD
6 extern bool is_helix_master(void); 9 extern bool is_helix_master(void);
7 #define is_keyboard_master() is_helix_master() 10 #define is_keyboard_master() is_helix_master()
diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk
index d5d69c979..a31e9d9b2 100644
--- a/keyboards/helix/rev2/rules.mk
+++ b/keyboards/helix/rev2/rules.mk
@@ -8,3 +8,8 @@ LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.)
8LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) 8LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
9LED_ANIMATIONS = yes # LED animations 9LED_ANIMATIONS = yes # LED animations
10IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) 10IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
11
12# If OLED_ENABLE is 'yes'
13# If OLED_SELECT is 'core', use QMK standard oled_dirver.c.
14# If OLED_SELECT is other than 'core', use helix/local_drivers/ssd1306.c.
15OLED_SELECT = local
diff --git a/keyboards/helix/rev3_4rows/rev3_4rows.c b/keyboards/helix/rev3_4rows/rev3_4rows.c
index cf183366d..c034c8338 100644
--- a/keyboards/helix/rev3_4rows/rev3_4rows.c
+++ b/keyboards/helix/rev3_4rows/rev3_4rows.c
@@ -21,15 +21,13 @@ bool is_mac_mode(void) {
21} 21}
22 22
23void set_mac_mode(bool macmode) { 23void set_mac_mode(bool macmode) {
24 if (macmode) { 24 /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI)/AG_SWAP(=MAGIC_SWAP_ALT_GUI) keys.
25 /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI) key. */ 25 * see
26 /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124 */ 26 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124
27 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = false; 27 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81
28 } else { 28 */
29 /* The result is the same as pressing the AG_SWAP(=MAGIC_SWAP_ALT_GUI) key. */ 29 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode;
30 /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ 30 eeconfig_update_keymap(keymap_config.raw);
31 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = true;
32 }
33} 31}
34 32
35void dip_switch_update_kb(uint8_t index, bool active) { 33void dip_switch_update_kb(uint8_t index, bool active) {
diff --git a/keyboards/helix/rev3_5rows/rev3_5rows.c b/keyboards/helix/rev3_5rows/rev3_5rows.c
index cf183366d..c034c8338 100644
--- a/keyboards/helix/rev3_5rows/rev3_5rows.c
+++ b/keyboards/helix/rev3_5rows/rev3_5rows.c
@@ -21,15 +21,13 @@ bool is_mac_mode(void) {
21} 21}
22 22
23void set_mac_mode(bool macmode) { 23void set_mac_mode(bool macmode) {
24 if (macmode) { 24 /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI)/AG_SWAP(=MAGIC_SWAP_ALT_GUI) keys.
25 /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI) key. */ 25 * see
26 /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124 */ 26 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124
27 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = false; 27 * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81
28 } else { 28 */
29 /* The result is the same as pressing the AG_SWAP(=MAGIC_SWAP_ALT_GUI) key. */ 29 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode;
30 /* https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81 */ 30 eeconfig_update_keymap(keymap_config.raw);
31 keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = true;
32 }
33} 31}
34 32
35void dip_switch_update_kb(uint8_t index, bool active) { 33void dip_switch_update_kb(uint8_t index, bool active) {