diff options
Diffstat (limited to 'keyboards')
-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 0000000000..287fd2f4ac --- /dev/null +++ b/keyboards/halfcliff/config.h @@ -0,0 +1,69 @@ +/* +Copyright 2021 n2 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x0335 +#define PRODUCT_ID 0x0021 +#define DEVICE_VER 0x0001 +#define MANUFACTURER n2 +#define PRODUCT halfcliff + +/* key matrix size */ +#define MATRIX_ROWS 20 +#define MATRIX_COLS 5 + +#define MATRIX_ROW_PINS { F5, F6, F7, D7, B5, F5, F6, F7, D7, B5 } +#define MATRIX_COL_PINS { B4, E6, C6, B6, B2 } +#define UNUSED_PINS + +//#define NUMBER_OF_ENCODERS 1 +#define ENCODERS_PAD_A { D4 } +#define ENCODERS_PAD_B { F4 } +#define ENCODER_RESOLUTION 2 + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6 + + #define RGB_DI_PIN D3 + #ifdef RGB_DI_PIN + #define RGBLED_NUM 10 + #define RGBLIGHT_SPLIT + #define RGBLED_SPLIT { 5, 5 } + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ + #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ + #endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/halfcliff/halfcliff.c b/keyboards/halfcliff/halfcliff.c new file mode 100644 index 0000000000..999e9036db --- /dev/null +++ b/keyboards/halfcliff/halfcliff.c @@ -0,0 +1,92 @@ +/* Copyright 2021 n2 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "halfcliff.h" + +#ifdef OLED_DRIVER_ENABLE + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _DEFAULT = 0, + _RAISE, + _LOWER, + _ADJUST +/* _FN */ +}; + +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + } + return rotation; +} + +__attribute__((weak)) void oled_task_user(void) { + if (!is_keyboard_master()) { + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + oled_write_P(qmk_logo, false); + } else { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (get_highest_layer(layer_state)) { + case _DEFAULT: + oled_write_P(PSTR("DEFAULT\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("RAISE\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("LOWER\n"), false); + break; + case _ADJUST: + oled_write_P(PSTR("ADJUST\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined"), false); + }; + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK\n") : PSTR(" \n"), false); + } +} +#endif + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (index == 0) { /* Left side encoder */ + if (clockwise) { + tap_code(KC_WH_U); + } else { + tap_code(KC_WH_D); + } + } else if (index == 1) { /* Right side encoder */ + if (clockwise) { + tap_code(KC_WH_U); + } else { + tap_code(KC_WH_D); + } + } + return true; +} +#endif diff --git a/keyboards/halfcliff/halfcliff.h b/keyboards/halfcliff/halfcliff.h new file mode 100644 index 0000000000..6e4c808641 --- /dev/null +++ b/keyboards/halfcliff/halfcliff.h @@ -0,0 +1,58 @@ +/* Copyright 2021 n2 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "quantum.h" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ + +#define LAYOUT( \ + l51,l50,l00,l01,l02,l03,l04,r04,r03,r02,r01,r00,r50,r51,r52,\ + l61,l60,l10,l11,l12,l13,l14,r14,r13,r12,r11,r10,r60,r61,r62,\ + l71,l70,l20,l21,l22,l23,l24,r24,r23,r22,r21,r20,r70,r71,r72,\ + l81,l80,l30,l31,l32,l33,l34,r34,r33,r32,r31,r30,r80,r81,r82,\ + l91,l90,l40,l41,l42,l43,l44,r44,r43,r42,r41,r40,r90,r91,r92\ +) \ +{ \ + {l00, l01, l02, l03, l04 }, \ + {l10, l11, l12, l13, l14 }, \ + {l20, l21, l22, l23, l24 }, \ + {l30, l31, l32, l33, l34 }, \ + {l40, l41, l42, l43, l44 }, \ + {l50, l51, KC_NO,KC_NO,KC_NO}, \ + {l60, l61, KC_NO,KC_NO,KC_NO}, \ + {l70, l71, KC_NO,KC_NO,KC_NO}, \ + {l80, l81, KC_NO,KC_NO,KC_NO}, \ + {l90, l91, KC_NO,KC_NO,KC_NO}, \ + {r00, r01, r02, r03, r04 }, \ + {r10, r11, r12, r13, r14 }, \ + {r20, r21, r22, r23, r24 }, \ + {r30, r31, r32, r33, r34 }, \ + {r40, r41, r42, r43, r44 }, \ + {r50, r51, r52, KC_NO,KC_NO}, \ + {r60, r61, r62, KC_NO,KC_NO}, \ + {r70, r71, r72, KC_NO,KC_NO}, \ + {r80, r81, r82, KC_NO,KC_NO}, \ + {r90, r91, r92, KC_NO,KC_NO}, \ +} diff --git a/keyboards/halfcliff/info.json b/keyboards/halfcliff/info.json new file mode 100644 index 0000000000..2a859bb4c3 --- /dev/null +++ b/keyboards/halfcliff/info.json @@ -0,0 +1,88 @@ +{ + "keyboard_name": "halfcliff", + "url": "https://github.com/N2-Sumikko", + "maintainer": "n2", + "width": 17.25, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [ + {"x":0.75,"y":0}, + {"x":1.75,"y":0}, + {"x":2.75,"y":0}, + {"x":3.75,"y":0}, + {"x":4.75,"y":0}, + {"x":5.75,"y":0}, + {"x":6.75,"y":0}, + {"x":8.25,"y":0}, + {"x":9.25,"y":0}, + {"x":10.25,"y":0}, + {"x":11.25,"y":0}, + {"x":12.25,"y":0}, + {"x":13.25,"y":0}, + {"x":14.25,"y":0}, + {"x":15.25,"y":0}, + {"x":0.25,"y":1,"w":1.5}, + {"x":1.75,"y":1}, + {"x":2.75,"y":1}, + {"x":3.75,"y":1}, + {"x":4.75,"y":1}, + {"x":5.75,"y":1}, + {"x":6.75,"y":1}, + {"x":8.25,"y":1}, + {"x":9.25,"y":1}, + {"x":10.25,"y":1}, + {"x":11.25,"y":1}, + {"x":12.25,"y":1}, + {"x":13.25,"y":1}, + {"x":14.25,"y":1}, + {"x":16.25,"y":0}, + {"x":0,"y":2,"w":1.75}, + {"x":1.75,"y":2}, + {"x":2.75,"y":2}, + {"x":3.75,"y":2}, + {"x":4.75,"y":2}, + {"x":5.75,"y":2}, + {"x":6.75,"y":2}, + {"x":8.25,"y":2}, + {"x":9.25,"y":2}, + {"x":10.25,"y":2}, + {"x":11.25,"y":2}, + {"x":12.25,"y":2}, + {"x":13.25,"y":2}, + {"x":14.25,"y":2}, + {"x":15.5,"y":1,"w":1.25,"h":2}, + {"x":0,"y":3,"w":1.75}, + {"x":1.75,"y":3}, + {"x":2.75,"y":3}, + {"x":3.75,"y":3}, + {"x":4.75,"y":3}, + {"x":5.75,"y":3}, + {"x":6.75,"y":3}, + {"x":8.25,"y":3}, + {"x":9.25,"y":3}, + {"x":10.25,"y":3}, + {"x":11.25,"y":3}, + {"x":12.25,"y":3}, + {"x":13.25,"y":3}, + {"x":14.25,"y":3}, + {"x":15.25,"y":3,"w":2}, + {"x":0.5,"y":4,"w":1.25}, + {"x":1.75,"y":4}, + {"x":2.75,"y":4}, + {"x":3.75,"y":4}, + {"x":4.75,"y":4}, + {"x":5.75,"y":4}, + {"x":6.75,"y":4}, + {"x":8.25,"y":4}, + {"x":9.25,"y":4}, + {"x":10.25,"y":4}, + {"x":11.25,"y":4}, + {"x":12.25,"y":4}, + {"x":13.25,"y":4}, + {"x":14.25,"y":4}, + {"x":15.25,"y":4} + ] + } + } +}
\ 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 0000000000..02743f5d49 --- /dev/null +++ b/keyboards/halfcliff/keymaps/default/keymap.c @@ -0,0 +1,109 @@ +/* Copyright 2021 n2 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#include "keymap_jp.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _DEFAULT = 0, + _RAISE, + _LOWER, + _ADJUST +/* _FN */ +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* DEFAULT + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * |ZEN/HAN | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | ^ | \ | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | TAB | q | w | e | r | t | | y | u | i | o | p | @ | [ | BSPC | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | CAPS | a | s | d | f | g | | h | j | k | l | ; | : | ] | ENT | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | LSHIFT | z | x | c | v | b | | n | m | , | . | / | \ | UP | RSHIFT | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | CTRL | LGUI | ALT | MUHEN | SPACE | SPACE | LOWER | RAISE | SPACE | HENKAN | KANA | APP | LEFT | DOWN | RIGHT | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_DEFAULT] = LAYOUT( + 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, + 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, + 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, + 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, + 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 + ), + /* RAISE + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + /* LOWER + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | |RGB_TOG | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_VAI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_HUI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_SAI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT( + _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + /* ADJUST + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/halfcliff/keymaps/default/readme.md b/keyboards/halfcliff/keymaps/default/readme.md new file mode 100644 index 0000000000..2924c68c24 --- /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 0000000000..e0a825e7c3 --- /dev/null +++ b/keyboards/halfcliff/keymaps/via/keymap.c @@ -0,0 +1,112 @@ +/* Copyright 2021 n2 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H +#include "keymap_jp.h" + +#define RAISE FN_MO13 +#define LOWER FN_MO23 + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _DEFAULT = 0, + _RAISE, + _LOWER, + _ADJUST +/* _FN */ +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* DEFAULT + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * |ZEN/HAN | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | ^ | \ | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | TAB | q | w | e | r | t | | y | u | i | o | p | @ | [ | BSPC | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | CAPS | a | s | d | f | g | | h | j | k | l | ; | : | ] | ENT | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | LSHIFT | z | x | c | v | b | | n | m | , | . | / | \ | UP | RSHIFT | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | CTRL | LGUI | ALT | MUHEN | SPACE | SPACE | LOWER | RAISE | SPACE | HENKAN | KANA | APP | LEFT | DOWN | RIGHT | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_DEFAULT] = LAYOUT( + 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, + 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, + 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, + 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, + 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 + ), + /* RAISE + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_1, KC_2, KC_3, KC_4, KC_5, _______, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + /* LOWER + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | |RGB_TOG | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_VAI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_HUI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | |RGB_SAI | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT( + _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + /* ADJUST + * ,--------------------------------------------------------------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/halfcliff/keymaps/via/readme.md b/keyboards/halfcliff/keymaps/via/readme.md new file mode 100644 index 0000000000..2924c68c24 --- /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 0000000000..1e5b99807c --- /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 0000000000..556b75ca59 --- /dev/null +++ b/keyboards/halfcliff/matrix.c @@ -0,0 +1,277 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include <stdint.h> +#include <stdbool.h> +#include "util.h" +#include "matrix.h" +#include "debounce.h" +#include "quantum.h" +#include "split_util.h" +#include "config.h" +#include "transport.h" + +#define ERROR_DISCONNECT_COUNT 5 + +#define ROWS_PER_HAND (MATRIX_ROWS / 2) + +static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +static matrix_row_t matrix[MATRIX_ROWS]; // debounced values + +// row offsets for each hand +uint8_t thisHand, thatHand; + +// user-defined overridable functions +__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } + +__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } + +__attribute__((weak)) void matrix_init_user(void) {} + +__attribute__((weak)) void matrix_scan_user(void) {} + +__attribute__((weak)) void matrix_slave_scan_user(void) {} + +matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } + +void matrix_print(void) {} + +static inline void setPinOutput_writeLow(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + setPinOutput(pin); + writePinLow(pin); + } +} + +static inline void setPinInputHigh_atomic(pin_t pin) { + ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } +} + +// matrix code +static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } + +static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } + +static void unselect_rows(void) { + for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { + setPinInputHigh_atomic(row_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Start with a clear matrix row + matrix_row_t current_row_value = 0; + + // Select row + select_row(current_row); + wait_us(30); + + // For each col... + for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + // Select the col pin to read (active low) + uint8_t pin_state = readPin(col_pins[col_index]); + + // Populate the matrix row with the state of the col pin + current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + if (current_row + 1 < MATRIX_ROWS) { + wait_us(30); // wait for row signal to go HIGH + } + + // If the row has changed, store the row and return the changed flag. + if (current_matrix[current_row] != current_row_value) { + current_matrix[current_row] = current_row_value; + return true; + } + return false; +} + +static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } + +static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } + +static void unselect_cols(void) { + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh_atomic(col_pins[x]); + } +} + +static void init_pins(void) { + unselect_rows(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh_atomic(col_pins[x]); + } + unselect_cols(); + for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { + setPinInputHigh_atomic(row_pins[x]); + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { + bool matrix_changed = false; + + // Select col |