aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2021-05-13 02:31:53 +0100
committerGitHub <noreply@github.com>2021-05-12 18:31:53 -0700
commit17864b249fbbc1e72bce6ef7115b5cb2e3a81d7c (patch)
treeae8386bbb472ae498eb2a374c20ccce0222d5e60
parent0bada398dfba61c93ee5dbec0aeb92b8af0f45a4 (diff)
downloadqmk_firmware-17864b249fbbc1e72bce6ef7115b5cb2e3a81d7c.tar.gz
qmk_firmware-17864b249fbbc1e72bce6ef7115b5cb2e3a81d7c.zip
[Keyboard] Seigaiha (#12791)
Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r--keyboards/barleycorn/readme.md2
-rw-r--r--keyboards/seigaiha/config.h105
-rw-r--r--keyboards/seigaiha/info.json83
-rw-r--r--keyboards/seigaiha/keymaps/default/keymap.c32
-rw-r--r--keyboards/seigaiha/keymaps/default/readme.md5
-rw-r--r--keyboards/seigaiha/keymaps/via/keymap.c48
-rw-r--r--keyboards/seigaiha/keymaps/via/readme.md5
-rw-r--r--keyboards/seigaiha/keymaps/via/rules.mk1
-rw-r--r--keyboards/seigaiha/matrix.c123
-rw-r--r--keyboards/seigaiha/readme.md23
-rw-r--r--keyboards/seigaiha/rules.mk29
-rw-r--r--keyboards/seigaiha/seigaiha.c45
-rw-r--r--keyboards/seigaiha/seigaiha.h35
13 files changed, 535 insertions, 1 deletions
diff --git a/keyboards/barleycorn/readme.md b/keyboards/barleycorn/readme.md
index 775d25968..dd96c69e9 100644
--- a/keyboards/barleycorn/readme.md
+++ b/keyboards/barleycorn/readme.md
@@ -5,7 +5,7 @@
5An f-row less compact 1800 kit with only through hole components. 5An f-row less compact 1800 kit with only through hole components.
6 6
7* Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [GitHub](https://github.com/yiancar) 7* Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [GitHub](https://github.com/yiancar)
8* Hardware Supported: ATMEGA328p with vusb [PCB](https://github.com/yiancar/gingham_pcb) 8* Hardware Supported: ATMEGA328p with vusb [PCB](https://github.com/yiancar/barleycorn_pcb)
9* Hardware Availability: https://mykeyboard.eu/, https://novelkeys.xyz 9* Hardware Availability: https://mykeyboard.eu/, https://novelkeys.xyz
10 10
11Make example for this keyboard (after setting up your build environment): 11Make example for this keyboard (after setting up your build environment):
diff --git a/keyboards/seigaiha/config.h b/keyboards/seigaiha/config.h
new file mode 100644
index 000000000..5e87bd6f8
--- /dev/null
+++ b/keyboards/seigaiha/config.h
@@ -0,0 +1,105 @@
1/*
2Copyright 2021 Yiancar-Designs
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22#define VENDOR_ID 0x8968
23#define PRODUCT_ID 0x4750
24#define DEVICE_VER 0x0001
25#define MANUFACTURER Yiancar-Designs
26#define PRODUCT Seigaiha
27
28/* key matrix size */
29#define MATRIX_ROWS 5
30#define MATRIX_COLS 15
31
32/*
33 * Keyboard Matrix Assignments
34 *
35 * Change this to how you wired your keyboard
36 * COLS: AVR pins used for columns, left to right
37 * ROWS: AVR pins used for rows, top to bottom
38 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
39 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
40 *
41 */
42
43/* A Custom matrix.c is used to poll the port expander D5 shows that the pins are hardwired there */
44#define MATRIX_ROW_PINS { C0, B4, B3, B2, B5 }
45#define MATRIX_COL_PINS { B0, D7, D6, D4, B1, C1, C2, D1, C3, D0, D5, D5, D5, D5, D5 }
46#define UNUSED_PINS
47#define PORT_EXPANDER_ADDRESS 0x20
48
49/* COL2ROW, ROW2COL*/
50#define DIODE_DIRECTION COL2ROW
51
52#define USB_MAX_POWER_CONSUMPTION 100
53
54#define BOOTMAGIC_LITE_ROW 1
55#define BOOTMAGIC_LITE_COLUMN 0
56
57/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
58#define LOCKING_SUPPORT_ENABLE
59/* Locking resynchronize hack */
60#define LOCKING_RESYNC_ENABLE
61
62/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
63 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
64 */
65// #define GRAVE_ESC_CTRL_OVERRIDE
66
67/*
68 * Force NKRO
69 *
70 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
71 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
72 * makefile for this to work.)
73 *
74 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
75 * until the next keyboard reset.
76 *
77 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
78 * fully operational during normal computer usage.
79 *
80 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
81 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
82 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
83 * power-up.
84 *
85 */
86//#define FORCE_NKRO
87
88
89/*
90 * Feature disable options
91 * These options are also useful to firmware size reduction.
92 */
93
94/* disable debug print */
95//#define NO_DEBUG
96
97/* disable print */
98//#define NO_PRINT
99
100/* disable action features */
101//#define NO_ACTION_LAYER
102//#define NO_ACTION_TAPPING
103//#define NO_ACTION_ONESHOT
104//#define NO_ACTION_MACRO
105//#define NO_ACTION_FUNCTION
diff --git a/keyboards/seigaiha/info.json b/keyboards/seigaiha/info.json
new file mode 100644
index 000000000..bd313313e
--- /dev/null
+++ b/keyboards/seigaiha/info.json
@@ -0,0 +1,83 @@
1{
2 "keyboard_name": "Seigaiha",
3 "url": "www.yiancar-designs.com",
4 "maintainer": "Yiancar-Designs",
5 "width": 18.25,
6 "height": 5,
7 "layouts": {
8 "LAYOUT_alice_split_bs": {
9 "layout": [
10 {"x":0, "y":0},
11 {"x":1.25, "y":0},
12 {"x":2.25, "y":0},
13 {"x":3.25, "y":0},
14 {"x":4.25, "y":0},
15 {"x":5.25, "y":0},
16 {"x":6.25, "y":0},
17 {"x":7.25, "y":0},
18 {"x":10.25, "y":0},
19 {"x":11.25, "y":0},
20 {"x":12.25, "y":0},
21 {"x":13.25, "y":0},
22 {"x":14.25, "y":0},
23 {"x":15.25, "y":0},
24 {"x":16.25, "y":0},
25 {"x":17.25, "y":0},
26
27 {"x":0, "y":1},
28 {"x":1.25, "y":1, "w":1.5},
29 {"x":2.75, "y":1},
30 {"x":3.75, "y":1},
31 {"x":4.75, "y":1},
32 {"x":5.75, "y":1},
33 {"x":6.75, "y":1},
34 {"x":9.75, "y":1},
35 {"x":10.75, "y":1},
36 {"x":11.75, "y":1},
37 {"x":12.75, "y":1},
38 {"x":13.75, "y":1},
39 {"x":14.75, "y":1},
40 {"x":15.75, "y":1},
41 {"x":16.75, "y":1, "w":1.5},
42
43 {"x":0, "y":2},
44 {"x":1.25, "y":2, "w":1.75},
45 {"x":3, "y":2},
46 {"x":4, "y":2},
47 {"x":5, "y":2},
48 {"x":6, "y":2},
49 {"x":7, "y":2},
50 {"x":10, "y":2},
51 {"x":11, "y":2},
52 {"x":12, "y":2},
53 {"x":13, "y":2},
54 {"x":14, "y":2},
55 {"x":15, "y":2},
56 {"x":16, "y":2, "w":2.25},
57
58 {"x":1.25, "y":3, "w":2.25},
59 {"x":3.5, "y":3},
60 {"x":4.5, "y":3},
61 {"x":5.5, "y":3},
62 {"x":6.5, "y":3},
63 {"x":7.5, "y":3},
64 {"x":9.5, "y":3},
65 {"x":10.5, "y":3},
66 {"x":11.5, "y":3},
67 {"x":12.5, "y":3},
68 {"x":13.5, "y":3},
69 {"x":14.5, "y":3},
70 {"x":15.5, "y":3, "w":1.75},
71 {"x":17.25, "y":3},
72
73 {"x":1.25, "y":4, "w":1.5},
74 {"x":4.25, "y":4, "w":1.5},
75 {"x":5.75, "y":4, "w":2},
76 {"x":7.75, "y":4, "w":1.25},
77 {"x":9.5, "y":4, "w":2.75},
78 {"x":12.25, "y":4, "w":1.5},
79 {"x":16.75, "y":4, "w":1.5}
80 ]
81 }
82 }
83}
diff --git a/keyboards/seigaiha/keymaps/default/keymap.c b/keyboards/seigaiha/keymaps/default/keymap.c
new file mode 100644
index 000000000..607d85a13
--- /dev/null
+++ b/keyboards/seigaiha/keymaps/default/keymap.c
@@ -0,0 +1,32 @@
1/* Copyright 2021 Yiancar-Designs
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
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19[0] = LAYOUT_alice_split_bs( /* Base */
20 KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC,
21 KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
22 KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
23 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
24 KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, KC_SPC, KC_RALT, KC_RCTL),
25
26[1] = LAYOUT_alice_split_bs( /* FN */
27 KC_TRNS, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS,
28 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS,
29 KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_RGHT, KC_TRNS,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_DOWN, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
32};
diff --git a/keyboards/seigaiha/keymaps/default/readme.md b/keyboards/seigaiha/keymaps/default/readme.md
new file mode 100644
index 000000000..dceb6080e
--- /dev/null
+++ b/keyboards/seigaiha/keymaps/default/readme.md
@@ -0,0 +1,5 @@
1# The default keymap for Seigaiha with VIA disabled
2
3![Layer 0](https://i.imgur.com/wO8lfpih.png)
4
5![Layer 1](https://i.imgur.com/4Q0Rk2Vh.png)
diff --git a/keyboards/seigaiha/keymaps/via/keymap.c b/keyboards/seigaiha/keymaps/via/keymap.c
new file mode 100644
index 000000000..00f1b0150
--- /dev/null
+++ b/keyboards/seigaiha/keymaps/via/keymap.c
@@ -0,0 +1,48 @@
1/* Copyright 2021 Yiancar-Designs
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
18// This keymaps is used for VIA, it reflects the default keymap.
19
20const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
21[0] = LAYOUT_alice_split_bs( /* Base */
22 KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC,
23 KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
24 KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
25 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
26 KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, KC_SPC, KC_RALT, KC_RCTL),
27
28[1] = LAYOUT_alice_split_bs( /* FN */
29 KC_TRNS, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_RGHT, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_DOWN, KC_TRNS, KC_TRNS,
33 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
34
35[2] = LAYOUT_alice_split_bs( /* Empty for dynamic keymaps */
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
41
42[3] = LAYOUT_alice_split_bs( /* Empty for dynamic keymaps */
43 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
45 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
47 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
48};
diff --git a/keyboards/seigaiha/keymaps/via/readme.md b/keyboards/seigaiha/keymaps/via/readme.md
new file mode 100644
index 000000000..8f626d49e
--- /dev/null
+++ b/keyboards/seigaiha/keymaps/via/readme.md
@@ -0,0 +1,5 @@
1# The default keymap for Seigaiha with VIA enabled
2
3![Layer 0](https://i.imgur.com/wO8lfpih.png)
4
5![Layer 1](https://i.imgur.com/4Q0Rk2Vh.png)
diff --git a/keyboards/seigaiha/keymaps/via/rules.mk b/keyboards/seigaiha/keymaps/via/rules.mk
new file mode 100644
index 000000000..1e5b99807
--- /dev/null
+++ b/keyboards/seigaiha/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes
diff --git a/keyboards/seigaiha/matrix.c b/keyboards/seigaiha/matrix.c
new file mode 100644
index 000000000..212b8015f
--- /dev/null
+++ b/keyboards/seigaiha/matrix.c
@@ -0,0 +1,123 @@
1/*
2Copyright 2012-2020 Jun Wako, Jack Humbert, Yiancar-Designs
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h"
20#include "quantum.h"
21#include "i2c_master.h"
22
23static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
24static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
25
26static void unselect_rows(void) {
27 for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
28 setPinInputHigh(row_pins[x]);
29 }
30}
31
32static void select_row(uint8_t row) {
33 setPinOutput(row_pins[row]);
34 writePinLow(row_pins[row]);
35}
36
37static void unselect_row(uint8_t row) {
38 setPinInputHigh(row_pins[row]);
39}
40
41static void init_pins(void) {
42 unselect_rows();
43 // Set I/O
44 uint8_t send_data = 0x1F;
45 i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x00, &send_data, 1, 20);
46 // Set Pull-up
47 i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x06, &send_data, 1, 20);
48
49 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
50 if ( x < 10 ) {
51 setPinInputHigh(col_pins[x]);
52 }
53 }
54}
55
56void matrix_init_custom(void) {
57 // TODO: initialize hardware here
58 // Initialize I2C
59 i2c_init();
60
61 // initialize key pins
62 init_pins();
63 wait_ms(50);
64}
65
66static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
67 // Store last value of row prior to reading
68 matrix_row_t last_row_value = current_matrix[current_row];
69
70 // Clear data in matrix row
71 current_matrix[current_row] = 0;
72
73 // Select row and wait for row selecton to stabilize
74 select_row(current_row);
75 matrix_io_delay();
76
77 uint8_t port_expander_col_buffer;
78 i2c_readReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &port_expander_col_buffer, 1, 20);
79
80 // For each col...
81 for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
82 uint8_t pin_state;
83 // Select the col pin to read (active low)
84 switch (col_index) {
85 case 10 :
86 pin_state = port_expander_col_buffer & (1 << 0);
87 break;
88 case 11 :
89 pin_state = port_expander_col_buffer & (1 << 1);
90 break;
91 case 12 :
92 pin_state = port_expander_col_buffer & (1 << 2);
93 break;
94 case 13 :
95 pin_state = port_expander_col_buffer & (1 << 3);
96 break;
97 case 14 :
98 pin_state = port_expander_col_buffer & (1 << 4);
99 break;
100 default :
101 pin_state = readPin(col_pins[col_index]);
102 }
103
104 // Populate the matrix row with the state of the col pin
105 current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
106 }
107
108 // Unselect row
109 unselect_row(current_row);
110
111 return (last_row_value != current_matrix[current_row]);
112}
113
114bool matrix_scan_custom(matrix_row_t current_matrix[]) {
115 bool matrix_has_changed = false;
116
117 // Set row, read cols
118 for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
119 matrix_has_changed |= read_cols_on_row(current_matrix, current_row);
120 }
121
122 return matrix_has_changed;
123}
diff --git a/keyboards/seigaiha/readme.md b/keyboards/seigaiha/readme.md
new file mode 100644
index 000000000..fb0e8571a
--- /dev/null
+++ b/keyboards/seigaiha/readme.md
@@ -0,0 +1,23 @@
1# Seigaiha
2
3![Seigaiha](https://i.imgur.com/GCGyOmph.jpg)
4
5An alice layout kit with only through hole components.
6
7* Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [GitHub](https://github.com/yiancar)
8* Hardware Supported: ATMEGA328p with vusb [PCB](https://github.com/yiancar/seigaiha_pcb)
9* Hardware Availability: https://mykeyboard.eu/, https://novelkeys.xyz
10
11Make example for this keyboard (after setting up your build environment):
12
13 make seigaiha:default
14
15Flashing example for this keyboard:
16
17 make seigaiha:default:flash
18
19Bootloader:
20use usbasploader from HSGW's repository.
21https://github.com/hsgw/USBaspLoader/tree/plaid
22
23See 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/seigaiha/rules.mk b/keyboards/seigaiha/rules.mk
new file mode 100644
index 000000000..f19a8ec12
--- /dev/null
+++ b/keyboards/seigaiha/rules.mk
@@ -0,0 +1,29 @@
1# MCU name
2MCU = atmega328p
3
4# Bootloader selection
5BOOTLOADER = USBasp
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_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
18NKRO_ENABLE = no # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23
24CUSTOM_MATRIX = lite
25
26LAYOUTS = alice_split_bs
27
28SRC += matrix.c
29QUANTUM_LIB_SRC += i2c_master.c
diff --git a/keyboards/seigaiha/seigaiha.c b/keyboards/seigaiha/seigaiha.c
new file mode 100644
index 000000000..911034eb5
--- /dev/null
+++ b/keyboards/seigaiha/seigaiha.c
@@ -0,0 +1,45 @@
1/* Copyright 2021 Yiancar-Designs
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 "seigaiha.h"
17#include "i2c_master.h"
18
19// There is no need to initialize the I/O it is done in matrix.c
20
21uint8_t send_data = 0x00;
22
23bool led_update_kb(led_t led_state) {
24 bool res = led_update_user(led_state);
25 if(res) {
26 if (led_state.caps_lock){
27 send_data |= 1 << 5;
28 } else {
29 send_data &= ~(1 << 5);
30 }
31 i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x0A, &send_data, 1, 20);
32 }
33 return res;
34}
35
36__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
37 if (IS_LAYER_ON_STATE(state, 1)) {
38 send_data |= 1 << 6;
39 }
40 if (IS_LAYER_OFF_STATE(state, 1)) {
41 send_data &= ~(1 << 6);
42 }
43 // Data is send to the port expander during led_update_kb as it runs continuously.
44 return state;
45}
diff --git a/keyboards/seigaiha/seigaiha.h b/keyboards/seigaiha/seigaiha.h
new file mode 100644
index 000000000..e05c6f524
--- /dev/null
+++ b/keyboards/seigaiha/seigaiha.h
@@ -0,0 +1,35 @@
1/* Copyright 2021 Yiancar-Designs
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#define XXX KC_NO
20
21#include "quantum.h"
22
23#define LAYOUT_alice_split_bs( \
24 K10, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
25 K20, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
26 K30, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \
27 K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
28 K41, K43, K45, K46, K48, K4A, K4E \
29) { \
30 { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \
31 { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
32 { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, XXX, K2E }, \
33 { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
34 { XXX, K41, XXX, K43, XXX, K45, K46, XXX, K48, XXX, K4A, XXX, XXX, XXX, K4E } \
35}