diff options
author | QMK Bot <hello@qmk.fm> | 2022-03-26 00:46:16 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-03-26 00:46:16 +0000 |
commit | 1fabad1cec5b773c86b5516ad52d8989d1b67251 (patch) | |
tree | 2944c3345e0c7f2cd8a31135e7cbdceb19a4ce98 /keyboards | |
parent | 7cec7b678036d105c9b97cb4e728fdcb986ccb57 (diff) | |
parent | 7e0dde1f0009bc47430091736d7893148876b4ec (diff) | |
download | qmk_firmware-1fabad1cec5b773c86b5516ad52d8989d1b67251.tar.gz qmk_firmware-1fabad1cec5b773c86b5516ad52d8989d1b67251.zip |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/ydkb/grape/config.h | 57 | ||||
-rw-r--r-- | keyboards/ydkb/grape/grape.c | 16 | ||||
-rw-r--r-- | keyboards/ydkb/grape/grape.h | 47 | ||||
-rw-r--r-- | keyboards/ydkb/grape/info.json | 130 | ||||
-rw-r--r-- | keyboards/ydkb/grape/keymaps/default/keymap.c | 29 | ||||
-rw-r--r-- | keyboards/ydkb/grape/keymaps/via/keymap.c | 51 | ||||
-rw-r--r-- | keyboards/ydkb/grape/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/ydkb/grape/matrix.c | 96 | ||||
-rw-r--r-- | keyboards/ydkb/grape/readme.md | 23 | ||||
-rw-r--r-- | keyboards/ydkb/grape/rules.mk | 22 |
10 files changed, 473 insertions, 0 deletions
diff --git a/keyboards/ydkb/grape/config.h b/keyboards/ydkb/grape/config.h new file mode 100644 index 0000000000..3396f18d61 --- /dev/null +++ b/keyboards/ydkb/grape/config.h @@ -0,0 +1,57 @@ +/* Copyright 2022 somepin + * + * 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 0x5945 // "YE" +#define PRODUCT_ID 0x6772 // "GR" +#define DEVICE_VER 0x0001 +#define MANUFACTURER YDKB +#define PRODUCT Grape + +/* key matrix size */ +#define MATRIX_ROWS 7 +#define MATRIX_COLS 18 + +#define MATRIX_COL_PINS { F4, F5, F6, F7, C7, C6, B6, B5, B4, D7, D6, D4, D5, D3, B3, B2, B1, B0 } + +#define SN74X138_ADDRESS_PINS { D2, D1, D0 } + +#define LED_NUM_LOCK_PIN F1 +#define LED_CAPS_LOCK_PIN F0 +#define LED_SCROLL_LOCK_PIN E6 +#define LED_PIN_ON_STATE 0 + +#define BACKLIGHT_PIN B7 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN E6 +#define RGBLED_NUM 4 +#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 + +#define DYNAMIC_KEYMAP_LAYER_COUNT 3 diff --git a/keyboards/ydkb/grape/grape.c b/keyboards/ydkb/grape/grape.c new file mode 100644 index 0000000000..c0d33b064b --- /dev/null +++ b/keyboards/ydkb/grape/grape.c @@ -0,0 +1,16 @@ +/* Copyright 2022 somepin + * + * 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 "grape.h" diff --git a/keyboards/ydkb/grape/grape.h b/keyboards/ydkb/grape/grape.h new file mode 100644 index 0000000000..0f20f7ea8a --- /dev/null +++ b/keyboards/ydkb/grape/grape.h @@ -0,0 +1,47 @@ +/* Copyright 2022 somepin + * + * 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" + +#define XXX KC_NO + +/* 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_all( \ + K0A, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, K0N, K0P, K0Q, K0R, K0S, \ + K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1P, K1Q, K1R, K1S, \ + K2P, K2Q, K2R, K2S, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K1N, K3P, K3Q, K3R, K3S, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K4P, K4Q, K4R, K4S, \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4N, K5Q, K5R, K5S, \ + K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K4M, K5N, K6Q, K6R, K6S, \ + K6A, K6B, K6C, K6E, K6F, K6H, K6I, K6J, K6K, K6L, K6M, K6N, K5P, K6P \ +) { \ + { K0A, XXX, K0C, K0D, K0E, K0F, K0G, K0H, K0I, K0J, K0K, K0L, XXX, K0N, K0P, K0Q, K0R, K0S }, \ + { XXX, XXX, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, XXX, K1N, K1P, K1Q, K1R, K1S }, \ + { K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, K2S }, \ + { K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, K3S }, \ + { K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4P, K4Q, K4R, K4S }, \ + { K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5P, K5Q, K5R, K5S }, \ + { K6A, K6B, K6C, XXX, K6E, K6F, XXX, K6H, K6I, K6J, K6K, K6L, K6M, K6N, K6P, K6Q, K6R, K6S } \ +} diff --git a/keyboards/ydkb/grape/info.json b/keyboards/ydkb/grape/info.json new file mode 100644 index 0000000000..9024ca4d0b --- /dev/null +++ b/keyboards/ydkb/grape/info.json @@ -0,0 +1,130 @@ +{ + "keyboard_name": "Grape", + "url": "https://item.taobao.com/item.htm?id=642205244150", + "maintainer": "Gacathon", + "layouts": { + "LAYOUT_all": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "F1", "x": 2, "y": 0 }, + { "label": "F2", "x": 3, "y": 0 }, + { "label": "F3", "x": 4, "y": 0 }, + { "label": "F4", "x": 5, "y": 0 }, + { "label": "F5", "x": 6, "y": 0 }, + { "label": "F6", "x": 7, "y": 0 }, + { "label": "Insert", "x": 8.5, "y": 0 }, + { "label": "Home", "x": 9.5, "y": 0 }, + { "label": "PgUp", "x": 10.5, "y": 0 }, + { "label": "PrtSc", "x": 11.5, "y": 0 }, + { "label": "Pause", "x": 13, "y": 0 }, + { "label": "Num Lock", "x": 16, "y": 0 }, + { "label": "/", "x": 17, "y": 0 }, + { "label": "*", "x": 18, "y": 0 }, + { "label": "-", "x": 19, "y": 0 }, + { "label": "F7", "x": 2, "y": 1 }, + { "label": "F8", "x": 3, "y": 1 }, + { "label": "F9", "x": 4, "y": 1 }, + { "label": "F10", "x": 5, "y": 1 }, + { "label": "F11", "x": 6, "y": 1 }, + { "label": "F12", "x": 7, "y": 1 }, + { "label": "Delete", "x": 8.5, "y": 1 }, + { "label": "End", "x": 9.5, "y": 1 }, + { "label": "PgDn", "x": 10.5, "y": 1 }, + { "label": "Scroll Lock", "x": 11.5, "y": 1 }, + { "label": "7", "x": 16, "y": 1 }, + { "label": "8", "x": 17, "y": 1 }, + { "label": "9", "x": 18, "y": 1 }, + { "label": "+", "x": 19, "y": 1 }, + { "label": "4", "x": 16, "y": 2 }, + { "label": "5", "x": 17, "y": 2 }, + { "label": "6", "x": 18, "y": 2 }, + { "label": "+", "x": 19, "y": 2 }, + { "label": "~", "x": 0, "y": 3 }, + { "label": "!", "x": 1, "y": 3 }, + { "label": "@", "x": 2, "y": 3 }, + { "label": "#", "x": 3, "y": 3 }, + { "label": "$", "x": 4, "y": 3 }, + { "label": "%", "x": 5, "y": 3 }, + { "label": "^", "x": 6, "y": 3 }, + { "label": "&", "x": 7, "y": 3 }, + { "label": "*", "x": 8, "y": 3 }, + { "label": "(", "x": 9, "y": 3 }, + { "label": ")", "x": 10, "y": 3 }, + { "label": "_", "x": 11, "y": 3 }, + { "label": "+", "x": 12, "y": 3 }, + { "label": "Bksp", "x": 13, "y": 3 }, + { "label": "Bksp", "x": 14, "y": 3 }, + { "label": "1", "x": 16, "y": 3 }, + { "label": "2", "x": 17, "y": 3 }, + { "label": "3", "x": 18, "y": 3 }, + { "label": "Enter", "x": 19, "y": 3 }, + { "label": "Tab", "x": 0, "y": 4, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 4 }, + { "label": "W", "x": 2.5, "y": 4 }, + { "label": "E", "x": 3.5, "y": 4 }, + { "label": "R", "x": 4.5, "y": 4 }, + { "label": "T", "x": 5.5, "y": 4 }, + { "label": "Y", "x": 6.5, "y": 4 }, + { "label": "U", "x": 7.5, "y": 4 }, + { "label": "I", "x": 8.5, "y": 4 }, + { "label": "O", "x": 9.5, "y": 4 }, + { "label": "P", "x": 10.5, "y": 4 }, + { "label": "{", "x": 11.5, "y": 4 }, + { "label": "}", "x": 12.5, "y": 4 }, + { "label": "|", "x": 13.5, "y": 4, "w": 1.5 }, + { "label": "0", "x": 16, "y": 4 }, + { "label": "0", "x": 17, "y": 4 }, + { "label": ".", "x": 18, "y": 4 }, + { "label": "Enter", "x": 19, "y": 4 }, + { "label": "Caps Lock", "x": 0, "y": 5, "w": 1.75 }, + { "label": "A", "x": 1.75, "y": 5 }, + { "label": "S", "x": 2.75, "y": 5 }, + { "label": "D", "x": 3.75, "y": 5 }, + { "label": "F", "x": 4.75, "y": 5 }, + { "label": "G", "x": 5.75, "y": 5 }, + { "label": "H", "x": 6.75, "y": 5 }, + { "label": "J", "x": 7.75, "y": 5 }, + { "label": "K", "x": 8.75, "y": 5 }, + { "label": "L", "x": 9.75, "y": 5 }, + { "label": ":", "x": 10.75, "y": 5 }, + { "label": "\"", "x": 11.75, "y": 5 }, + { "label": "Enter", "x": 12.75, "y": 5, "w": 2.25 }, + { "label": "F13", "x": 16.5, "y": 5.25 }, + { "label": "F14", "x": 17.5, "y": 5.25 }, + { "label": "F15", "x": 18.5, "y": 5.25 }, + { "label": "Shift", "x": 0, "y": 6, "w": 1.25 }, + { "label": "Shift", "x": 1.25, "y": 6 }, + { "label": "Z", "x": 2.25, "y": 6 }, + { "label": "X", "x": 3.25, "y": 6 }, + { "label": "C", "x": 4.25, "y": 6 }, + { "label": "V", "x": 5.25, "y": 6 }, + { "label": "B", "x": 6.25, "y": 6 }, + { "label": "N", "x": 7.25, "y": 6 }, + { "label": "M", "x": 8.25, "y": 6 }, + { "label": "<", "x": 9.25, "y": 6 }, + { "label": ">", "x": 10.25, "y": 6 }, + { "label": "?", "x": 11.25, "y": 6 }, + { "label": "Shift", "x": 12.25, "y": 6 }, + { "label": "Shift", "x": 13.25, "y": 6 }, + { "label": "\u2191", "x": 14.5, "y": 6.25 }, + { "label": "F16", "x": 16.5, "y": 6.25 }, + { "label": "F17", "x": 17.5, "y": 6.25 }, + { "label": "F18", "x": 18.5, "y": 6.25 }, + { "label": "Ctrl", "x": 0, "y": 7 }, + { "label": "Win", "x": 1, "y": 7 }, + { "label": "Alt", "x": 2, "y": 7 }, + { "x": 3, "y": 7, "w": 3 }, + { "x": 6, "y": 7, "w": 3 }, + { "label": "Alt", "x": 9, "y": 7 }, + { "label": "Win", "x": 10, "y": 7 }, + { "label": "Menu", "x": 11, "y": 7 }, + { "label": "Ctrl", "x": 12, "y": 7 }, + { "label": "\u2190", "x": 13.5, "y": 7.25 }, + { "label": "\u2193", "x": 14.5, "y": 7.25 }, + { "label": "\u2192", "x": 15.5, "y": 7.25 }, + { "label": "BTN1", "x": 17, "y": 7.25 }, + { "label": "BTN2", "x": 18, "y": 7.25 } + ] + } + } +} diff --git a/keyboards/ydkb/grape/keymaps/default/keymap.c b/keyboards/ydkb/grape/keymaps/default/keymap.c new file mode 100644 index 0000000000..2704820ad9 --- /dev/null +++ b/keyboards/ydkb/grape/keymaps/default/keymap.c @@ -0,0 +1,29 @@ +/* Copyright 2022 somepin + * + * 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_all( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, KC_PAUS, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_END, KC_PGDN, KC_SLCK, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + 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_BSPC, KC_P1, KC_P2, KC_P3, KC_PENT, + 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_P0, KC_P0, KC_PDOT, KC_PENT, + 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_F13, KC_F14, KC_F15, + KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_F16, KC_F17, KC_F18, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_BTN1, KC_BTN2 + ) +}; diff --git a/keyboards/ydkb/grape/keymaps/via/keymap.c b/keyboards/ydkb/grape/keymaps/via/keymap.c new file mode 100644 index 0000000000..f01f63bcad --- /dev/null +++ b/keyboards/ydkb/grape/keymaps/via/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2022 somepin + * + * 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_all( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, KC_PAUS, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_END, KC_PGDN, KC_SLCK, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + 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_BSPC, KC_P1, KC_P2, KC_P3, KC_PENT, + 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_P0, KC_P0, KC_PDOT, KC_PENT, + 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_F13, KC_F14, KC_F15, + KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_F16, KC_F17, KC_F18, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_BTN1, KC_BTN2 + ), + + [1] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [2] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/ydkb/grape/keymaps/via/rules.mk b/keyboards/ydkb/grape/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/ydkb/grape/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/ydkb/grape/matrix.c b/keyboards/ydkb/grape/matrix.c new file mode 100644 index 0000000000..700761fa44 --- /dev/null +++ b/keyboards/ydkb/grape/matrix.c @@ -0,0 +1,96 @@ +/* +Copyright 2022 somepin + +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 "matrix.h" +#include "quantum.h" +#include "sn74x138.h" + +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* All rows use a 74HC138 3 to 8 bit demultiplexer. + * + * A2 A1 A0 + * D0 D1 D2 + * 0: 0 0 0 + * 1: 0 0 1 + * 2: 0 1 0 + * 3: 0 1 1 + * 4: 1 0 0 + * 5: 1 0 1 + * 6: 1 1 0 + */ +static void select_row(uint8_t row) { + sn74x138_set_addr(row); +} + +static void init_pins(void) { + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + bool matrix_changed = false; + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Start with a clear matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selection to stabilize + select_row(current_row); + matrix_io_delay(); + + // For each col... + matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; + 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_matrix[current_row] |= pin_state ? 0 : (row_shifter << col_index); + } + + // Determine if matrix changed state + if ((last_row_value != current_matrix[current_row]) && !(matrix_changed)) { + matrix_changed = true; + } + + return matrix_changed; +} + +void matrix_init_custom(void) { + // initialize demultiplexer + sn74x138_init(); + // initialize key pins + init_pins(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { + changed |= read_cols_on_row(current_matrix, current_row); + } + + return changed; +} diff --git a/keyboards/ydkb/grape/readme.md b/keyboards/ydkb/grape/readme.md new file mode 100644 index 0000000000..9024f38b58 --- /dev/null +++ b/keyboards/ydkb/grape/readme.md @@ -0,0 +1,23 @@ +# YDKB Grape + +![YDKB Grape](https://i.imgur.com/TZjgC9yh.jpg) + +The YDKB Grape is a Cherry G80-11800/11900 replacement PCB utilizing the ATmega32U4 microcontroller. + +* Keyboard Maintainer: [Gacathon](https://github.com/Gacathon) +* Hardware Supported: YDKB Grape (ATmega32U4) +* Hardware Availability: [TaoBao](https://item.taobao.com/item.htm?id=642205244150) + +Make example for this keyboard (after setting up your build environment): + + make ydkb/grape:default + +Flashing example for this keyboard: + + make ydkb/grape:default:flash + +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). + +## Bootloader + +To enter the bootloader, briefly press the physical reset button between Num Lock and Numpad 8 on the front of the PCB. diff --git a/keyboards/ydkb/grape/rules.mk b/keyboards/ydkb/grape/rules.mk new file mode 100644 index 0000000000..57b231441e --- /dev/null +++ b/keyboards/ydkb/grape/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# 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 +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +CUSTOM_MATRIX = lite +VPATH += drivers/gpio +SRC += matrix.c sn74x138.c |