diff options
Diffstat (limited to 'keyboards/helix')
| -rw-r--r-- | keyboards/helix/pico/config.h | 10 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/biacco/keymap.c | 35 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/biacco/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/default/keymap.c | 135 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/default/readme.md | 6 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/default/readme_jp.md | 14 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/default/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/mtei/keymap.c | 163 | ||||
| -rw-r--r-- | keyboards/helix/pico/keymaps/mtei/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/helix/pico/matrix.c | 342 | ||||
| -rw-r--r-- | keyboards/helix/pico/override_helix_options.mk-maintenance | 42 | ||||
| -rw-r--r-- | keyboards/helix/pico/pico.c | 29 | ||||
| -rw-r--r-- | keyboards/helix/pico/pico.h | 20 | ||||
| -rw-r--r-- | keyboards/helix/pico/post_rules.mk | 138 | ||||
| -rw-r--r-- | keyboards/helix/pico/qmk_conf/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/helix/pico/rules.mk | 4 | ||||
| -rw-r--r-- | keyboards/helix/pico/split_util.c | 104 | ||||
| -rw-r--r-- | keyboards/helix/pico/split_util.h | 16 |
18 files changed, 165 insertions, 913 deletions
diff --git a/keyboards/helix/pico/config.h b/keyboards/helix/pico/config.h index b01fd3a00..ea2ce8c94 100644 --- a/keyboards/helix/pico/config.h +++ b/keyboards/helix/pico/config.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> |
| 3 | Copyright 2015 Jack Humbert | 3 | Copyright 2015 Jack Humbert |
| 4 | Copyright 2018 MakotoKurauchi | ||
| 4 | 5 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
| @@ -42,12 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 42 | // #define MASTER_RIGHT | 43 | // #define MASTER_RIGHT |
| 43 | // #define EE_HANDS | 44 | // #define EE_HANDS |
| 44 | 45 | ||
| 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 */ | 46 | /* key matrix size */ |
| 52 | // Rows are doubled-up | 47 | // Rows are doubled-up |
| 53 | #define MATRIX_ROWS 8 | 48 | #define MATRIX_ROWS 8 |
| @@ -114,8 +109,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 114 | 109 | ||
| 115 | #if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) | 110 | #if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) |
| 116 | // USB_MAX_POWER_CONSUMPTION value for Helix keyboard | 111 | // USB_MAX_POWER_CONSUMPTION value for Helix keyboard |
| 117 | // 120 RGBoff, OLEDoff | 112 | // 120 RGBoff |
| 118 | // 120 OLED | ||
| 119 | // 330 RGB 6 | 113 | // 330 RGB 6 |
| 120 | // 300 RGB 32 | 114 | // 300 RGB 32 |
| 121 | // 310 OLED & RGB 32 | 115 | // 310 OLED & RGB 32 |
diff --git a/keyboards/helix/pico/keymaps/biacco/keymap.c b/keyboards/helix/pico/keymaps/biacco/keymap.c index a1d041c02..aa196c7e6 100644 --- a/keyboards/helix/pico/keymaps/biacco/keymap.c +++ b/keyboards/helix/pico/keymaps/biacco/keymap.c | |||
| @@ -1,24 +1,19 @@ | |||
| 1 | /* Copyright 2018 Biacco42 | ||
| 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 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #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 | |||
| 14 | extern keymap_config_t keymap_config; | ||
| 15 | |||
| 16 | #ifdef RGBLIGHT_ENABLE | ||
| 17 | //Following line allows macro to read current RGB settings | ||
| 18 | extern rgblight_config_t rgblight_config; | ||
| 19 | #endif | ||
| 20 | |||
| 21 | extern uint8_t is_master; | ||
| 22 | 17 | ||
| 23 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 18 | // 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. | 19 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
diff --git a/keyboards/helix/pico/keymaps/biacco/rules.mk b/keyboards/helix/pico/keymaps/biacco/rules.mk index 993ade267..d97135946 100644 --- a/keyboards/helix/pico/keymaps/biacco/rules.mk +++ b/keyboards/helix/pico/keymaps/biacco/rules.mk | |||
| @@ -10,10 +10,8 @@ AUDIO_ENABLE = yes # Audio output on port B5 | |||
| 10 | LTO_ENABLE = no # if firmware size over limit, try this option | 10 | LTO_ENABLE = no # if firmware size over limit, try this option |
| 11 | 11 | ||
| 12 | # Helix Spacific Build Options | 12 | # Helix Spacific Build Options |
| 13 | # you can uncomment and edit follows 6 Variables | 13 | # you can uncomment and edit follows 4 Variables |
| 14 | # jp: 以下の6つの変数を必要に応じて編集し、コメントアウトをはずします。 | 14 | # jp: 以下の4つの変数を必要に応じて編集し、コメントアウトをはずします。 |
| 15 | # OLED_ENABLE = no # OLED_ENABLE | ||
| 16 | # LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 17 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 15 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 18 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 16 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 19 | LED_ANIMATIONS = no # LED animations | 17 | LED_ANIMATIONS = no # LED animations |
diff --git a/keyboards/helix/pico/keymaps/default/keymap.c b/keyboards/helix/pico/keymaps/default/keymap.c index f23ab8576..11ee30258 100644 --- a/keyboards/helix/pico/keymaps/default/keymap.c +++ b/keyboards/helix/pico/keymaps/default/keymap.c | |||
| @@ -1,24 +1,25 @@ | |||
| 1 | /* Copyright 2018 MakotoKurauchi | ||
| 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 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #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 | |||
| 14 | 17 | ||
| 15 | #ifdef RGBLIGHT_ENABLE | 18 | #ifdef RGBLIGHT_ENABLE |
| 16 | //Following line allows macro to read current RGB settings | 19 | //Following line allows macro to read current RGB settings |
| 17 | extern rgblight_config_t rgblight_config; | 20 | extern rgblight_config_t rgblight_config; |
| 18 | #endif | 21 | #endif |
| 19 | 22 | ||
| 20 | extern uint8_t is_master; | ||
| 21 | |||
| 22 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 23 | // 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. | 24 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
| 24 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 25 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
| @@ -334,10 +335,6 @@ void matrix_init_user(void) { | |||
| 334 | #ifdef RGBLIGHT_ENABLE | 335 | #ifdef RGBLIGHT_ENABLE |
| 335 | RGB_current_mode = rgblight_config.mode; | 336 | RGB_current_mode = rgblight_config.mode; |
| 336 | #endif | 337 | #endif |
| 337 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
| 338 | #ifdef SSD1306OLED | ||
| 339 | iota_gfx_init(!has_usb()); // turns on the display | ||
| 340 | #endif | ||
| 341 | } | 338 | } |
| 342 | 339 | ||
| 343 | 340 | ||
| @@ -365,105 +362,3 @@ void music_scale_user(void) | |||
| 365 | } | 362 | } |
| 366 | 363 | ||
| 367 | #endif | 364 | #endif |
| 368 | |||
| 369 | |||
| 370 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 371 | #ifdef SSD1306OLED | ||
| 372 | |||
| 373 | void matrix_scan_user(void) { | ||
| 374 | iota_gfx_task(); // this is what updates the display continuously | ||
| 375 | } | ||
| 376 | |||
| 377 | void matrix_update(struct CharacterMatrix *dest, | ||
| 378 | const struct CharacterMatrix *source) { | ||
| 379 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 380 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 381 | dest->dirty = true; | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 385 | //assign the right code to your layers for OLED display | ||
| 386 | #define L_BASE 0 | ||
| 387 | #define L_LOWER (1<<_LOWER) | ||
| 388 | #define L_RAISE (1<<_RAISE) | ||
| 389 | #define L_ADJUST (1<<_ADJUST) | ||
| 390 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | ||
| 391 | |||
| 392 | static void render_logo(struct CharacterMatrix *matrix) { | ||
| 393 | |||
| 394 | static char logo[]={ | ||
| 395 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | ||
| 396 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | ||
| 397 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, | ||
| 398 | 0}; | ||
| 399 | matrix_write(matrix, logo); | ||
| 400 | //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); | ||
| 401 | } | ||
| 402 | |||
| 403 | |||
| 404 | |||
| 405 | void render_status(struct CharacterMatrix *matrix) { | ||
| 406 | |||
| 407 | // Render to mode icon | ||
| 408 | static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; | ||
| 409 | if(keymap_config.swap_lalt_lgui==false){ | ||
| 410 | matrix_write(matrix, logo[0][0]); | ||
| 411 | matrix_write_P(matrix, PSTR("\n")); | ||
| 412 | matrix_write(matrix, logo[0][1]); | ||
| 413 | }else{ | ||
| 414 | matrix_write(matrix, logo[1][0]); | ||
| 415 | matrix_write_P(matrix, PSTR("\n")); | ||
| 416 | matrix_write(matrix, logo[1][1]); | ||
| 417 | } | ||
| 418 | |||
| 419 | // 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 | ||
| 420 | char buf[40]; | ||
| 421 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 422 | matrix_write_P(matrix, PSTR("\nLayer: ")); | ||
| 423 | switch (layer_state) { | ||
| 424 | case L_BASE: | ||
| 425 | matrix_write_P(matrix, PSTR("Default")); | ||
| 426 | break; | ||
| 427 | case L_RAISE: | ||
| 428 | matrix_write_P(matrix, PSTR("Raise")); | ||
| 429 | break; | ||
| 430 | case L_LOWER: | ||
| 431 | matrix_write_P(matrix, PSTR("Lower")); | ||
| 432 | break; | ||
| 433 | case L_ADJUST: | ||
| 434 | case L_ADJUST_TRI: | ||
| 435 | matrix_write_P(matrix, PSTR("Adjust")); | ||
| 436 | break; | ||
| 437 | default: | ||
| 438 | matrix_write(matrix, buf); | ||
| 439 | } | ||
| 440 | |||
| 441 | // Host Keyboard LED Status | ||
| 442 | char led[40]; | ||
| 443 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 444 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 445 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 446 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 447 | matrix_write(matrix, led); | ||
| 448 | } | ||
| 449 | |||
| 450 | |||
| 451 | void iota_gfx_task_user(void) { | ||
| 452 | struct CharacterMatrix matrix; | ||
| 453 | |||
| 454 | #if DEBUG_TO_SCREEN | ||
| 455 | if (debug_enable) { | ||
| 456 | return; | ||
| 457 | } | ||
| 458 | #endif | ||
| 459 | |||
| 460 | matrix_clear(&matrix); | ||
| 461 | if(is_master){ | ||
| 462 | render_status(&matrix); | ||
| 463 | }else{ | ||
| 464 | render_logo(&matrix); | ||
| 465 | } | ||
| 466 | matrix_update(&display, &matrix); | ||
| 467 | } | ||
| 468 | |||
| 469 | #endif | ||
diff --git a/keyboards/helix/pico/keymaps/default/readme.md b/keyboards/helix/pico/keymaps/default/readme.md index 789097021..a6c81651a 100644 --- a/keyboards/helix/pico/keymaps/default/readme.md +++ b/keyboards/helix/pico/keymaps/default/readme.md | |||
| @@ -96,10 +96,8 @@ see `qmk_firmware/keyboards/helix/pico/keymaps/default/rules.mk` | |||
| 96 | 96 | ||
| 97 | ``` | 97 | ``` |
| 98 | # Helix Spacific Build Options | 98 | # Helix Spacific Build Options |
| 99 | # you can uncomment and edit follows 6 Variables | 99 | # you can uncomment and edit follows 4 Variables |
| 100 | # jp: 以下の6つの変数を必要に応じて編集し、コメントアウトをはずします。 | 100 | # jp: 以下の4つの変数を必要に応じて編集し、コメントアウトをはずします。 |
| 101 | # OLED_ENABLE = no # OLED_ENABLE | ||
| 102 | # LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 103 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 101 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 104 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 102 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 105 | # LED_ANIMATIONS = yes # LED animations | 103 | # LED_ANIMATIONS = yes # LED animations |
diff --git a/keyboards/helix/pico/keymaps/default/readme_jp.md b/keyboards/helix/pico/keymaps/default/readme_jp.md index 28594dafc..73f97ad9a 100644 --- a/keyboards/helix/pico/keymaps/default/readme_jp.md +++ b/keyboards/helix/pico/keymaps/default/readme_jp.md | |||
| @@ -58,16 +58,13 @@ | |||
| 58 | 58 | ||
| 59 | ## カスタマイズ | 59 | ## カスタマイズ |
| 60 | 60 | ||
| 61 | オプションの OLED をつけたり、 | ||
| 62 | RGB バックライトまたは、RGB Underglow をつけた場合は、 | 61 | RGB バックライトまたは、RGB Underglow をつけた場合は、 |
| 63 | `qmk_firmware/keyboards/helix/pico/keymaps/default/rules.mk` の以下の部分を編集して機能を有効化してください。 | 62 | `qmk_firmware/keyboards/helix/pico/keymaps/default/rules.mk` の以下の部分を編集して機能を有効化してください。 |
| 64 | 63 | ||
| 65 | ``` | 64 | ``` |
| 66 | # Helix Spacific Build Options | 65 | # Helix Spacific Build Options |
| 67 | # you can uncomment and edit follows 6 Variables | 66 | # you can uncomment and edit follows 4 Variables |
| 68 | # jp: 以下の6つの変数を必要に応じて編集し、コメントアウトをはずします。 | 67 | # jp: 以下の4つの変数を必要に応じて編集し、コメントアウトをはずします。 |
| 69 | # OLED_ENABLE = no # OLED_ENABLE | ||
| 70 | # LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 71 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 68 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 72 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 69 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 73 | # LED_ANIMATIONS = yes # LED animations | 70 | # LED_ANIMATIONS = yes # LED animations |
| @@ -89,13 +86,6 @@ rules.mk の下記の部分を編集して no を yes に変更してくださ | |||
| 89 | LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) | 86 | LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) |
| 90 | ``` | 87 | ``` |
| 91 | 88 | ||
| 92 | ## OLEDを有効にする | ||
| 93 | |||
| 94 | rules.mk の下記の部分を編集して no を yes に変更してください。 | ||
| 95 | ``` | ||
| 96 | OLED_ENABLE = yes # OLED_ENABLE | ||
| 97 | ``` | ||
| 98 | |||
| 99 | ## iPad/iPhoneサポートを有効にする。 | 89 | ## iPad/iPhoneサポートを有効にする。 |
| 100 | 90 | ||
| 101 | rules.mk の下記の部分を編集して no を yes に変更してください。 | 91 | rules.mk の下記の部分を編集して no を yes に変更してください。 |
diff --git a/keyboards/helix/pico/keymaps/default/rules.mk b/keyboards/helix/pico/keymaps/default/rules.mk index b50519fef..9a29406c1 100644 --- a/keyboards/helix/pico/keymaps/default/rules.mk +++ b/keyboards/helix/pico/keymaps/default/rules.mk | |||
| @@ -3,10 +3,8 @@ AUDIO_ENABLE = yes # Audio output | |||
| 3 | LTO_ENABLE = no # if firmware size over limit, try this option | 3 | LTO_ENABLE = no # if firmware size over limit, try this option |
| 4 | 4 | ||
| 5 | # Helix Spacific Build Options | 5 | # Helix Spacific Build Options |
| 6 | # you can uncomment and edit follows 6 Variables | 6 | # you can uncomment and edit follows 4 Variables |
| 7 | # jp: 以下の6つの変数を必要に応じて編集し、コメントアウトをはずします。 | 7 | # jp: 以下の4つの変数を必要に応じて編集し、コメントアウトをはずします。 |
| 8 | # OLED_ENABLE = no # OLED_ENABLE | ||
| 9 | # LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 10 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 8 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 11 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 9 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 12 | # LED_ANIMATIONS = yes # LED animations | 10 | # LED_ANIMATIONS = yes # LED animations |
diff --git a/keyboards/helix/pico/keymaps/mtei/keymap.c b/keyboards/helix/pico/keymaps/mtei/keymap.c index 728ef0eb5..58684be49 100644 --- a/keyboards/helix/pico/keymaps/mtei/keymap.c +++ b/keyboards/helix/pico/keymaps/mtei/keymap.c | |||
| @@ -1,31 +1,23 @@ | |||
| 1 | /* Copyright 2018 mtei | ||
| 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 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #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 | #ifdef CONSOLE_ENABLE | ||
| 14 | #include <print.h> | ||
| 15 | #endif | ||
| 16 | 17 | ||
| 17 | #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) | 18 | #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) |
| 18 | #define kc5(a,b,c,d,e) KC_##a, KC_##b, KC_##c, KC_##d, KC_##e | 19 | #define kc5(a,b,c,d,e) KC_##a, KC_##b, KC_##c, KC_##d, KC_##e |
| 19 | 20 | ||
| 20 | extern keymap_config_t keymap_config; | ||
| 21 | |||
| 22 | #ifdef RGBLIGHT_ENABLE | ||
| 23 | //Following line allows macro to read current RGB settings | ||
| 24 | extern rgblight_config_t rgblight_config; | ||
| 25 | #endif | ||
| 26 | |||
| 27 | extern uint8_t is_master; | ||
| 28 | |||
| 29 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 21 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
| 30 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 22 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
| 31 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 23 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
| @@ -373,10 +365,6 @@ void matrix_init_user(void) { | |||
| 373 | #ifdef AUDIO_ENABLE | 365 | #ifdef AUDIO_ENABLE |
| 374 | startup_user(); | 366 | startup_user(); |
| 375 | #endif | 367 | #endif |
| 376 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
| 377 | #ifdef SSD1306OLED | ||
| 378 | iota_gfx_init(!has_usb()); // turns on the display | ||
| 379 | #endif | ||
| 380 | } | 368 | } |
| 381 | 369 | ||
| 382 | 370 | ||
| @@ -404,124 +392,3 @@ void music_scale_user(void) | |||
| 404 | } | 392 | } |
| 405 | 393 | ||
| 406 | #endif | 394 | #endif |
| 407 | |||
| 408 | |||
| 409 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 410 | #ifdef SSD1306OLED | ||
| 411 | |||
| 412 | void matrix_scan_user(void) { | ||
| 413 | iota_gfx_task(); // this is what updates the display continuously | ||
| 414 | } | ||
| 415 | |||
| 416 | void matrix_update(struct CharacterMatrix *dest, | ||
| 417 | const struct CharacterMatrix *source) { | ||
| 418 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 419 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 420 | dest->dirty = true; | ||
| 421 | } | ||
| 422 | } | ||
| 423 | |||
| 424 | static void render_logo(struct CharacterMatrix *matrix) { | ||
| 425 | |||
| 426 | static char logo[]={ | ||
| 427 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | ||
| 428 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | ||
| 429 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, | ||
| 430 | 0}; | ||
| 431 | matrix_write(matrix, logo); | ||
| 432 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_ANIMATIONS) | ||
| 433 | char buf[30]; | ||
| 434 | if(rgblight_config.enable) { | ||
| 435 | snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ", | ||
| 436 | rgblight_config.mode, | ||
| 437 | rgblight_config.hue/RGBLIGHT_HUE_STEP, | ||
| 438 | rgblight_config.sat/RGBLIGHT_SAT_STEP, | ||
| 439 | rgblight_config.val/RGBLIGHT_VAL_STEP); | ||
| 440 | matrix_write(matrix, buf); | ||
| 441 | } | ||
| 442 | #endif | ||
| 443 | //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); | ||
| 444 | } | ||
| 445 | |||
| 446 | static const char Qwerty_name[] PROGMEM = " Qwerty"; | ||
| 447 | static const char Colemak_name[] PROGMEM = " Colemak"; | ||
| 448 | static const char Dvorak_name[] PROGMEM = " Dvorak"; | ||
| 449 | static const char Eucalyn_name[] PROGMEM = " Eucalyn"; | ||
| 450 | |||
| 451 | static const char NumL_name[] PROGMEM = ":NumL"; | ||
| 452 | static const char NumR_name[] PROGMEM = ":NumR"; | ||
| 453 | static const char Lower_name[] PROGMEM = ":Func"; | ||
| 454 | static const char Raise_name[] PROGMEM = ":Extra"; | ||
| 455 | static const char Adjust_name[] PROGMEM = ":Adjust"; | ||
| 456 | |||
| 457 | static const char *layer_names[] = { | ||
| 458 | [_QWERTY] = Qwerty_name, | ||
| 459 | [_COLEMAK] = Colemak_name, | ||
| 460 | [_DVORAK] = Dvorak_name, | ||
| 461 | [_EUCALYN] = Eucalyn_name, | ||
| 462 | |||
| 463 | [_NUML] = NumL_name, | ||
| 464 | [_NUMR] = NumR_name, | ||
| 465 | [_LOWER] = Lower_name, | ||
| 466 | [_RAISE] = Raise_name, | ||
| 467 | [_ADJUST] = Adjust_name | ||
| 468 | }; | ||
| 469 | |||
| 470 | void render_status(struct CharacterMatrix *matrix) { | ||
| 471 | |||
| 472 | // Render to mode icon | ||
| 473 | static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; | ||
| 474 | if(keymap_config.swap_lalt_lgui==false){ | ||
| 475 | matrix_write(matrix, logo[0][0]); | ||
| 476 | matrix_write_P(matrix, PSTR("\n")); | ||
| 477 | matrix_write(matrix, logo[0][1]); | ||
| 478 | }else{ | ||
| 479 | matrix_write(matrix, logo[1][0]); | ||
| 480 | matrix_write_P(matrix, PSTR("\n")); | ||
| 481 | matrix_write(matrix, logo[1][1]); | ||
| 482 | } | ||
| 483 | |||
| 484 | // 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 | ||
| 485 | int name_num; | ||
| 486 | uint32_t lstate; | ||
| 487 | matrix_write_P(matrix, layer_names[current_default_layer]); | ||
| 488 | matrix_write_P(matrix, PSTR("\n")); | ||
| 489 | for( lstate = layer_state, name_num = 0; | ||
| 490 | lstate && name_num < sizeof(layer_names)/sizeof(char *); | ||
| 491 | lstate >>=1, name_num++ ) { | ||
| 492 | if( (lstate & 1) != 0 ) { | ||
| 493 | if( layer_names[name_num] ) { | ||
| 494 | matrix_write_P(matrix, layer_names[name_num]); | ||
| 495 | } | ||
| 496 | } | ||
| 497 | } | ||
| 498 | |||
| 499 | // Host Keyboard LED Status | ||
| 500 | char led[40]; | ||
| 501 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 502 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 503 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 504 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 505 | matrix_write(matrix, led); | ||
| 506 | } | ||
| 507 | |||
| 508 | |||
| 509 | void iota_gfx_task_user(void) { | ||
| 510 | struct CharacterMatrix matrix; | ||
| 511 | |||
| 512 | #if DEBUG_TO_SCREEN | ||
| 513 | if (debug_enable) { | ||
| 514 | return; | ||
| 515 | } | ||
| 516 | #endif | ||
| 517 | |||
| 518 | matrix_clear(&matrix); | ||
| 519 | if(is_master){ | ||
| 520 | render_status(&matrix); | ||
| 521 | }else{ | ||
| 522 | render_logo(&matrix); | ||
| 523 | } | ||
| 524 | matrix_update(&display, &matrix); | ||
| 525 | } | ||
| 526 | |||
| 527 | #endif | ||
diff --git a/keyboards/helix/pico/keymaps/mtei/rules.mk b/keyboards/helix/pico/keymaps/mtei/rules.mk index 05a60f67d..413d0519d 100644 --- a/keyboards/helix/pico/keymaps/mtei/rules.mk +++ b/keyboards/helix/pico/keymaps/mtei/rules.mk | |||
| @@ -10,10 +10,8 @@ AUDIO_ENABLE = yes # Audio output on port B5 | |||
| 10 | LTO_ENABLE = no # if firmware size over limit, try this option | 10 | LTO_ENABLE = no # if firmware size over limit, try this option |
| 11 | 11 | ||
| 12 | # Helix Spacific Build Options | 12 | # Helix Spacific Build Options |
| 13 | # you can uncomment and edit follows 6 Variables | 13 | # you can uncomment and edit follows 4 Variables |
| 14 | # jp: 以下の6つの変数を必要に応じて編集し、コメントアウトをはずします。 | 14 | # jp: 以下の4つの変数を必要に応じて編集し、コメントアウトをはずします。 |
| 15 | # OLED_ENABLE = no # OLED_ENABLE | ||
| 16 | # LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 17 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 15 | # LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 18 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 16 | # LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 19 | # LED_ANIMATIONS = yes # LED animations | 17 | # LED_ANIMATIONS = yes # LED animations |
diff --git a/keyboards/helix/pico/matrix.c b/keyboards/helix/pico/matrix.c deleted file mode 100644 index b18213d84..000000000 --- a/keyboards/helix/pico/matrix.c +++ /dev/null | |||
| @@ -1,342 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along 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 "quantum.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 | |||
| 46 | static uint8_t debouncing = DEBOUNCE; | ||
| 47 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | ||
| 48 | static uint8_t error_count = 0; | ||
| 49 | |||
| 50 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 51 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 52 | |||
| 53 | /* matrix state(1:on, 0:off) */ | ||
| 54 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 55 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 56 | |||
| 57 | static matrix_row_t read_cols(void); | ||
| 58 | static void init_cols(void); | ||
| 59 | static void unselect_rows(void); | ||
| 60 | static void select_row(uint8_t row); | ||
| 61 | static uint8_t matrix_master_scan(void); | ||
| 62 | |||
| 63 | |||
| 64 | __attribute__ ((weak)) | ||
| 65 | void matrix_init_kb(void) { | ||
| 66 | matrix_init_user(); | ||
| 67 | } | ||
| 68 | |||
| 69 | __attribute__ ((weak)) | ||
| 70 | void matrix_scan_kb(void) { | ||
| 71 | matrix_scan_user(); | ||
| 72 | } | ||
| 73 | |||
| 74 | __attribute__ ((weak)) | ||
| 75 | void matrix_init_user(void) { | ||
| 76 | } | ||
| 77 | |||
| 78 | __attribute__ ((weak)) | ||
| 79 | void matrix_scan_user(void) { | ||
| 80 | } | ||
| 81 | |||
| 82 | inline | ||
| 83 | uint8_t matrix_rows(void) | ||
| 84 | { | ||
| 85 | return MATRIX_ROWS; | ||
| 86 | } | ||
| 87 | |||
| 88 | inline | ||
| 89 | uint8_t matrix_cols(void) | ||
| 90 | { | ||
| 91 | return MATRIX_COLS; | ||
| 92 | } | ||
| 93 | |||
| 94 | void matrix_init(void) | ||
| 95 | { | ||
| 96 | split_keyboard_setup(); | ||
| 97 | |||
| 98 | // initialize row and col | ||
| 99 | unselect_rows(); | ||
| 100 | init_cols(); | ||
| 101 | |||
| 102 | setPinOutput(B0); | ||
| 103 | setPinOutput(D5); | ||
| 104 | writePinHigh(B0); | ||
| 105 | writePinHigh(D5); | ||
| 106 | |||
| 107 | // initialize matrix state: all keys off | ||
| 108 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 109 | matrix[i] = 0; | ||
| 110 | matrix_debouncing[i] = 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | matrix_init_quantum(); | ||
| 114 | } | ||
| 115 | |||
| 116 | uint8_t _matrix_scan(void) | ||
| 117 | { | ||
| 118 | // Right hand is stored after the left in the matirx so, we need to offset it | ||
| 119 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 120 | |||
| 121 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 122 | select_row(i); | ||
| 123 | _delay_us(30); // without this wait read unstable value. | ||
| 124 | matrix_row_t cols = read_cols(); | ||
| 125 | if (matrix_debouncing[i+offset] != cols) { | ||
| 126 | matrix_debouncing[i+offset] = cols; | ||
| 127 | debouncing = DEBOUNCE; | ||
| 128 | } | ||
| 129 | unselect_rows(); | ||
| 130 | } | ||
| 131 | |||
| 132 | if (debouncing) { | ||
| 133 | if (--debouncing) { | ||
| 134 | _delay_ms(1); | ||
| 135 | } else { | ||
| 136 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 137 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | return 1; | ||
| 143 | } | ||
| 144 | |||
| 145 | #ifdef USE_MATRIX_I2C | ||
| 146 | |||
| 147 | // Get rows from other half over i2c | ||
| 148 | int i2c_transaction(void) { | ||
| 149 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 150 | |||
| 151 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
| 152 | if (err) goto i2c_error; | ||
| 153 | |||
| 154 | // start of matrix stored at 0x00 | ||
| 155 | err = i2c_master_write(0x00); | ||
| 156 | if (err) goto i2c_error; | ||
| 157 | |||
| 158 | // Start read | ||
| 159 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
| 160 | if (err) goto i2c_error; | ||
| 161 | |||
| 162 | if (!err) { | ||
| 163 | int i; | ||
| 164 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
| 165 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
| 166 | } | ||
| 167 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
| 168 | i2c_master_stop(); | ||
| 169 | } else { | ||
| 170 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
| 171 | i2c_reset_state(); | ||
| 172 | return err; | ||
| 173 | } | ||
| 174 | |||
| 175 | return 0; | ||
| 176 | } | ||
| 177 | |||
| 178 | #else // USE_SERIAL | ||
| 179 | |||
| 180 | int serial_transaction(void) { | ||
| 181 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 182 | int ret=serial_update_buffers(); | ||
| 183 | if (ret ) { | ||
| 184 | if(ret==2) writePinLow(B0); | ||
| 185 | return 1; | ||
| 186 | } | ||
| 187 | writePinHigh(B0); | ||
| 188 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 189 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | ||
| 190 | } | ||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | #endif | ||
| 194 | |||
| 195 | uint8_t matrix_scan(void) | ||
| 196 | { | ||
| 197 | if (is_helix_master()) { | ||
| 198 | matrix_master_scan(); | ||
| 199 | }else{ | ||
| 200 | matrix_slave_scan(); | ||
| 201 | |||
| 202 | int offset = (isLeftHand) ? ROWS_PER_HAND : 0; | ||
| 203 | |||
| 204 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 205 | matrix[offset+i] = serial_master_buffer[i]; | ||
| 206 | } | ||
| 207 | |||
| 208 | matrix_scan_quantum(); | ||
| 209 | } | ||
| 210 | return 1; | ||
| 211 | } | ||
| 212 | |||
| 213 | |||
| 214 | uint8_t matrix_master_scan(void) { | ||
| 215 | |||
| 216 | int ret = _matrix_scan(); | ||
| 217 | |||
| 218 | #ifndef KEYBOARD_helix_rev1 | ||
| 219 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
| 220 | |||
| 221 | #ifdef USE_MATRIX_I2C | ||
| 222 | // for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 223 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 224 | // i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 225 | // } | ||
| 226 | #else // USE_SERIAL | ||
| 227 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 228 | serial_master_buffer[i] = matrix[offset+i]; | ||
| 229 | } | ||
| 230 | #endif | ||
| 231 | #endif | ||
| 232 | |||
| 233 | #ifdef USE_MATRIX_I2C | ||
| 234 | if( i2c_transaction() ) { | ||
| 235 | #else // USE_SERIAL | ||
| 236 | if( serial_transaction() ) { | ||
| 237 | #endif | ||
| 238 | // turn on the indicator led when halves are disconnected | ||
| 239 | writePinLow(D5); | ||
| 240 | |||
| 241 | error_count++; | ||
| 242 | |||
| 243 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 244 | // reset other half if disconnected | ||
| 245 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 246 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 247 | matrix[slaveOffset+i] = 0; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | } else { | ||
| 251 | // turn off the indicator led on no error | ||
| 252 | writePinHigh(D5); | ||
| 253 | error_count = 0; | ||
| 254 | } | ||
| 255 | matrix_scan_quantum(); | ||
| 256 | return ret; | ||
| 257 | } | ||
| 258 | |||
| 259 | void matrix_slave_scan(void) { | ||
| 260 | _matrix_scan(); | ||
| 261 | |||
| 262 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
| 263 | |||
| 264 | #ifdef USE_MATRIX_I2C | ||
| 265 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 266 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 267 | i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 268 | } | ||
| 269 | #else // USE_SERIAL | ||
| 270 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 271 | serial_slave_buffer[i] = matrix[offset+i]; | ||
| 272 | } | ||
| 273 | #endif | ||
| 274 | } | ||
| 275 | |||
| 276 | bool matrix_is_modified(void) | ||
| 277 | { | ||
| 278 | if (debouncing) return false; | ||
| 279 | return true; | ||
| 280 | } | ||
| 281 | |||
| 282 | inline | ||
| 283 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 284 | { | ||
| 285 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 286 | } | ||
| 287 | |||
| 288 | inline | ||
| 289 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 290 | { | ||
| 291 | return matrix[row]; | ||
| 292 | } | ||
| 293 | |||
| 294 | void matrix_print(void) | ||
| 295 | { | ||
| 296 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 297 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 298 | print_hex8(row); print(": "); | ||
| 299 | print_bin_reverse16(matrix_get_row(row)); | ||
| 300 | print("\n"); | ||
| 301 | } | ||
| 302 | } | ||
| 303 | |||
| 304 | uint8_t matrix_key_count(void) | ||
| 305 | { | ||
| 306 | uint8_t count = 0; | ||
| 307 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 308 | count += bitpop16(matrix[i]); | ||
| 309 | } | ||
| 310 | return count; | ||
| 311 | } | ||
| 312 | |||
| 313 | static void init_cols(void) | ||
| 314 | { | ||
| 315 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 316 | _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); | ||
| 317 | _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | static matrix_row_t read_cols(void) | ||
| 322 | { | ||
| 323 | matrix_row_t result = 0; | ||
| 324 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 325 | result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); | ||
| 326 | } | ||
| 327 | return result; | ||
| 328 | } | ||
| 329 | |||
| 330 | static void unselect_rows(void) | ||
| 331 | { | ||
| 332 | for(int x = 0; x < ROWS_PER_HAND; x++) { | ||
| 333 | _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); | ||
| 334 | _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); | ||
| 335 | } | ||
| 336 | } | ||
| 337 | |||
| 338 | static void select_row(uint8_t row) | ||
| 339 | { | ||
| 340 | _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); | ||
| 341 | _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); | ||
| 342 | } | ||
diff --git a/keyboards/helix/pico/override_helix_options.mk-maintenance b/keyboards/helix/pico/override_helix_options.mk-maintenance new file mode 100644 index 000000000..0ff930957 --- /dev/null +++ b/keyboards/helix/pico/override_helix_options.mk-maintenance | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | # | ||
| 2 | # This file is not normally used. It is used for maintenance testing purposes. | ||
| 3 | # To use it, do the following: | ||
| 4 | # | ||
| 5 | # $ cp override_helix_options.mk-maintenance override_helix_options.mk | ||
| 6 | # | ||
| 7 | $(info -------------------------) | ||
| 8 | $(info override_helix_options.mk) | ||
| 9 | $(info -------------------------) | ||
| 10 | |||
| 11 | define HELIX_OVERRIDE_PARSE | ||
| 12 | ifeq ($(strip $1),back) | ||
| 13 | LED_BACK_ENABLE = yes | ||
| 14 | LED_UNDERGLOW_ENABLE = no | ||
| 15 | endif | ||
| 16 | ifeq ($(strip $1),under) | ||
| 17 | LED_BACK_ENABLE = no | ||
| 18 | LED_UNDERGLOW_ENABLE = yes | ||
| 19 | endif | ||
| 20 | ifneq ($(filter noled led-off led_off,$(strip $1)),) | ||
| 21 | LED_BACK_ENABLE = no | ||
| 22 | LED_UNDERGLOW_ENABLE = no | ||
| 23 | endif | ||
| 24 | ifneq ($(filter noaudio audio-off audio_off,$(strip $1)),) | ||
| 25 | AUDIO_ENABLE = no | ||
| 26 | endif | ||
| 27 | ifneq ($(filter audio audio-on audio_on,$(strip $1)),) | ||
| 28 | AUDIO_ENABLE = yes | ||
| 29 | endif | ||
| 30 | ifneq ($(filter sc split-common split_common,$(strip $1)),) | ||
| 31 | SPLIT_KEYBOARD = yes | ||
| 32 | endif | ||
| 33 | ifneq ($(filter nosc no-sc no-split-common no-split_common,$(strip $1)),) | ||
| 34 | SPLIT_KEYBOARD = no | ||
| 35 | endif | ||
| 36 | ifeq ($(strip $1),scan) | ||
| 37 | DEBUG_MATRIX_SCAN_RATE_ENABLE = yes | ||
| 38 | endif | ||
| 39 | ifeq ($(strip $1),scan-api) | ||
| 40 | DEBUG_MATRIX_SCAN_RATE_ENABLE = api | ||
| 41 | endif | ||
| 42 | endef # end of HELIX_OVERRIDE_PARSE | ||
diff --git a/keyboards/helix/pico/pico.c b/keyboards/helix/pico/pico.c index 315b35a7a..4cd195363 100644 --- a/keyboards/helix/pico/pico.c +++ b/keyboards/helix/pico/pico.c | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | /* Copyright 2018 MakotoKurauchi | ||
| 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 | */ | ||
| 1 | #include "helix.h" | 16 | #include "helix.h" |
| 2 | 17 | ||
| 3 | // Each keymap.c should use is_keyboard_master() instead of 'is_master'. | 18 | // Each keymap.c should use is_keyboard_master() instead of 'is_master'. |
| @@ -5,14 +20,6 @@ | |||
| 5 | // for the old keymap.c. | 20 | // for the old keymap.c. |
| 6 | uint8_t is_master = false; | 21 | uint8_t is_master = false; |
| 7 | 22 | ||
| 8 | #ifdef SSD1306OLED | ||
| 9 | #include "ssd1306.h" | ||
| 10 | |||
| 11 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 12 | return process_record_gfx(keycode,record) && process_record_user(keycode, record); | ||
| 13 | } | ||
| 14 | #endif | ||
| 15 | |||
| 16 | void matrix_init_kb(void) { | 23 | void matrix_init_kb(void) { |
| 17 | // Each keymap.c should use is_keyboard_master() instead of is_master. | 24 | // Each keymap.c should use is_keyboard_master() instead of is_master. |
| 18 | // But keep is_master for a while for backwards compatibility | 25 | // But keep is_master for a while for backwards compatibility |
| @@ -28,9 +35,3 @@ void keyboard_post_init_kb(void) { | |||
| 28 | #endif | 35 | #endif |
| 29 | keyboard_post_init_user(); | 36 | keyboard_post_init_user(); |
| 30 | } | 37 | } |
| 31 | |||
| 32 | #if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED) | ||
| 33 | void matrix_slave_scan_user(void) { | ||
| 34 | matrix_scan_user(); | ||
| 35 | } | ||
| 36 | #endif | ||
diff --git a/keyboards/helix/pico/pico.h b/keyboards/helix/pico/pico.h index 5fa5f7295..3e51d54d8 100644 --- a/keyboards/helix/pico/pico.h +++ b/keyboards/helix/pico/pico.h | |||
| @@ -1,12 +1,22 @@ | |||
| 1 | /* Copyright 2018 MakotoKurauchi | ||
| 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 | */ | ||
| 1 | #pragma once | 16 | #pragma once |
| 2 | 17 | ||
| 3 | #include "helix.h" | 18 | #include "helix.h" |
| 4 | 19 | ||
| 5 | #ifndef SPLIT_KEYBOARD | ||
| 6 | extern bool is_helix_master(void); | ||
| 7 | #define is_keyboard_master() is_helix_master() | ||
| 8 | #endif | ||
| 9 | |||
| 10 | // Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'. | 20 | // Each keymap.c should use is_keyboard_master() instead of 'is_master', 'has_usb()'. |
| 11 | // But keep 'is_master' for a while for backwards compatibility | 21 | // But keep 'is_master' for a while for backwards compatibility |
| 12 | // for the old keymap.c. | 22 | // for the old keymap.c. |
diff --git a/keyboards/helix/pico/post_rules.mk b/keyboards/helix/pico/post_rules.mk index 38573d75a..88bb5482b 100644 --- a/keyboards/helix/pico/post_rules.mk +++ b/keyboards/helix/pico/post_rules.mk | |||
| @@ -4,90 +4,30 @@ | |||
| 4 | # Post-processing rules convert keyboard-specific shortcuts (that represent | 4 | # Post-processing rules convert keyboard-specific shortcuts (that represent |
| 5 | # combinations of standard options) into QMK standard options. | 5 | # combinations of standard options) into QMK standard options. |
| 6 | # | 6 | # |
| 7 | -include $(strip $(HELIX_TOP_DIR)/pico/override_helix_options.mk) ## File dedicated to maintenance | ||
| 7 | 8 | ||
| 8 | define HELIX_CUSTOMISE_MSG | 9 | # Parse 'HELIX=xx,yy,zz' option |
| 9 | $(info Helix Spacific Build Options) | 10 | ifneq ($(strip $(HELIX)),) |
| 10 | $(info - OLED_ENABLE = $(OLED_ENABLE)) | 11 | # make HELIX=ios helix/pico:AKEYMAP |
| 11 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) | 12 | # make HELIX=no-ani helix/pico:AKEYMAP |
| 12 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) | 13 | # make HELIX=ios,no-ani helix/pico:AKEYMAP |
| 13 | $(info - LED_ANIMATIONS = $(LED_ANIMATIONS)) | 14 | define HELIX_OPTION_PARSE |
| 14 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) | 15 | # parce 'no-ani' 'ios' |
| 15 | $(info ) | 16 | $(if $(SHOW_PARCE),$(info parse .$1.)) #debug |
| 16 | endef | 17 | $(if $(HELIX_OVERRIDE_PARSE),$(call HELIX_OVERRIDE_PARSE,$1)) |
| 17 | 18 | ||
| 18 | define HELIX_HELP_MSG | 19 | ifeq ($(strip $1),ios) |
| 19 | $(info Helix keyboard convenient command line option) | 20 | IOS_DEVICE_ENABLE = yes |
| 20 | $(info - make HELIX=<options> helix/pico:<keymap>) | 21 | endif |
| 21 | $(info - option= oled | back | under | na | no-ani) | 22 | ifneq ($(filter na no_ani no-ani,$(strip $1)),) |
| 22 | $(info - ios | sc | split-common | scan | verbose) | 23 | LED_ANIMATIONS = no |
| 23 | $(info - ex.) | 24 | endif |
| 24 | $(info - make HELIX=oled helix/pico:<keymap>) | 25 | endef # end of HELIX_OPTION_PARSE |
| 25 | $(info - make HELIX=back helix/pico:<keymap>) | ||
| 26 | $(info - make HELIX=under helix/pico:<keymap>) | ||
| 27 | $(info - make HELIX=back,na helix/pico:<keymap>) | ||
| 28 | $(info - make HELIX=back,ios helix/pico:<keymap>) | ||
| 29 | $(info ) | ||
| 30 | endef | ||
| 31 | 26 | ||
| 32 | ifneq ($(strip $(HELIX)),) | ||
| 33 | COMMA=, | 27 | COMMA=, |
| 34 | helix_option := $(subst $(COMMA), , $(HELIX)) | 28 | $(eval $(foreach A_OPTION_NAME,$(subst $(COMMA), ,$(HELIX)), \ |
| 35 | ifneq ($(filter help,$(helix_option)),) | 29 | $(call HELIX_OPTION_PARSE,$(A_OPTION_NAME)))) |
| 36 | $(eval $(call HELIX_HELP_MSG)) | ||
| 37 | $(error ) | ||
| 38 | endif | ||
| 39 | ifneq ($(filter oled,$(helix_option)),) | ||
| 40 | OLED_ENABLE = yes | ||
| 41 | endif | ||
| 42 | ifneq ($(filter back,$(helix_option)),) | ||
| 43 | LED_BACK_ENABLE = yes | ||
| 44 | else ifneq ($(filter under,$(helix_option)),) | ||
| 45 | LED_UNDERGLOW_ENABLE = yes | ||
| 46 | endif | ||
| 47 | ifneq ($(filter na,$(helix_option)),) | ||
| 48 | LED_ANIMATIONS = no | ||
| 49 | endif | ||
| 50 | ifneq ($(filter no_ani,$(helix_option)),) | ||
| 51 | LED_ANIMATIONS = no | ||
| 52 | endif | ||
| 53 | ifneq ($(filter no-ani,$(helix_option)),) | ||
| 54 | LED_ANIMATIONS = no | ||
| 55 | endif | ||
| 56 | ifneq ($(filter ios,$(helix_option)),) | ||
| 57 | IOS_DEVICE_ENABLE = yes | ||
| 58 | endif | ||
| 59 | ifneq ($(filter sc,$(helix_option)),) | ||
| 60 | SPLIT_KEYBOARD = yes | ||
| 61 | endif | ||
| 62 | ifneq ($(filter split-common,$(helix_option)),) | ||
| 63 | SPLIT_KEYBOARD = yes | ||
| 64 | endif | ||
| 65 | ifneq ($(filter scan,$(helix_option)),) | ||
| 66 | # use DEBUG_MATRIX_SCAN_RATE | ||
| 67 | # see docs/newbs_testing_debugging.md | ||
| 68 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE | ||
| 69 | CONSOLE_ENABLE = yes | ||
| 70 | SHOW_VERBOSE_INFO = yes | ||
| 71 | endif | ||
| 72 | ifneq ($(filter verbose,$(helix_option)),) | ||
| 73 | SHOW_VERBOSE_INFO = yes | ||
| 74 | endif | ||
| 75 | SHOW_HELIX_OPTIONS = yes | 30 | SHOW_HELIX_OPTIONS = yes |
| 76 | endif | ||
| 77 | |||
| 78 | ifneq ($(strip $(SPLIT_KEYBOARD)), yes) | ||
| 79 | SRC += local_drivers/serial.c | ||
| 80 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 81 | |||
| 82 | # A workaround until #7089 is merged. | ||
| 83 | # serial.c must not be compiled with the -lto option. | ||
| 84 | # The current LIB_SRC has a side effect with the -fno-lto option, so use it. | ||
| 85 | LIB_SRC += local_drivers/serial.c | ||
| 86 | |||
| 87 | CUSTOM_MATRIX = yes | ||
| 88 | |||
| 89 | SRC += pico/matrix.c | ||
| 90 | SRC += pico/split_util.c | ||
| 91 | endif | 31 | endif |
| 92 | 32 | ||
| 93 | ######## | 33 | ######## |
| @@ -98,7 +38,6 @@ ifeq ($(strip $(LED_BACK_ENABLE)), yes) | |||
| 98 | RGBLIGHT_ENABLE = yes | 38 | RGBLIGHT_ENABLE = yes |
| 99 | OPT_DEFS += -DRGBLED_BACK | 39 | OPT_DEFS += -DRGBLED_BACK |
| 100 | ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) | 40 | ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) |
| 101 | $(eval $(call HELIX_CUSTOMISE_MSG)) | ||
| 102 | $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') | 41 | $(error LED_BACK_ENABLE and LED_UNDERGLOW_ENABLE both 'yes') |
| 103 | endif | 42 | endif |
| 104 | else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) | 43 | else ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) |
| @@ -113,35 +52,26 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes) | |||
| 113 | OPT_DEFS += -DLED_ANIMATIONS | 52 | OPT_DEFS += -DLED_ANIMATIONS |
| 114 | endif | 53 | endif |
| 115 | 54 | ||
| 116 | ifeq ($(strip $(OLED_ENABLE)), yes) | ||
| 117 | SRC += local_drivers/i2c.c | ||
| 118 | SRC += local_drivers/ssd1306.c | ||
| 119 | KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers | ||
| 120 | OPT_DEFS += -DOLED_ENABLE | ||
| 121 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | ||
| 122 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 123 | endif | ||
| 124 | endif | ||
| 125 | |||
| 126 | ifeq ($(strip $(AUDIO_ENABLE)),yes) | 55 | ifeq ($(strip $(AUDIO_ENABLE)),yes) |
| 127 | ifeq ($(strip $(RGBLIGHT_ENABLE)),yes) | 56 | ifeq ($(strip $(RGBLIGHT_ENABLE)),yes) |
| 128 | LTO_ENABLE = yes | 57 | LTO_ENABLE = yes |
| 129 | endif | 58 | endif |
| 130 | ifeq ($(strip $(OLED_ENABLE)),yes) | ||
| 131 | LTO_ENABLE = yes | ||
| 132 | endif | ||
| 133 | endif | 59 | endif |
| 134 | 60 | ||
| 135 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) | 61 | ifneq ($(strip $(SHOW_HELIX_OPTIONS)),) |
| 136 | $(eval $(call HELIX_CUSTOMISE_MSG)) | 62 | $(info Helix Spacific Build Options) |
| 137 | ifneq ($(strip $(SHOW_VERBOSE_INFO)),) | 63 | $(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE)) |
| 138 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) | 64 | $(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE)) |
| 139 | $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE)) | 65 | $(info - LED_ANIMATIONS = $(LED_ANIMATIONS)) |
| 140 | $(info -- OPT_DEFS = $(OPT_DEFS)) | 66 | $(info - IOS_DEVICE_ENABLE = $(IOS_DEVICE_ENABLE)) |
| 141 | $(info -- SPLIT_KEYBOARD = $(SPLIT_KEYBOARD)) | 67 | $(info ) |
| 142 | $(info -- LTO_ENABLE = $(LTO_ENABLE)) | 68 | $(info QMK Build Options) |
| 143 | $(info ) | 69 | $(info -- SPLIT_KEYBOARD = $(SPLIT_KEYBOARD)) |
| 144 | endif | 70 | $(info -- AUDIO_ENABLE = $(AUDIO_ENABLE)) |
| 71 | $(info -- RGBLIGHT_ENABLE = $(RGBLIGHT_ENABLE)) | ||
| 72 | $(info -- CONSOLE_ENABLE = $(CONSOLE_ENABLE)) | ||
| 73 | $(info -- OPT_DEFS = $(OPT_DEFS)) | ||
| 74 | $(info -- LTO_ENABLE = $(LTO_ENABLE)) | ||
| 75 | $(info -- DEBUG_MATRIX_SCAN_RATE_ENABLE = $(DEBUG_MATRIX_SCAN_RATE_ENABLE)) | ||
| 76 | $(info ) | ||
| 145 | endif | 77 | endif |
| 146 | |||
| 147 | OLED_ENABLE = no # disable OLED in TOP/common_features.mk | ||
diff --git a/keyboards/helix/pico/qmk_conf/rules.mk b/keyboards/helix/pico/qmk_conf/rules.mk index e2993b3f8..08ca8e094 100644 --- a/keyboards/helix/pico/qmk_conf/rules.mk +++ b/keyboards/helix/pico/qmk_conf/rules.mk | |||
| @@ -1,4 +1,2 @@ | |||
| 1 | EXTRAKEY_ENABLE = yes # Audio control and System control | 1 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 2 | AUDIO_ENABLE = yes # Audio output | 2 | AUDIO_ENABLE = yes # Audio output |
| 3 | |||
| 4 | include $(strip $(KEYBOARD_LOCAL_FEATURES_MK)) | ||
diff --git a/keyboards/helix/pico/rules.mk b/keyboards/helix/pico/rules.mk index 12caec37e..efa7ae4be 100644 --- a/keyboards/helix/pico/rules.mk +++ b/keyboards/helix/pico/rules.mk | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | SPLIT_KEYBOARD = yes | ||
| 2 | |||
| 1 | # Helix Spacific Build Options default values | 3 | # Helix Spacific Build Options default values |
| 2 | OLED_ENABLE = no # OLED_ENABLE | ||
| 3 | LOCAL_GLCDFONT = no # use each keymaps "helixfont.h" insted of "common/glcdfont.c" | ||
| 4 | LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) | 4 | LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.) |
| 5 | LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) | 5 | LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.) |
| 6 | LED_ANIMATIONS = yes # LED animations | 6 | LED_ANIMATIONS = yes # LED animations |
diff --git a/keyboards/helix/pico/split_util.c b/keyboards/helix/pico/split_util.c deleted file mode 100644 index c77e63f33..000000000 --- a/keyboards/helix/pico/split_util.c +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 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 | #include "wait.h" | ||
| 11 | |||
| 12 | #ifdef USE_MATRIX_I2C | ||
| 13 | # include "i2c.h" | ||
| 14 | #else | ||
| 15 | # include "serial.h" | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #ifdef EE_HANDS | ||
| 19 | # include "eeconfig.h" | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #ifndef SPLIT_USB_TIMEOUT | ||
| 23 | #define SPLIT_USB_TIMEOUT 2500 | ||
| 24 | #endif | ||
| 25 | |||
| 26 | volatile bool isLeftHand = true; | ||
| 27 | |||
| 28 | bool waitForUsb(void) { | ||
| 29 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { | ||
| 30 | // This will return true of a USB connection has been established | ||
| 31 | if (UDADDR & _BV(ADDEN)) { | ||
| 32 | return true; | ||
| 33 | } | ||
| 34 | wait_ms(100); | ||
| 35 | } | ||
| 36 | |||
| 37 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | ||
| 38 | (USBCON &= ~(_BV(USBE) | _BV(OTGPADE))); | ||
| 39 | |||
| 40 | return false; | ||
| 41 | } | ||
| 42 | |||
| 43 | bool is_keyboard_left(void) { | ||
| 44 | #if defined(SPLIT_HAND_PIN) | ||
| 45 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand | ||
| 46 | setPinInput(SPLIT_HAND_PIN); | ||
| 47 | return readPin(SPLIT_HAND_PIN); | ||
| 48 | #elif defined(EE_HANDS) | ||
| 49 | return eeconfig_read_handedness(); | ||
| 50 | #elif defined(MASTER_RIGHT) | ||
| 51 | return !is_helix_master(); | ||
| 52 | #endif | ||
| 53 | |||
| 54 | return is_helix_master(); | ||
| 55 | } | ||
| 56 | |||
| 57 | bool is_helix_master(void) { | ||
| 58 | static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN; | ||
| 59 | |||
| 60 | // only check once, as this is called often | ||
| 61 | if (usbstate == UNKNOWN) { | ||
| 62 | #if defined(SPLIT_USB_DETECT) | ||
| 63 | usbstate = waitForUsb() ? MASTER : SLAVE; | ||
| 64 | #elif defined(__AVR__) | ||
| 65 | USBCON |= (1 << OTGPADE); // enables VBUS pad | ||
| 66 | wait_us(5); | ||
| 67 | |||
| 68 | usbstate = (USBSTA & (1 << VBUS)) ? MASTER : SLAVE; // checks state of VBUS | ||
| 69 | #else | ||
| 70 | usbstate = MASTER; | ||
| 71 | #endif | ||
| 72 | } | ||
| 73 | |||
| 74 | return (usbstate == MASTER); | ||
| 75 | } | ||
| 76 | |||
| 77 | static void keyboard_master_setup(void) { | ||
| 78 | |||
| 79 | #ifdef USE_MATRIX_I2C | ||
| 80 | i2c_master_init(); | ||
| 81 | #else | ||
| 82 | serial_master_init(); | ||
| 83 | #endif | ||
| 84 | } | ||
| 85 | |||
| 86 | static void keyboard_slave_setup(void) { | ||
| 87 | |||
| 88 | #ifdef USE_MATRIX_I2C | ||
| 89 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
| 90 | #else | ||
| 91 | serial_slave_init(); | ||
| 92 | #endif | ||
| 93 | } | ||
| 94 | |||
| 95 | void split_keyboard_setup(void) { | ||
| 96 | isLeftHand = is_keyboard_left(); | ||
| 97 | |||
| 98 | if (is_helix_master()) { | ||
| 99 | keyboard_master_setup(); | ||
| 100 | } else { | ||
| 101 | keyboard_slave_setup(); | ||
| 102 | } | ||
| 103 | sei(); | ||
| 104 | } | ||
diff --git a/keyboards/helix/pico/split_util.h b/keyboards/helix/pico/split_util.h deleted file mode 100644 index b839ce6e3..000000000 --- a/keyboards/helix/pico/split_util.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdbool.h> | ||
| 4 | #include "eeconfig.h" | ||
| 5 | |||
| 6 | #define SLAVE_I2C_ADDRESS 0x32 | ||
| 7 | |||
| 8 | extern volatile bool isLeftHand; | ||
| 9 | |||
| 10 | // slave version of matix scan, defined in matrix.c | ||
| 11 | void matrix_slave_scan(void); | ||
| 12 | |||
| 13 | void split_keyboard_setup(void); | ||
| 14 | bool is_helix_master(void); | ||
| 15 | |||
| 16 | void matrix_master_OLED_init (void); | ||
