diff options
31 files changed, 2505 insertions, 0 deletions
diff --git a/keyboards/bastardkb/charybdis/3x5/3x5.c b/keyboards/bastardkb/charybdis/3x5/3x5.c new file mode 100644 index 000000000..d896cf692 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/3x5.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) | ||
3 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
4 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
5 | * | ||
6 | * This program is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Publicw License as published by | ||
8 | * the Free Software Foundation, either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #include "3x5.h" | ||
21 | |||
22 | // clang-format off | ||
23 | #ifdef RGB_MATRIX_ENABLE | ||
24 | /** | ||
25 | * \brief LEDs index. | ||
26 | * | ||
27 | * ╭────────────────────╮ ╭────────────────────╮ | ||
28 | * 2 3 8 9 12 30 27 26 21 20 | ||
29 | * ├────────────────────┤ ├────────────────────┤ | ||
30 | * 1 4 7 10 13 31 28 25 22 19 | ||
31 | * ├────────────────────┤ ├────────────────────┤ | ||
32 | * 0 5 6 11 14 32 29 24 23 18 | ||
33 | * ╰────────────────────╯ ╰────────────────────╯ | ||
34 | * 15 16 17 33 34 XX | ||
35 | * ╰────────────╯ ╰────────────╯ | ||
36 | */ | ||
37 | led_config_t g_led_config = { { | ||
38 | /* Key Matrix to LED index. */ | ||
39 | // Left split. | ||
40 | { 2, 3, 8, 9, 12 }, // Top row | ||
41 | { 1, 4, 7, 10, 13 }, // Middle row | ||
42 | { 0, 5, 6, 11, 14 }, // Bottom row | ||
43 | { 17, NO_LED, 15, 16, NO_LED }, // Thumb cluster | ||
44 | // Right split. | ||
45 | { 20, 21, 26, 27, 30 }, // Top row | ||
46 | { 19, 22, 25, 28, 31 }, // Middle row | ||
47 | { 18, 23, 24, 29, 32 }, // Bottom row | ||
48 | { 33, NO_LED, 34, NO_LED, NO_LED }, // Thumb cluster | ||
49 | }, { | ||
50 | /* LED index to physical position. */ | ||
51 | // Left split. | ||
52 | /* index=0 */ { 0, 42 }, { 0, 21 }, { 0, 0 }, // col 1 (left most) | ||
53 | /* index=3 */ { 18, 0 }, { 18, 21 }, { 18, 42 }, // col 2 | ||
54 | /* index=6 */ { 36, 42 }, { 36, 21 }, { 36, 0 }, | ||
55 | /* index=9 */ { 54, 0 }, { 54, 21 }, { 54, 42 }, | ||
56 | /* index=12 */ { 72, 0 }, { 72, 21 }, { 72, 42 }, | ||
57 | /* index=15 */ { 72, 64 }, { 90, 64 }, { 108, 64 }, // Thumb cluster | ||
58 | // Right split. | ||
59 | /* index=18 */ { 224, 42 }, { 224, 21 }, { 224, 0 }, // col 10 (right most) | ||
60 | /* index=21 */ { 206, 0 }, { 206, 21 }, { 206, 42 }, // col 9 | ||
61 | /* index=24 */ { 188, 42 }, { 188, 21 }, { 188, 0 }, | ||
62 | /* index=27 */ { 170, 0 }, { 170, 21 }, { 170, 42 }, | ||
63 | /* index=30 */ { 152, 0 }, { 152, 21 }, { 152, 42 }, | ||
64 | /* index=33 */ { 152, 64 }, { 134, 64 }, | ||
65 | }, { | ||
66 | /* LED index to flag. */ | ||
67 | // Left split. | ||
68 | /* index=0 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 | ||
69 | /* index=3 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 | ||
70 | /* index=6 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
71 | /* index=9 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
72 | /* index=12 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
73 | /* index=15 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster | ||
74 | // Right split. | ||
75 | /* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 | ||
76 | /* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 | ||
77 | /* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
78 | /* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
79 | /* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
80 | /* index=33 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster | ||
81 | } }; | ||
82 | #endif | ||
83 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/3x5.h b/keyboards/bastardkb/charybdis/3x5/3x5.h new file mode 100644 index 000000000..665fcbeec --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/3x5.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #include "charybdis.h" | ||
22 | |||
23 | // clang-format off | ||
24 | #define LAYOUT_charybdis_3x5( \ | ||
25 | k00, k01, k02, k03, k04, k44, k43, k42, k41, k40, \ | ||
26 | k10, k11, k12, k13, k14, k54, k53, k52, k51, k50, \ | ||
27 | k20, k21, k22, k23, k24, k64, k63, k62, k61, k60, \ | ||
28 | k32, k33, k30, k70, k72 \ | ||
29 | ) \ | ||
30 | { \ | ||
31 | { k00, k01, k02, k03, k04 }, \ | ||
32 | { k10, k11, k12, k13, k14 }, \ | ||
33 | { k20, k21, k22, k23, k24 }, \ | ||
34 | { k30, KC_NO, k32, k33, KC_NO }, \ | ||
35 | { k40, k41, k42, k43, k44 }, \ | ||
36 | { k50, k51, k52, k53, k54 }, \ | ||
37 | { k60, k61, k62, k63, k64 }, \ | ||
38 | { k70, KC_NO, k72, KC_NO, KC_NO }, \ | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * \brief Compatibility layout with the split_3x5_3 community layout. | ||
43 | * | ||
44 | * This effectively renders the Charbdis Nano compatible with existing layout | ||
45 | * implementations relying on the `split_3x5_3` layout, which includes, among | ||
46 | * others, Manna-Harbour's (@manna_harbour) Miryoku layout. | ||
47 | * | ||
48 | * The last key on the layout is ignored, to transform the input 36-keys layout | ||
49 | * into the Charybdis Nano's 35-keys layout. | ||
50 | */ | ||
51 | #define LAYOUT_split_3x5_3( \ | ||
52 | k00, k01, k02, k03, k04, k44, k43, k42, k41, k40, \ | ||
53 | k10, k11, k12, k13, k14, k54, k53, k52, k51, k50, \ | ||
54 | k20, k21, k22, k23, k24, k64, k63, k62, k61, k60, \ | ||
55 | k32, k33, k30, k70, k72, ___ \ | ||
56 | ) \ | ||
57 | { \ | ||
58 | { k00, k01, k02, k03, k04 }, \ | ||
59 | { k10, k11, k12, k13, k14 }, \ | ||
60 | { k20, k21, k22, k23, k24 }, \ | ||
61 | { k30, KC_NO, k32, k33, KC_NO }, \ | ||
62 | { k40, k41, k42, k43, k44 }, \ | ||
63 | { k50, k51, k52, k53, k54 }, \ | ||
64 | { k60, k61, k62, k63, k64 }, \ | ||
65 | { k70, KC_NO, k72, KC_NO, KC_NO }, \ | ||
66 | } | ||
67 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/config.h b/keyboards/bastardkb/charybdis/3x5/config.h new file mode 100644 index 000000000..9c69f7c35 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/config.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #define VENDOR_ID 0xA8F8 | ||
22 | #define PRODUCT_ID 0x1832 | ||
23 | #define DEVICE_VER 0x0001 | ||
24 | #define MANUFACTURER Bastard Keyboards | ||
25 | #define PRODUCT Charybdis Nano | ||
26 | |||
27 | /* Key matrix configuration. */ | ||
28 | |||
29 | // Rows are doubled-up. | ||
30 | #define MATRIX_ROWS 8 | ||
31 | #define MATRIX_COLS 5 | ||
32 | |||
33 | // Wiring configuration for each half. | ||
34 | #define MATRIX_ROW_PINS \ | ||
35 | { B7, C6, D4, B5 } | ||
36 | #define MATRIX_COL_PINS \ | ||
37 | { C7, F0, D7, E6, B4 } | ||
38 | |||
39 | #define MATRIX_ROW_PINS_RIGHT \ | ||
40 | { F0, C6, D4, B5 } | ||
41 | #define MATRIX_COL_PINS_RIGHT \ | ||
42 | { C7, B7, D7, E6, B4 } | ||
43 | |||
44 | #define DIODE_DIRECTION ROW2COL | ||
45 | |||
46 | /* Handedness. */ | ||
47 | #define MASTER_RIGHT | ||
48 | |||
49 | /* Bootmagic Lite configuration. */ | ||
50 | #define BOOTMAGIC_LITE_ROW 0 | ||
51 | #define BOOTMAGIC_LITE_COLUMN 0 | ||
52 | #define BOOTMAGIC_LITE_ROW_RIGHT 4 | ||
53 | #define BOOTMAGIC_LITE_COLUMN_RIGHT 0 | ||
54 | |||
55 | /* serial.c configuration (for split keyboard) */ | ||
56 | #define SOFT_SERIAL_PIN D2 | ||
57 | |||
58 | /* Set 0 if debouncing isn't needed. */ | ||
59 | #define DEBOUNCE 5 | ||
60 | |||
61 | /* Disable action features. */ | ||
62 | #define NO_ACTION_MACRO // Disable old-style macro handling. | ||
63 | #define NO_ACTION_FUNCTION // Disable old-style function handling. | ||
64 | |||
65 | /* PMW3360 settings. */ | ||
66 | #define PMW3360_CS_PIN B0 | ||
67 | |||
68 | // Trackball angle adjustment. | ||
69 | #define ROTATIONAL_TRANSFORM_ANGLE -25 | ||
70 | |||
71 | /* RGB settings. */ | ||
72 | |||
73 | #define RGB_DI_PIN D3 | ||
74 | #define RGBLED_NUM 35 | ||
75 | #define RGBLED_SPLIT \ | ||
76 | { 18, 17 } | ||
77 | |||
78 | /* RGB matrix support. */ | ||
79 | #ifdef RGB_MATRIX_ENABLE | ||
80 | # define SPLIT_TRANSPORT_MIRROR | ||
81 | # define DRIVER_LED_TOTAL RGBLED_NUM | ||
82 | # define RGB_MATRIX_SPLIT RGBLED_SPLIT | ||
83 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 | ||
84 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
85 | # define RGB_DISABLE_WHEN_USB_SUSPENDED | ||
86 | # define RGB_MATRIX_KEYPRESSES | ||
87 | #endif | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/info.json b/keyboards/bastardkb/charybdis/3x5/info.json new file mode 100644 index 000000000..03fb05664 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/info.json | |||
@@ -0,0 +1,86 @@ | |||
1 | { | ||
2 | "keyboard_name": "Charybdis Nano", | ||
3 | "url": "https://www.bastardkb.com", | ||
4 | "maintainer": "Quentin Lebastard", | ||
5 | "layouts": { | ||
6 | "LAYOUT_charybdis_3x5": { | ||
7 | "layout": [ | ||
8 | { "label": "L00", "x": 0, "y": 0 }, | ||
9 | { "label": "L01", "x": 1, "y": 0 }, | ||
10 | { "label": "L02", "x": 2, "y": 0 }, | ||
11 | { "label": "L03", "x": 3, "y": 0 }, | ||
12 | { "label": "L04", "x": 4, "y": 0 }, | ||
13 | { "label": "R00", "x": 11, "y": 0 }, | ||
14 | { "label": "R01", "x": 12, "y": 0 }, | ||
15 | { "label": "R02", "x": 13, "y": 0 }, | ||
16 | { "label": "R03", "x": 14, "y": 0 }, | ||
17 | { "label": "R04", "x": 15, "y": 0 }, | ||
18 | { "label": "L10", "x": 0, "y": 1 }, | ||
19 | { "label": "L11", "x": 1, "y": 1 }, | ||
20 | { "label": "L12", "x": 2, "y": 1 }, | ||
21 | { "label": "L13", "x": 3, "y": 1 }, | ||
22 | { "label": "L14", "x": 4, "y": 1 }, | ||
23 | { "label": "R10", "x": 11, "y": 1 }, | ||
24 | { "label": "R11", "x": 12, "y": 1 }, | ||
25 | { "label": "R12", "x": 13, "y": 1 }, | ||
26 | { "label": "R13", "x": 14, "y": 1 }, | ||
27 | { "label": "R14", "x": 15, "y": 1 }, | ||
28 | { "label": "L20", "x": 0, "y": 2 }, | ||
29 | { "label": "L21", "x": 1, "y": 2 }, | ||
30 | { "label": "L22", "x": 2, "y": 2 }, | ||
31 | { "label": "L23", "x": 3, "y": 2 }, | ||
32 | { "label": "L24", "x": 4, "y": 2 }, | ||
33 | { "label": "R20", "x": 11, "y": 2 }, | ||
34 | { "label": "R21", "x": 12, "y": 2 }, | ||
35 | { "label": "R22", "x": 13, "y": 2 }, | ||
36 | { "label": "R23", "x": 14, "y": 2 }, | ||
37 | { "label": "R24", "x": 15, "y": 2 }, | ||
38 | { "label": "L30", "x": 4, "y": 3 }, | ||
39 | { "label": "L31", "x": 5, "y": 3 }, | ||
40 | { "label": "L32", "x": 6, "y": 3 }, | ||
41 | { "label": "R30", "x": 9, "y": 3 }, | ||
42 | { "label": "R31", "x": 10, "y": 3 } | ||
43 | ] | ||
44 | }, | ||
45 | "LAYOUT_split_3x5_3": { | ||
46 | "layout": [ | ||
47 | { "label": "L00", "x": 0, "y": 0 }, | ||
48 | { "label": "L01", "x": 1, "y": 0 }, | ||
49 | { "label": "L02", "x": 2, "y": 0 }, | ||
50 | { "label": "L03", "x": 3, "y": 0 }, | ||
51 | { "label": "L04", "x": 4, "y": 0 }, | ||
52 | { "label": "R00", "x": 11, "y": 0 }, | ||
53 | { "label": "R01", "x": 12, "y": 0 }, | ||
54 | { "label": "R02", "x": 13, "y": 0 }, | ||
55 | { "label": "R03", "x": 14, "y": 0 }, | ||
56 | { "label": "R04", "x": 15, "y": 0 }, | ||
57 | { "label": "L10", "x": 0, "y": 1 }, | ||
58 | { "label": "L11", "x": 1, "y": 1 }, | ||
59 | { "label": "L12", "x": 2, "y": 1 }, | ||
60 | { "label": "L13", "x": 3, "y": 1 }, | ||
61 | { "label": "L14", "x": 4, "y": 1 }, | ||
62 | { "label": "R10", "x": 11, "y": 1 }, | ||
63 | { "label": "R11", "x": 12, "y": 1 }, | ||
64 | { "label": "R12", "x": 13, "y": 1 }, | ||
65 | { "label": "R13", "x": 14, "y": 1 }, | ||
66 | { "label": "R14", "x": 15, "y": 1 }, | ||
67 | { "label": "L20", "x": 0, "y": 2 }, | ||
68 | { "label": "L21", "x": 1, "y": 2 }, | ||
69 | { "label": "L22", "x": 2, "y": 2 }, | ||
70 | { "label": "L23", "x": 3, "y": 2 }, | ||
71 | { "label": "L24", "x": 4, "y": 2 }, | ||
72 | { "label": "R20", "x": 11, "y": 2 }, | ||
73 | { "label": "R21", "x": 12, "y": 2 }, | ||
74 | { "label": "R22", "x": 13, "y": 2 }, | ||
75 | { "label": "R23", "x": 14, "y": 2 }, | ||
76 | { "label": "R24", "x": 15, "y": 2 }, | ||
77 | { "label": "L30", "x": 4, "y": 3 }, | ||
78 | { "label": "L31", "x": 5, "y": 3 }, | ||
79 | { "label": "L32", "x": 6, "y": 3 }, | ||
80 | { "label": "R30", "x": 9, "y": 3 }, | ||
81 | { "label": "R31", "x": 10, "y": 3 }, | ||
82 | { "label": "R32", "x": 11, "y": 3 } | ||
83 | ] | ||
84 | } | ||
85 | } | ||
86 | } | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/default/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/default/config.h new file mode 100644 index 000000000..f2dd86c65 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/default/config.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #pragma once | ||
18 | |||
19 | #ifndef TAPPING_TERM | ||
20 | /** | ||
21 | * \brief Configure the global tapping term (default: 200ms). | ||
22 | * | ||
23 | * If you have a lot of accidental mod activations, crank up the tapping term. | ||
24 | * | ||
25 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term | ||
26 | */ | ||
27 | # define TAPPING_TERM 200 | ||
28 | #endif // TAPPING_TERM | ||
29 | |||
30 | /* RGB Matrix. */ | ||
31 | |||
32 | #ifdef RGB_MATRIX_ENABLE | ||
33 | // Disable control of RGB matrix by keycodes (must use firmware implementation | ||
34 | // to control the feature). | ||
35 | # define RGB_MATRIX_DISABLE_KEYCODES | ||
36 | |||
37 | // Limit maximum brightness to keep power consumption reasonable, and avoid | ||
38 | // disconnects. | ||
39 | # undef RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
40 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 | ||
41 | |||
42 | // Rainbow swirl as startup mode. | ||
43 | # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
44 | # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
45 | |||
46 | // Slow swirl at startup. | ||
47 | # define RGB_MATRIX_STARTUP_SPD 32 | ||
48 | |||
49 | // Startup values. | ||
50 | # define RGB_MATRIX_STARTUP_HUE 0 | ||
51 | # define RGB_MATRIX_STARTUP_SAT 255 | ||
52 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
53 | # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL | ||
54 | #endif // RGB_MATRIX_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c new file mode 100644 index 000000000..18fe86052 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | enum charybdis_keymap_layers { | ||
20 | LAYER_BASE = 0, | ||
21 | LAYER_LOWER, | ||
22 | LAYER_RAISE, | ||
23 | }; | ||
24 | |||
25 | #define LOWER MO(LAYER_LOWER) | ||
26 | #define RAISE MO(LAYER_RAISE) | ||
27 | |||
28 | #define CTL_BSP CTL_T(KC_BSPC) | ||
29 | #define SFT_SPC SFT_T(KC_SPC) | ||
30 | #define GUI_ENT GUI_T(KC_ENT) | ||
31 | |||
32 | // clang-format off | ||
33 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
34 | [LAYER_BASE] = LAYOUT_charybdis_3x5( | ||
35 | // ╭─────────────────────────────────────────────╮ ╭─────────────────────────────────────────────╮ | ||
36 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, | ||
37 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
38 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, | ||
39 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
40 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, | ||
41 | // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ | ||
42 | CTL_BSP, SFT_SPC, LOWER, RAISE, GUI_ENT | ||
43 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
44 | ), | ||
45 | |||
46 | [LAYER_LOWER] = LAYOUT_charybdis_3x5( | ||
47 | // ╭─────────────────────────────────────────────╮ ╭─────────────────────────────────────────────╮ | ||
48 | RGB_TOG, KC_MNXT, KC_MPLY, KC_MPRV, XXXXXXX, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, | ||
49 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
50 | KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_4, KC_5, KC_6, KC_PMNS, | ||
51 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
52 | XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, RESET, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, | ||
53 | // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ | ||
54 | XXXXXXX, XXXXXXX, _______, XXXXXXX, _______ | ||
55 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
56 | ), | ||
57 | |||
58 | [LAYER_RAISE] = LAYOUT_charybdis_3x5( | ||
59 | // ╭─────────────────────────────────────────────╮ ╭─────────────────────────────────────────────╮ | ||
60 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, KC_MUTE, KC_VOLD, XXXXXXX, | ||
61 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
62 | KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, | ||
63 | // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ | ||
64 | KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, RESET, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, | ||
65 | // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ | ||
66 | _______, _______, XXXXXXX, _______, XXXXXXX | ||
67 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
68 | ), | ||
69 | }; | ||
70 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/default/readme.md b/keyboards/bastardkb/charybdis/3x5/keymaps/default/readme.md new file mode 100644 index 000000000..390865682 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/default/readme.md | |||
@@ -0,0 +1,7 @@ | |||
1 | # Charybdis (3x5) default keymap | ||
2 | |||
3 | > :bulb: Have a look at the [`via` keymap](../via) for a more feature-rich layout. | ||
4 | |||
5 | The Charydbis (3x5) default keymap is inspired from the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap. | ||
6 | |||
7 | This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h new file mode 100644 index 000000000..f515d8533 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h | |||
@@ -0,0 +1,118 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #pragma once | ||
18 | |||
19 | #ifdef VIA_ENABLE | ||
20 | /* VIA configuration. */ | ||
21 | # define DYNAMIC_KEYMAP_LAYER_COUNT 7 | ||
22 | #endif // VIA_ENABLE | ||
23 | |||
24 | /* Disable unused features. */ | ||
25 | #define NO_ACTION_ONESHOT | ||
26 | |||
27 | #ifndef TAPPING_TERM | ||
28 | /** | ||
29 | * \brief Configure the global tapping term (default: 200ms). | ||
30 | * | ||
31 | * If you have a lot of accidental mod activations, crank up the tapping term. | ||
32 | * | ||
33 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term | ||
34 | */ | ||
35 | # define TAPPING_TERM 200 | ||
36 | #endif // TAPPING_TERM | ||
37 | |||
38 | /** | ||
39 | * \brief Enable rapid switch from tap to hold. | ||
40 | * | ||
41 | * Note that a side-effect of this setting is to disable auto-repeat when | ||
42 | * pressing key twice, except for one-shot keys. | ||
43 | * | ||
44 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-force-hold | ||
45 | */ | ||
46 | #define TAPPING_FORCE_HOLD | ||
47 | |||
48 | /* | ||
49 | * Tap-or-Hold decision modes. | ||
50 | * | ||
51 | * Note that the following flags behave differently when combined (ie. when 2 or | ||
52 | * more are enabled). | ||
53 | * | ||
54 | * See bit.ly/tap-or-hold for a visual explanation of the following tap-or-hold | ||
55 | * decision modes. | ||
56 | */ | ||
57 | |||
58 | /** | ||
59 | * \brief Faster tap-hold trigger. | ||
60 | * | ||
61 | * Without `PERMISSIVE_HOLD`, within `TAPPING_TERM`: | ||
62 | * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ ae | ||
63 | * With `PERMISSIVE_HOLD`, within `TAPPING_TERM`: | ||
64 | * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ Mod+e | ||
65 | * | ||
66 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#permissive-hold | ||
67 | */ | ||
68 | #define PERMISSIVE_HOLD | ||
69 | |||
70 | /** | ||
71 | * \brief Prevent normal rollover on alphas from accidentally triggering mods. | ||
72 | * | ||
73 | * Ignores key presses that interrupt a mod-tap. Must-have for Home Row mod. | ||
74 | * | ||
75 | * Without `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`: | ||
76 | * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ Mod+e | ||
77 | * With `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`: | ||
78 | * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ ae | ||
79 | * | ||
80 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#ignore-mod-tap-interrupt | ||
81 | */ | ||
82 | #define IGNORE_MOD_TAP_INTERRUPT | ||
83 | |||
84 | /* Charybdis-specific features. */ | ||
85 | |||
86 | #ifdef POINTING_DEVICE_ENABLE | ||
87 | // Enable pointer acceleration, which increases the speed by ~2x for large | ||
88 | // displacement, while maintaining 1x speed for slow movements. See also: | ||
89 | // - `CHARYBDIS_POINTER_ACCELERATION_FACTOR` | ||
90 | # define CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
91 | |||
92 | // Automatically enable the pointer layer when moving the trackball. See also: | ||
93 | // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` | ||
94 | // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` | ||
95 | // #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
96 | #endif // POINTING_DEVICE_ENABLE | ||
97 | |||
98 | /* RGB Matrix. */ | ||
99 | |||
100 | #ifdef RGB_MATRIX_ENABLE | ||
101 | // Limit maximum brightness to keep power consumption reasonable, and avoid | ||
102 | // disconnects. | ||
103 | # undef RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
104 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 | ||
105 | |||
106 | // Rainbow swirl as startup mode. | ||
107 | # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
108 | # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
109 | |||
110 | // Slow swirl at startup. | ||
111 | # define RGB_MATRIX_STARTUP_SPD 32 | ||
112 | |||
113 | // Startup values. | ||
114 | # define RGB_MATRIX_STARTUP_HUE 0 | ||
115 | # define RGB_MATRIX_STARTUP_SAT 255 | ||
116 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
117 | # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL | ||
118 | #endif // RGB_MATRIX_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c new file mode 100644 index 000000000..ba549deec --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
20 | # include "timer.h" | ||
21 | #endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
22 | |||
23 | enum charybdis_keymap_layers { | ||
24 | LAYER_BASE = 0, | ||
25 | LAYER_FUNCTION, | ||
26 | LAYER_NAVIGATION, | ||
27 | LAYER_MEDIA, | ||
28 | LAYER_POINTER, | ||
29 | LAYER_NUMERAL, | ||
30 | LAYER_SYMBOLS, | ||
31 | }; | ||
32 | |||
33 | // Automatically enable sniping-mode on the pointer layer. | ||
34 | #define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER | ||
35 | |||
36 | #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
37 | static uint16_t auto_pointer_layer_timer = 0; | ||
38 | |||
39 | # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS | ||
40 | # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 | ||
41 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS | ||
42 | |||
43 | # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD | ||
44 | # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 | ||
45 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD | ||
46 | #endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
47 | |||
48 | #define ESC_MED LT(LAYER_MEDIA, KC_ESC) | ||
49 | #define SPC_NAV LT(LAYER_NAVIGATION, KC_SPC) | ||
50 | #define TAB_FUN LT(LAYER_FUNCTION, KC_TAB) | ||
51 | #define ENT_SYM LT(LAYER_SYMBOLS, KC_ENT) | ||
52 | #define BSP_NUM LT(LAYER_NUMERAL, KC_BSPC) | ||
53 | #define _L_PTR(KC) LT(LAYER_POINTER, KC) | ||
54 | |||
55 | // clang-format off | ||
56 | /** \brief QWERTY layout (3 rows, 10 columns). */ | ||
57 | #define LAYOUT_LAYER_BASE \ | ||
58 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ | ||
59 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, \ | ||
60 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ | ||
61 | ESC_MED, SPC_NAV, TAB_FUN, ENT_SYM, BSP_NUM | ||
62 | |||
63 | /** Convenience row shorthands. */ | ||
64 | #define _______________DEAD_HALF_ROW_______________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX | ||
65 | #define ______________HOME_ROW_GACS_L______________ KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX | ||
66 | #define ______________HOME_ROW_GACS_R______________ XXXXXXX, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI | ||
67 | |||
68 | /* | ||
69 | * Layers used on the Charybdis Nano. | ||
70 | * | ||
71 | * These layers started off heavily inspired by the Miryoku layout, but trimmed | ||
72 | * down and tailored for a stock experience that is meant to be fundation for | ||
73 | * further personalization. | ||
74 | * | ||
75 | * See https://github.com/manna-harbour/miryoku for the original layout. | ||
76 | */ | ||
77 | |||
78 | /** | ||
79 | * \brief Function layer. | ||
80 | * | ||
81 | * Secondary right-hand layer has function keys mirroring the numerals on the | ||
82 | * primary layer with extras on the pinkie column, plus system keys on the inner | ||
83 | * column. App is on the tertiary thumb key and other thumb keys are duplicated | ||
84 | * from the base layer to enable auto-repeat. | ||
85 | */ | ||
86 | #define LAYOUT_LAYER_FUNCTION \ | ||
87 | _______________DEAD_HALF_ROW_______________, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, \ | ||
88 | ______________HOME_ROW_GACS_L______________, KC_SLCK, KC_F4, KC_F5, KC_F6, KC_F11, \ | ||
89 | _______________DEAD_HALF_ROW_______________, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, \ | ||
90 | XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX | ||
91 | |||
92 | /** | ||
93 | * \brief Media layer. | ||
94 | * | ||
95 | * Tertiary left- and right-hand layer is media and RGB control. This layer is | ||
96 | * symmetrical to accomodate the left- and right-hand trackball. | ||
97 | */ | ||
98 | #define LAYOUT_LAYER_MEDIA \ | ||
99 | XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, \ | ||
100 | KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, \ | ||
101 | XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, RESET, RESET, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
102 | _______, KC_MPLY, KC_MSTP, KC_MSTP, KC_MPLY | ||
103 | |||
104 | /** \brief Mouse emulation and pointer functions. */ | ||
105 | #define LAYOUT_LAYER_POINTER \ | ||
106 | XXXXXXX, XXXXXXX, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, \ | ||
107 | ______________HOME_ROW_GACS_L______________, ______________HOME_ROW_GACS_R______________, \ | ||
108 | _______, DRGSCRL, SNIPING, EEP_RST, RESET, RESET, EEP_RST, SNIPING, DRGSCRL, _______, \ | ||
109 | KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN3, KC_BTN1 | ||
110 | |||
111 | /** | ||
112 | * \brief Navigation layer. | ||
113 | * | ||
114 | * Primary right-hand layer (left home thumb) is navigation and editing. Cursor | ||
115 | * keys are on the home position, line and page movement below, clipboard above, | ||
116 | * caps lock and insert on the inner column. Thumb keys are duplicated from the | ||
117 | * base layer to avoid having to layer change mid edit and to enable auto-repeat. | ||
118 | */ | ||
119 | #define LAYOUT_LAYER_NAVIGATION \ | ||
120 | _______________DEAD_HALF_ROW_______________, _______________DEAD_HALF_ROW_______________, \ | ||
121 | ______________HOME_ROW_GACS_L______________, KC_CLCK, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ | ||
122 | _______________DEAD_HALF_ROW_______________, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, \ | ||
123 | XXXXXXX, _______, XXXXXXX, KC_ENT, KC_BSPC | ||
124 | |||
125 | /** | ||
126 | * \brief Numeral layout. | ||
127 | * | ||
128 | * Primary left-hand layer (right home thumb) is numerals and symbols. Numerals | ||
129 | * are in the standard numpad locations with symbols in the remaining positions. | ||
130 | * `KC_DOT` is duplicated from the base layer. | ||
131 | */ | ||
132 | #define LAYOUT_LAYER_NUMERAL \ | ||
133 | KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, _______________DEAD_HALF_ROW_______________, \ | ||
134 | KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, ______________HOME_ROW_GACS_R______________, \ | ||
135 | KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, _______________DEAD_HALF_ROW_______________, \ | ||
136 | KC_DOT, KC_0, KC_MINS, XXXXXXX, _______ | ||
137 | |||
138 | /** | ||
139 | * \brief Symbols layer. | ||
140 | * | ||
141 | * Secondary left-hand layer has shifted symbols in the same locations to reduce | ||
142 | * chording when using mods with shifted symbols. `KC_LPRN` is duplicated next to | ||
143 | * `KC_RPRN`. | ||
144 | */ | ||
145 | #define LAYOUT_LAYER_SYMBOLS \ | ||
146 | KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, _______________DEAD_HALF_ROW_______________, \ | ||
147 | KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, ______________HOME_ROW_GACS_R______________, \ | ||
148 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, _______________DEAD_HALF_ROW_______________, \ | ||
149 | KC_LPRN, KC_RPRN, KC_UNDS, _______, XXXXXXX | ||
150 | |||
151 | /** | ||
152 | * \brief Add Home Row mod to a layout. | ||
153 | * | ||
154 | * Expects a 10-key per row layout. Adds support for GACS (Gui, Alt, Ctl, Shift) | ||
155 | * home row. The layout passed in parameter must contain at least 20 keycodes. | ||
156 | * | ||
157 | * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: | ||
158 | * | ||
159 | * HOME_ROW_MOD_GACS(LAYER_ALPHAS_QWERTY) | ||
160 | */ | ||
161 | #define _HOME_ROW_MOD_GACS( \ | ||
162 | L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ | ||
163 | L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ | ||
164 | ...) \ | ||
165 | L00, L01, L02, L03, L04, \ | ||
166 | R05, R06, R07, R08, R09, \ | ||
167 | LGUI_T(L10), LALT_T(L11), LCTL_T(L12), LSFT_T(L13), L14, \ | ||
168 | R15, RSFT_T(R16), RCTL_T(R17), LALT_T(R18), RGUI_T(R19), \ | ||
169 | __VA_ARGS__ | ||
170 | #define HOME_ROW_MOD_GACS(...) _HOME_ROW_MOD_GACS(__VA_ARGS__) | ||
171 | |||
172 | /** | ||
173 | * \brief Add pointer layer keys to a layout. | ||
174 | * | ||
175 | * Expects a 10-key per row layout. The layout passed in parameter must contain | ||
176 | * at least 30 keycodes. | ||
177 | * | ||
178 | * This is meant to be used with `LAYER_ALPHAS_QWERTY` defined above, eg.: | ||
179 | * | ||
180 | * POINTER_MOD(LAYER_ALPHAS_QWERTY) | ||
181 | */ | ||
182 | #define _POINTER_MOD( \ | ||
183 | L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ | ||
184 | L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ | ||
185 | L20, L21, L22, L23, L24, R25, R26, R27, R28, R29, \ | ||
186 | ...) \ | ||
187 | L00, L01, L02, L03, L04, \ | ||
188 | R05, R06, R07, R08, R09, \ | ||
189 | L10, L11, L12, L13, L14, \ | ||
190 | R15, R16, R17, R18, R19, \ | ||
191 | _L_PTR(L20), L21, L22, L23, L24, \ | ||
192 | R25, R26, R27, R28, _L_PTR(R29), \ | ||
193 | __VA_ARGS__ | ||
194 | #define POINTER_MOD(...) _POINTER_MOD(__VA_ARGS__) | ||
195 | |||
196 | #define LAYOUT_wrapper(...) LAYOUT_charybdis_3x5(__VA_ARGS__) | ||
197 | |||
198 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
199 | [LAYER_BASE] = LAYOUT_wrapper( | ||
200 | POINTER_MOD(HOME_ROW_MOD_GACS(LAYOUT_LAYER_BASE)) | ||
201 | ), | ||
202 | [LAYER_FUNCTION] = LAYOUT_wrapper(LAYOUT_LAYER_FUNCTION), | ||
203 | [LAYER_NAVIGATION] = LAYOUT_wrapper(LAYOUT_LAYER_NAVIGATION), | ||
204 | [LAYER_MEDIA] = LAYOUT_wrapper(LAYOUT_LAYER_MEDIA), | ||
205 | [LAYER_NUMERAL] = LAYOUT_wrapper(LAYOUT_LAYER_NUMERAL), | ||
206 | [LAYER_POINTER] = LAYOUT_wrapper(LAYOUT_LAYER_POINTER), | ||
207 | [LAYER_SYMBOLS] = LAYOUT_wrapper(LAYOUT_LAYER_SYMBOLS), | ||
208 | }; | ||
209 | // clang-format on | ||
210 | |||
211 | #ifdef POINTING_DEVICE_ENABLE | ||
212 | # ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
213 | report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { | ||
214 | if (abs(mouse_report.x) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD || abs(mouse_report.y) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD) { | ||
215 | if (auto_pointer_layer_timer == 0) { | ||
216 | layer_on(LAYER_POINTER); | ||
217 | # ifdef RGB_MATRIX_ENABLE | ||
218 | rgb_matrix_mode_noeeprom(RGB_MATRIX_NONE); | ||
219 | rgb_matrix_sethsv_noeeprom(HSV_GREEN); | ||
220 | # endif // RGB_MATRIX_ENABLE | ||
221 | } | ||
222 | auto_pointer_layer_timer = timer_read(); | ||
223 | } | ||
224 | return mouse_report; | ||
225 | } | ||
226 | |||
227 | void matrix_scan_kb(void) { | ||
228 | if (auto_pointer_layer_timer != 0 && TIMER_DIFF_16(timer_read(), auto_pointer_layer_timer) >= CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS) { | ||
229 | auto_pointer_layer_timer = 0; | ||
230 | layer_off(LAYER_POINTER); | ||
231 | # ifdef RGB_MATRIX_ENABLE | ||
232 | rgb_matrix_mode_noeeprom(RGB_MATRIX_STARTUP_MODE); | ||
233 | # endif // RGB_MATRIX_ENABLE | ||
234 | } | ||
235 | matrix_scan_user(); | ||
236 | } | ||
237 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
238 | |||
239 | # ifdef CHARYBDIS_AUTO_SNIPING_ON_LAYER | ||
240 | layer_state_t layer_state_set_kb(layer_state_t state) { | ||
241 | state = layer_state_set_user(state); | ||
242 | charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); | ||
243 | return state; | ||
244 | } | ||
245 | # endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER | ||
246 | #endif // POINTING_DEVICE_ENABLE | ||
247 | |||
248 | #ifdef RGB_MATRIX_ENABLE | ||
249 | // Forward-declare this helper function since it is defined in rgb_matrix.c. | ||
250 | void rgb_matrix_update_pwm_buffers(void); | ||
251 | #endif | ||
252 | |||
253 | void shutdown_user(void) { | ||
254 | #ifdef RGBLIGHT_ENABLE | ||
255 | rgblight_enable_noeeprom(); | ||
256 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); | ||
257 | rgblight_setrgb_red(); | ||
258 | #endif // RGBLIGHT_ENABLE | ||
259 | #ifdef RGB_MATRIX_ENABLE | ||
260 | rgb_matrix_set_color_all(RGB_RED); | ||
261 | rgb_matrix_update_pwm_buffers(); | ||
262 | #endif // RGB_MATRIX_ENABLE | ||
263 | } | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/readme.md b/keyboards/bastardkb/charybdis/3x5/keymaps/via/readme.md new file mode 100644 index 000000000..dc7f6f2d3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/readme.md | |||
@@ -0,0 +1,63 @@ | |||
1 | # Charybdis (3x5) `via` keymap | ||
2 | |||
3 | The Charydbis (3x5) `via` keymap is based on a QWERTY layout with [home row mods](https://precondition.github.io/home-row-mods) and [Miryoku-inspired layers](https://github.com/manna-harbour/miryoku), and some features and changes specific to the Charybdis. | ||
4 | |||
5 | This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. | ||
6 | |||
7 | This layout also supports VIA. | ||
8 | |||
9 | ## Customizing the keymap | ||
10 | |||
11 | ### Dynamic DPI scaling | ||
12 | |||
13 | Use the following keycodes to change the default DPI: | ||
14 | |||
15 | - `POINTER_DEFAULT_DPI_FORWARD`: increases the DPI; decreases when shifted; | ||
16 | - `POINTER_DEFAULT_DPI_REVERSE`: decreases the DPI; increases when shifted. | ||
17 | |||
18 | There's a maximum of 16 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. | ||
19 | |||
20 | Use the following keycodes to change the sniping mode DPI: | ||
21 | |||
22 | - `POINTER_SNIPING_DPI_FORWARD`: increases the DPI; decreases when shifted; | ||
23 | - `POINTER_SNIPING_DPI_REVERSE`: decreases the DPI; increases when shifted. | ||
24 | |||
25 | There's a maximum of 4 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. | ||
26 | |||
27 | ### Drag-scroll | ||
28 | |||
29 | Use the `DRAGSCROLL_MODE` keycode to enable drag-scroll on hold. Use the `DRAGSCROLL_TOGGLE` keycode to enable/disable drag-scroll on key press. | ||
30 | |||
31 | ### Sniping | ||
32 | |||
33 | Use the `SNIPING_MODE` keycode to enable sniping mode on hold. Use the `SNIPING_TOGGLE` keycode to enable/disable sniping mode on key press. | ||
34 | |||
35 | Change the value of `CHARYBDIS_AUTO_SNIPING_ON_LAYER` to automatically enable sniping mode on layer change. By default, sniping mode is enabled on the pointer layer: | ||
36 | |||
37 | ```c | ||
38 | #define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER | ||
39 | ``` | ||
40 | |||
41 | ### Auto pointer layer | ||
42 | |||
43 | The pointer layer can be automatically enabled when moving the trackball. To enable or disable this behavior, add or remove the following define: | ||
44 | |||
45 | ```c | ||
46 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
47 | ``` | ||
48 | |||
49 | By default, the layer is turned off 1 second after the last registered trackball movement: | ||
50 | |||
51 | ```c | ||
52 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 | ||
53 | ``` | ||
54 | |||
55 | The trigger sensibility can also be tuned. The lower the value, the more sensible the trigger: | ||
56 | |||
57 | ```c | ||
58 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 | ||
59 | ``` | ||
60 | |||
61 | ## Layout | ||
62 | |||
63 |  | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/rules.mk b/keyboards/bastardkb/charybdis/3x5/keymaps/via/rules.mk new file mode 100644 index 000000000..1e5b99807 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/rules.mk | |||
@@ -0,0 +1 @@ | |||
VIA_ENABLE = yes | |||
diff --git a/keyboards/bastardkb/charybdis/3x5/readme.md b/keyboards/bastardkb/charybdis/3x5/readme.md new file mode 100644 index 000000000..7a91035be --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/readme.md | |||
@@ -0,0 +1,15 @@ | |||
1 | # Charybdis Nano (3x5) | ||
2 | |||
3 | An ergonomic keyboard with integrated trackball. | ||
4 | |||
5 | The Charybdis is available in 4x6 and 3x5 form factor at [bastardkb.com](https://bastardkb.com). | ||
6 | |||
7 | ## Keymaps | ||
8 | |||
9 | ### [`default`](keymaps/default) | ||
10 | |||
11 | A simple QWERTY layout with 4 layers. | ||
12 | |||
13 | ### [`via`](keymaps/via) | ||
14 | |||
15 | A [Miryoku-inspired](https://github.com/manna-harbour/miryoku), feature-rich, keymap with VIA support. | ||
diff --git a/keyboards/bastardkb/charybdis/3x5/rules.mk b/keyboards/bastardkb/charybdis/3x5/rules.mk new file mode 100644 index 000000000..c5f3f0fb8 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/rules.mk | |||
@@ -0,0 +1,38 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
15 | NKRO_ENABLE = no # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
17 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | |||
20 | AUDIO_SUPPORTED = no # Audio is not supported | ||
21 | RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default | ||
22 | RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default | ||
23 | RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality | ||
24 | RGB_MATRIX_DRIVER = WS2812 | ||
25 | |||
26 | # Enable link-time optimization by default. The Charybdis packs a lot of | ||
27 | # features (RGB, Via, trackball) in a small atmega32u4 package. | ||
28 | LTO_ENABLE = yes | ||
29 | |||
30 | # Charybdis nano is a split 3x5 keyboard with a maximum of 3 thumb keys (2 on | ||
31 | # the trackball side). | ||
32 | SPLIT_KEYBOARD = yes | ||
33 | LAYOUTS = split_3x5_3 # Support community layout, in particular Manna-Harbour's Miryoku layout | ||
34 | |||
35 | POINTING_DEVICE_ENABLE = yes # Enable trackball | ||
36 | POINTING_DEVICE_DRIVER = pmw3360 | ||
37 | # https://qmk.fm/changes/2018-11-16-use-a-single-endpoint-for-hid-reports | ||
38 | MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/4x6.c b/keyboards/bastardkb/charybdis/4x6/4x6.c new file mode 100644 index 000000000..6cd8fffee --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/4x6.c | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) | ||
3 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
4 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
5 | * | ||
6 | * This program is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Publicw License as published by | ||
8 | * the Free Software Foundation, either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #include "4x6.h" | ||
21 | |||
22 | // clang-format off | ||
23 | #ifdef RGB_MATRIX_ENABLE | ||
24 | /** | ||
25 | * \brief LEDs index. | ||
26 | * | ||
27 | * ╭────────────────────────╮ ╭────────────────────────╮ | ||
28 | * 0 7 8 15 16 20 49 45 44 37 36 29 | ||
29 | * ├────────────────────────┤ ├────────────────────────┤ | ||
30 | * 1 6 9 14 17 21 50 46 43 38 35 30 | ||
31 | * ├────────────────────────┤ ├────────────────────────┤ | ||
32 | * 2 5 10 13 18 22 51 47 42 39 34 31 | ||
33 | * ├────────────────────────┤ ├────────────────────────┤ | ||
34 | * 3 4 11 12 19 23 52 48 41 40 33 32 | ||
35 | * ╰────────────────────────╯ ╰────────────────────────╯ | ||
36 | * 26 27 28 53 54 XX | ||
37 | * 25 24 55 XX | ||
38 | * ╰────────────╯ ╰────────────╯ | ||
39 | */ | ||
40 | led_config_t g_led_config = { { | ||
41 | /* Key Matrix to LED index. */ | ||
42 | // Left split. | ||
43 | { 0, 7, 8, 15, 16, 20 }, // Num row | ||
44 | { 1, 6, 9, 14, 17, 21 }, // Top row | ||
45 | { 2, 5, 10, 13, 18, 22 }, // Middle row | ||
46 | { 3, 4, 11, 12, 19, 23 }, // Bottom row | ||
47 | { NO_LED, 28, 24, 26, 27, 25 }, // Thumb cluster | ||
48 | // Right split. | ||
49 | { 29, 36, 37, 44, 45, 49 }, // Num row | ||
50 | { 30, 35, 38, 43, 46, 50 }, // Top row | ||
51 | { 31, 34, 39, 42, 47, 51 }, // Middle row | ||
52 | { 32, 33, 40, 41, 48, 52 }, // Bottom row | ||
53 | { NO_LED, 53, 55, 54, NO_LED, NO_LED }, // Thumb cluster | ||
54 | }, { | ||
55 | /* LED index to physical position. */ | ||
56 | // Left split. | ||
57 | /* index=0 */ { 0, 0 }, { 0, 12 }, { 0, 24 }, { 0, 36 }, // col 1 (left most) | ||
58 | /* index=4 */ { 16, 36 }, { 16, 24 }, { 16, 12 }, { 16, 0 }, // col 2 | ||
59 | /* index=8 */ { 32, 0 }, { 32, 12 }, { 32, 24 }, { 32, 36 }, | ||
60 | /* index=12 */ { 48, 36 }, { 48, 24 }, { 48, 12 }, { 48, 0 }, | ||
61 | /* index=16 */ { 64, 0 }, { 64, 12 }, { 64, 24 }, { 64, 36 }, | ||
62 | /* index=20 */ { 80, 0 }, { 80, 12 }, { 80, 24 }, { 80, 36 }, | ||
63 | /* index=24 */ { 112, 64 }, { 96, 64 }, { 80, 52 }, | ||
64 | /* index=27 */ { 96, 52 }, { 112, 52 }, | ||
65 | // Right split. | ||
66 | /* index=29 */ { 224, 0 }, { 224, 12 }, { 224, 24 }, { 224, 36 }, // col 12 (right most) | ||
67 | /* index=33 */ { 208, 36 }, { 208, 24 }, { 208, 12 }, { 208, 0 }, // col 11 | ||
68 | /* index=37 */ { 192, 0 }, { 192, 12 }, { 192, 24 }, { 192, 36 }, | ||
69 | /* index=41 */ { 176, 36 }, { 176, 24 }, { 176, 12 }, { 176, 0 }, | ||
70 | /* index=45 */ { 160, 0 }, { 160, 12 }, { 160, 24 }, { 160, 36 }, | ||
71 | /* index=49 */ { 144, 0 }, { 144, 12 }, { 144, 24 }, { 144, 36 }, | ||
72 | /* index=53 */ { 112, 52 }, { 128, 64 }, { 112, 64 }, | ||
73 | }, { | ||
74 | /* LED index to flag. */ | ||
75 | // Left split. | ||
76 | /* index=0 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 | ||
77 | /* index=4 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 | ||
78 | /* index=8 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
79 | /* index=12 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
80 | /* index=16 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
81 | /* index=20 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
82 | /* index=24 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster top | ||
83 | /* index=27 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster bottom | ||
84 | // Right split. | ||
85 | /* index=29 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 12 | ||
86 | /* index=33 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 11 | ||
87 | /* index=37 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
88 | /* index=41 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
89 | /* index=45 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
90 | /* index=49 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
91 | /* index=53 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster | ||
92 | } }; | ||
93 | #endif | ||
94 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/4x6.h b/keyboards/bastardkb/charybdis/4x6/4x6.h new file mode 100644 index 000000000..c26d356d6 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/4x6.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #include "charybdis.h" | ||
22 | |||
23 | // clang-format off | ||
24 | #define LAYOUT_charybdis_4x6( \ | ||
25 | k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \ | ||
26 | k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \ | ||
27 | k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \ | ||
28 | k30, k31, k32, k33, k34, k35, k85, k84, k83, k82, k81, k80, \ | ||
29 | k43, k44, k41, k91, k93, \ | ||
30 | k45, k42, k95 \ | ||
31 | ) \ | ||
32 | { \ | ||
33 | { k00, k01, k02, k03, k04, k05 }, \ | ||
34 | { k10, k11, k12, k13, k14, k15 }, \ | ||
35 | { k20, k21, k22, k23, k24, k25 }, \ | ||
36 | { k30, k31, k32, k33, k34, k35 }, \ | ||
37 | { KC_NO, k41, k42, k43, k44, k45 }, \ | ||
38 | { k50, k51, k52, k53, k54, k55 }, \ | ||
39 | { k60, k61, k62, k63, k64, k65 }, \ | ||
40 | { k70, k71, k72, k73, k74, k75 }, \ | ||
41 | { k80, k81, k82, k83, k84, k85 }, \ | ||
42 | { KC_NO, k91, KC_NO, k93, KC_NO, k95 }, \ | ||
43 | } | ||
44 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/config.h b/keyboards/bastardkb/charybdis/4x6/config.h new file mode 100644 index 000000000..f00fb382f --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/config.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #define VENDOR_ID 0xA8F8 | ||
22 | #define PRODUCT_ID 0x1833 | ||
23 | #define DEVICE_VER 0x0001 | ||
24 | #define MANUFACTURER Bastard Keyboards | ||
25 | #define PRODUCT Charybdis | ||
26 | |||
27 | /* Key matrix configuration. */ | ||
28 | |||
29 | // Rows are doubled-up. | ||
30 | #define MATRIX_ROWS 10 | ||
31 | #define MATRIX_COLS 6 | ||
32 | |||
33 | // Wiring configuration for each half. | ||
34 | #define MATRIX_ROW_PINS \ | ||
35 | { F1, B7, C6, D4, B5 } | ||
36 | #define MATRIX_COL_PINS \ | ||
37 | { D5, C7, F0, D7, E6, B4 } | ||
38 | |||
39 | #define MATRIX_ROW_PINS_RIGHT \ | ||
40 | { D5, F0, C6, D4, B5 } | ||
41 | #define MATRIX_COL_PINS_RIGHT \ | ||
42 | { F1, C7, B7, D7, E6, B4 } | ||
43 | |||
44 | #define DIODE_DIRECTION ROW2COL | ||
45 | |||
46 | #define ROTATIONAL_TRANSFORM_ANGLE -25 | ||
47 | |||
48 | /* Handedness. */ | ||
49 | #define MASTER_RIGHT | ||
50 | |||
51 | /* Bootmagic Lite configuration. */ | ||
52 | #define BOOTMAGIC_LITE_ROW 0 | ||
53 | #define BOOTMAGIC_LITE_COLUMN 0 | ||
54 | #define BOOTMAGIC_LITE_ROW_RIGHT 5 | ||
55 | #define BOOTMAGIC_LITE_COLUMN_RIGHT 0 | ||
56 | |||
57 | /* serial.c configuration (for split keyboard) */ | ||
58 | #define SOFT_SERIAL_PIN D2 | ||
59 | |||
60 | /* Set 0 if debouncing isn't needed */ | ||
61 | #define DEBOUNCE 5 | ||
62 | |||
63 | /* Disable action features. */ | ||
64 | #define NO_ACTION_MACRO // Disable old-style macro handling. | ||
65 | #define NO_ACTION_FUNCTION // Disable old-style function handling. | ||
66 | |||
67 | /* PMW3360 settings. */ | ||
68 | #define PMW3360_CS_PIN B0 | ||
69 | |||
70 | #define RGB_DI_PIN D3 | ||
71 | #define RGBLED_NUM 56 | ||
72 | #define RGBLED_SPLIT \ | ||
73 | { 29, 27 } | ||
74 | |||
75 | /* RGB matrix support. */ | ||
76 | #ifdef RGB_MATRIX_ENABLE | ||
77 | # define SPLIT_TRANSPORT_MIRROR | ||
78 | # define DRIVER_LED_TOTAL RGBLED_NUM | ||
79 | # define RGB_MATRIX_SPLIT RGBLED_SPLIT | ||
80 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 | ||
81 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
82 | # define RGB_DISABLE_WHEN_USB_SUSPENDED | ||
83 | # define RGB_MATRIX_KEYPRESSES | ||
84 | #endif | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/info.json b/keyboards/bastardkb/charybdis/4x6/info.json new file mode 100644 index 000000000..956dfe88f --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/info.json | |||
@@ -0,0 +1,67 @@ | |||
1 | { | ||
2 | "keyboard_name": "Charybdis", | ||
3 | "url": "https://www.bastardkb.com", | ||
4 | "maintainer": "Quentin Lebastard", | ||
5 | "layouts": { | ||
6 | "LAYOUT_charybdis_4x6": { | ||
7 | "layout": [ | ||
8 | { "label": "L00", "x": 0, "y": 0 }, | ||
9 | { "label": "L01", "x": 1, "y": 0 }, | ||
10 | { "label": "L02", "x": 2, "y": 0 }, | ||
11 | { "label": "L03", "x": 3, "y": 0 }, | ||
12 | { "label": "L04", "x": 4, "y": 0 }, | ||
13 | { "label": "L05", "x": 5, "y": 0 }, | ||
14 | { "label": "R00", "x": 11, "y": 0 }, | ||
15 | { "label": "R01", "x": 12, "y": 0 }, | ||
16 | { "label": "R02", "x": 13, "y": 0 }, | ||
17 | { "label": "R03", "x": 14, "y": 0 }, | ||
18 | { "label": "R04", "x": 15, "y": 0 }, | ||
19 | { "label": "R05", "x": 16, "y": 0 }, | ||
20 | { "label": "L10", "x": 0, "y": 1 }, | ||
21 | { "label": "L11", "x": 1, "y": 1 }, | ||
22 | { "label": "L12", "x": 2, "y": 1 }, | ||
23 | { "label": "L13", "x": 3, "y": 1 }, | ||
24 | { "label": "L14", "x": 4, "y": 1 }, | ||
25 | { "label": "L15", "x": 5, "y": 1 }, | ||
26 | { "label": "R10", "x": 11, "y": 1 }, | ||
27 | { "label": "R11", "x": 12, "y": 1 }, | ||
28 | { "label": "R12", "x": 13, "y": 1 }, | ||
29 | { "label": "R13", "x": 14, "y": 1 }, | ||
30 | { "label": "R14", "x": 15, "y": 1 }, | ||
31 | { "label": "R15", "x": 16, "y": 1 }, | ||
32 | { "label": "L20", "x": 0, "y": 2 }, | ||
33 | { "label": "L21", "x": 1, "y": 2 }, | ||
34 | { "label": "L22", "x": 2, "y": 2 }, | ||
35 | { "label": "L23", "x": 3, "y": 2 }, | ||
36 | { "label": "L24", "x": 4, "y": 2 }, | ||
37 | { "label": "L25", "x": 5, "y": 2 }, | ||
38 | { "label": "R20", "x": 11, "y": 2 }, | ||
39 | { "label": "R21", "x": 12, "y": 2 }, | ||
40 | { "label": "R22", "x": 13, "y": 2 }, | ||
41 | { "label": "R23", "x": 14, "y": 2 }, | ||
42 | { "label": "R24", "x": 15, "y": 2 }, | ||
43 | { "label": "R25", "x": 16, "y": 2 }, | ||
44 | { "label": "L30", "x": 0, "y": 3 }, | ||
45 | { "label": "L31", "x": 1, "y": 3 }, | ||
46 | { "label": "L32", "x": 2, "y": 3 }, | ||
47 | { "label": "L33", "x": 3, "y": 3 }, | ||
48 | { "label": "L34", "x": 4, "y": 3 }, | ||
49 | { "label": "L35", "x": 5, "y": 3 }, | ||
50 | { "label": "R30", "x": 11, "y": 3 }, | ||
51 | { "label": "R31", "x": 12, "y": 3 }, | ||
52 | { "label": "R32", "x": 13, "y": 3 }, | ||
53 | { "label": "R33", "x": 14, "y": 3 }, | ||
54 | { "label": "R34", "x": 15, "y": 3 }, | ||
55 | { "label": "R35", "x": 16, "y": 3 }, | ||
56 | { "label": "L40", "x": 5, "y": 4 }, | ||
57 | { "label": "L41", "x": 6, "y": 4 }, | ||
58 | { "label": "L42", "x": 7, "y": 4 }, | ||
59 | { "label": "R40", "x": 9, "y": 4 }, | ||
60 | { "label": "R41", "x": 10, "y": 4 }, | ||
61 | { "label": "L50", "x": 6, "y": 5 }, | ||
62 | { "label": "L51", "x": 7, "y": 5 }, | ||
63 | { "label": "R50", "x": 9, "y": 5 } | ||
64 | ] | ||
65 | } | ||
66 | } | ||
67 | } | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/default/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/default/config.h new file mode 100644 index 000000000..383b3f9dc --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/default/config.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #pragma once | ||
18 | |||
19 | /* RGB Matrix. */ | ||
20 | |||
21 | #ifdef RGB_MATRIX_ENABLE | ||
22 | // Limit maximum brightness to keep power consumption reasonable, and avoid | ||
23 | // disconnects. | ||
24 | # undef RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
25 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 | ||
26 | |||
27 | // Rainbow swirl as startup mode. | ||
28 | # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
29 | # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
30 | |||
31 | // Slow swirl at startup. | ||
32 | # define RGB_MATRIX_STARTUP_SPD 32 | ||
33 | |||
34 | // Startup values. | ||
35 | # define RGB_MATRIX_STARTUP_HUE 0 | ||
36 | # define RGB_MATRIX_STARTUP_SAT 255 | ||
37 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
38 | # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL | ||
39 | #endif // RGB_MATRIX_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c new file mode 100644 index 000000000..de8eed9c0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | enum charybdis_keymap_layers { | ||
20 | LAYER_BASE = 0, | ||
21 | LAYER_LOWER, | ||
22 | LAYER_RAISE, | ||
23 | }; | ||
24 | |||
25 | #define LOWER MO(LAYER_LOWER) | ||
26 | #define RAISE MO(LAYER_RAISE) | ||
27 | |||
28 | // clang-format off | ||
29 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
30 | [LAYER_BASE] = LAYOUT_charybdis_4x6( | ||
31 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
32 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, | ||
33 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
34 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, | ||
35 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
36 | KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
37 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
38 | KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LALT, | ||
39 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
40 | KC_LGUI, KC_SPC, LOWER, RAISE, KC_ENT, | ||
41 | KC_LALT, KC_BSPC, KC_DEL | ||
42 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
43 | ), | ||
44 | |||
45 | [LAYER_LOWER] = LAYOUT_charybdis_4x6( | ||
46 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
47 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS, | ||
48 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
49 | RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_RBRC, XXXXXXX, | ||
50 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
51 | RGB_TOG, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PEQL, | ||
52 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
53 | RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, RESET, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PDOT, | ||
54 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
55 | XXXXXXX, XXXXXXX, _______, XXXXXXX, _______, | ||
56 | XXXXXXX, XXXXXXX, KC_P0 | ||
57 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
58 | ), | ||
59 | |||
60 | [LAYER_RAISE] = LAYOUT_charybdis_4x6( | ||
61 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
62 | KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | ||
63 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
64 | KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, | ||
65 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
66 | KC_MPLY, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, KC_MUTE, | ||
67 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
68 | KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, RESET, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, | ||
69 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
70 | _______, _______, XXXXXXX, _______, XXXXXXX, | ||
71 | _______, _______, XXXXXXX | ||
72 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
73 | ), | ||
74 | }; | ||
75 | // clang-format on | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/default/readme.md b/keyboards/bastardkb/charybdis/4x6/keymaps/default/readme.md new file mode 100644 index 000000000..23a85e54d --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/default/readme.md | |||
@@ -0,0 +1,7 @@ | |||
1 | # Charybdis (4x6) default keymap | ||
2 | |||
3 | > :bulb: Have a look at the [`via` keymap](../via) for a more feature-rich layout. | ||
4 | |||
5 | The Charydbis (4x6) default keymap is inspired from the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap. | ||
6 | |||
7 | This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h new file mode 100644 index 000000000..75eb2240f --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #pragma once | ||
18 | |||
19 | #ifdef VIA_ENABLE | ||
20 | /* VIA configuration. */ | ||
21 | # define DYNAMIC_KEYMAP_LAYER_COUNT 4 | ||
22 | #endif // VIA_ENABLE | ||
23 | |||
24 | /* Disable unused features. */ | ||
25 | #define NO_ACTION_ONESHOT | ||
26 | |||
27 | #ifndef TAPPING_TERM | ||
28 | /** | ||
29 | * \brief Configure the global tapping term (default: 200ms). | ||
30 | * | ||
31 | * If you have a lot of accidental mod activations, crank up the tapping term. | ||
32 | * | ||
33 | * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term | ||
34 | */ | ||
35 | # define TAPPING_TERM 200 | ||
36 | #endif // TAPPING_TERM | ||
37 | |||
38 | /* Charybdis-specific features. */ | ||
39 | |||
40 | #ifdef POINTING_DEVICE_ENABLE | ||
41 | // Enable pointer acceleration, which increases the speed by ~2x for large | ||
42 | // displacement, while maintaining 1x speed for slow movements. | ||
43 | // - `CHARYBDIS_POINTER_ACCELERATION_FACTOR` | ||
44 | # define CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
45 | |||
46 | // Automatically enable the pointer layer when moving the trackball. See also: | ||
47 | // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` | ||
48 | // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` | ||
49 | // #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
50 | #endif // POINTING_DEVICE_ENABLE | ||
51 | |||
52 | /* RGB Matrix. */ | ||
53 | |||
54 | #ifdef RGB_MATRIX_ENABLE | ||
55 | // Limit maximum brightness to keep power consumption reasonable, and avoid | ||
56 | // disconnects. | ||
57 | # undef RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
58 | # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 | ||
59 | |||
60 | // Rainbow swirl as startup mode. | ||
61 | # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
62 | # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
63 | |||
64 | // Slow swirl at startup. | ||
65 | # define RGB_MATRIX_STARTUP_SPD 32 | ||
66 | |||
67 | // Startup values. | ||
68 | # define RGB_MATRIX_STARTUP_HUE 0 | ||
69 | # define RGB_MATRIX_STARTUP_SAT 255 | ||
70 | # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS | ||
71 | # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL | ||
72 | #endif // RGB_MATRIX_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c new file mode 100644 index 000000000..d53d580a4 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /** | ||
2 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
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 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
20 | # include "timer.h" | ||
21 | #endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
22 | |||
23 | enum charybdis_keymap_layers { | ||
24 | LAYER_BASE = 0, | ||
25 | LAYER_LOWER, | ||
26 | LAYER_RAISE, | ||
27 | LAYER_POINTER, | ||
28 | }; | ||
29 | |||
30 | /** \brief Automatically enable sniping-mode on the pointer layer. */ | ||
31 | #define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER | ||
32 | |||
33 | #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
34 | static uint16_t auto_pointer_layer_timer = 0; | ||
35 | |||
36 | # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS | ||
37 | # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 | ||
38 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS | ||
39 | |||
40 | # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD | ||
41 | # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 | ||
42 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD | ||
43 | #endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
44 | |||
45 | #define LOWER MO(LAYER_LOWER) | ||
46 | #define RAISE MO(LAYER_RAISE) | ||
47 | #define PT_Z LT(LAYER_POINTER, KC_Z) | ||
48 | #define PT_SLSH LT(LAYER_POINTER, KC_SLSH) | ||
49 | |||
50 | // clang-format off | ||
51 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
52 | [LAYER_BASE] = LAYOUT_charybdis_4x6( | ||
53 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
54 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, | ||
55 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
56 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, | ||
57 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
58 | KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
59 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
60 | KC_LCTL, PT_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, PT_SLSH, KC_LALT, | ||
61 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
62 | KC_LGUI, KC_SPC, LOWER, RAISE, KC_ENT, | ||
63 | KC_LALT, KC_BSPC, KC_DEL | ||
64 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
65 | ), | ||
66 | |||
67 | [LAYER_LOWER] = LAYOUT_charybdis_4x6( | ||
68 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
69 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS, | ||
70 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
71 | RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_RBRC, XXXXXXX, | ||
72 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
73 | RGB_TOG, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PEQL, | ||
74 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
75 | RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PDOT, | ||
76 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
77 | XXXXXXX, XXXXXXX, _______, XXXXXXX, _______, | ||
78 | XXXXXXX, XXXXXXX, KC_P0 | ||
79 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
80 | ), | ||
81 | |||
82 | [LAYER_RAISE] = LAYOUT_charybdis_4x6( | ||
83 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
84 | KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, | ||
85 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
86 | KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, | ||
87 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
88 | KC_MPLY, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, KC_MUTE, | ||
89 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
90 | KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, | ||
91 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
92 | _______, _______, XXXXXXX, _______, XXXXXXX, | ||
93 | _______, _______, XXXXXXX | ||
94 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
95 | ), | ||
96 | |||
97 | [LAYER_POINTER] = LAYOUT_charybdis_4x6( | ||
98 | // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ | ||
99 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
100 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
101 | XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
102 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
103 | XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX, | ||
104 | // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ | ||
105 | XXXXXXX, _______, DRGSCRL, SNIPING, EEP_RST, RESET, RESET, EEP_RST, SNIPING, DRGSCRL, _______, XXXXXXX, | ||
106 | // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ | ||
107 | KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN3, KC_BTN1, | ||
108 | XXXXXXX, KC_BTN2, KC_BTN2 | ||
109 | // ╰───────────────────────────╯ ╰──────────────────╯ | ||
110 | ), | ||
111 | }; | ||
112 | // clang-format on | ||
113 | |||
114 | #ifdef POINTING_DEVICE_ENABLE | ||
115 | # ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
116 | report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { | ||
117 | if (abs(mouse_report.x) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD || abs(mouse_report.y) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD) { | ||
118 | if (auto_pointer_layer_timer == 0) { | ||
119 | layer_on(LAYER_POINTER); | ||
120 | # ifdef RGB_MATRIX_ENABLE | ||
121 | rgb_matrix_mode_noeeprom(RGB_MATRIX_NONE); | ||
122 | rgb_matrix_sethsv_noeeprom(HSV_GREEN); | ||
123 | # endif // RGB_MATRIX_ENABLE | ||
124 | } | ||
125 | auto_pointer_layer_timer = timer_read(); | ||
126 | } | ||
127 | return mouse_report; | ||
128 | } | ||
129 | |||
130 | void matrix_scan_kb(void) { | ||
131 | if (auto_pointer_layer_timer != 0 && TIMER_DIFF_16(timer_read(), auto_pointer_layer_timer) >= CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS) { | ||
132 | auto_pointer_layer_timer = 0; | ||
133 | layer_off(LAYER_POINTER); | ||
134 | # ifdef RGB_MATRIX_ENABLE | ||
135 | rgb_matrix_mode_noeeprom(RGB_MATRIX_STARTUP_MODE); | ||
136 | # endif // RGB_MATRIX_ENABLE | ||
137 | } | ||
138 | matrix_scan_user(); | ||
139 | } | ||
140 | # endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
141 | |||
142 | # ifdef CHARYBDIS_AUTO_SNIPING_ON_LAYER | ||
143 | layer_state_t layer_state_set_kb(layer_state_t state) { | ||
144 | state = layer_state_set_user(state); | ||
145 | charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); | ||
146 | return state; | ||
147 | } | ||
148 | # endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER | ||
149 | #endif // POINTING_DEVICE_ENABLE | ||
150 | |||
151 | #ifdef RGB_MATRIX_ENABLE | ||
152 | // Forward-declare this helper function since it is defined in rgb_matrix.c. | ||
153 | void rgb_matrix_update_pwm_buffers(void); | ||
154 | #endif | ||
155 | |||
156 | void shutdown_user(void) { | ||
157 | #ifdef RGBLIGHT_ENABLE | ||
158 | rgblight_enable_noeeprom(); | ||
159 | rgblight_mode_noeeprom(1); | ||
160 | rgblight_setrgb_red(); | ||
161 | #endif // RGBLIGHT_ENABLE | ||
162 | #ifdef RGB_MATRIX_ENABLE | ||
163 | rgb_matrix_set_color_all(RGB_RED); | ||
164 | rgb_matrix_update_pwm_buffers(); | ||
165 | #endif // RGB_MATRIX_ENABLE | ||
166 | } | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/readme.md b/keyboards/bastardkb/charybdis/4x6/keymaps/via/readme.md new file mode 100644 index 000000000..ad2634ef0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/readme.md | |||
@@ -0,0 +1,61 @@ | |||
1 | # Charybdis (4x6) `via` keymap | ||
2 | |||
3 | The Charydbis (4x6) `via` keymap is inspired from the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap, with some features and changes specific to the Charybdis. | ||
4 | |||
5 | This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. | ||
6 | |||
7 | ## Customizing the keymap | ||
8 | |||
9 | ### Dynamic DPI scaling | ||
10 | |||
11 | Use the following keycodes to change the default DPI: | ||
12 | |||
13 | - `POINTER_DEFAULT_DPI_FORWARD`: increases the DPI; decreases when shifted; | ||
14 | - `POINTER_DEFAULT_DPI_REVERSE`: decreases the DPI; increases when shifted. | ||
15 | |||
16 | There's a maximum of 16 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. | ||
17 | |||
18 | Use the following keycodes to change the sniping mode DPI: | ||
19 | |||
20 | - `POINTER_SNIPING_DPI_FORWARD`: increases the DPI; decreases when shifted; | ||
21 | - `POINTER_SNIPING_DPI_REVERSE`: decreases the DPI; increases when shifted. | ||
22 | |||
23 | There's a maximum of 4 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. | ||
24 | |||
25 | ### Drag-scroll | ||
26 | |||
27 | Use the `DRAGSCROLL_MODE` keycode to enable drag-scroll on hold. Use the `DRAGSCROLL_TOGGLE` keycode to enable/disable drag-scroll on key press. | ||
28 | |||
29 | ### Sniping | ||
30 | |||
31 | Use the `SNIPING_MODE` keycode to enable sniping mode on hold. Use the `SNIPING_TOGGLE` keycode to enable/disable sniping mode on key press. | ||
32 | |||
33 | Change the value of `CHARYBDIS_AUTO_SNIPING_ON_LAYER` to automatically enable sniping mode on layer change. By default, sniping mode is enabled on the pointer layer: | ||
34 | |||
35 | ```c | ||
36 | #define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER | ||
37 | ``` | ||
38 | |||
39 | ### Auto pointer layer | ||
40 | |||
41 | The pointer layer can be automatically enabled when moving the trackball. To enable or disable this behavior, add or remove the following define: | ||
42 | |||
43 | ```c | ||
44 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE | ||
45 | ``` | ||
46 | |||
47 | By default, the layer is turned off 1 second after the last registered trackball movement: | ||
48 | |||
49 | ```c | ||
50 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 | ||
51 | ``` | ||
52 | |||
53 | The trigger sensibility can also be tuned. The lower the value, the more sensible the trigger: | ||
54 | |||
55 | ```c | ||
56 | #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 | ||
57 | ``` | ||
58 | |||
59 | ## Layout | ||
60 | |||
61 |  | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/rules.mk b/keyboards/bastardkb/charybdis/4x6/keymaps/via/rules.mk new file mode 100644 index 000000000..1e5b99807 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/rules.mk | |||
@@ -0,0 +1 @@ | |||
VIA_ENABLE = yes | |||
diff --git a/keyboards/bastardkb/charybdis/4x6/readme.md b/keyboards/bastardkb/charybdis/4x6/readme.md new file mode 100644 index 000000000..af2396cd6 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/readme.md | |||
@@ -0,0 +1,15 @@ | |||
1 | # Charybdis (4x6) | ||
2 | |||
3 | An ergonomic keyboard with integrated trackball. | ||
4 | |||
5 | The Charybdis is available in 4x6 and 3x5 form factor at [bastardkb.com](https://bastardkb.com). | ||
6 | |||
7 | ## Keymaps | ||
8 | |||
9 | ### [`default`](keymaps/default) | ||
10 | |||
11 | A simple QWERTY layout with 3 layers. | ||
12 | |||
13 | ### [`via`](keymaps/via) | ||
14 | |||
15 | Same as the [default](keymaps/default) keymap, but with VIA support. | ||
diff --git a/keyboards/bastardkb/charybdis/4x6/rules.mk b/keyboards/bastardkb/charybdis/4x6/rules.mk new file mode 100644 index 000000000..e137f5d4c --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/rules.mk | |||
@@ -0,0 +1,37 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = atmel-dfu | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
15 | NKRO_ENABLE = no # Enable N-Key Rollover | ||
16 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
17 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
18 | AUDIO_ENABLE = no # Audio output | ||
19 | |||
20 | AUDIO_SUPPORTED = no # Audio is not supported. | ||
21 | RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default. | ||
22 | RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default. | ||
23 | RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality | ||
24 | RGB_MATRIX_DRIVER = WS2812 | ||
25 | |||
26 | # Enable link-time optimization by default. The Charybdis packs a lot of | ||
27 | # features (RGB, Via, trackball) in a small atmega32u4 package. | ||
28 | LTO_ENABLE = yes | ||
29 | |||
30 | # Charybdis is a split 4x6 keyboard with a maximum of 5 thumb keys (3 on the | ||
31 | # trackball side). | ||
32 | SPLIT_KEYBOARD = yes | ||
33 | |||
34 | POINTING_DEVICE_ENABLE = yes # Enable trackball | ||
35 | POINTING_DEVICE_DRIVER = pmw3360 | ||
36 | # https://qmk.fm/changes/2018-11-16-use-a-single-endpoint-for-hid-reports | ||
37 | MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint | ||
diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c new file mode 100644 index 000000000..f94682ba4 --- /dev/null +++ b/keyboards/bastardkb/charybdis/charybdis.c | |||
@@ -0,0 +1,343 @@ | |||
1 | /* | ||
2 | * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) | ||
3 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
4 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
5 | * | ||
6 | * This program is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Publicw License as published by | ||
8 | * the Free Software Foundation, either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #include "charybdis.h" | ||
21 | |||
22 | #ifdef CONSOLE_ENABLE | ||
23 | # include "print.h" | ||
24 | #endif // CONSOLE_ENABLE | ||
25 | |||
26 | #ifdef POINTING_DEVICE_ENABLE | ||
27 | # ifndef CHARYBDIS_MINIMUM_DEFAULT_DPI | ||
28 | # define CHARYBDIS_MINIMUM_DEFAULT_DPI 400 | ||
29 | # endif // CHARYBDIS_MINIMUM_DEFAULT_DPI | ||
30 | |||
31 | # ifndef CHARYBDIS_DEFAULT_DPI_CONFIG_STEP | ||
32 | # define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 | ||
33 | # endif // CHARYBDIS_DEFAULT_DPI_CONFIG_STEP | ||
34 | |||
35 | # ifndef CHARYBDIS_MINIMUM_SNIPING_DPI | ||
36 | # define CHARYBDIS_MINIMUM_SNIPING_DPI 200 | ||
37 | # endif // CHARYBDIS_MINIMUM_SNIPER_MODE_DPI | ||
38 | |||
39 | # ifndef CHARYBDIS_SNIPING_DPI_CONFIG_STEP | ||
40 | # define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 | ||
41 | # endif // CHARYBDIS_SNIPING_DPI_CONFIG_STEP | ||
42 | |||
43 | // Fixed DPI for drag-scroll. | ||
44 | # ifndef CHARYBDIS_DRAGSCROLL_DPI | ||
45 | # define CHARYBDIS_DRAGSCROLL_DPI 100 | ||
46 | # endif // CHARYBDIS_DRAGSCROLL_DPI | ||
47 | |||
48 | # ifndef CHARYBDIS_DRAGSCROLL_BUFFER_SIZE | ||
49 | # define CHARYBDIS_DRAGSCROLL_BUFFER_SIZE 6 | ||
50 | # endif // !CHARYBDIS_DRAGSCROLL_BUFFER_SIZE | ||
51 | |||
52 | # ifndef CHARYBDIS_POINTER_ACCELERATION_FACTOR | ||
53 | # define CHARYBDIS_POINTER_ACCELERATION_FACTOR 24 | ||
54 | # endif // !CHARYBDIS_POINTER_ACCELERATION_FACTOR | ||
55 | |||
56 | typedef union { | ||
57 | uint8_t raw; | ||
58 | struct { | ||
59 | uint8_t pointer_default_dpi : 4; // 16 steps available. | ||
60 | uint8_t pointer_sniping_dpi : 2; // 4 steps available. | ||
61 | bool is_dragscroll_enabled : 1; | ||
62 | bool is_sniping_enabled : 1; | ||
63 | } __attribute__((packed)); | ||
64 | } charybdis_config_t; | ||
65 | |||
66 | static charybdis_config_t g_charybdis_config = {0}; | ||
67 | |||
68 | /** | ||
69 | * \brief Set the value of `config` from EEPROM. | ||
70 | * | ||
71 | * Note that `is_dragscroll_enabled` and `is_sniping_enabled` are purposefully | ||
72 | * ignored since we do not want to persist this state to memory. In practice, | ||
73 | * this state is always written to maximize write-performances. Therefore, we | ||
74 | * explicitly set them to `false` in this function. | ||
75 | */ | ||
76 | static void read_charybdis_config_from_eeprom(charybdis_config_t* config) { | ||
77 | config->raw = eeconfig_read_kb() & 0xff; | ||
78 | config->is_dragscroll_enabled = false; | ||
79 | config->is_sniping_enabled = false; | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * \brief Save the value of `config` to eeprom. | ||
84 | * | ||
85 | * Note that all values are written verbatim, including whether drag-scroll | ||
86 | * and/or sniper mode are enabled. `read_charybdis_config_from_eeprom(…)` | ||
87 | * resets these 2 values to `false` since it does not make sense to persist | ||
88 | * these across reboots of the board. | ||
89 | */ | ||
90 | static void write_charybdis_config_to_eeprom(charybdis_config_t* config) { eeconfig_update_kb(config->raw); } | ||
91 | |||
92 | /** \brief Return the current value of the pointer's default DPI. */ | ||
93 | static uint16_t get_pointer_default_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_default_dpi * CHARYBDIS_DEFAULT_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_DEFAULT_DPI; } | ||
94 | |||
95 | /** \brief Return the current value of the pointer's sniper-mode DPI. */ | ||
96 | static uint16_t get_pointer_sniping_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_sniping_dpi * CHARYBDIS_SNIPING_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_SNIPING_DPI; } | ||
97 | |||
98 | /** \brief Set the appropriate DPI for the input config. */ | ||
99 | static void maybe_update_pointing_device_cpi(charybdis_config_t* config) { | ||
100 | if (config->is_dragscroll_enabled) { | ||
101 | pointing_device_set_cpi(CHARYBDIS_DRAGSCROLL_DPI); | ||
102 | } else if (config->is_sniping_enabled) { | ||
103 | pointing_device_set_cpi(get_pointer_sniping_dpi(config)); | ||
104 | } else { | ||
105 | pointing_device_set_cpi(get_pointer_default_dpi(config)); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * \brief Update the pointer's default DPI to the next or previous step. | ||
111 | * | ||
112 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
113 | * The increment/decrement steps are equal to CHARYBDIS_DEFAULT_DPI_CONFIG_STEP. | ||
114 | */ | ||
115 | static void step_pointer_default_dpi(charybdis_config_t* config, bool forward) { | ||
116 | config->pointer_default_dpi += forward ? 1 : -1; | ||
117 | maybe_update_pointing_device_cpi(config); | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * \brief Update the pointer's sniper-mode DPI to the next or previous step. | ||
122 | * | ||
123 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
124 | * The increment/decrement steps are equal to CHARYBDIS_SNIPING_DPI_CONFIG_STEP. | ||
125 | */ | ||
126 | static void step_pointer_sniping_dpi(charybdis_config_t* config, bool forward) { | ||
127 | config->pointer_sniping_dpi += forward ? 1 : -1; | ||
128 | maybe_update_pointing_device_cpi(config); | ||
129 | } | ||
130 | |||
131 | uint16_t charybdis_get_pointer_default_dpi(void) { return get_pointer_default_dpi(&g_charybdis_config); } | ||
132 | |||
133 | uint16_t charybdis_get_pointer_sniping_dpi(void) { return get_pointer_sniping_dpi(&g_charybdis_config); } | ||
134 | |||
135 | void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward) { step_pointer_default_dpi(&g_charybdis_config, forward); } | ||
136 | |||
137 | void charybdis_cycle_pointer_default_dpi(bool forward) { | ||
138 | step_pointer_default_dpi(&g_charybdis_config, forward); | ||
139 | write_charybdis_config_to_eeprom(&g_charybdis_config); | ||
140 | } | ||
141 | |||
142 | void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward) { step_pointer_sniping_dpi(&g_charybdis_config, forward); } | ||
143 | |||
144 | void charybdis_cycle_pointer_sniping_dpi(bool forward) { | ||
145 | step_pointer_sniping_dpi(&g_charybdis_config, forward); | ||
146 | write_charybdis_config_to_eeprom(&g_charybdis_config); | ||
147 | } | ||
148 | |||
149 | bool charybdis_get_pointer_sniping_enabled(void) { return g_charybdis_config.is_sniping_enabled; } | ||
150 | |||
151 | void charybdis_set_pointer_sniping_enabled(bool enable) { | ||
152 | g_charybdis_config.is_sniping_enabled = enable; | ||
153 | maybe_update_pointing_device_cpi(&g_charybdis_config); | ||
154 | } | ||
155 | |||
156 | bool charybdis_get_pointer_dragscroll_enabled(void) { return g_charybdis_config.is_dragscroll_enabled; } | ||
157 | |||
158 | void charybdis_set_pointer_dragscroll_enabled(bool enable) { | ||
159 | g_charybdis_config.is_dragscroll_enabled = enable; | ||
160 | maybe_update_pointing_device_cpi(&g_charybdis_config); | ||
161 | } | ||
162 | |||
163 | void pointing_device_init_kb(void) { maybe_update_pointing_device_cpi(&g_charybdis_config); } | ||
164 | |||
165 | # ifndef CONSTRAIN_HID | ||
166 | # define CONSTRAIN_HID(value) ((value) < -127 ? -127 : ((value) > 127 ? 127 : (value))) | ||
167 | # endif // !CONSTRAIN_HID | ||
168 | |||
169 | /** | ||
170 | * \brief Add optional acceleration effect. | ||
171 | * | ||
172 | * If `CHARYBDIS_ENABLE_POINTER_ACCELERATION` is defined, add a simple and naive | ||
173 | * acceleration effect to the provided value. Return the value unchanged | ||
174 | * otherwise. | ||
175 | */ | ||
176 | # ifndef DISPLACEMENT_WITH_ACCELERATION | ||
177 | # ifdef CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
178 | # define DISPLACEMENT_WITH_ACCELERATION(d) (CONSTRAIN_HID(d > 0 ? d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d : -d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d)) | ||
179 | # else // !CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
180 | # define DISPLACEMENT_WITH_ACCELERATION(d) (d) | ||
181 | # endif // CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
182 | # endif // !DISPLACEMENT_WITH_ACCELERATION | ||
183 | |||
184 | /** | ||
185 | * \brief Augment the pointing device behavior. | ||
186 | * | ||
187 | * Implement the Charybdis-specific features for pointing devices: | ||
188 | * - Drag-scroll | ||
189 | * - Sniping | ||
190 | * - Acceleration | ||
191 | */ | ||
192 | static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { | ||
193 | static int16_t scroll_buffer_x = 0; | ||
194 | static int16_t scroll_buffer_y = 0; | ||
195 | if (g_charybdis_config.is_dragscroll_enabled) { | ||
196 | # ifdef CHARYBDIS_DRAGSCROLL_REVERSE_X | ||
197 | scroll_buffer_x -= mouse_report->x; | ||
198 | # else | ||
199 | scroll_buffer_x += mouse_report->x; | ||
200 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_X | ||
201 | # ifdef CHARYBDIS_DRAGSCROLL_REVERSE_Y | ||
202 | scroll_buffer_y -= mouse_report->y; | ||
203 | # else | ||
204 | scroll_buffer_y += mouse_report->y; | ||
205 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_Y | ||
206 | mouse_report->x = 0; | ||
207 | mouse_report->y = 0; | ||
208 | if (abs(scroll_buffer_x) > CHARYBDIS_DRAGSCROLL_BUFFER_SIZE) { | ||
209 | mouse_report->h = scroll_buffer_x > 0 ? 1 : -1; | ||
210 | scroll_buffer_x = 0; | ||
211 | } | ||
212 | if (abs(scroll_buffer_y) > CHARYBDIS_DRAGSCROLL_BUFFER_SIZE) { | ||
213 | mouse_report->v = scroll_buffer_y > 0 ? 1 : -1; | ||
214 | scroll_buffer_y = 0; | ||
215 | } | ||
216 | } else if (!g_charybdis_config.is_sniping_enabled) { | ||
217 | mouse_report->x = DISPLACEMENT_WITH_ACCELERATION(mouse_report->x); | ||
218 | mouse_report->y = DISPLACEMENT_WITH_ACCELERATION(mouse_report->y); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { | ||
223 | if (is_keyboard_master()) { | ||
224 | pointing_device_task_charybdis(&mouse_report); | ||
225 | mouse_report = pointing_device_task_user(mouse_report); | ||
226 | } | ||
227 | return mouse_report; | ||
228 | } | ||
229 | |||
230 | # if defined(POINTING_DEVICE_ENABLE) && !defined(NO_CHARYBDIS_KEYCODES) | ||
231 | /** \brief Whether SHIFT mod is enabled. */ | ||
232 | static bool has_shift_mod(void) { | ||
233 | # ifdef NO_ACTION_ONESHOT | ||
234 | return mod_config(get_mods()) & MOD_MASK_SHIFT; | ||
235 | # else | ||
236 | return mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; | ||
237 | # endif // NO_ACTION_ONESHOT | ||
238 | } | ||
239 | # endif // POINTING_DEVICE_ENABLE && !NO_CHARYBDIS_KEYCODES | ||
240 | |||
241 | /** | ||
242 | * \brief Outputs the Charybdis configuration to console. | ||
243 | * | ||
244 | * Prints the in-memory configuration structure to console, for debugging. | ||
245 | * Includes: | ||
246 | * - raw value | ||
247 | * - drag-scroll: on/off | ||
248 | * - sniping: on/off | ||
249 | * - default DPI: internal table index/actual DPI | ||
250 | * - sniping DPI: internal table index/actual DPI | ||
251 | */ | ||
252 | static void debug_charybdis_config_to_console(charybdis_config_t* config) { | ||
253 | # ifdef CONSOLE_ENABLE | ||
254 | dprintf("(charybdis) process_record_kb: config = {\n" | ||
255 | "\traw = 0x%04X,\n" | ||
256 | "\t{\n" | ||
257 | "\t\tis_dragscroll_enabled=%b\n" | ||
258 | "\t\tis_sniping_enabled=%b\n" | ||
259 | "\t\tdefault_dpi=0x%02X (%ld)\n" | ||
260 | "\t\tsniping_dpi=0x%01X (%ld)\n" | ||
261 | "\t}\n" | ||
262 | "}\n", | ||
263 | config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config)); | ||
264 | # endif // CONSOLE_ENABLE | ||
265 | } | ||
266 | |||
267 | bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | ||
268 | if (!process_record_user(keycode, record)) { | ||
269 | debug_charybdis_config_to_console(&g_charybdis_config); | ||
270 | return false; | ||
271 | } | ||
272 | # ifdef POINTING_DEVICE_ENABLE | ||
273 | # ifndef NO_CHARYBDIS_KEYCODES | ||
274 | switch (keycode) { | ||
275 | case POINTER_DEFAULT_DPI_FORWARD: | ||
276 | if (record->event.pressed) { | ||
277 | // Step backward if shifted, forward otherwise. | ||
278 | charybdis_cycle_pointer_default_dpi(/* forward= */ !has_shift_mod()); | ||
279 | } | ||
280 | break; | ||
281 | case POINTER_DEFAULT_DPI_REVERSE: | ||
282 | if (record->event.pressed) { | ||
283 | // Step forward if shifted, backward otherwise. | ||
284 | charybdis_cycle_pointer_default_dpi(/* forward= */ has_shift_mod()); | ||
285 | } | ||
286 | break; | ||
287 | case POINTER_SNIPING_DPI_FORWARD: | ||
288 | if (record->event.pressed) { | ||
289 | // Step backward if shifted, forward otherwise. | ||
290 | charybdis_cycle_pointer_sniping_dpi(/* forward= */ !has_shift_mod()); | ||
291 | } | ||
292 | break; | ||
293 | case POINTER_SNIPING_DPI_REVERSE: | ||
294 | if (record->event.pressed) { | ||
295 | // Step forward if shifted, backward otherwise. | ||
296 | charybdis_cycle_pointer_sniping_dpi(/* forward= */ has_shift_mod()); | ||
297 | } | ||
298 | break; | ||
299 | case SNIPING_MODE: | ||
300 | charybdis_set_pointer_sniping_enabled(record->event.pressed); | ||
301 | break; | ||
302 | case SNIPING_MODE_TOGGLE: | ||
303 | if (record->event.pressed) { | ||
304 | charybdis_set_pointer_sniping_enabled(!charybdis_get_pointer_sniping_enabled()); | ||
305 | } | ||
306 | break; | ||
307 | case DRAGSCROLL_MODE: | ||
308 | charybdis_set_pointer_dragscroll_enabled(record->event.pressed); | ||
309 | break; | ||
310 | case DRAGSCROLL_MODE_TOGGLE: | ||
311 | if (record->event.pressed) { | ||
312 | charybdis_set_pointer_dragscroll_enabled(!charybdis_get_pointer_dragscroll_enabled()); | ||
313 | } | ||
314 | break; | ||
315 | } | ||
316 | # endif // !NO_CHARYBDIS_KEYCODES | ||
317 | # ifndef MOUSEKEY_ENABLE | ||
318 | // Simulate mouse keys if full support is not enabled (reduces firmware size | ||
319 | // while maintaining support for mouse keys). | ||
320 | if (IS_MOUSEKEY_BUTTON(keycode)) { | ||
321 | report_mouse_t mouse_report = pointing_device_get_report(); | ||
322 | mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, record->event.pressed, keycode - KC_MS_BTN1); | ||
323 | pointing_device_set_report(mouse_report); | ||
324 | pointing_device_send(); | ||
325 | } | ||
326 | # endif // !MOUSEKEY_ENABLE | ||
327 | # endif // POINTING_DEVICE_ENABLE | ||
328 | debug_charybdis_config_to_console(&g_charybdis_config); | ||
329 | return true; | ||
330 | } | ||
331 | |||
332 | void eeconfig_init_kb(void) { | ||
333 | g_charybdis_config.raw = 0; | ||
334 | write_charybdis_config_to_eeprom(&g_charybdis_config); | ||
335 | maybe_update_pointing_device_cpi(&g_charybdis_config); | ||
336 | eeconfig_init_user(); | ||
337 | } | ||
338 | |||
339 | void matrix_init_kb(void) { | ||
340 | read_charybdis_config_from_eeprom(&g_charybdis_config); | ||
341 | matrix_init_user(); | ||
342 | } | ||
343 | #endif // POINTING_DEVICE_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/charybdis.h b/keyboards/bastardkb/charybdis/charybdis.h new file mode 100644 index 000000000..42423c0c9 --- /dev/null +++ b/keyboards/bastardkb/charybdis/charybdis.h | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | // clang-format off | ||
22 | #if defined(KEYBOARD_bastardkb_charybdis_3x5) | ||
23 | # include "3x5.h" | ||
24 | #elif defined(KEYBOARD_bastardkb_charybdis_4x6) | ||
25 | # include "4x6.h" | ||
26 | #else | ||
27 | # error "Unsuported format" | ||
28 | #endif | ||
29 | // clang-format on | ||
30 | |||
31 | #include "quantum.h" | ||
32 | |||
33 | #ifdef POINTING_DEVICE_ENABLE | ||
34 | # ifndef NO_CHARYBDIS_KEYCODES | ||
35 | enum charybdis_keycodes { | ||
36 | # ifdef VIA_ENABLE | ||
37 | POINTER_DEFAULT_DPI_FORWARD = USER00, | ||
38 | # else | ||
39 | POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE, | ||
40 | # endif // VIA_ENABLE | ||
41 | POINTER_DEFAULT_DPI_REVERSE, | ||
42 | POINTER_SNIPING_DPI_FORWARD, | ||
43 | POINTER_SNIPING_DPI_REVERSE, | ||
44 | SNIPING_MODE, | ||
45 | SNIPING_MODE_TOGGLE, | ||
46 | DRAGSCROLL_MODE, | ||
47 | DRAGSCROLL_MODE_TOGGLE, | ||
48 | CHARYBDIS_SAFE_RANGE, | ||
49 | }; | ||
50 | |||
51 | # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD | ||
52 | # define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE | ||
53 | # define S_D_MOD POINTER_SNIPING_DPI_FORWARD | ||
54 | # define S_D_RMOD POINTER_SNIPING_DPI_REVERSE | ||
55 | # define SNIPING SNIPING_MODE | ||
56 | # define SNP_TOG SNIPING_MODE_TOGGLE | ||
57 | # define DRGSCRL DRAGSCROLL_MODE | ||
58 | # define DRG_TOG DRAGSCROLL_MODE_TOGGLE | ||
59 | # endif // !NO_CHARYBDIS_KEYCODES | ||
60 | |||
61 | /** \brief Return the current DPI value for the pointer's default mode. */ | ||
62 | uint16_t charybdis_get_pointer_default_dpi(void); | ||
63 | |||
64 | /** | ||
65 | * \brief Update the pointer's default DPI to the next or previous step. | ||
66 | * | ||
67 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
68 | * The increment/decrement steps are equal to CHARYBDIS_DEFAULT_DPI_CONFIG_STEP. | ||
69 | * | ||
70 | * The new value is persisted in EEPROM. | ||
71 | */ | ||
72 | void charybdis_cycle_pointer_default_dpi(bool forward); | ||
73 | |||
74 | /** | ||
75 | * \brief Same as `charybdis_cycle_pointer_default_dpi`, but do not write to | ||
76 | * EEPROM. | ||
77 | * | ||
78 | * This means that reseting the board will revert the value to the last | ||
79 | * persisted one. | ||
80 | */ | ||
81 | void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward); | ||
82 | |||
83 | /** \brief Return the current DPI value for the pointer's sniper-mode. */ | ||
84 | uint16_t charybdis_get_pointer_sniping_dpi(void); | ||
85 | |||
86 | /** | ||
87 | * \brief Update the pointer's sniper-mode DPI to the next or previous step. | ||
88 | * | ||
89 | * Increases the DPI value if `forward` is `true`, decreases it otherwise. | ||
90 | * The increment/decrement steps are equal to CHARYBDIS_SNIPING_DPI_CONFIG_STEP. | ||
91 | * | ||
92 | * The new value is persisted in EEPROM. | ||
93 | */ | ||
94 | void charybdis_cycle_pointer_sniping_dpi(bool forward); | ||
95 | |||
96 | /** | ||
97 | * \brief Same as `charybdis_cycle_pointer_sniping_dpi`, but do not write to | ||
98 | * EEPROM. | ||
99 | * | ||
100 | * This means that reseting the board will revert the value to the last | ||
101 | * persisted one. | ||
102 | */ | ||
103 | void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward); | ||
104 | |||
105 | /** \brief Whether sniper-mode is enabled. */ | ||
106 | bool charybdis_get_pointer_sniping_enabled(void); | ||
107 | |||
108 | /** | ||
109 | * \brief Enable/disable sniper mode. | ||
110 | * | ||
111 | * When sniper mode is enabled the dpi is reduced to slow down the pointer for | ||
112 | * more accurate movements. | ||
113 | */ | ||
114 | void charybdis_set_pointer_sniping_enabled(bool enable); | ||
115 | |||
116 | /** \brief Whether drag-scroll is enabled. */ | ||
117 | bool charybdis_get_pointer_dragscroll_enabled(void); | ||
118 | |||
119 | /** | ||
120 | * \brief Enable/disable drag-scroll mode. | ||
121 | * | ||
122 | * When drag-scroll mode is enabled, horizontal and vertical pointer movements | ||
123 | * are translated into horizontal and vertical scroll movements. | ||
124 | */ | ||
125 | void charybdis_set_pointer_dragscroll_enabled(bool enable); | ||
126 | #endif // POINTING_DEVICE_ENABLE | ||
diff --git a/keyboards/bastardkb/charybdis/config.h b/keyboards/bastardkb/charybdis/config.h new file mode 100644 index 000000000..c88451335 --- /dev/null +++ b/keyboards/bastardkb/charybdis/config.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
3 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
4 | * | ||
5 | * 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 | * the Free Software Foundation, either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* Pointing device configuration. */ | ||
24 | |||
25 | // Enable use of pointing device on slave split. | ||
26 | #define SPLIT_POINTING_ENABLE | ||
27 | |||
28 | // Pointing device is on the right split. | ||
29 | #define POINTING_DEVICE_RIGHT | ||
30 | |||
31 | // Limits the frequency that the sensor is polled for motion. | ||
32 | #define POINTING_DEVICE_TASK_THROTTLE_MS 1 | ||
33 | |||
34 | /** \brief Invert X axis on mouse reports. */ | ||
35 | #define POINTING_DEVICE_INVERT_X | ||
diff --git a/keyboards/bastardkb/charybdis/post_config.h b/keyboards/bastardkb/charybdis/post_config.h new file mode 100644 index 000000000..540751f6c --- /dev/null +++ b/keyboards/bastardkb/charybdis/post_config.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | * Copyright 2015 Jack Humbert | ||
4 | * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> | ||
5 | * Copyright 2021 Charly Delay <charly@codesink.dev> (@0xcharly) | ||
6 | * | ||
7 | * This program is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation, either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | #pragma once | ||
22 | |||
23 | /* Mouse config. */ | ||
24 | |||
25 | #ifndef MOUSEKEY_MOVE_DELTA | ||
26 | # ifndef MK_KINETIC_SPEED | ||
27 | # define MOUSEKEY_MOVE_DELTA 5 | ||
28 | # else // MK_KINETIC_SPEED | ||
29 | # define MOUSEKEY_MOVE_DELTA 25 | ||
30 | # endif // !MK_KINETIC_SPEED | ||
31 | #endif // !MOUSEKEY_MOVE_DELTA | ||
32 | |||
33 | #ifndef MOUSEKEY_DELAY | ||
34 | # ifndef MK_KINETIC_SPEED | ||
35 | # define MOUSEKEY_DELAY 300 | ||
36 | # else // MK_KINETIC_SPEED | ||
37 | # define MOUSEKEY_DELAY 8 | ||
38 | # endif // !MK_KINETIC_SPEED | ||
39 | #endif // !MOUSEKEY_DELAY | ||
40 | |||
41 | #ifndef MOUSEKEY_INTERVAL | ||
42 | # ifndef MK_KINETIC_SPEED | ||
43 | # define MOUSEKEY_INTERVAL 50 | ||
44 | # else // MK_KINETIC_SPEED | ||
45 | # define MOUSEKEY_INTERVAL 20 | ||
46 | # endif // !MK_KINETIC_SPEED | ||
47 | #endif // !MOUSEKEY_INTERNAL | ||
48 | |||
49 | #ifndef MOUSEKEY_MAX_SPEED | ||
50 | # define MOUSEKEY_MAX_SPEED 7 | ||
51 | #endif // !MOUSEKEY_MAX_SPEED | ||
52 | |||
53 | #ifndef MOUSEKEY_TIME_TO_MAX | ||
54 | # define MOUSEKEY_TIME_TO_MAX 60 | ||
55 | #endif // !MOUSEKEY_TIME_TO_MAX | ||
56 | |||
57 | #ifndef MOUSEKEY_INITIAL_SPEED | ||
58 | # define MOUSEKEY_INITIAL_SPEED 100 | ||
59 | #endif // !MOUSEKEY_INITIAL_SPEED | ||
60 | |||
61 | #ifndef MOUSEKEY_BASE_SPEED | ||
62 | # define MOUSEKEY_BASE_SPEED 1000 | ||
63 | #endif // !MOUSEKEY_BASE_SPEED | ||
64 | |||
65 | #ifndef MOUSEKEY_DECELERATED_SPEED | ||
66 | # define MOUSEKEY_DECELERATED_SPEED 400 | ||
67 | #endif // !MOUSEKEY_DECELERATED_SPEED | ||
68 | |||
69 | #ifndef MOUSEKEY_ACCELERATED_SPEED | ||
70 | # define MOUSEKEY_ACCELERATED_SPEED 3000 | ||
71 | #endif // !MOUSEKEY_ACCELERATED_SPEED | ||
72 | |||
73 | /* Mouse scroll config. */ | ||
74 | |||
75 | #ifndef MOUSEKEY_WHEEL_DELAY | ||
76 | # define MOUSEKEY_WHEEL_DELAY 15 | ||
77 | #endif // !MOUSEKEY_WHEEL_DELAY | ||
78 | |||
79 | #ifndef MOUSEKEY_WHEEL_DELTA | ||
80 | # define MOUSEKEY_WHEEL_DELTA 1 | ||
81 | #endif // !MOUSEKEY_WHEEL_DELTA | ||
82 | |||
83 | #ifndef MOUSEKEY_WHEEL_INTERVAL | ||
84 | # define MOUSEKEY_WHEEL_INTERVAL 50 | ||
85 | #endif // !MOUSEKEY_WHEEL_INTERVAL | ||
86 | |||
87 | #ifndef MOUSEKEY_WHEEL_MAX_SPEED | ||
88 | # define MOUSEKEY_WHEEL_MAX_SPEED 8 | ||
89 | #endif // !MOUSEKEY_WHEEL_MAX_SPEED | ||
90 | |||
91 | #ifndef MOUSEKEY_WHEEL_TIME_TO_MAX | ||
92 | # define MOUSEKEY_WHEEL_TIME_TO_MAX 80 | ||
93 | #endif // !MOUSEKEY_WHEEL_TIME_TO_MAX | ||
94 | |||
95 | #ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS | ||
96 | # define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8 | ||
97 | #endif // !MOUSEKEY_WHEEL_INITIAL_MOVEMENTS | ||
98 | |||
99 | #ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS | ||
100 | # define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48 | ||
101 | #endif // !MOUSEKEY_WHEEL_BASE_MOVEMENTS | ||
102 | |||
103 | #ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS | ||
104 | # define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 | ||
105 | #endif // !MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS | ||
106 | |||
107 | #ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS | ||
108 | # define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 | ||
109 | #endif // !MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS | ||
diff --git a/keyboards/bastardkb/charybdis/readme.md b/keyboards/bastardkb/charybdis/readme.md new file mode 100644 index 000000000..461f33117 --- /dev/null +++ b/keyboards/bastardkb/charybdis/readme.md | |||
@@ -0,0 +1,178 @@ | |||
1 | # Charybdis (6x4, 5x3 "Nano") | ||
2 | |||
3 | An ergonomic keyboard with integrated trackball. | ||
4 | |||
5 | Engineered to be a full mouse replacement solution with high-quality, custom-developed components. | ||
6 | |||
7 | There are 6x4 and 5x3 "Nano" versions. | ||
8 | |||
9 | - Keyboard Maintainer: [Bastard Keyboards](https://github.com/Bastardkb) | ||
10 | - Hardware Supported: elite-C V4 | ||
11 | - Hardware Availability: [Bastard Keyboards](https://bastardkb.com) | ||
12 | |||
13 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | ||
14 | |||
15 | Brand new to QMK? Start with the [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
16 | |||
17 | Check out the [keyboard build guides](https://docs.bastardkb.com) for the Charybdis and other ergonomic keyboards. | ||
18 | |||
19 | ## Building the firmware | ||
20 | |||
21 | ### Charybdis (4x6) | ||
22 | |||
23 | The `default` keymap is inspired from the original [Dactyl Manuform](../../handwired/dactyl_manuform) layout. | ||
24 | |||
25 | ```shell | ||
26 | qmk compile -kb bastardkb/charybdis/4x6 -km default | ||
27 | ``` | ||
28 | |||
29 | Check out the `via` layout if you're looking for VIA support: | ||
30 | |||
31 | ```shell | ||
32 | qmk compile -kb bastardkb/charybdis/4x6 -km via | ||
33 | ``` | ||
34 | |||
35 | ### Charybdis (3x5) | ||
36 | |||
37 | The `default` keymap is inspired from the original [Dactyl Manuform](../../handwired/dactyl_manuform) layout. | ||
38 | |||
39 | ```shell | ||
40 | qmk compile -kb bastardkb/charybdis/3x5 -km default | ||
41 | ``` | ||
42 | |||
43 | Check out the `via` layout if you're looking for VIA support: | ||
44 | |||
45 | ```shell | ||
46 | qmk compile -kb bastardkb/charybdis/3x5 -km via | ||
47 | ``` | ||
48 | |||
49 | ## Customizing the firmware | ||
50 | |||
51 | ### Dynamic DPI scaling | ||
52 | |||
53 | The pointer's DPI can be changed at runtime. | ||
54 | |||
55 | By default, the DPI is set to `400`. The Charybdis supports up to 16 different DPI values. By default, it cycles between `400` and `3400`, with a step of `200` (_ie._ `400`, `600`, `800`, …, `3400`). | ||
56 | |||
57 | Calling `charybdis_cycle_pointer_default_dpi(bool forward)` will cycle forward or backward the possible values. | ||
58 | |||
59 | Use `charybdis_cycle_pointer_default_dpi_noeeprom(bool forward)` to change the DPI value without persisting the change to EEPROM (_ie._ resetting the board will revert to the last saved value). | ||
60 | |||
61 | `charybdis_get_pointer_default_dpi()` returns the current DPI value. | ||
62 | |||
63 | This behavior can be further customized with the following defines: | ||
64 | |||
65 | ```c | ||
66 | #define CHARYBDIS_MINIMUM_DEFAULT_DPI 400 | ||
67 | #define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 | ||
68 | ``` | ||
69 | |||
70 | ### Drag-scroll | ||
71 | |||
72 | Drag-scroll enables scrolling with the trackball. When drag-scroll is enabled, the trackball's `x` and `y` movements are converted into `h` (horizontal) and `v` (vertical) movement, effectively sending scroll instructions to the host system. | ||
73 | |||
74 | Call `charybdis_set_pointer_dragscroll_enabled(bool enable)` to enable/disable drag-scroll. | ||
75 | |||
76 | `charybdis_get_pointer_dragscroll_enabled()` returns whether sniping mode is currently enabled. | ||
77 | |||
78 | To invert the horizontal scrolling direction, define `CHARYBDIS_DRAGSCROLL_REVERSE_X`: | ||
79 | |||
80 | ```c | ||
81 | #define CHARYBDIS_DRAGSCROLL_REVERSE_X | ||
82 | ``` | ||
83 | |||
84 | To invert the vertical scrolling direction (_ie._ mimic macOS "natural" scroll direction), define `CHARYBDIS_DRAGSCROLL_REVERSE_Y`: | ||
85 | |||
86 | ```c | ||
87 | #define CHARYBDIS_DRAGSCROLL_REVERSE_Y | ||
88 | ``` | ||
89 | |||
90 | This only affects the vertical scroll direction. | ||
91 | |||
92 | ### Sniping mode | ||
93 | |||
94 | Sniping mode slows down the pointer for more precise gestures. It is useful when combined with a higher default DPI. | ||
95 | |||
96 | Call `charybdis_set_pointer_sniping_enabled(bool enable)` to enable/disable sniping mode. | ||
97 | |||
98 | `charybdis_get_pointer_sniping_enabled()` returns whether sniping mode is currently enabled. | ||
99 | |||
100 | Like the default pointer's DPI, the sniper mode DPI can be changed at runtime. | ||
101 | |||
102 | By default, sniping mode lowers the DPI to `200`. This can be changed at runtime: the Charybdis supports up to 4 different DPI values for sniping mode. By default, it cycles between `200`, `300`, `400` and `500`. | ||
103 | |||
104 | Calling `charybdis_cycle_pointer_sniping_dpi(bool forward)` will cycle forward or backward the possible values. | ||
105 | |||
106 | Use `charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward)` to change the sniping mode DPI value without persisting the change to EEPROM (_ie._ resetting the board will revert to the last saved value). | ||
107 | |||
108 | `charybdis_get_pointer_sniping_dpi()` returns the current sniping mode DPI value. | ||
109 | |||
110 | This behavior can be further customized with the following defines: | ||
111 | |||
112 | ```c | ||
113 | #define CHARYBDIS_MINIMUM_SNIPING_DPI 200 | ||
114 | #define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 | ||
115 | ``` | ||
116 | |||
117 | ### Acceleration | ||
118 | |||
119 | By default, the pointer's movements are linear. To enable acceleration, add the following define: | ||
120 | |||
121 | ```c | ||
122 | #define CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
123 | ``` | ||
124 | |||
125 | The acceleration factor can be further tune _via_ the `CHARYBDIS_POINTER_ACCELERATION_FACTOR`: | ||
126 | |||
127 | ```c | ||
128 | #define CHARYBDIS_POINTER_ACCELERATION_FACTOR 24 | ||
129 | ``` | ||
130 | |||
131 | ### Custom keycodes | ||
132 | |||
133 | The Charybdis firmware defines a number of keycodes to leverage its features, namely: | ||
134 | |||
135 | ``` | ||
136 | #ifndef NO_CHARYBDIS_KEYCODES | ||
137 | enum charybdis_keycodes { | ||
138 | POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE, | ||
139 | POINTER_DEFAULT_DPI_REVERSE, | ||
140 | POINTER_SNIPING_DPI_FORWARD, | ||
141 | POINTER_SNIPING_DPI_REVERSE, | ||
142 | SNIPING_MODE, | ||
143 | SNIPING_MODE_TOGGLE, | ||
144 | DRAGSCROLL_MODE, | ||
145 | DRAGSCROLL_MODE_TOGGLE, | ||
146 | CHARYBDIS_SAFE_RANGE, | ||
147 | }; | ||
148 | |||
149 | #define DPI_MOD POINTER_DEFAULT_DPI_FORWARD | ||
150 | #define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE | ||
151 | #define S_D_MOD POINTER_SNIPING_DPI_FORWARD | ||
152 | #define S_D_RMOD POINTER_SNIPING_DPI_REVERSE | ||
153 | #define SNIPING SNIPING_MODE | ||
154 | #define SNP_TOG SNIPING_MODE_TOGGLE | ||
155 | #define DRGSCRL DRAGSCROLL_MODE | ||
156 | #define DRG_TOG DRAGSCROLL_MODE_TOGGLE | ||
157 | #endif // !NO_CHARYBDIS_KEYCODES | ||
158 | ``` | ||
159 | |||
160 | Users extending the keycode set themselves (either in their keymap, or in their userspace) must start at `CHARYBDIS_SAFE_RANGE` to avoid conflicts, _eg._: | ||
161 | |||
162 | ```c | ||
163 | enum userspace_keycodes { | ||
164 | #ifndef NO_CHARYBDIS_KEYCODES | ||
165 | MY_FIRST_KEYCODE = CHARYBDIS_SAFE_RANGE, | ||
166 | #else | ||
167 | MY_FIRST_KEYCODE = SAFE_RANGE, | ||
168 | #endif // !NO_CHARYBDIS_KEYCODES | ||
169 | MY_SECOND_KEYCODE, | ||
170 | … | ||
171 | }; | ||
172 | ``` | ||
173 | |||
174 | To disable the custom keycodes, and reduce binary size, simply add a definition in `config.h`: | ||
175 | |||
176 | ```c | ||
177 | #define NO_CHARYBDIS_KEYCODES | ||
178 | ``` | ||