diff options
author | N2-Sumikko <54104281+N2-Sumikko@users.noreply.github.com> | 2021-07-30 00:42:28 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 08:42:28 -0700 |
commit | dc2dfe2a6c8fa14839959680cae1d063b2f9546e (patch) | |
tree | 1bcc204063e44262691b58c4ed37922129206a7b | |
parent | 3a48cd64cbaa8d7eb9c6984e532bfa95f87c93b7 (diff) | |
download | qmk_firmware-dc2dfe2a6c8fa14839959680cae1d063b2f9546e.tar.gz qmk_firmware-dc2dfe2a6c8fa14839959680cae1d063b2f9546e.zip |
[Keyboard] Add halfcliff keyboard (#13515)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r-- | keyboards/halfcliff/config.h | 69 | ||||
-rw-r--r-- | keyboards/halfcliff/halfcliff.c | 92 | ||||
-rw-r--r-- | keyboards/halfcliff/halfcliff.h | 58 | ||||
-rw-r--r-- | keyboards/halfcliff/info.json | 88 | ||||
-rw-r--r-- | keyboards/halfcliff/keymaps/default/keymap.c | 109 | ||||
-rw-r--r-- | keyboards/halfcliff/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/halfcliff/keymaps/via/keymap.c | 112 | ||||
-rw-r--r-- | keyboards/halfcliff/keymaps/via/readme.md | 1 | ||||
-rw-r--r-- | keyboards/halfcliff/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/halfcliff/matrix.c | 277 | ||||
-rw-r--r-- | keyboards/halfcliff/readme.md | 19 | ||||
-rw-r--r-- | keyboards/halfcliff/rules.mk | 29 |
12 files changed, 856 insertions, 0 deletions
diff --git a/keyboards/halfcliff/config.h b/keyboards/halfcliff/config.h new file mode 100644 index 000000000..287fd2f4a --- /dev/null +++ b/keyboards/halfcliff/config.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | Copyright 2021 n2 | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x0335 | ||
24 | #define PRODUCT_ID 0x0021 | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER n2 | ||
27 | #define PRODUCT halfcliff | ||
28 | |||
29 | /* key matrix size */ | ||
30 | #define MATRIX_ROWS 20 | ||
31 | #define MATRIX_COLS 5 | ||
32 | |||
33 | #define MATRIX_ROW_PINS { F5, F6, F7, D7, B5, F5, F6, F7, D7, B5 } | ||
34 | #define MATRIX_COL_PINS { B4, E6, C6, B6, B2 } | ||
35 | #define UNUSED_PINS | ||
36 | |||
37 | //#define NUMBER_OF_ENCODERS 1 | ||
38 | #define ENCODERS_PAD_A { D4 } | ||
39 | #define ENCODERS_PAD_B { F4 } | ||
40 | #define ENCODER_RESOLUTION 2 | ||
41 | |||
42 | /* | ||
43 | * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. | ||
44 | */ | ||
45 | #define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6 | ||
46 | |||
47 | #define RGB_DI_PIN D3 | ||
48 | #ifdef RGB_DI_PIN | ||
49 | #define RGBLED_NUM 10 | ||
50 | #define RGBLIGHT_SPLIT | ||
51 | #define RGBLED_SPLIT { 5, 5 } | ||
52 | #define RGBLIGHT_HUE_STEP 8 | ||
53 | #define RGBLIGHT_SAT_STEP 8 | ||
54 | #define RGBLIGHT_VAL_STEP 8 | ||
55 | #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ | ||
56 | #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ | ||
57 | #endif | ||
58 | |||
59 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
60 | #define DEBOUNCE 5 | ||
61 | |||
62 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
63 | #define LOCKING_SUPPORT_ENABLE | ||
64 | /* Locking resynchronize hack */ | ||
65 | #define LOCKING_RESYNC_ENABLE | ||
66 | |||
67 | /* disable these deprecated features by default */ | ||
68 | #define NO_ACTION_MACRO | ||
69 | #define NO_ACTION_FUNCTION | ||
diff --git a/keyboards/halfcliff/halfcliff.c b/keyboards/halfcliff/halfcliff.c new file mode 100644 index 000000000..999e9036d --- /dev/null +++ b/keyboards/halfcliff/halfcliff.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* Copyright 2021 n2 | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include "halfcliff.h" | ||
18 | |||
19 | #ifdef OLED_DRIVER_ENABLE | ||
20 | |||
21 | // Defines names for use in layer keycodes and the keymap | ||
22 | enum layer_names { | ||
23 | _DEFAULT = 0, | ||
24 | _RAISE, | ||
25 | _LOWER, | ||
26 | _ADJUST | ||
27 | /* _FN */ | ||
28 | }; | ||
29 | |||
30 | __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
31 | if (!is_keyboard_master()) { | ||
32 | return OLED_ROTATION_180; // flips the display 180 degrees if offhand | ||
33 | } | ||
34 | return rotation; | ||
35 | } | ||
36 | |||
37 | __attribute__((weak)) void oled_task_user(void) { | ||
38 | if (!is_keyboard_master()) { | ||
39 | static const char PROGMEM qmk_logo[] = { | ||
40 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, | ||
41 | 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, | ||
42 | 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 | ||
43 | }; | ||
44 | oled_write_P(qmk_logo, false); | ||
45 | } else { | ||
46 | // Host Keyboard Layer Status | ||
47 | oled_write_P(PSTR("Layer: "), false); | ||
48 | switch (get_highest_layer(layer_state)) { | ||
49 | case _DEFAULT: | ||
50 | oled_write_P(PSTR("DEFAULT\n"), false); | ||
51 | break; | ||
52 | case _RAISE: | ||
53 | oled_write_P(PSTR("RAISE\n"), false); | ||
54 | break; | ||
55 | case _LOWER: | ||
56 | oled_write_P(PSTR("LOWER\n"), false); | ||
57 | break; | ||
58 | case _ADJUST: | ||
59 | oled_write_P(PSTR("ADJUST\n"), false); | ||
60 | break; | ||
61 | default: | ||
62 | // Or use the write_ln shortcut over adding '\n' to the end of your string | ||
63 | oled_write_ln_P(PSTR("Undefined"), false); | ||
64 | }; | ||
65 | // Host Keyboard LED Status | ||
66 | led_t led_state = host_keyboard_led_state(); | ||
67 | oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false); | ||
68 | oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false); | ||
69 | oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK\n") : PSTR(" \n"), false); | ||
70 | } | ||
71 | } | ||
72 | #endif | ||
73 | |||
74 | #ifdef ENCODER_ENABLE | ||
75 | bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
76 | if (!encoder_update_user(index, clockwise)) { return false; } | ||
77 | if (index == 0) { /* Left side encoder */ | ||
78 | if (clockwise) { | ||
79 | tap_code(KC_WH_U); | ||
80 | } else { | ||
81 | tap_code(KC_WH_D); | ||
82 | } | ||
83 | } else if (index == 1) { /* Right side encoder */ | ||
84 | if (clockwise) { | ||
85 | tap_code(KC_WH_U); | ||
86 | } else { | ||
87 | tap_code(KC_WH_D); | ||
88 | } | ||
89 | } | ||
90 | return true; | ||
91 | } | ||
92 | #endif | ||
diff --git a/keyboards/halfcliff/halfcliff.h b/keyboards/halfcliff/halfcliff.h new file mode 100644 index 000000000..6e4c80864 --- /dev/null +++ b/keyboards/halfcliff/halfcliff.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright 2021 n2 | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #pragma once | ||
18 | |||
19 | #include "quantum.h" | ||
20 | |||
21 | /* This is a shortcut to help you visually see your layout. | ||
22 | * | ||
23 | * The first section contains all of the arguments representing the physical | ||
24 | * layout of the board and position of the keys. | ||
25 | * | ||
26 | * The second converts the arguments into a two-dimensional array which | ||
27 | * represents the switch matrix. | ||
28 | */ | ||
29 | |||
30 | #define LAYOUT( \ | ||
31 | l51,l50,l00,l01,l02,l03,l04,r04,r03,r02,r01,r00,r50,r51,r52,\ | ||
32 | l61,l60,l10,l11,l12,l13,l14,r14,r13,r12,r11,r10,r60,r61,r62,\ | ||
33 | l71,l70,l20,l21,l22,l23,l24,r24,r23,r22,r21,r20,r70,r71,r72,\ | ||
34 | l81,l80,l30,l31,l32,l33,l34,r34,r33,r32,r31,r30,r80,r81,r82,\ | ||
35 | l91,l90,l40,l41,l42,l43,l44,r44,r43,r42,r41,r40,r90,r91,r92\ | ||
36 | ) \ | ||
37 | { \ | ||
38 | {l00, l01, l02, l03, l04 }, \ | ||
39 | {l10, l11, l12, l13, l14 }, \ | ||
40 | {l20, l21, l22, l23, l24 }, \ | ||
41 | {l30, l31, l32, l33, l34 }, \ | ||
42 | {l40, l41, l42, l43, l44 }, \ | ||
43 | {l50, l51, KC_NO,KC_NO,KC_NO}, \ | ||
44 | {l60, l61, KC_NO,KC_NO,KC_NO}, \ | ||
45 | {l70, l71, KC_NO,KC_NO,KC_NO}, \ | ||
46 | {l80, l81, KC_NO,KC_NO,KC_NO}, \ | ||
47 | {l90, l91, KC_NO,KC_NO,KC_NO}, \ | ||
48 | {r00, r01, r02, r03, r04 }, \ | ||
49 | {r10, r11, r12, r13, r14 }, \ | ||
50 | {r20, r21, r22, r23, r24 }, \ | ||
51 | {r30, r31, r32, r33, r34 }, \ | ||
52 | {r40, r41, r42, r43, r44 }, \ | ||
53 | {r50, r51, r52, KC_NO,KC_NO}, \ | ||
54 | {r60, r61, r62, KC_NO,KC_NO}, \ | ||
55 | {r70, r71, r72, KC_NO,KC_NO}, \ | ||
56 | {r80, r81, r82, KC_NO,KC_NO}, \ | ||
57 | {r90, r91, r92, KC_NO,KC_NO}, \ | ||
58 | } | ||
diff --git a/keyboards/halfcliff/info.json b/keyboards/halfcliff/info.json new file mode 100644 index 000000000..2a859bb4c --- /dev/null +++ b/keyboards/halfcliff/info.json | |||
@@ -0,0 +1,88 @@ | |||
1 | { | ||
2 | "keyboard_name": "halfcliff", | ||
3 | "url": "https://github.com/N2-Sumikko", | ||
4 | "maintainer": "n2", | ||
5 | "width": 17.25, | ||
6 | "height": 5, | ||
7 | "layouts": { | ||
8 | "LAYOUT": { | ||
9 | "layout": [ | ||
10 | {"x":0.75,"y":0}, | ||
11 | {"x":1.75,"y":0}, | ||
12 | {"x":2.75,"y":0}, | ||
13 | {"x":3.75,"y":0}, | ||
14 | {"x":4.75,"y":0}, | ||
15 | {"x":5.75,"y":0}, | ||
16 | {"x":6.75,"y":0}, | ||
17 | {"x":8.25,"y":0}, | ||
18 | {"x":9.25,"y":0}, | ||
19 | {"x":10.25,"y":0}, | ||
20 | {"x":11.25,"y":0}, | ||
21 | {"x":12.25,"y":0}, | ||
22 | {"x":13.25,"y":0}, | ||
23 | {"x":14.25,"y":0}, | ||
24 | {"x":15.25,"y":0}, | ||
25 | {"x":0.25,"y":1,"w":1.5}, | ||
26 | {"x":1.75,"y":1}, | ||
27 | {"x":2.75,"y":1}, | ||
28 | {"x":3.75,"y":1}, | ||
29 | {"x":4.75,"y":1}, | ||
30 | {"x":5.75,"y":1}, | ||
31 | {"x":6.75,"y":1}, | ||
32 | {"x":8.25,"y":1}, | ||
33 | {"x":9.25,"y":1}, | ||
34 | {"x":10.25,"y":1}, | ||
35 | {"x":11.25,"y":1}, | ||
36 | {"x":12.25,"y":1}, | ||
37 | {"x":13.25,"y":1}, | ||
38 | {"x":14.25,"y":1}, | ||
39 | {"x":16.25,"y":0}, | ||
40 | {"x":0,"y":2,"w":1.75}, | ||
41 | {"x":1.75,"y":2}, | ||
42 | {"x":2.75,"y":2}, | ||
43 | {"x":3.75,"y":2}, | ||
44 | {"x":4.75,"y":2}, | ||
45 | {"x":5.75,"y":2}, | ||
46 | {"x":6.75,"y":2}, | ||
47 | {"x":8.25,"y":2}, | ||
48 | {"x":9.25,"y":2}, | ||
49 | {"x":10.25,"y":2}, | ||
50 | {"x":11.25,"y":2}, | ||
51 | {"x":12.25,"y":2}, | ||
52 | {"x":13.25,"y":2}, | ||
53 | {"x":14.25,"y":2}, | ||
54 | {"x":15.5,"y":1,"w":1.25,"h":2}, | ||
55 | {"x":0,"y":3,"w":1.75}, | ||
56 | {"x":1.75,"y":3}, | ||
57 | {"x":2.75,"y":3}, | ||
58 | {"x":3.75,"y":3}, | ||
59 | {"x":4.75,"y":3}, | ||
60 | {"x":5.75,"y":3}, | ||
61 | {"x":6.75,"y":3}, | ||
62 | {"x":8.25,"y":3}, | ||
63 | {"x":9.25,"y":3}, | ||
64 | {"x":10.25,"y":3}, | ||
65 | {"x":11.25,"y":3}, | ||
66 | {"x":12.25,"y":3}, | ||
67 | {"x":13.25,"y":3}, | ||
68 | {"x":14.25,"y":3}, | ||
69 | {"x":15.25,"y":3,"w":2}, | ||
70 | {"x":0.5,"y":4,"w":1.25}, | ||
71 | {"x":1.75,"y":4}, | ||
72 | {"x":2.75,"y":4}, | ||
73 | {"x":3.75,"y":4}, | ||
74 | {"x":4.75,"y":4}, | ||
75 | {"x":5.75,"y":4}, | ||
76 | {"x":6.75,"y":4}, | ||
77 | {"x":8.25,"y":4}, | ||
78 | {"x":9.25,"y":4}, | ||
79 | {"x":10.25,"y":4}, | ||
80 | {"x":11.25,"y":4}, | ||
81 | {"x":12.25,"y":4}, | ||
82 | {"x":13.25,"y":4}, | ||
83 | {"x":14.25,"y":4}, | ||
84 | {"x":15.25,"y":4} | ||
85 | ] | ||
86 | } | ||
87 | } | ||
88 | } \ No newline at end of file | ||
diff --git a/keyboards/halfcliff/keymaps/default/keymap.c b/keyboards/halfcliff/keymaps/default/keymap.c new file mode 100644 index 000000000..02743f5d4 --- /dev/null +++ b/keyboards/halfcliff/keymaps/default/keymap.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* Copyright 2021 n2 | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include QMK_KEYBOARD_H | ||
17 | #include "keymap_jp.h" | ||
18 | |||
19 | // Defines names for use in layer keycodes and the keymap | ||
20 | enum layer_names { | ||
21 | _DEFAULT = 0, | ||
22 | _RAISE, | ||
23 | _LOWER, | ||
24 | _ADJUST | ||
25 | /* _FN */ | ||
26 | }; | ||
27 | |||
28 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
29 | /* DEFAULT | ||
30 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
31 | * |ZEN/HAN | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | ^ | \ | | ||
32 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
33 | * | TAB | q | w | e | r | t | | y | u | i | o | p | @ | [ | BSPC | | ||
34 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
35 | * | CAPS | a | s | d | f | g | | h | j | k | l | ; | : | ] | ENT | | ||
36 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
37 | * | LSHIFT | z | x | c | v | b | | n | m | , | . | / | \ | UP | RSHIFT | | ||
38 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
39 | * | CTRL | LGUI | ALT | MUHEN | SPACE | SPACE | LOWER | RAISE | SPACE | HENKAN | KANA | APP | LEFT | DOWN | RIGHT | | ||
40 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
41 | */ | ||
42 | [_DEFAULT] = LAYOUT( | ||
43 | KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, | ||
44 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, _______, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT , JP_LBRC, KC_BSPC, | ||
45 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, _______, KC_H, KC_J, KC_K, KC_L, KC_SCLN, JP_COLN, JP_RBRC, KC_ENT, | ||
46 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, JP_BSLS, KC_UP, KC_RSFT, | ||
47 | KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_SPC, MO(_LOWER), MO(_RAISE), KC_SPC, KC_HENK, KC_KANA, KC_APP, KC_LEFT, KC_DOWN, KC_RGHT | ||
48 | ), | ||
49 | /* RAISE | ||
50 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
51 | * | | | | | | | | | | | | | | | | | ||
52 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
53 | * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | | | ||
54 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
55 | * | | | | | | | | | | | | | | | | | ||
56 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
57 | * | | | | | | | | | | | | | | | | | ||
58 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
59 | * | | | | | | | | | | | | | | | | | ||
60 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
61 | */ | ||
62 | [_RAISE] = LAYOUT( | ||
63 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
64 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, | ||
65 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
66 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
67 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
68 | ), | ||
69 | /* LOWER | ||
70 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
71 | * | | | | | | |RGB_TOG | | | | | | | | | | ||
72 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
73 | * | | | | | | |RGB_VAI | | | | | | | | | | ||
74 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
75 | * | | | | | | |RGB_HUI | | | | | | | | | | ||
76 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
77 | * | | | | | | |RGB_SAI | | | | | | | | | | ||
78 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
79 | * | | | | | | | | | | | | | | | | | ||
80 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
81 | */ | ||
82 | [_LOWER] = LAYOUT( | ||
83 | _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, | ||
84 | _______, _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
85 | _______, _______, _______, _______, _______, _______, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
86 | _______, _______, _______, _______, _______, _______, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
87 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
88 | ), | ||
89 | /* ADJUST | ||
90 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
91 | * | | | | | | | | | | | | | | | | | ||
92 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
93 | * | | | | | | | | | | | | | | | | | ||
94 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
95 | * | | | | | | | | | | | | | | | | | ||
96 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
97 | * | | | | | | | | | | | | | | | | | ||
98 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
99 | * | | | | | | | | | | | | | | | | | ||
100 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
101 | */ | ||
102 | [_ADJUST] = LAYOUT( | ||
103 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
104 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
105 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
106 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
107 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
108 | ) | ||
109 | }; | ||
diff --git a/keyboards/halfcliff/keymaps/default/readme.md b/keyboards/halfcliff/keymaps/default/readme.md new file mode 100644 index 000000000..2924c68c2 --- /dev/null +++ b/keyboards/halfcliff/keymaps/default/readme.md | |||
@@ -0,0 +1 @@ | |||
# The default keymap for halfcliff | |||
diff --git a/keyboards/halfcliff/keymaps/via/keymap.c b/keyboards/halfcliff/keymaps/via/keymap.c new file mode 100644 index 000000000..e0a825e7c --- /dev/null +++ b/keyboards/halfcliff/keymaps/via/keymap.c | |||
@@ -0,0 +1,112 @@ | |||
1 | /* Copyright 2021 n2 | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include QMK_KEYBOARD_H | ||
17 | #include "keymap_jp.h" | ||
18 | |||
19 | #define RAISE FN_MO13 | ||
20 | #define LOWER FN_MO23 | ||
21 | |||
22 | // Defines names for use in layer keycodes and the keymap | ||
23 | enum layer_names { | ||
24 | _DEFAULT = 0, | ||
25 | _RAISE, | ||
26 | _LOWER, | ||
27 | _ADJUST | ||
28 | /* _FN */ | ||
29 | }; | ||
30 | |||
31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
32 | /* DEFAULT | ||
33 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
34 | * |ZEN/HAN | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | ^ | \ | | ||
35 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
36 | * | TAB | q | w | e | r | t | | y | u | i | o | p | @ | [ | BSPC | | ||
37 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
38 | * | CAPS | a | s | d | f | g | | h | j | k | l | ; | : | ] | ENT | | ||
39 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
40 | * | LSHIFT | z | x | c | v | b | | n | m | , | . | / | \ | UP | RSHIFT | | ||
41 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
42 | * | CTRL | LGUI | ALT | MUHEN | SPACE | SPACE | LOWER | RAISE | SPACE | HENKAN | KANA | APP | LEFT | DOWN | RIGHT | | ||
43 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
44 | */ | ||
45 | [_DEFAULT] = LAYOUT( | ||
46 | KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, | ||
47 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, _______, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT , JP_LBRC, KC_BSPC, | ||
48 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, _______, KC_H, KC_J, KC_K, KC_L, KC_SCLN, JP_COLN, JP_RBRC, KC_ENT, | ||
49 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, JP_BSLS, KC_UP, KC_RSFT, | ||
50 | KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_SPC, FN_MO23, FN_MO13, KC_SPC, KC_HENK, KC_KANA, KC_APP, KC_LEFT, KC_DOWN, KC_RGHT | ||
51 | ), | ||
52 | /* RAISE | ||
53 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
54 | * | | | | | | | | | | | | | | | | | ||
55 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
56 | * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | | | ||
57 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
58 | * | | | | | | | | | | | | | | | | | ||
59 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
60 | * | | | | | | | | | | | | | | | | | ||
61 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
62 | * | | | | | | | | | | | | | | | | | ||
63 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
64 | */ | ||
65 | [_RAISE] = LAYOUT( | ||
66 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
67 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, | ||
68 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
69 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
70 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
71 | ), | ||
72 | /* LOWER | ||
73 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
74 | * | | | | | | |RGB_TOG | | | | | | | | | | ||
75 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
76 | * | | | | | | |RGB_VAI | | | | | | | | | | ||
77 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
78 | * | | | | | | |RGB_HUI | | | | | | | | | | ||
79 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
80 | * | | | | | | |RGB_SAI | | | | | | | | | | ||
81 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
82 | * | | | | | | | | | | | | | | | | | ||
83 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
84 | */ | ||
85 | [_LOWER] = LAYOUT( | ||
86 | _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, | ||
87 | _______, _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
88 | _______, _______, _______, _______, _______, _______, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
89 | _______, _______, _______, _______, _______, _______, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, | ||
90 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
91 | ), | ||
92 | /* ADJUST | ||
93 | * ,--------------------------------------------------------------------------------------------------------------------------------------. | ||
94 | * | | | | | | | | | | | | | | | | | ||
95 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
96 | * | | | | | | | | | | | | | | | | | ||
97 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
98 | * | | | | | | | | | | | | | | | | | ||
99 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
100 | * | | | | | | | | | | | | | | | | | ||
101 | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| | ||
102 | * | | | | | | | | | | | | | | | | | ||
103 | * `--------------------------------------------------------------------------------------------------------------------------------------' | ||
104 | */ | ||
105 | [_ADJUST] = LAYOUT( | ||
106 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
107 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
108 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
109 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
110 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
111 | ) | ||
112 | }; | ||
diff --git a/keyboards/halfcliff/keymaps/via/readme.md b/keyboards/halfcliff/keymaps/via/readme.md new file mode 100644 index 000000000..2924c68c2 --- /dev/null +++ b/keyboards/halfcliff/keymaps/via/readme.md | |||
@@ -0,0 +1 @@ | |||
# The default keymap for halfcliff | |||
diff --git a/keyboards/halfcliff/keymaps/via/rules.mk b/keyboards/halfcliff/keymaps/via/rules.mk new file mode 100644 index 000000000..1e5b99807 --- /dev/null +++ b/keyboards/halfcliff/keymaps/via/rules.mk | |||
@@ -0,0 +1 @@ | |||
VIA_ENABLE = yes | |||
diff --git a/keyboards/halfcliff/matrix.c b/keyboards/halfcliff/matrix.c new file mode 100644 index 000000000..556b75ca5 --- /dev/null +++ b/keyboards/halfcliff/matrix.c | |||
@@ -0,0 +1,277 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | #include <stdint.h> | ||
18 | #include <stdbool.h> | ||
19 | #include "util.h" | ||
20 | #include "matrix.h" | ||
21 | #include "debounce.h" | ||
22 | #include "quantum.h" | ||
23 | #include "split_util.h" | ||
24 | #include "config.h" | ||
25 | #include "transport.h" | ||
26 | |||
27 | #define ERROR_DISCONNECT_COUNT 5 | ||
28 | |||
29 | #define ROWS_PER_HAND (MATRIX_ROWS / 2) | ||
30 | |||
31 | static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
32 | static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
33 | |||
34 | /* matrix state(1:on, 0:off) */ | ||
35 | static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | ||
36 | static matrix_row_t matrix[MATRIX_ROWS]; // debounced values | ||
37 | |||
38 | // row offsets for each hand | ||
39 | uint8_t thisHand, thatHand; | ||
40 | |||
41 | // user-defined overridable functions | ||
42 | __attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } | ||
43 | |||
44 | __attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } | ||
45 | |||
46 | __attribute__((weak)) void matrix_init_user(void) {} | ||
47 | |||
48 | __attribute__((weak)) void matrix_scan_user(void) {} | ||
49 | |||
50 | __attribute__((weak)) void matrix_slave_scan_user(void) {} | ||
51 | |||
52 | matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } | ||
53 | |||
54 | void matrix_print(void) {} | ||
55 | |||
56 | static inline void setPinOutput_writeLow(pin_t pin) { | ||
57 | ATOMIC_BLOCK_FORCEON { | ||
58 | setPinOutput(pin); | ||
59 | writePinLow(pin); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | static inline void setPinInputHigh_atomic(pin_t pin) { | ||
64 | ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } | ||
65 | } | ||
66 | |||
67 | // matrix code | ||
68 | static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } | ||
69 | |||
70 | static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } | ||
71 | |||
72 | static void unselect_rows(void) { | ||
73 | for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
74 | setPinInputHigh_atomic(row_pins[x]); | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { | ||
79 | // Start with a clear matrix row | ||
80 | matrix_row_t current_row_value = 0; | ||
81 | |||
82 | // Select row | ||
83 | select_row(current_row); | ||
84 | wait_us(30); | ||
85 | |||
86 | // For each col... | ||
87 | for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { | ||
88 | // Select the col pin to read (active low) | ||
89 | uint8_t pin_state = readPin(col_pins[col_index]); | ||
90 | |||
91 | // Populate the matrix row with the state of the col pin | ||
92 | current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); | ||
93 | } | ||
94 | |||
95 | // Unselect row | ||
96 | unselect_row(current_row); | ||
97 | if (current_row + 1 < MATRIX_ROWS) { | ||
98 | wait_us(30); // wait for row signal to go HIGH | ||
99 | } | ||
100 | |||
101 | // If the row has changed, store the row and return the changed flag. | ||
102 | if (current_matrix[current_row] != current_row_value) { | ||
103 | current_matrix[current_row] = current_row_value; | ||
104 | return true; | ||
105 | } | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } | ||
110 | |||
111 | static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } | ||
112 | |||
113 | static void unselect_cols(void) { | ||
114 | for (uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
115 | setPinInputHigh_atomic(col_pins[x]); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | static void init_pins(void) { | ||
120 | unselect_rows(); | ||
121 | for (uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
122 | setPinInputHigh_atomic(col_pins[x]); | ||
123 | } | ||
124 | unselect_cols(); | ||
125 | for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { | ||
126 | setPinInputHigh_atomic(row_pins[x]); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { | ||
131 | bool matrix_changed = false; | ||
132 | |||
133 | // Select col | ||
134 | select_col(current_col); | ||
135 | wait_us(30); | ||
136 | |||
137 | // For each row... | ||
138 | for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { | ||
139 | // Store last value of row prior to reading | ||
140 | matrix_row_t last_row_value = current_matrix[row_index]; | ||
141 | matrix_row_t current_row_value = last_row_value; | ||
142 | |||
143 | // Check row pin state | ||
144 | if (readPin(row_pins[row_index]) == 0) { | ||
145 | // Pin LO, set col bit | ||
146 | current_row_value |= (MATRIX_ROW_SHIFTER << current_col); | ||
147 | } else { | ||
148 | // Pin HI, clear col bit | ||
149 | current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col); | ||
150 | } | ||
151 | |||
152 | // Determine if the matrix changed state | ||
153 | if ((last_row_value != current_row_value)) { | ||
154 | matrix_changed |= true; | ||
155 | current_matrix[row_index] = current_row_value; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | // Unselect col | ||
160 | unselect_col(current_col); | ||
161 | if (current_col + 1 < MATRIX_COLS) { | ||
162 | wait_us(30); // wait for col signal to go HIGH | ||
163 | } | ||
164 | |||
165 | return matrix_changed; | ||
166 | } | ||
167 | |||
168 | void matrix_init(void) { | ||
169 | split_pre_init(); | ||
170 | |||
171 | // Set pinout for right half if pinout for that half is defined | ||
172 | if (!isLeftHand) { | ||
173 | #ifdef DIRECT_PINS_RIGHT | ||
174 | const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT; | ||
175 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
176 | for (uint8_t j = 0; j < MATRIX_COLS; j++) { | ||
177 | direct_pins[i][j] = direct_pins_right[i][j]; | ||
178 | } | ||
179 | } | ||
180 | #endif | ||
181 | #ifdef MATRIX_ROW_PINS_RIGHT | ||
182 | const pin_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT; | ||
183 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
184 | row_pins[i] = row_pins_right[i]; | ||
185 | } | ||
186 | #endif | ||
187 | #ifdef MATRIX_COL_PINS_RIGHT | ||
188 | const pin_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT; | ||
189 | for (uint8_t i = 0; i < MATRIX_COLS; i++) { | ||
190 | col_pins[i] = col_pins_right[i]; | ||
191 | } | ||
192 | #endif | ||
193 | } | ||
194 | |||
195 | thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
196 | thatHand = ROWS_PER_HAND - thisHand; | ||
197 | |||
198 | // initialize key pins | ||
199 | init_pins(); | ||
200 | |||
201 | // initialize matrix state: all keys off | ||
202 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
203 | raw_matrix[i] = 0; | ||
204 | matrix[i] = 0; | ||
205 | } | ||
206 | |||
207 | debounce_init(ROWS_PER_HAND); | ||
208 | |||
209 | matrix_init_quantum(); | ||
210 | |||
211 | split_post_init(); | ||
212 | } | ||
213 | |||
214 | bool matrix_post_scan(void) { | ||
215 | bool changed = false; | ||
216 | if (is_keyboard_master()) { | ||
217 | static uint8_t error_count; | ||
218 | |||
219 | matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; | ||
220 | if (!transport_master(matrix + thisHand, slave_matrix)) { | ||
221 | error_count++; | ||
222 | |||
223 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
224 | // reset other half if disconnected | ||
225 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
226 | matrix[thatHand + i] = 0; | ||
227 | slave_matrix[i] = 0; | ||
228 | } | ||
229 | |||
230 | changed = true; | ||
231 | } | ||
232 | } else { | ||
233 | error_count = 0; | ||
234 | |||
235 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
236 | if (matrix[thatHand + i] != slave_matrix[i]) { | ||
237 | matrix[thatHand + i] = slave_matrix[i]; | ||
238 | changed = true; | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | |||
243 | matrix_scan_quantum(); | ||
244 | } else { | ||
245 | transport_slave(matrix + thatHand, matrix + thisHand); | ||
246 | |||
247 | matrix_slave_scan_user(); | ||
248 | } | ||
249 | |||
250 | return changed; | ||
251 | } | ||
252 | |||
253 | uint8_t matrix_scan(void) { | ||
254 | bool local_changed = false; | ||
255 | static matrix_row_t temp_raw_matrix[MATRIX_ROWS]; // temp raw values | ||
256 | |||
257 | // Set row, read cols | ||
258 | for (uint8_t current_row = 0; current_row < ROWS_PER_HAND/2; current_row++) { | ||
259 | local_changed |= read_cols_on_row(raw_matrix, current_row); | ||
260 | } | ||
261 | |||
262 | // Set col, read rows | ||
263 | for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { | ||
264 | local_changed |= read_rows_on_col(temp_raw_matrix, current_col); | ||
265 | //Updated key matrix on lines 6-10 (or lines 16-20) | ||
266 | if(local_changed) { | ||
267 | for (uint8_t i = ROWS_PER_HAND/2; i < ROWS_PER_HAND; i++) { | ||
268 | raw_matrix[i] = temp_raw_matrix[i]; | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | |||
273 | debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed); | ||
274 | |||
275 | bool remote_changed = matrix_post_scan(); | ||
276 | return (uint8_t)(local_changed || remote_changed); | ||
277 | } | ||
diff --git a/keyboards/halfcliff/readme.md b/keyboards/halfcliff/readme.md new file mode 100644 index 000000000..37e8d85c2 --- /dev/null +++ b/keyboards/halfcliff/readme.md | |||
@@ -0,0 +1,19 @@ | |||
1 | # halfcliff | ||
2 | |||
3 |  | ||
4 | |||
5 | Halfcliff keyboard is a split keyboard using a single-sided board. | ||
6 | |||
7 | * Keyboard Maintainer: [n2](https://github.com/N2-Sumikko) | ||
8 | * Hardware Supported: halfcliff PCB, Pro Micro | ||
9 | * Hardware Availability: [PCB & Plate Data](https://github.com/N2-Sumikko/HalfCliff.git) | ||
10 | |||
11 | Make example for this keyboard (after setting up your build environment): | ||
12 | |||
13 | make halfcliff:default | ||
14 | |||
15 | Flashing example for this keyboard: | ||
16 | |||
17 | make halfcliff:default:flash | ||
18 | |||
19 | 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. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
diff --git a/keyboards/halfcliff/rules.mk b/keyboards/halfcliff/rules.mk new file mode 100644 index 000000000..f8883f6a4 --- /dev/null +++ b/keyboards/halfcliff/rules.mk | |||
@@ -0,0 +1,29 @@ | |||
1 | # MCU name | ||
2 | MCU = atmega32u4 | ||
3 | |||
4 | # Bootloader selection | ||
5 | BOOTLOADER = caterina | ||
6 | |||
7 | # Build Options | ||
8 | # change yes to no to disable | ||
9 | # | ||
10 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
11 | MOUSEKEY_ENABLE = no # Mouse keys | ||
12 | EXTRAKEY_ENABLE = no # Audio control and System control | ||
13 | CONSOLE_ENABLE = no # Console for debug | ||
14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
16 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
17 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
18 | NKRO_ENABLE = no # USB Nkey Rollover | ||
19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
20 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
21 | BLUETOOTH_ENABLE = no # Enable Bluetooth | ||
22 | AUDIO_ENABLE = no # Audio output | ||
23 | SPLIT_KEYBOARD = yes | ||
24 | ENCODER_ENABLE = no | ||
25 | POINTING_DEVICE_ENABLE = no | ||
26 | CUSTOM_MATRIX = yes | ||
27 | OLED_DRIVER_ENABLE = no | ||
28 | |||
29 | SRC += matrix.c | ||