aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMakotoKurauchi <pluis@me.com>2018-07-27 06:26:02 +0900
committerDrashna Jaelre <drashna@live.com>2018-07-26 14:26:02 -0700
commit07e0558e9a3607907c8efed6ae0f5e8c53befc8b (patch)
treeefe359ec91db1053d39cc307ceca9fba9fcc2e78
parentf2bf5a9a749c55c8941e3b17a2416631972b4cc7 (diff)
downloadqmk_firmware-07e0558e9a3607907c8efed6ae0f5e8c53befc8b.tar.gz
qmk_firmware-07e0558e9a3607907c8efed6ae0f5e8c53befc8b.zip
Keyboard: Add HelixPico keyboard (#3502)
-rw-r--r--keyboards/helix/helix.h3
-rw-r--r--keyboards/helix/pico/config.h152
-rw-r--r--keyboards/helix/pico/info.json13
-rw-r--r--keyboards/helix/pico/keymaps/default/config.h31
-rw-r--r--keyboards/helix/pico/keymaps/default/keymap.c474
-rw-r--r--keyboards/helix/pico/keymaps/default/readme.md128
-rw-r--r--keyboards/helix/pico/keymaps/default/readme_jp.md137
-rw-r--r--keyboards/helix/pico/keymaps/default/rules.mk115
-rw-r--r--keyboards/helix/pico/matrix.c351
-rw-r--r--keyboards/helix/pico/pico.c14
-rw-r--r--keyboards/helix/pico/pico.h65
-rw-r--r--keyboards/helix/pico/rules.mk3
-rw-r--r--keyboards/helix/pico/serial_config.h16
-rw-r--r--keyboards/helix/pico/split_util.c70
-rw-r--r--keyboards/helix/pico/split_util.h19
15 files changed, 1591 insertions, 0 deletions
diff --git a/keyboards/helix/helix.h b/keyboards/helix/helix.h
index 36d12ef86..d73feb6bb 100644
--- a/keyboards/helix/helix.h
+++ b/keyboards/helix/helix.h
@@ -7,6 +7,9 @@
7#ifdef KEYBOARD_helix_rev2 7#ifdef KEYBOARD_helix_rev2
8 #include "rev2.h" 8 #include "rev2.h"
9#endif 9#endif
10#ifdef KEYBOARD_helix_pico
11 #include "pico.h"
12#endif
10 13
11#include "quantum.h" 14#include "quantum.h"
12 15
diff --git a/keyboards/helix/pico/config.h b/keyboards/helix/pico/config.h
new file mode 100644
index 000000000..b49f0173b
--- /dev/null
+++ b/keyboards/helix/pico/config.h
@@ -0,0 +1,152 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef PICO_CONFIG_H
20#define PICO_CONFIG_H
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x3060
25#define DEVICE_VER 0x0002
26#define MANUFACTURER Yushakobo
27#define PRODUCT HelixPico
28#define DESCRIPTION A split keyboard for the cheap makers
29
30
31#define PREVENT_STUCK_MODIFIERS
32#define TAPPING_FORCE_HOLD
33#define TAPPING_TERM 100
34
35/* Use I2C or Serial */
36#define USE_I2C
37#define USE_SERIAL
38//#define USE_MATRIX_I2C
39
40/* Select hand configuration */
41#define MASTER_LEFT
42// #define MASTER_RIGHT
43// #define EE_HANDS
44
45// Helix keyboard OLED support
46// see ./rules.mk: OLED_ENABLE=yes or no
47#ifdef OLED_ENABLE
48 #define SSD1306OLED
49#endif
50
51/* key matrix size */
52// Rows are doubled-up
53#define MATRIX_ROWS 8
54#define MATRIX_ROW_PINS { D4, C6, D7, E6 }
55
56// wiring of each half
57#define MATRIX_COLS 7
58#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
59// #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
61/* define if matrix has ghost */
62//#define MATRIX_HAS_GHOST
63
64/* number of backlight levels */
65// #define BACKLIGHT_LEVELS 3
66
67/* Set 0 if debouncing isn't needed */
68#define DEBOUNCING_DELAY 5
69
70/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
71//#define LOCKING_SUPPORT_ENABLE
72/* Locking resynchronize hack */
73//#define LOCKING_RESYNC_ENABLE
74
75/* key combination for command */
76#define IS_COMMAND() ( \
77 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
78)
79
80/* Audio */
81#ifdef AUDIO_ENABLE
82 #define B5_AUDIO
83#endif
84
85/* ws2812 RGB LED */
86#define RGB_DI_PIN D3
87#define RGBLIGHT_TIMER
88//#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h
89#define ws2812_PORTREG PORTD
90#define ws2812_DDRREG DDRD
91
92// Helix keyboard RGB LED support
93//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no
94// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes
95#ifdef RGBLED_BACK
96 #define RGBLED_NUM 25
97#else
98 #define RGBLED_NUM 6
99#endif
100
101#ifndef IOS_DEVICE_ENABLE
102 #if RGBLED_NUM <= 6
103 #define RGBLIGHT_LIMIT_VAL 255
104 #else
105 #define RGBLIGHT_LIMIT_VAL 130
106 #endif
107 #define RGBLIGHT_VAL_STEP 17
108#else
109 #if RGBLED_NUM <= 6
110 #define RGBLIGHT_LIMIT_VAL 90
111 #else
112 #define RGBLIGHT_LIMIT_VAL 45
113 #endif
114 #define RGBLIGHT_VAL_STEP 4
115#endif
116#define RGBLIGHT_HUE_STEP 10
117#define RGBLIGHT_SAT_STEP 17
118
119#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE)
120// USB_MAX_POWER_CONSUMPTION value for Helix keyboard
121// 120 RGBoff, OLEDoff
122// 120 OLED
123// 330 RGB 6
124// 300 RGB 32
125// 310 OLED & RGB 32
126 #define USB_MAX_POWER_CONSUMPTION 400
127#else
128 // fix iPhone and iPad power adapter issue
129 // iOS device need lessthan 100
130 #define USB_MAX_POWER_CONSUMPTION 100
131#endif
132
133/*
134 * Feature disable options
135 * These options are also useful to firmware size reduction.
136 */
137
138/* disable debug print */
139// #define NO_DEBUG
140
141/* disable print */
142// #define NO_PRINT
143
144/* disable action features */
145//#define NO_ACTION_LAYER
146//#define NO_ACTION_TAPPING
147//#define NO_ACTION_ONESHOT
148//#define NO_ACTION_MACRO
149//#define NO_ACTION_FUNCTION
150
151
152#endif
diff --git a/keyboards/helix/pico/info.json b/keyboards/helix/pico/info.json
new file mode 100644
index 000000000..f4e50b95c
--- /dev/null
+++ b/keyboards/helix/pico/info.json
@@ -0,0 +1,13 @@
1{
2 "keyboard_name": "HelixPico",
3 "url": "https://github.com/MakotoKurauchi/helix",
4 "maintainer": "MakotoKurauchi",
5 "width": 15,
6 "height": 4,
7 "layouts": {
8 "LAYOUT": {
9 "key_count": 50,
10 "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":13, "y":2}, {"x":14, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}, {"x":13, "y":3}, {"x":14, "y":3}]
11 }
12 }
13}
diff --git a/keyboards/helix/pico/keymaps/default/config.h b/keyboards/helix/pico/keymaps/default/config.h
new file mode 100644
index 000000000..6084b0970
--- /dev/null
+++ b/keyboards/helix/pico/keymaps/default/config.h
@@ -0,0 +1,31 @@
1/*
2This is the c configuration file for the keymap
3
4Copyright 2012 Jun Wako <wakojun@gmail.com>
5Copyright 2015 Jack Humbert
6
7This program is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef CONFIG_USER_H
22#define CONFIG_USER_H
23
24// place overrides here
25
26#ifdef AUDIO_ENABLE
27 #define STARTUP_SONG SONG(STARTUP_SOUND)
28 #define AUDIO_CLICKY
29#endif
30
31#endif /* CONFIG_USER_H */
diff --git a/keyboards/helix/pico/keymaps/default/keymap.c b/keyboards/helix/pico/keymaps/default/keymap.c
new file mode 100644
index 000000000..75221d485
--- /dev/null
+++ b/keyboards/helix/pico/keymaps/default/keymap.c
@@ -0,0 +1,474 @@
1#include QMK_KEYBOARD_H
2#include "bootloader.h"
3#ifdef PROTOCOL_LUFA
4#include "lufa.h"
5#include "split_util.h"
6#endif
7#ifdef AUDIO_ENABLE
8 #include "audio.h"
9#endif
10#ifdef SSD1306OLED
11 #include "ssd1306.h"
12#endif
13
14extern keymap_config_t keymap_config;
15
16#ifdef RGBLIGHT_ENABLE
17//Following line allows macro to read current RGB settings
18extern rgblight_config_t rgblight_config;
19#endif
20
21extern uint8_t is_master;
22
23// Each layer gets a name for readability, which is then used in the keymap matrix below.
24// The underscores don't mean anything - you can have a layer called STUFF or any other name.
25// Layer names don't all need to be of the same length, obviously, and you can also skip them
26// entirely and just use numbers.
27enum layer_number {
28 _QWERTY = 0,
29 _COLEMAK,
30 _DVORAK,
31 _LOWER,
32 _RAISE,
33 _ADJUST
34};
35
36enum custom_keycodes {
37 QWERTY = SAFE_RANGE,
38 COLEMAK,
39 DVORAK,
40 LOWER,
41 RAISE,
42 ADJUST,
43 BACKLIT,
44 EISU,
45 KANA,
46 RGBRST
47};
48
49enum macro_keycodes {
50 KC_SAMPLEMACRO,
51};
52
53
54// Fillers to make layering more clear
55#define _______ KC_TRNS
56#define XXXXXXX KC_NO
57//Macros
58#define M_SAMPLE M(KC_SAMPLEMACRO)
59
60const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
61
62 /* Qwerty
63 * ,-----------------------------------------. ,-----------------------------------------.
64 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
65 * |------+------+------+------+------+------| |------+------+------+------+------+------|
66 * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
67 * |------+------+------+------+------+------| |------+------+------+------+------+------|
68 * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
69 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
70 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
71 * `-------------------------------------------------------------------------------------------------'
72 */
73
74[_QWERTY] = LAYOUT( \
75 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
76 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
77 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
78 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
79 ),
80 /* Colemak
81 * ,-----------------------------------------. ,-----------------------------------------.
82 * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp |
83 * |------+------+------+------+------+------| |------+------+------+------+------+------|
84 * | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' |
85 * |------+------+------+------+------+------| |------+------+------+------+------+------|
86 * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter |
87 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
88 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
89 * `-------------------------------------------------------------------------------------------------'
90 */
91 [_COLEMAK] = LAYOUT( \
92 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
93 KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
94 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
95 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
96 ),
97
98 /* Dvorak
99 * ,-----------------------------------------. ,-----------------------------------------.
100 * | Tab | ' | , | . | P | Y | | F | G | C | R | L | Bksp |
101 * |------+------+------+------+------+------| |------+------+------+------+------+------|
102 * | Ctrl | A | O | E | U | I | | D | H | T | N | S | / |
103 * |------+------+------+------+------+------| |------+------+------+------+------+------|
104 * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter |
105 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
106 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
107 * `-------------------------------------------------------------------------------------------------'
108 */
109 [_DVORAK] = LAYOUT( \
110 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
111 KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
112 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
113 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
114 ),
115
116 /* Lower
117 * ,-----------------------------------------. ,-----------------------------------------.
118 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
119 * |------+------+------+------+------+------| |------+------+------+------+------+------|
120 * | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
121 * |------+------+------+------+------+------| |------+------+------+------+------+------|
122 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc | Home | End | |
123 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
124 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
125 * `-------------------------------------------------------------------------------------------------'
126 */
127 [_LOWER] = LAYOUT( \
128 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
129 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
130 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_PSCR, KC_HOME, KC_END, _______, \
131 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
132 ),
133
134 /* Raise
135 * ,-----------------------------------------. ,-----------------------------------------.
136 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
137 * |------+------+------+------+------+------| |------+------+------+------+------+------|
138 * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
139 * |------+------+------+------+------+------| |------+------+------+------+------+------|
140 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc |PageDn|PageUp| |
141 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
142 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
143 * `-------------------------------------------------------------------------------------------------'
144 */
145 [_RAISE] = LAYOUT( \
146 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
147 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
148 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_PSCR, KC_PGDN, KC_PGUP, _______, \
149 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
150 ),
151
152 /* Adjust (Lower + Raise)
153 * ,-----------------------------------------. ,-----------------------------------------.
154 * | | Reset| | | | | | | | | | | |
155 * |------+------+------+------+------+------| |------+------+------+------+------+------|
156 * | |Aud on|Audoff|MU TOG|MU MOD| Mac | | Win |Qwerty|Colemk|Dvorak| | |
157 * |------+------+------+------+------+------| |------+------+------+------+------+------|
158 * | |CK TOG|CK RST| CK UP|CK DWN| | | | |RGB ON| HUE+ | SAT+ | VAL+ |
159 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
160 * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- |
161 * `-------------------------------------------------------------------------------------------------'
162 */
163 [_ADJUST] = LAYOUT( \
164 _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
165 _______, AU_ON, AU_OFF, MU_TOG, MU_MOD, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
166 _______, CK_TOGG, CK_RST, CK_UP, CK_DOWN, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
167 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \
168 )
169};
170
171
172
173#ifdef AUDIO_ENABLE
174
175float tone_qwerty[][2] = SONG(QWERTY_SOUND);
176float tone_dvorak[][2] = SONG(DVORAK_SOUND);
177float tone_colemak[][2] = SONG(COLEMAK_SOUND);
178float tone_plover[][2] = SONG(PLOVER_SOUND);
179float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
180float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
181#endif
182
183// define variables for reactive RGB
184bool TOG_STATUS = false;
185int RGB_current_mode;
186
187void persistent_default_layer_set(uint16_t default_layer) {
188 eeconfig_update_default_layer(default_layer);
189 default_layer_set(default_layer);
190}
191
192// Setting ADJUST layer RGB back to default
193void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
194 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
195 #ifdef RGBLIGHT_ENABLE
196 //rgblight_mode(RGB_current_mode);
197 #endif
198 layer_on(layer3);
199 } else {
200 layer_off(layer3);
201 }
202}
203
204bool process_record_user(uint16_t keycode, keyrecord_t *record) {
205 switch (keycode) {
206 case QWERTY:
207 if (record->event.pressed) {
208 #ifdef AUDIO_ENABLE
209 PLAY_SONG(tone_qwerty);
210 #endif
211 persistent_default_layer_set(1UL<<_QWERTY);
212 }
213 return false;
214 break;
215 case COLEMAK:
216 if (record->event.pressed) {
217 #ifdef AUDIO_ENABLE
218 PLAY_SONG(tone_colemak);
219 #endif
220 persistent_default_layer_set(1UL<<_COLEMAK);
221 }
222 return false;
223 break;
224 case DVORAK:
225 if (record->event.pressed) {
226 #ifdef AUDIO_ENABLE
227 PLAY_SONG(tone_dvorak);
228 #endif
229 persistent_default_layer_set(1UL<<_DVORAK);
230 }
231 return false;
232 break;
233 case LOWER:
234 if (record->event.pressed) {
235 //not sure how to have keyboard check mode and set it to a variable, so my work around
236 //uses another variable that would be set to true after the first time a reactive key is pressed.
237 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
238 } else {
239 TOG_STATUS = !TOG_STATUS;
240 #ifdef RGBLIGHT_ENABLE
241 //rgblight_mode(16);
242 #endif
243 }
244 layer_on(_LOWER);
245 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
246 } else {
247 #ifdef RGBLIGHT_ENABLE
248 //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
249 #endif
250 TOG_STATUS = false;
251 layer_off(_LOWER);
252 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
253 }
254 return false;
255 break;
256 case RAISE:
257 if (record->event.pressed) {
258 //not sure how to have keyboard check mode and set it to a variable, so my work around
259 //uses another variable that would be set to true after the first time a reactive key is pressed.
260 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
261 } else {
262 TOG_STATUS = !TOG_STATUS;
263 #ifdef RGBLIGHT_ENABLE
264 //rgblight_mode(15);
265 #endif
266 }
267 layer_on(_RAISE);
268 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
269 } else {
270 #ifdef RGBLIGHT_ENABLE
271 //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
272 #endif
273 layer_off(_RAISE);
274 TOG_STATUS = false;
275 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
276 }
277 return false;
278 break;
279 case ADJUST:
280 if (record->event.pressed) {
281 layer_on(_ADJUST);
282 } else {
283 layer_off(_ADJUST);
284 }
285 return false;
286 break;
287 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
288 case RGB_MOD:
289 #ifdef RGBLIGHT_ENABLE
290 if (record->event.pressed) {
291 rgblight_mode(RGB_current_mode);
292 rgblight_step();
293 RGB_current_mode = rgblight_config.mode;
294 }
295 #endif
296 return false;
297 break;
298 case EISU:
299 if (record->event.pressed) {
300 if(keymap_config.swap_lalt_lgui==false){
301 register_code(KC_LANG2);
302 }else{
303 SEND_STRING(SS_LALT("`"));
304 }
305 } else {
306 unregister_code(KC_LANG2);
307 }
308 return false;
309 break;
310 case KANA:
311 if (record->event.pressed) {
312 if(keymap_config.swap_lalt_lgui==false){
313 register_code(KC_LANG1);
314 }else{
315 SEND_STRING(SS_LALT("`"));
316 }
317 } else {
318 unregister_code(KC_LANG1);
319 }
320 return false;
321 break;
322 case RGBRST:
323 #ifdef RGBLIGHT_ENABLE
324 if (record->event.pressed) {
325 eeconfig_update_rgblight_default();
326 rgblight_enable();
327 RGB_current_mode = rgblight_config.mode;
328 }
329 #endif
330 break;
331 }
332 return true;
333}
334
335void matrix_init_user(void) {
336 #ifdef AUDIO_ENABLE
337 startup_user();
338 #endif
339 #ifdef RGBLIGHT_ENABLE
340 RGB_current_mode = rgblight_config.mode;
341 #endif
342 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
343 #ifdef SSD1306OLED
344 iota_gfx_init(!has_usb()); // turns on the display
345 #endif
346}
347
348
349#ifdef AUDIO_ENABLE
350
351void startup_user()
352{
353 _delay_ms(50); // gets rid of tick
354}
355
356void shutdown_user()
357{
358 _delay_ms(150);
359 stop_all_notes();
360}
361
362void music_on_user(void)
363{
364 music_scale_user();
365}
366
367void music_scale_user(void)
368{
369 PLAY_SONG(music_scale);
370}
371
372#endif
373
374
375//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
376#ifdef SSD1306OLED
377
378void matrix_scan_user(void) {
379 iota_gfx_task(); // this is what updates the display continuously
380}
381
382void matrix_update(struct CharacterMatrix *dest,
383 const struct CharacterMatrix *source) {
384 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
385 memcpy(dest->display, source->display, sizeof(dest->display));
386 dest->dirty = true;
387 }
388}
389
390//assign the right code to your layers for OLED display
391#define L_BASE 0
392#define L_LOWER (1<<_LOWER)
393#define L_RAISE (1<<_RAISE)
394#define L_ADJUST (1<<_ADJUST)
395#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
396
397static void render_logo(struct CharacterMatrix *matrix) {
398
399 static char logo[]={
400 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
401 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
402 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
403 0};
404 matrix_write(matrix, logo);
405 //matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
406}
407
408
409
410void render_status(struct CharacterMatrix *matrix) {
411
412 // Render to mode icon
413 static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
414 if(keymap_config.swap_lalt_lgui==false){
415 matrix_write(matrix, logo[0][0]);
416 matrix_write_P(matrix, PSTR("\n"));
417 matrix_write(matrix, logo[0][1]);
418 }else{
419 matrix_write(matrix, logo[1][0]);
420 matrix_write_P(matrix, PSTR("\n"));
421 matrix_write(matrix, logo[1][1]);
422 }
423
424 // 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
425 char buf[40];
426 snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
427 matrix_write_P(matrix, PSTR("\nLayer: "));
428 switch (layer_state) {
429 case L_BASE:
430 matrix_write_P(matrix, PSTR("Default"));
431 break;
432 case L_RAISE:
433 matrix_write_P(matrix, PSTR("Raise"));
434 break;
435 case L_LOWER:
436 matrix_write_P(matrix, PSTR("Lower"));
437 break;
438 case L_ADJUST:
439 case L_ADJUST_TRI:
440 matrix_write_P(matrix, PSTR("Adjust"));
441 break;
442 default:
443 matrix_write(matrix, buf);
444 }
445
446 // Host Keyboard LED Status
447 char led[40];
448 snprintf(led, sizeof(led), "\n%s %s %s",
449 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
450 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
451 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
452 matrix_write(matrix, led);
453}
454
455
456void iota_gfx_task_user(void) {
457 struct CharacterMatrix matrix;
458
459#if DEBUG_TO_SCREEN
460 if (debug_enable) {
461 return;
462 }
463#endif
464
465 matrix_clear(&matrix);
466 if(is_master){
467 render_status(&matrix);
468 }else{
469 render_logo(&matrix);
470 }
471 matrix_update(&display, &matrix);
472}
473
474#endif
diff --git a/keyboards/helix/pico/keymaps/default/readme.md b/keyboards/helix/pico/keymaps/default/readme.md
new file mode 100644
index 000000000..13948cf62
--- /dev/null
+++ b/keyboards/helix/pico/keymaps/default/readme.md
@@ -0,0 +1,128 @@
1# The Default HelixPico Layout
2## Layout
3
4### Qwerty
5```
6 ,-----------------------------------------. ,-----------------------------------------.
7 | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
8 |------+------+------+------+------+------| |------+------+------+------+------+------|
9 | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
10 |------+------+------+------+------+------| |------+------+------+------+------+------|
11 | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
12 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
13 |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
14 `-------------------------------------------------------------------------------------------------'
15```
16
17### Colemak
18```
19 ,-----------------------------------------. ,-----------------------------------------.
20 | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp |
21 |------+------+------+------+------+------| |------+------+------+------+------+------|
22 | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' |
23 |------+------+------+------+------+------| |------+------+------+------+------+------|
24 | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter |
25 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
26 |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
27 `-------------------------------------------------------------------------------------------------'
28```
29
30### Dvorak
31```
32 ,-----------------------------------------. ,-----------------------------------------.
33 | Tab | ' | , | . | P | Y | | F | G | C | R | L | Bksp |
34 |------+------+------+------+------+------| |------+------+------+------+------+------|
35 | Ctrl | A | O | E | U | I | | D | H | T | N | S | / |
36 |------+------+------+------+------+------| |------+------+------+------+------+------|
37 | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter |
38 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
39 |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
40 `-------------------------------------------------------------------------------------------------'
41```
42
43## Layers
44
45|Priority|number|name|description|
46| ---- | ---- | --- | --- |
47|high|16|Adjust|Functions|
48||4|Raise|Numeric charactors|
49||3|Lower|Other charactors|
50||2|Dvorak|Dvorak leyout|
51||1|Colemak|Colemak leyout|
52|low|0|Qwerty|QWERTY leyout(base)|
53
54### Lower
55```
56 ,-----------------------------------------. ,-----------------------------------------.
57 | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
58 |------+------+------+------+------+------| |------+------+------+------+------+------|
59 | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
60 |------+------+------+------+------+------| |------+------+------+------+------+------|
61 | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc | Home | End | |
62 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
63 | | | | | | | | | | | Next | Vol- | Vol+ | Play |
64 `-------------------------------------------------------------------------------------------------'
65```
66
67### Raise
68```
69 ,-----------------------------------------. ,-----------------------------------------.
70 | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
71 |------+------+------+------+------+------| |------+------+------+------+------+------|
72 | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
73 |------+------+------+------+------+------| |------+------+------+------+------+------|
74 | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc |PageDn|PageUp| |
75 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
76 | | | | | | | | | | | Next | Vol- | Vol+ | Play |
77 `-------------------------------------------------------------------------------------------------'
78```
79
80### Adjust (Lower + Raise)
81```
82 ,-----------------------------------------. ,-----------------------------------------.
83 | | Reset| | | | | | | | | | | |
84 |------+------+------+------+------+------| |------+------+------+------+------+------|
85 | |Aud on|Audoff|MU TOG|MU MOD| Mac | | Win |Qwerty|Colemk|Dvorak| | |
86 |------+------+------+------+------+------| |------+------+------+------+------+------|
87 | |CK TOG|CK RST| CK UP|CK DWN| | | | |RGB ON| HUE+ | SAT+ | VAL+ |
88 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
89 | | | | | | | | | | | MODE | HUE- | SAT- | VAL- |
90 `-------------------------------------------------------------------------------------------------'
91```
92
93## Customize
94
95see `qmk_firmware/keyboards/helix/pico/keymaps/default/rules.mk`
96
97```
98# Helix keyboard customize
99# you can edit follows 6 Variables
100# jp: 以下の6つの変数を必要に応じて編集します。
101OLED_ENABLE = no # OLED_ENABLE
102LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
103LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.)
104LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
105LED_ANIMATIONS = yes # LED animations
106IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
107
108```
109## Compile
110
111go to qmk top directory.
112```
113$ cd qmk_firmware
114```
115
116build
117```
118$ make helix/pico:default
119```
120
121flash to keyboard
122```
123$ make helix/pico:default:avrdude
124```
125
126## Link
127* more detail wrote in Japanese [helix/Doc/firmware_jp.md](https://github.com/MakotoKurauchi/helix/blob/master/Doc/firmware_jp.md)
128* [Helix top](https://github.com/MakotoKurauchi/helix)
diff --git a/keyboards/helix/pico/keymaps/default/readme_jp.md b/keyboards/helix/pico/keymaps/default/readme_jp.md
new file mode 100644
index 000000000..1e272f9e6
--- /dev/null
+++ b/keyboards/helix/pico/keymaps/default/readme_jp.md
@@ -0,0 +1,137 @@
1# The Default HelixPico Layout
2## 配列
3
4### Qwerty配列
5
6```
7 ,-----------------------------------------. ,-----------------------------------------.
8 | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
9 |------+------+------+------+------+------| |------+------+------+------+------+------|
10 | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
11 |------+------+------+------+------+------| |------+------+------+------+------+------|
12 | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
13 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
14 |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
15 `-------------------------------------------------------------------------------------------------'
16```
17
18### Lower
19```
20 ,-----------------------------------------. ,-----------------------------------------.
21 | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
22 |------+------+------+------+------+------| |------+------+------+------+------+------|
23 | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
24 |------+------+------+------+------+------| |------+------+------+------+------+------|
25 | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc | Home | End | |
26 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
27 | | | | | | | | | | | Next | Vol- | Vol+ | Play |
28 `-------------------------------------------------------------------------------------------------'
29```
30
31### Raise
32```
33 ,-----------------------------------------. ,-----------------------------------------.
34 | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
35 |------+------+------+------+------+------| |------+------+------+------+------+------|
36 | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
37 |------+------+------+------+------+------| |------+------+------+------+------+------|
38 | | F7 | F8 | F9 | F10 | F11 | | F12 | | PrSc |PageDn|PageUp| |
39 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
40 | | | | | | | | | | | Next | Vol- | Vol+ | Play |
41 `-------------------------------------------------------------------------------------------------'
42```
43
44### Adjust (Lower + Raise)
45```
46 ,-----------------------------------------. ,-----------------------------------------.
47 | | Reset| | | | | | | | | | | |
48 |------+------+------+------+------+------| |------+------+------+------+------+------|
49 | |Aud on|Audoff|MU TOG|MU MOD| Mac | | Win |Qwerty|Colemk|Dvorak| | |
50 |------+------+------+------+------+------| |------+------+------+------+------+------|
51 | |CK TOG|CK RST| CK UP|CK DWN| | | | |RGB ON| HUE+ | SAT+ | VAL+ |
52 |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
53 | | | | | | | | | | | MODE | HUE- | SAT- | VAL- |
54 `-------------------------------------------------------------------------------------------------'
55```
56
57他の配列(Colemak,Dvorak)は、[readme.md](readme.md) を参照
58
59## コンパイルの仕方
60
61コンパイルは、qmk_firmware のトップディレクトリで行います。
62
63```
64$ cd qmk_firmware
65```
66qmk_firmwareでは各キーボードのコンパイルは、`<キーボード名>:<キーマップ名>`という指定で行います。
67
68```
69$ make helix/pico:default
70```
71
72キーボードへの書き込みまで同時に行うには下記のように`:avrdude`を付けます。
73
74```
75$ make helix/pico:default:avrdude
76```
77
78コンパイル結果と中間生成物を消去したい場合は以下のようにします。
79
80```
81$ make helix/pico:default:clean
82```
83
84## カスタマイズ
85
86オプションの OLED をつけたり、
87RGB バックライトまたは、RGB Underglow をつけた場合は、
88`qmk_firmware/keyboards/helix/pico/keymaps/default/rules.mk` の以下の部分を編集して機能を有効化してください。
89
90```
91# Helix keyboard customize
92# you can edit follows 6 Variables
93# jp: 以下の6つの変数を必要に応じて編集します。
94OLED_ENABLE = no # OLED_ENABLE
95LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
96LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.)
97LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
98LED_ANIMATIONS = yes # LED animations
99IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
100
101```
102
103## RGB バックライトを有効にする
104
105rules.mk の下記の部分を編集して no を yes に変更してください。
106
107```
108LED_BACK_ENABLE = yes # LED backlight (Enable WS2812 RGB underlight.)
109```
110
111## RGB Underglow を有効にする
112
113rules.mk の下記の部分を編集して no を yes に変更してください。
114```
115LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.)
116```
117
118## OLEDを有効にする
119
120rules.mk の下記の部分を編集して no を yes に変更してください。
121```
122OLED_ENABLE = yes # OLED_ENABLE
123```
124
125## iPad/iPhoneサポートを有効にする。
126
127rules.mk の下記の部分を編集して no を yes に変更してください。
128RBG Underglow や RGBバックライトの輝度を抑えて、iPad, iPhone にも接続できるようになります。
129
130```
131IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
132```
133
134## リンク
135
136* さらに詳細は、[こちら helix/Doc/firmware_jp.md](https://github.com/MakotoKurauchi/helix/blob/master/Doc/firmware_jp.md)をご覧ください。
137* [Helix top](https://github.com/MakotoKurauchi/helix)
diff --git a/keyboards/helix/pico/keymaps/default/rules.mk b/keyboards/helix/pico/keymaps/default/rules.mk
new file mode 100644
index 000000000..18b1d596b
--- /dev/null
+++ b/keyboards/helix/pico/keymaps/default/rules.mk
@@ -0,0 +1,115 @@
1
2# Build Options
3# change to "no" to disable the options, or define them in the Makefile in
4# the appropriate keymap folder that will get included automatically
5#
6BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
7MOUSEKEY_ENABLE = no # Mouse keys(+4700)
8EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
9CONSOLE_ENABLE = no # Console for debug(+400)
10COMMAND_ENABLE = no # Commands for debug and configuration
11NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
13MIDI_ENABLE = no # MIDI controls
14AUDIO_ENABLE = yes # Audio output on port B5
15UNICODE_ENABLE = no # Unicode
16BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
17RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
18SWAP_HANDS_ENABLE = no # Enable one-hand typing
19
20define HELIX_CUSTOMISE_MSG
21 $(info Helix customize)
22 $(info - OLED_ENABLE=$(OLED_ENABLE))
23 $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE))
24 $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE))
25 $(info - LED_ANIMATION=$(LED_ANIMATIONS))
26 $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE))
27endef
28
29# Helix keyboard customize
30# you can edit follows 6 Variables
31# jp: 以下の6つの変数を必要に応じて編集します。
32OLED_ENABLE = no # OLED_ENABLE
33LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c"
34LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.)
35LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
36LED_ANIMATIONS = yes # LED animations
37IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
38
39#### LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE.
40#### Do not enable these with audio at the same time.
41
42### Helix keyboard 'default' keymap: convenient command line option
43## make HELIX=<options> helix:defualt
44## option= oled | back | under | na | ios
45## ex.
46## make HELIX=oled helix:defualt
47## make HELIX=oled,back helix:defualt
48## make HELIX=oled,under helix:defualt
49## make HELIX=oled,back,na helix:defualt
50## make HELIX=oled,back,ios helix:defualt
51##
52ifneq ($(strip $(HELIX)),)
53 ifeq ($(findstring oled,$(HELIX)), oled)
54 OLED_ENABLE = yes
55 endif
56 ifeq ($(findstring back,$(HELIX)), back)
57 LED_BACK_ENABLE = yes
58 else ifeq ($(findstring under,$(HELIX)), under)
59 LED_UNDERGLOW_ENABLE = yes
60 endif
61 ifeq ($(findstring na,$(HELIX)), na)
62 LED_ANIMATIONS = no
63 endif
64 ifeq ($(findstring ios,$(HELIX)), ios)
65 IOS_DEVICE_ENABLE = yes
66 endif
67 $(eval $(call HELIX_CUSTOMISE_MSG))
68 $(info )
69endif
70
71# Uncomment these for checking
72# jp: コンパイル時にカスタマイズの状態を表示したい時はコメントをはずします。
73# $(eval $(call HELIX_CUSTOMISE_MSG))
74# $(info )
75
76ifeq ($(strip $(LED_BACK_ENABLE)), yes)
77 RGBLIGHT_ENABLE = yes
78 OPT_DEFS += -DRGBLED_BACK
79 ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
80 $(eval $(call HELIX_CUSTOMISE_MSG))
81 $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes')
82 endif
83else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes)
84 RGBLIGHT_ENABLE = yes
85else
86 RGBLIGHT_ENABLE = no
87endif
88
89ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes)
90 OPT_DEFS += -DIOS_DEVICE_ENABLE
91endif
92
93ifeq ($(strip $(LED_ANIMATIONS)), yes)
94 OPT_DEFS += -DRGBLIGHT_ANIMATIONS
95endif
96
97ifeq ($(strip $(OLED_ENABLE)), yes)
98 OPT_DEFS += -DOLED_ENABLE
99endif
100
101ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
102 OPT_DEFS += -DLOCAL_GLCDFONT
103endif
104
105# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
106SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
107
108ifndef QUANTUM_DIR
109 include ../../../../Makefile
110endif
111
112# Uncomment these for debugging
113# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE))
114# $(info -- OPT_DEFS=$(OPT_DEFS))
115# $(info )
diff --git a/keyboards/helix/pico/matrix.c b/keyboards/helix/pico/matrix.c
new file mode 100644
index 000000000..aba55da7c
--- /dev/null
+++ b/keyboards/helix/pico/matrix.c
@@ -0,0 +1,351 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include <avr/wdt.h>
25#include <avr/interrupt.h>
26#include <util/delay.h>
27#include "print.h"
28#include "debug.h"
29#include "util.h"
30#include "matrix.h"
31#include "split_util.h"
32#include "pro_micro.h"
33
34#ifdef USE_MATRIX_I2C
35# include "i2c.h"
36#else // USE_SERIAL
37# include "serial.h"
38#endif
39
40#ifndef DEBOUNCE
41# define DEBOUNCE 5
42#endif
43
44#define ERROR_DISCONNECT_COUNT 5
45
46static uint8_t debouncing = DEBOUNCE;
47static const int ROWS_PER_HAND = MATRIX_ROWS/2;
48static uint8_t error_count = 0;
49uint8_t is_master = 0 ;
50
51static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
52static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
53
54/* matrix state(1:on, 0:off) */
55static matrix_row_t matrix[MATRIX_ROWS];
56static matrix_row_t matrix_debouncing[MATRIX_ROWS];
57
58static matrix_row_t read_cols(void);
59static void init_cols(void);
60static void unselect_rows(void);
61static void select_row(uint8_t row);
62static uint8_t matrix_master_scan(void);
63
64
65__attribute__ ((weak))
66void matrix_init_kb(void) {
67 matrix_init_user();
68}
69
70__attribute__ ((weak))
71void matrix_scan_kb(void) {
72 matrix_scan_user();
73}
74
75__attribute__ ((weak))
76void matrix_init_user(void) {
77}
78
79__attribute__ ((weak))
80void matrix_scan_user(void) {
81}
82
83inline
84uint8_t matrix_rows(void)
85{
86 return MATRIX_ROWS;
87}
88
89inline
90uint8_t matrix_cols(void)
91{
92 return MATRIX_COLS;
93}
94
95void matrix_init(void)
96{
97 debug_enable = true;
98 debug_matrix = true;
99 debug_mouse = true;
100 // initialize row and col
101 unselect_rows();
102 init_cols();
103
104 TX_RX_LED_INIT;
105 TXLED0;
106 RXLED0;
107
108 // initialize matrix state: all keys off
109 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
110 matrix[i] = 0;
111 matrix_debouncing[i] = 0;
112 }
113
114 is_master = has_usb();
115
116 matrix_init_quantum();
117}
118
119uint8_t _matrix_scan(void)
120{
121 // Right hand is stored after the left in the matirx so, we need to offset it
122 int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
123
124 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
125 select_row(i);
126 _delay_us(30); // without this wait read unstable value.
127 matrix_row_t cols = read_cols();
128 if (matrix_debouncing[i+offset] != cols) {
129 matrix_debouncing[i+offset] = cols;
130 debouncing = DEBOUNCE;
131 }
132 unselect_rows();
133 }
134
135 if (debouncing) {
136 if (--debouncing) {
137 _delay_ms(1);
138 } else {
139 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
140 matrix[i+offset] = matrix_debouncing[i+offset];
141 }
142 }
143 }
144
145 return 1;
146}
147
148#ifdef USE_MATRIX_I2C
149
150// Get rows from other half over i2c
151int i2c_transaction(void) {
152 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
153
154 int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
155 if (err) goto i2c_error;
156
157 // start of matrix stored at 0x00
158 err = i2c_master_write(0x00);
159 if (err) goto i2c_error;
160
161 // Start read
162 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
163 if (err) goto i2c_error;
164
165 if (!err) {
166 int i;
167 for (i = 0; i < ROWS_PER_HAND-1; ++i) {
168 matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
169 }
170 matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
171 i2c_master_stop();
172 } else {
173i2c_error: // the cable is disconnceted, or something else went wrong
174 i2c_reset_state();
175 return err;
176 }
177
178 return 0;
179}
180
181#else // USE_SERIAL
182
183int serial_transaction(void) {
184 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
185 int ret=serial_update_buffers();
186 if (ret ) {
187 if(ret==2)RXLED1;
188 return 1;
189 }
190 RXLED0;
191 for (int i = 0; i < ROWS_PER_HAND; ++i) {
192 matrix[slaveOffset+i] = serial_slave_buffer[i];
193 }
194 return 0;
195}
196#endif
197
198uint8_t matrix_scan(void)
199{
200 if (is_master) {
201 matrix_master_scan();
202 }else{
203 matrix_slave_scan();
204
205// if(serial_slave_DATA_CORRUPT()){
206// TXLED0;
207 int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
208
209 for (int i = 0; i < ROWS_PER_HAND; ++i) {
210 matrix[offset+i] = serial_master_buffer[i];
211 }
212
213// }else{
214// TXLED1;
215// }
216
217 matrix_scan_quantum();
218 }
219 return 1;
220}
221
222
223uint8_t matrix_master_scan(void) {
224
225 int ret = _matrix_scan();
226
227#ifndef KEYBOARD_helix_rev1
228 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
229
230#ifdef USE_MATRIX_I2C
231// for (int i = 0; i < ROWS_PER_HAND; ++i) {
232 /* i2c_slave_buffer[i] = matrix[offset+i]; */
233// i2c_slave_buffer[i] = matrix[offset+i];
234// }
235#else // USE_SERIAL
236 for (int i = 0; i < ROWS_PER_HAND; ++i) {
237 serial_master_buffer[i] = matrix[offset+i];
238 }
239#endif
240#endif
241
242#ifdef USE_MATRIX_I2C
243 if( i2c_transaction() ) {
244#else // USE_SERIAL
245 if( serial_transaction() ) {
246#endif
247 // turn on the indicator led when halves are disconnected
248 TXLED1;
249
250 error_count++;
251
252 if (error_count > ERROR_DISCONNECT_COUNT) {
253 // reset other half if disconnected
254 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
255 for (int i = 0; i < ROWS_PER_HAND; ++i) {
256 matrix[slaveOffset+i] = 0;
257 }
258 }
259 } else {
260 // turn off the indicator led on no error
261 TXLED0;
262 error_count = 0;
263 }
264 matrix_scan_quantum();
265 return ret;
266}
267
268void matrix_slave_scan(void) {
269 _matrix_scan();
270
271 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
272
273#ifdef USE_MATRIX_I2C
274 for (int i = 0; i < ROWS_PER_HAND; ++i) {
275 /* i2c_slave_buffer[i] = matrix[offset+i]; */
276 i2c_slave_buffer[i] = matrix[offset+i];
277 }
278#else // USE_SERIAL
279 for (int i = 0; i < ROWS_PER_HAND; ++i) {
280 serial_slave_buffer[i] = matrix[offset+i];
281 }
282#endif
283}
284
285bool matrix_is_modified(void)
286{
287 if (debouncing) return false;
288 return true;
289}
290
291inline
292bool matrix_is_on(uint8_t row, uint8_t col)
293{
294 return (matrix[row] & ((matrix_row_t)1<<col));
295}
296
297inline
298matrix_row_t matrix_get_row(uint8_t row)
299{
300 return matrix[row];
301}
302
303void matrix_print(void)
304{
305 print("\nr/c 0123456789ABCDEF\n");
306 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
307 phex(row); print(": ");
308 pbin_reverse16(matrix_get_row(row));
309 print("\n");
310 }
311}
312
313uint8_t matrix_key_count(void)
314{
315 uint8_t count = 0;
316 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
317 count += bitpop16(matrix[i]);
318 }
319 return count;
320}
321
322static void init_cols(void)
323{
324 for(int x = 0; x < MATRIX_COLS; x++) {
325 _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
326 _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
327 }
328}
329
330static matrix_row_t read_cols(void)
331{
332 matrix_row_t result = 0;
333 for(int x = 0; x < MATRIX_COLS; x++) {
334 result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
335 }
336 return result;
337}
338
339static void unselect_rows(void)
340{
341 for(int x = 0; x < ROWS_PER_HAND; x++) {
342 _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
343 _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
344 }
345}
346
347static void select_row(uint8_t row)
348{
349 _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
350 _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
351}
diff --git a/keyboards/helix/pico/pico.c b/keyboards/helix/pico/pico.c
new file mode 100644
index 000000000..5e248ccff
--- /dev/null
+++ b/keyboards/helix/pico/pico.c
@@ -0,0 +1,14 @@
1#include "helix.h"
2
3
4#ifdef SSD1306OLED
5void led_set_kb(uint8_t usb_led) {
6 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
7 //led_set_user(usb_led);
8}
9#endif
10
11void matrix_init_kb(void) {
12
13 matrix_init_user();
14};
diff --git a/keyboards/helix/pico/pico.h b/keyboards/helix/pico/pico.h
new file mode 100644
index 000000000..a3d658daa
--- /dev/null
+++ b/keyboards/helix/pico/pico.h
@@ -0,0 +1,65 @@
1#ifndef PICO_H
2#define PICO_CONFIG_H
3
4#include "../helix.h"
5
6//void promicro_bootloader_jmp(bool program);
7#include "quantum.h"
8
9#ifdef RGBLIGHT_ENABLE
10//rgb led driver
11#include "ws2812.h"
12#endif
13
14#ifdef USE_I2C
15#include <stddef.h>
16#ifdef __AVR__
17 #include <avr/io.h>
18 #include <avr/interrupt.h>
19#endif
20#endif
21
22//void promicro_bootloader_jmp(bool program);
23
24
25#ifndef FLIP_HALF
26// Standard Keymap
27// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
28#define LAYOUT( \
29 L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
30 L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
31 L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
32 L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \
33 ) \
34 { \
35 { L00, L01, L02, L03, L04, L05, KC_NO }, \
36 { L10, L11, L12, L13, L14, L15, KC_NO }, \
37 { L20, L21, L22, L23, L24, L25, KC_NO }, \
38 { L30, L31, L32, L33, L34, L35, L36 }, \
39 { R05, R04, R03, R02, R01, R00, KC_NO }, \
40 { R15, R14, R13, R12, R11, R10, KC_NO }, \
41 { R25, R24, R23, R22, R21, R20, KC_NO }, \
42 { R35, R34, R33, R32, R31, R30, R36 }, \
43 }
44#else
45// Keymap with right side flipped
46// (TRRS jack on both halves are to the right)
47#define LAYOUT( \
48 L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
49 L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
50 L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
51 L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35 \
52 ) \
53 { \
54 { L00, L01, L02, L03, L04, L05, KC_NO }, \
55 { L10, L11, L12, L13, L14, L15, KC_NO }, \
56 { L20, L21, L22, L23, L24, L25, KC_NO }, \
57 { L30, L31, L32, L33, L34, L35, L36 }, \
58 { KC_NO, R00, R01, R02, R03, R04, R05 }, \
59 { KC_NO, R10, R11, R12, R13, R14, R15 }, \
60 { KC_NO, R20, R21, R22, R23, R24, R25 }, \
61 { R36, R30, R31, R32, R33, R34, R35 }, \
62 }
63#endif
64
65#endif
diff --git a/keyboards/helix/pico/rules.mk b/keyboards/helix/pico/rules.mk
new file mode 100644
index 000000000..c994ac8de
--- /dev/null
+++ b/keyboards/helix/pico/rules.mk
@@ -0,0 +1,3 @@
1SRC += pico/matrix.c \
2 pico/split_util.c \
3 ws2812.c
diff --git a/keyboards/helix/pico/serial_config.h b/keyboards/helix/pico/serial_config.h
new file mode 100644
index 000000000..82c6e4e83
--- /dev/null
+++ b/keyboards/helix/pico/serial_config.h
@@ -0,0 +1,16 @@
1#ifndef SOFT_SERIAL_CONFIG_H
2#define SOFT_SERIAL_CONFIG_H
3
4/* Soft Serial defines */
5#define SERIAL_PIN_DDR DDRD
6#define SERIAL_PIN_PORT PORTD
7#define SERIAL_PIN_INPUT PIND
8#define SERIAL_PIN_MASK _BV(PD2)
9#define SERIAL_PIN_INTERRUPT INT2_vect
10
11#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
12#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
13
14//// #error rev2 serial config
15
16#endif /* SOFT_SERIAL_CONFIG_H */
diff --git a/keyboards/helix/pico/split_util.c b/keyboards/helix/pico/split_util.c
new file mode 100644
index 000000000..beb39fa00
--- /dev/null
+++ b/keyboards/helix/pico/split_util.c
@@ -0,0 +1,70 @@
1#include <avr/io.h>
2#include <avr/wdt.h>
3#include <avr/power.h>
4#include <avr/interrupt.h>
5#include <util/delay.h>
6#include <avr/eeprom.h>
7#include "split_util.h"
8#include "matrix.h"
9#include "keyboard.h"
10
11#ifdef USE_MATRIX_I2C
12# include "i2c.h"
13#else
14# include "serial.h"
15#endif
16
17volatile bool isLeftHand = true;
18
19static void setup_handedness(void) {
20 #ifdef EE_HANDS
21 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
22 #else
23 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
24 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
25 isLeftHand = !has_usb();
26 #else
27 isLeftHand = has_usb();
28 #endif
29 #endif
30}
31
32static void keyboard_master_setup(void) {
33
34#ifdef USE_MATRIX_I2C
35 i2c_master_init();
36#else
37 serial_master_init();
38#endif
39}
40
41static void keyboard_slave_setup(void) {
42
43#ifdef USE_MATRIX_I2C
44 i2c_slave_init(SLAVE_I2C_ADDRESS);
45#else
46 serial_slave_init();
47#endif
48}
49
50bool 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
56void split_keyboard_setup(void) {
57 setup_handedness();
58
59 if (has_usb()) {
60 keyboard_master_setup();
61 } else {
62 keyboard_slave_setup();
63 }
64 sei();
65}
66
67// this code runs before the usb and keyboard is initialized
68void matrix_setup(void) {
69 split_keyboard_setup();
70}
diff --git a/keyboards/helix/pico/split_util.h b/keyboards/helix/pico/split_util.h
new file mode 100644
index 000000000..687ca19bd
--- /dev/null
+++ b/keyboards/helix/pico/split_util.h
@@ -0,0 +1,19 @@
1#ifndef SPLIT_KEYBOARD_UTIL_H
2#define SPLIT_KEYBOARD_UTIL_H
3
4#include <stdbool.h>
5#include "eeconfig.h"
6
7#define SLAVE_I2C_ADDRESS 0x32
8
9extern volatile bool isLeftHand;
10
11// slave version of matix scan, defined in matrix.c
12void matrix_slave_scan(void);
13
14void split_keyboard_setup(void);
15bool has_usb(void);
16
17void matrix_master_OLED_init (void);
18
19#endif