diff options
author | yiancar <yiangosyiangou@cytanet.com.cy> | 2021-05-13 02:31:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 18:31:53 -0700 |
commit | 17864b249fbbc1e72bce6ef7115b5cb2e3a81d7c (patch) | |
tree | ae8386bbb472ae498eb2a374c20ccce0222d5e60 /keyboards/seigaiha | |
parent | 0bada398dfba61c93ee5dbec0aeb92b8af0f45a4 (diff) |
[Keyboard] Seigaiha (#12791)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/seigaiha')
-rw-r--r-- | keyboards/seigaiha/config.h | 105 | ||||
-rw-r--r-- | keyboards/seigaiha/info.json | 83 | ||||
-rw-r--r-- | keyboards/seigaiha/keymaps/default/keymap.c | 32 | ||||
-rw-r--r-- | keyboards/seigaiha/keymaps/default/readme.md | 5 | ||||
-rw-r--r-- | keyboards/seigaiha/keymaps/via/keymap.c | 48 | ||||
-rw-r--r-- | keyboards/seigaiha/keymaps/via/readme.md | 5 | ||||
-rw-r--r-- | keyboards/seigaiha/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/seigaiha/matrix.c | 123 | ||||
-rw-r--r-- | keyboards/seigaiha/readme.md | 23 | ||||
-rw-r--r-- | keyboards/seigaiha/rules.mk | 29 | ||||
-rw-r--r-- | keyboards/seigaiha/seigaiha.c | 45 | ||||
-rw-r--r-- | keyboards/seigaiha/seigaiha.h | 35 |
12 files changed, 534 insertions, 0 deletions
diff --git a/keyboards/seigaiha/config.h b/keyboards/seigaiha/config.h new file mode 100644 index 0000000000..5e87bd6f83 --- /dev/null +++ b/keyboards/seigaiha/config.h @@ -0,0 +1,105 @@ +/* +Copyright 2021 Yiancar-Designs + +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" + +#define VENDOR_ID 0x8968 +#define PRODUCT_ID 0x4750 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Yiancar-Designs +#define PRODUCT Seigaiha + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ + +/* A Custom matrix.c is used to poll the port expander D5 shows that the pins are hardwired there */ +#define MATRIX_ROW_PINS { C0, B4, B3, B2, B5 } +#define MATRIX_COL_PINS { B0, D7, D6, D4, B1, C1, C2, D1, C3, D0, D5, D5, D5, D5, D5 } +#define UNUSED_PINS +#define PORT_EXPANDER_ADDRESS 0x20 + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +#define USB_MAX_POWER_CONSUMPTION 100 + +#define BOOTMAGIC_LITE_ROW 1 +#define BOOTMAGIC_LITE_COLUMN 0 + +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/seigaiha/info.json b/keyboards/seigaiha/info.json new file mode 100644 index 0000000000..bd313313e0 --- /dev/null +++ b/keyboards/seigaiha/info.json @@ -0,0 +1,83 @@ +{ + "keyboard_name": "Seigaiha", + "url": "www.yiancar-designs.com", + "maintainer": "Yiancar-Designs", + "width": 18.25, + "height": 5, + "layouts": { + "LAYOUT_alice_split_bs": { + "layout": [ + {"x":0, "y":0}, + {"x":1.25, "y":0}, + {"x":2.25, "y":0}, + {"x":3.25, "y":0}, + {"x":4.25, "y":0}, + {"x":5.25, "y":0}, + {"x":6.25, "y":0}, + {"x":7.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":16.25, "y":0}, + {"x":17.25, "y":0}, + + {"x":0, "y":1}, + {"x":1.25, "y":1, "w":1.5}, + {"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":9.75, "y":1}, + {"x":10.75, "y":1}, + {"x":11.75, "y":1}, + {"x":12.75, "y":1}, + {"x":13.75, "y":1}, + {"x":14.75, "y":1}, + {"x":15.75, "y":1}, + {"x":16.75, "y":1, "w":1.5}, + + {"x":0, "y":2}, + {"x":1.25, "y":2, "w":1.75}, + {"x":3, "y":2}, + {"x":4, "y":2}, + {"x":5, "y":2}, + {"x":6, "y":2}, + {"x":7, "y":2}, + {"x":10, "y":2}, + {"x":11, "y":2}, + {"x":12, "y":2}, + {"x":13, "y":2}, + {"x":14, "y":2}, + {"x":15, "y":2}, + {"x":16, "y":2, "w":2.25}, + + {"x":1.25, "y":3, "w":2.25}, + {"x":3.5, "y":3}, + {"x":4.5, "y":3}, + {"x":5.5, "y":3}, + {"x":6.5, "y":3}, + {"x":7.5, "y":3}, + {"x":9.5, "y":3}, + {"x":10.5, "y":3}, + {"x":11.5, "y":3}, + {"x":12.5, "y":3}, + {"x":13.5, "y":3}, + {"x":14.5, "y":3}, + {"x":15.5, "y":3, "w":1.75}, + {"x":17.25, "y":3}, + + {"x":1.25, "y":4, "w":1.5}, + {"x":4.25, "y":4, "w":1.5}, + {"x":5.75, "y":4, "w":2}, + {"x":7.75, "y":4, "w":1.25}, + {"x":9.5, "y":4, "w":2.75}, + {"x":12.25, "y":4, "w":1.5}, + {"x":16.75, "y":4, "w":1.5} + ] + } + } +} diff --git a/keyboards/seigaiha/keymaps/default/keymap.c b/keyboards/seigaiha/keymaps/default/keymap.c new file mode 100644 index 0000000000..607d85a132 --- /dev/null +++ b/keyboards/seigaiha/keymaps/default/keymap.c @@ -0,0 +1,32 @@ +/* Copyright 2021 Yiancar-Designs + * + * 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 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT_alice_split_bs( /* Base */ + 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, + 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, + 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, + 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), + KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, KC_SPC, KC_RALT, KC_RCTL), + +[1] = LAYOUT_alice_split_bs( /* FN */ + 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, + 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, + 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, + 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, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) +}; diff --git a/keyboards/seigaiha/keymaps/default/readme.md b/keyboards/seigaiha/keymaps/default/readme.md new file mode 100644 index 0000000000..dceb6080e4 --- /dev/null +++ b/keyboards/seigaiha/keymaps/default/readme.md @@ -0,0 +1,5 @@ +# The default keymap for Seigaiha with VIA disabled + +![Layer 0](https://i.imgur.com/wO8lfpih.png) + +![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 0000000000..00f1b01501 --- /dev/null +++ b/keyboards/seigaiha/keymaps/via/keymap.c @@ -0,0 +1,48 @@ +/* Copyright 2021 Yiancar-Designs + * + * 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 + +// This keymaps is used for VIA, it reflects the default keymap. + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT_alice_split_bs( /* Base */ + 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, + 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, + 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, + 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), + KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, KC_SPC, KC_RALT, KC_RCTL), + +[1] = LAYOUT_alice_split_bs( /* FN */ + 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, + 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, + 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, + 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, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +[2] = LAYOUT_alice_split_bs( /* Empty for dynamic keymaps */ + 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, + 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, 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, 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, KC_TRNS, KC_TRNS), + +[3] = LAYOUT_alice_split_bs( /* Empty for dynamic keymaps */ + 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, + 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, 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, 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, KC_TRNS, KC_TRNS) +}; diff --git a/keyboards/seigaiha/keymaps/via/readme.md b/keyboards/seigaiha/keymaps/via/readme.md new file mode 100644 index 0000000000..8f626d49e3 --- /dev/null +++ b/keyboards/seigaiha/keymaps/via/readme.md @@ -0,0 +1,5 @@ +# The default keymap for Seigaiha with VIA enabled + +![Layer 0](https://i.imgur.com/wO8lfpih.png) + +![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 0000000000..1e5b99807c --- /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 0000000000..212b8015f0 --- /dev/null +++ b/keyboards/seigaiha/matrix.c @@ -0,0 +1,123 @@ +/* +Copyright 2012-2020 Jun Wako, Jack Humbert, Yiancar-Designs + +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 "wait.h" +#include "quantum.h" +#include "i2c_master.h" + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +static void unselect_rows(void) { + for(uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static void select_row(uint8_t row) { + setPinOutput(row_pins[row]); + writePinLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) { + setPinInputHigh(row_pins[row]); +} + +static void init_pins(void) { + unselect_rows(); + // Set I/O + uint8_t send_data = 0x1F; + i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x00, &send_data, 1, 20); + // Set Pull-up + i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x06, &send_data, 1, 20); + + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + if ( x < 10 ) { + setPinInputHigh(col_pins[x]); + } + } +} + +void matrix_init_custom(void) { + // TODO: initialize hardware here + // Initialize I2C + i2c_init(); + + // initialize key pins + init_pins(); + wait_ms(50); +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + matrix_io_delay(); + + uint8_t port_expander_col_buffer; + i2c_readReg((PORT_EXPANDER_ADDRESS << 1), 0x09, &port_expander_col_buffer, 1, 20); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + uint8_t pin_state; + // Select the col pin to read (active low) + switch (col_index) { + case 10 : + pin_state = port_expander_col_buffer & (1 << 0); + break; + case 11 : + pin_state = port_expander_col_buffer & (1 << 1); + break; + case 12 : + pin_state = port_expander_col_buffer & (1 << 2); + break; + case 13 : + pin_state = port_expander_col_buffer & (1 << 3); + break; + case 14 : + pin_state = port_expander_col_buffer & (1 << 4); + break; + default : + pin_state = readPin(col_pins[col_index]); + } + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool matrix_has_changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { + matrix_has_changed |= read_cols_on_row(current_matrix, current_row); + } + + return matrix_has_changed; +} diff --git a/keyboards/seigaiha/readme.md b/keyboards/seigaiha/readme.md new file mode 100644 index 0000000000..fb0e8571ae --- /dev/null +++ b/keyboards/seigaiha/readme.md @@ -0,0 +1,23 @@ +# Seigaiha + +![Seigaiha](https://i.imgur.com/GCGyOmph.jpg) + +An alice layout kit with only through hole components. + +* Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [GitHub](https://github.com/yiancar) +* Hardware Supported: ATMEGA328p with vusb [PCB](https://github.com/yiancar/seigaiha_pcb) +* Hardware Availability: https://mykeyboard.eu/, https://novelkeys.xyz + +Make example for this keyboard (after setting up your build environment): + + make seigaiha:default + +Flashing example for this keyboard: + + make seigaiha:default:flash + +Bootloader: +use usbasploader from HSGW's repository. +https://github.com/hsgw/USBaspLoader/tree/plaid + +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/seigaiha/rules.mk b/keyboards/seigaiha/rules.mk new file mode 100644 index 0000000000..f19a8ec12e --- /dev/null +++ b/keyboards/seigaiha/rules.mk @@ -0,0 +1,29 @@ +# MCU name +MCU = atmega328p + +# Bootloader selection +BOOTLOADER = USBasp + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +CUSTOM_MATRIX = lite + +LAYOUTS = alice_split_bs + +SRC += matrix.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/seigaiha/seigaiha.c b/keyboards/seigaiha/seigaiha.c new file mode 100644 index 0000000000..911034eb56 --- /dev/null +++ b/keyboards/seigaiha/seigaiha.c @@ -0,0 +1,45 @@ +/* Copyright 2021 Yiancar-Designs + * + * 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 "seigaiha.h" +#include "i2c_master.h" + +// There is no need to initialize the I/O it is done in matrix.c + +uint8_t send_data = 0x00; + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + if (led_state.caps_lock){ + send_data |= 1 << 5; + } else { + send_data &= ~(1 << 5); + } + i2c_writeReg((PORT_EXPANDER_ADDRESS << 1), 0x0A, &send_data, 1, 20); + } + return res; +} + +__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { + if (IS_LAYER_ON_STATE(state, 1)) { + send_data |= 1 << 6; + } + if (IS_LAYER_OFF_STATE(state, 1)) { + send_data &= ~(1 << 6); + } + // Data is send to the port expander during led_update_kb as it runs continuously. + return state; +} diff --git a/keyboards/seigaiha/seigaiha.h b/keyboards/seigaiha/seigaiha.h new file mode 100644 index 0000000000..e05c6f5242 --- /dev/null +++ b/keyboards/seigaiha/seigaiha.h @@ -0,0 +1,35 @@ +/* Copyright 2021 Yiancar-Designs + * + * 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 + +#define XXX KC_NO + +#include "quantum.h" + +#define LAYOUT_alice_split_bs( \ + K10, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K20, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K30, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \ + K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K41, K43, K45, K46, K48, K4A, K4E \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, XXX, K2E }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ + { XXX, K41, XXX, K43, XXX, K45, K46, XXX, K48, XXX, K4A, XXX, XXX, XXX, K4E } \ +} |