diff --git a/keyboards/j80/keymaps/vial/config.h b/keyboards/j80/keymaps/vial/config.h new file mode 100644 index 0000000000..8a28607f06 --- /dev/null +++ b/keyboards/j80/keymaps/vial/config.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#pragma once + +#define VIAL_KEYBOARD_UID {0x17, 0x02, 0x25, 0x86, 0xE8, 0x06, 0x80, 0x02} + +// ESC + Enter +#define VIAL_UNLOCK_COMBO_ROWS { 0, 3 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 13 } + +#define DYNAMIC_KEYMAP_LAYER_COUNT 3 diff --git a/keyboards/j80/keymaps/vial/keymap.c b/keyboards/j80/keymaps/vial/keymap.c new file mode 100644 index 0000000000..d7c78fbb20 --- /dev/null +++ b/keyboards/j80/keymaps/vial/keymap.c @@ -0,0 +1,26 @@ +/* Copyright 2019 JER + * + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT_tkl_ansi_split_rshift( + KC_ESC, 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_PSCR, KC_SCRL, KC_PAUS, + 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_BSPC, KC_INS, KC_HOME, 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_DEL, KC_END, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_APP, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT) +}; diff --git a/keyboards/j80/keymaps/vial/rules.mk b/keyboards/j80/keymaps/vial/rules.mk new file mode 100644 index 0000000000..c79bece395 --- /dev/null +++ b/keyboards/j80/keymaps/vial/rules.mk @@ -0,0 +1,5 @@ +VIA_ENABLE = yes # Enable VIA +VIAL_ENABLE = yes # Enable VIAL +LTO_ENABLE = yes + +MOUSEKEY_ENABLE = yes diff --git a/keyboards/j80/keymaps/vial/vial.json b/keyboards/j80/keymaps/vial/vial.json new file mode 100644 index 0000000000..09859caea6 --- /dev/null +++ b/keyboards/j80/keymaps/vial/vial.json @@ -0,0 +1,249 @@ +{ + "lighting": "qmk_backlight", + "matrix": { + "rows": 7, + "cols": 14 + }, + "layouts": { + "labels": [ + "ISO Enter", + "Split Right Shift", + [ + "Bottom Row", + "WKL", + "WK" + ] + ], + "keymap": [ + [ + { + "x": 2.5 + }, + "0,0", + { + "x": 1 + }, + "0,2", + "0,3", + "0,4", + "0,5", + { + "x": 0.5 + }, + "0,7", + "0,8", + "0,9", + "0,10", + { + "x": 0.5 + }, + "0,11", + "0,13", + "0,12", + "0,1", + { + "x": 0.25 + }, + "6,1", + "6,2", + "6,13" + ], + [ + { + "y": 0.5, + "x": 2.5 + }, + "1,0", + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,13", + { + "w": 2 + }, + "1,12", + { + "x": 0.25 + }, + "6,6", + "6,5", + "6,4" + ], + [ + { + "x": 2.5, + "w": 1.5 + }, + "2,0", + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,13", + { + "w": 1.5 + }, + "2,12\n\n\n0,0", + { + "x": 0.25 + }, + "6,12", + "6,8", + "6,7", + { + "x": 1.75, + "w": 1.25, + "h": 2, + "w2": 1.5, + "h2": 1, + "x2": -0.25 + }, + "3,13\n\n\n0,1" + ], + [ + { + "x": 2.5, + "w": 1.75 + }, + "3,0", + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "w": 2.25 + }, + "3,13\n\n\n0,0", + { + "x": 4 + }, + "2,12\n\n\n0,1" + ], + [ + { + "w": 1.25 + }, + "4,0\n\n\n0,1", + "3,12\n\n\n0,1", + { + "x": 0.25, + "w": 2.25 + }, + "4,0\n\n\n0,0", + "4,1", + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + { + "w": 2.75 + }, + "4,11\n\n\n1,0", + { + "x": 1.25 + }, + "4,12", + { + "x": 1.25, + "w": 1.75 + }, + "4,11\n\n\n1,1", + "4,13\n\n\n1,1" + ], + [ + { + "x": 2.5, + "w": 1.5 + }, + "5,0\n\n\n2,0", + "5,1\n\n\n2,0", + { + "w": 1.5 + }, + "5,2\n\n\n2,0", + { + "w": 7 + }, + "5,4\n\n\n2,0", + { + "w": 1.5 + }, + "5,9\n\n\n2,0", + "5,10\n\n\n2,0", + { + "w": 1.5 + }, + "5,11\n\n\n2,0", + { + "x": 0.25 + }, + "5,13", + "5,12", + "5,7" + ], + [ + { + "y": 0.25, + "x": 2.5, + "w": 1.25 + }, + "5,0\n\n\n2,1", + { + "w": 1.25 + }, + "5,1\n\n\n2,1", + { + "w": 1.25 + }, + "5,2\n\n\n2,1", + { + "w": 6.25 + }, + "5,4\n\n\n2,1", + { + "w": 1.25 + }, + "5,8\n\n\n2,1", + { + "w": 1.25 + }, + "5,9\n\n\n2,1", + { + "w": 1.25 + }, + "5,10\n\n\n2,1", + { + "w": 1.25 + }, + "5,11\n\n\n2,1" + ] + ] + } +} diff --git a/keyboards/kmac_happy/config.h b/keyboards/kmac_happy/config.h new file mode 100644 index 0000000000..72ca895d33 --- /dev/null +++ b/keyboards/kmac_happy/config.h @@ -0,0 +1,33 @@ +/* Copyright 2024 nlnjnj + * + * 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 . + */ +#pragma once + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* + * Keyboard Matrix Assignments + * The KMAC uses a demultiplexer for some of the cols. + * See matrix.c for more details. +*/ +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { } + +/* 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 diff --git a/keyboards/kmac_happy/info.json b/keyboards/kmac_happy/info.json new file mode 100644 index 0000000000..e471d42973 --- /dev/null +++ b/keyboards/kmac_happy/info.json @@ -0,0 +1,93 @@ +{ + "keyboard_name": "KMAC Happy", + "manufacturer": "KBDMOD", + "url": "https://kbdmodadmin.cafe24.com/product/detail.html?product_no=15&cate_no=4&display_group=1", + "maintainer": "nlnjnj", + "usb": { + "vid": "0xFEED", + "pid": "0x0305", + "device_version": "1.1.0" + }, + "backlight": { + "pin": "B5", + "levels": 3 + }, + "indicators": { + "caps_lock": "B1", + "on_state": 0 + }, + "processor": "atmega32u4", + "bootloader": "atmel-dfu", + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + {"matrix": [0, 5], "x": 5, "y": 0}, + {"matrix": [0, 6], "x": 6, "y": 0}, + {"matrix": [0, 7], "x": 7, "y": 0}, + {"matrix": [0, 8], "x": 8, "y": 0}, + {"matrix": [0, 9], "x": 9, "y": 0}, + {"matrix": [0, 10], "x": 10, "y": 0}, + {"matrix": [0, 11], "x": 11, "y": 0}, + {"matrix": [0, 12], "x": 12, "y": 0}, + {"matrix": [0, 13], "x": 13, "y": 0}, + {"matrix": [0, 14], "x": 14, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5}, + {"matrix": [1, 1], "x": 1.5, "y": 1}, + {"matrix": [1, 2], "x": 2.5, "y": 1}, + {"matrix": [1, 3], "x": 3.5, "y": 1}, + {"matrix": [1, 4], "x": 4.5, "y": 1}, + {"matrix": [1, 5], "x": 5.5, "y": 1}, + {"matrix": [1, 6], "x": 6.5, "y": 1}, + {"matrix": [1, 7], "x": 7.5, "y": 1}, + {"matrix": [1, 8], "x": 8.5, "y": 1}, + {"matrix": [1, 9], "x": 9.5, "y": 1}, + {"matrix": [1, 10], "x": 10.5, "y": 1}, + {"matrix": [1, 11], "x": 11.5, "y": 1}, + {"matrix": [1, 12], "x": 12.5, "y": 1}, + {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, + + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75}, + {"matrix": [2, 1], "x": 1.75, "y": 2}, + {"matrix": [2, 2], "x": 2.75, "y": 2}, + {"matrix": [2, 3], "x": 3.75, "y": 2}, + {"matrix": [2, 4], "x": 4.75, "y": 2}, + {"matrix": [2, 5], "x": 5.75, "y": 2}, + {"matrix": [2, 6], "x": 6.75, "y": 2}, + {"matrix": [2, 7], "x": 7.75, "y": 2}, + {"matrix": [2, 8], "x": 8.75, "y": 2}, + {"matrix": [2, 9], "x": 9.75, "y": 2}, + {"matrix": [2, 10], "x": 10.75, "y": 2}, + {"matrix": [2, 11], "x": 11.75, "y": 2}, + {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, + + {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, + {"matrix": [3, 1], "x": 2.25, "y": 3}, + {"matrix": [3, 2], "x": 3.25, "y": 3}, + {"matrix": [3, 3], "x": 4.25, "y": 3}, + {"matrix": [3, 4], "x": 5.25, "y": 3}, + {"matrix": [3, 5], "x": 6.25, "y": 3}, + {"matrix": [3, 6], "x": 7.25, "y": 3}, + {"matrix": [3, 7], "x": 8.25, "y": 3}, + {"matrix": [3, 8], "x": 9.25, "y": 3}, + {"matrix": [3, 9], "x": 10.25, "y": 3}, + {"matrix": [3, 10], "x": 11.25, "y": 3}, + {"matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75}, + {"matrix": [3, 13], "x": 14, "y": 3}, + + {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.5}, + {"matrix": [4, 1], "x": 1.5, "y": 4}, + {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.5}, + {"matrix": [4, 5], "x": 4, "y": 4, "w": 7}, + {"matrix": [4, 10], "x": 13, "y": 4, "w": 1.5}, + {"matrix": [4, 12], "x": 14.5, "y": 4}, + {"matrix": [4, 13], "x": 15.5, "y": 4, "w": 1.5} + ] + } + } +} diff --git a/keyboards/kmac_happy/keymaps/default/keymap.c b/keyboards/kmac_happy/keymaps/default/keymap.c new file mode 100644 index 0000000000..6eeb1e9bed --- /dev/null +++ b/keyboards/kmac_happy/keymaps/default/keymap.c @@ -0,0 +1,42 @@ +/* Copyright 2024 nlnjnj + * + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, 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_BSLS, KC_GRV, + 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_BSPC, + 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL + ), + [1] = LAYOUT( + 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_INS, KC_DEL, + KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, 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_PGDN, KC_TRNS, KC_UP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT + ) +}; + +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { + writePinLow(B1); + } else { + writePinHigh(B1); + } + return false; +} diff --git a/keyboards/kmac_happy/keymaps/vial/config.h b/keyboards/kmac_happy/keymaps/vial/config.h new file mode 100644 index 0000000000..5ff0037cda --- /dev/null +++ b/keyboards/kmac_happy/keymaps/vial/config.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#pragma once + +#define VIAL_KEYBOARD_UID {0x7B, 0x23, 0xF2, 0x86, 0xEF, 0xC8, 0x03, 0x05} + +// ESC + Enter +#define VIAL_UNLOCK_COMBO_ROWS { 0, 2 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 13 } diff --git a/keyboards/kmac_happy/keymaps/vial/keymap.c b/keyboards/kmac_happy/keymaps/vial/keymap.c new file mode 100644 index 0000000000..6eeb1e9bed --- /dev/null +++ b/keyboards/kmac_happy/keymaps/vial/keymap.c @@ -0,0 +1,42 @@ +/* Copyright 2024 nlnjnj + * + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, 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_BSLS, KC_GRV, + 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_BSPC, + 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL + ), + [1] = LAYOUT( + 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_INS, KC_DEL, + KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, 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_PGDN, KC_TRNS, KC_UP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT + ) +}; + +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { + writePinLow(B1); + } else { + writePinHigh(B1); + } + return false; +} diff --git a/keyboards/kmac_happy/keymaps/vial/rules.mk b/keyboards/kmac_happy/keymaps/vial/rules.mk new file mode 100644 index 0000000000..839cce340c --- /dev/null +++ b/keyboards/kmac_happy/keymaps/vial/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes # Enable VIA +VIAL_ENABLE = yes # Enable VIAL +LTO_ENABLE = yes diff --git a/keyboards/kmac_happy/keymaps/vial/vial.json b/keyboards/kmac_happy/keymaps/vial/vial.json new file mode 100644 index 0000000000..16e5fe7c6b --- /dev/null +++ b/keyboards/kmac_happy/keymaps/vial/vial.json @@ -0,0 +1,132 @@ +{ + "lighting": "none", + "matrix": { + "rows": 5, + "cols": 15 + }, + "layouts": { + "labels": [ + "Split Backspace", + "Split Right Shift" + ], + "keymap": [ + [ + "0,0", + "0,1", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + "0,10", + "0,11", + "0,12", + { + "w": 2 + }, + "0,13\n\n\n0,0", + { + "x": 1 + }, + "0,13\n\n\n0,1", + "0,14\n\n\n0,1" + ], + [ + { + "w": 1.5 + }, + "1,0", + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + " 1, 12", + { + "w": 1.5 + }, + "1,13" + ], + [ + { + "w": 1.75 + }, + "2,0", + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + { + "w": 2.25 + }, + "2,13" + ], + [ + { + "w": 2.25 + }, + "3,0", + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + { + "w": 2.75 + }, + "3,12\n\n\n1,0", + { + "x": 0.25, + "w": 1.75 + }, + "3,12\n\n\n1,1", + "3,13\n\n\n1,1" + ], + [ + { + "w": 1.5 + }, + "4,0", + "4,1", + { + "w": 1.5 + }, + "4,2", + { + "w": 7 + }, + "4,5", + { + "w": 1.5 + }, + "4,10", + "4,12", + { + "w": 1.5 + }, + "4,13" + ] + ] + } +} diff --git a/keyboards/kmac_happy/kmac_happy.c b/keyboards/kmac_happy/kmac_happy.c new file mode 100644 index 0000000000..7550d8f8b7 --- /dev/null +++ b/keyboards/kmac_happy/kmac_happy.c @@ -0,0 +1,23 @@ +/* Copyright 2024 nlnjnj + * + * 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 . + */ +#include "quantum.h" + +/* LED pin configuration + * Caps Lock: Low B1 + */ +void led_init_ports(void) { + DDRB |= (1<<1); // OUT +} diff --git a/keyboards/kmac_happy/matrix.c b/keyboards/kmac_happy/matrix.c new file mode 100644 index 0000000000..593ee38371 --- /dev/null +++ b/keyboards/kmac_happy/matrix.c @@ -0,0 +1,303 @@ +/* Copyright 2024 nlnjnj + * + * 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 . + */ +#include +#include +#if defined(__AVR__) +#include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" + + +/* Set 0 if debouncing isn't needed */ +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +#define COL_SHIFTER ((uint32_t)1) + +static uint16_t debouncing_time; +static bool debouncing = false; + + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static void init_rows(void); +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); +static void unselect_cols(void); +static void select_col(uint8_t col); + +__attribute__ ((weak)) +void matrix_init_user(void) {} + +__attribute__ ((weak)) +void matrix_scan_user(void) {} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +inline +uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) { + return MATRIX_COLS; +} + +void matrix_init(void) { + unselect_cols(); + init_rows(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_kb(); +} + +uint8_t matrix_scan(void) +{ + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } + } + + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCE)) { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + debouncing = false; + } + + matrix_scan_kb(); + return 1; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) & _BV(E2 & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (COL_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(COL_SHIFTER << current_col); + } + } + else { + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF))) + { + // Pin HI, set col bit + current_matrix[row_index] |= (COL_SHIFTER << current_col); + } + else + { + // Pin LO, clear col bit + current_matrix[row_index] &= ~(COL_SHIFTER << current_col); + } + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect cols + unselect_cols(); + + return matrix_changed; +} + +/* Row pin configuration + * row: 0 1 2 3 4 + * pin: D0 D1 D2 D3 D5 + * + * Caps lock uses its own pin E2 + */ +static void init_rows(void) { + DDRD &= ~((1<<0)| (1<<1) | (1<<2) | (1<<3) | (1<<5)); // IN + PORTD &= ~((1<<0)| (1<<1) | (1<<2) | (1<<3) | (1<<5)); // LO + + DDRE &= ~(1<<2); // IN + PORTE |= (1<<2); // HI +} + +/* Columns 0 - 14 + * col 0 ~ col 6: B6 + * These columns use a 74HC237D 3 to 8 bit demultiplexer. + * A B C GL1 + * col / pin: PF0 PF1 PC7 PC6 + * 2: 0 0 0 1 + * 3: 1 0 0 1 + * 4: 0 1 0 1 + * 5: 1 1 0 1 + * 6: 0 0 1 1 + * 7: 1 0 1 1 + * 8: 0 1 1 1 + * 9: 1 1 1 1 + * col 7: E6 + * col 8: B0 + * col 9: B7 + * col 10: D4 + * col 12: D6 + * col 13: D7 + * col 14: B4 + */ +static void unselect_cols(void) { + DDRB |= (1<<0) | (1<<7) | (1<<4); // OUT + PORTB &= ~((1<<0) | (1<<7) | (1<<4)); // LO + + DDRD |= (1<<4) | (1<<6) | (1<<7); // OUT + PORTD &= ~((1<<4) | (1<<6) | (1<<7)); // LO + + DDRE |= (1<<6); // OUT + PORTE &= ~((1<<6)); // LO + + DDRF |= (1<<0) | (1<<1); // OUT + PORTF &= ~((1<<0) | (1<<1)); // LO + + DDRC |= (1<<7) | (1<<6); // OUT + PORTC &= ~((1<<7) | (1<<6)); // LO +} + +static void select_col(uint8_t col) +{ + switch (col) { + case 0: + PORTC |= (1<<6); // HI + break; + case 1: + PORTC |= (1<<6); // HI + PORTF |= (1<<0); // HI + break; + case 2: + PORTC |= (1<<6); // HI + PORTF |= (1<<1); // HI + break; + case 3: + PORTC |= (1<<6); // HI + PORTF |= (1<<0); // HI + PORTF |= (1<<1); // HI + break; + case 4: + PORTC |= (1<<6); // HI + PORTC |= (1<<7); // HI + break; + case 5: + PORTC |= (1<<6); // HI + PORTF |= (1<<0); // HI + PORTC |= (1<<7); // HI + break; + case 6: + PORTC |= (1<<6); // HI + PORTF |= (1<<1); // HI + PORTC |= (1<<7); // HI + break; + case 7: + PORTC |= (1<<6); // HI + PORTF |= (1<<0); // HI + PORTF |= (1<<1); // HI + PORTC |= (1<<7); // HI + break; + case 8: + PORTE |= (1<<6); // HI + break; + case 9: + PORTB |= (1<<0); // HI + break; + case 10: + PORTB |= (1<<7); // HI + break; + case 11: + PORTD |= (1<<4); // HI + break; + case 12: + PORTD |= (1<<6); // HI + break; + case 13: + PORTD |= (1<<7); // HI + break; + case 14: + PORTB |= (1<<4); // HI + break; + } +} diff --git a/keyboards/kmac_happy/readme.md b/keyboards/kmac_happy/readme.md new file mode 100644 index 0000000000..3538fadc78 --- /dev/null +++ b/keyboards/kmac_happy/readme.md @@ -0,0 +1,36 @@ +KMAC Happy keyboard firmware +====================== + +The KMAC Happy is a HHKB layout 60% keyboard. It is programmed with the 'KMAC KEY MAP' original. + +## Hardware +Columns 7-14 and rows 0-4 are wired directly to the ATmega32U4, and columns 0-7 are wired to the [74HC237D demultiplexer](https://www.mouser.de/datasheet/2/916/74HC237-1319445.pdf). Capslock is on E2 and also triggers a reset if held when plugging the cable in. + +There is only one individually controllable led, which is the Capslock key. + +The ATmega32U4 runs on an external crystal on 8mhz, so you'll have to change the bitclock on the ISP programmer if you're unable to read or write the chip. + +## How to build + +``` +make kmac_happy:default +or +make kmac_happy:vial +``` + +## How to flash +Hold the capslock key while plugging in the USB and flash the .hex file using QMK Toolbox or Atmel FLIP. + +## **IMPORTANT** + +The backlight feature does not work in current version, I still does not figure out a way to add backlight function without breaking the firmware size limitation. + +May be fixed in future release. + +```bash + * The firmware is too large! 29052/28672 (380 bytes over) +``` + +## Thanks + +Thanks to Evy Dekkers for his great contribution, which makes the porting much easily. diff --git a/keyboards/kmac_happy/rules.mk b/keyboards/kmac_happy/rules.mk new file mode 100644 index 0000000000..8e343a7179 --- /dev/null +++ b/keyboards/kmac_happy/rules.mk @@ -0,0 +1,18 @@ +# Processor frequency +F_CPU = 8000000 + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +CUSTOM_MATRIX = yes # Custom matrix file +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +AUDIO_ENABLE = no # Audio output + +# Project specific files +SRC = matrix.c