From ed350a1aa6eac4194a0f75af798b47a6e6e85164 Mon Sep 17 00:00:00 2001 From: yulei Date: Sat, 14 Aug 2021 14:35:32 +0800 Subject: [PATCH] add falcon keyboard (#13674) * added falcon keyboard * Update keyboards/matrix/falcon/rules.mk Co-authored-by: Drashna Jaelre * Update keyboards/matrix/falcon/rules.mk Co-authored-by: Drashna Jaelre * Apply suggestions from code review Co-authored-by: Drashna Jaelre * Apply suggestions from code review Co-authored-by: Ryan * added description for the bootloader * Apply suggestions from code review Co-authored-by: Ryan Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/matrix/falcon/config.h | 72 +++++++++++++++++++ keyboards/matrix/falcon/falcon.c | 28 ++++++++ keyboards/matrix/falcon/falcon.h | 51 +++++++++++++ keyboards/matrix/falcon/info.json | 12 ++++ .../matrix/falcon/keymaps/default/keymap.c | 32 +++++++++ keyboards/matrix/falcon/keymaps/via/keymap.c | 46 ++++++++++++ keyboards/matrix/falcon/keymaps/via/rules.mk | 2 + keyboards/matrix/falcon/readme.md | 25 +++++++ keyboards/matrix/falcon/rules.mk | 24 +++++++ 9 files changed, 292 insertions(+) create mode 100644 keyboards/matrix/falcon/config.h create mode 100644 keyboards/matrix/falcon/falcon.c create mode 100644 keyboards/matrix/falcon/falcon.h create mode 100644 keyboards/matrix/falcon/info.json create mode 100644 keyboards/matrix/falcon/keymaps/default/keymap.c create mode 100644 keyboards/matrix/falcon/keymaps/via/keymap.c create mode 100644 keyboards/matrix/falcon/keymaps/via/rules.mk create mode 100644 keyboards/matrix/falcon/readme.md create mode 100644 keyboards/matrix/falcon/rules.mk diff --git a/keyboards/matrix/falcon/config.h b/keyboards/matrix/falcon/config.h new file mode 100644 index 0000000000..afd0b5d3ef --- /dev/null +++ b/keyboards/matrix/falcon/config.h @@ -0,0 +1,72 @@ +/** + * config.h + * + * Copyright 2021 astro + 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 + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4D58 +#define PRODUCT_ID 0x474E +#define DEVICE_VER 0x0001 +#define MANUFACTURER Matrix Lab +#define PRODUCT Falcon + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 13 + +#define MATRIX_ROW_PINS { F1, B7, F7, F5, F4} +#define MATRIX_COL_PINS { F6, B3, B2, B1, B0, C7, C6, B6, B5, B4, D7, D6, D4} + +#define UNUSED_PINS +#define DIODE_DIRECTION ROW2COL + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +//rgb light setting +#define RGBLED_NUM 4 +#define RGB_DI_PIN D1 +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +//pin setting +#define LED_CAPS_LOCK_PIN E2 +#define LED_POWER_PIN D5 +#define CHG_EN_PIN E6 +#define BATTERY_LEVEL_PIN F0 diff --git a/keyboards/matrix/falcon/falcon.c b/keyboards/matrix/falcon/falcon.c new file mode 100644 index 0000000000..0d77944315 --- /dev/null +++ b/keyboards/matrix/falcon/falcon.c @@ -0,0 +1,28 @@ +/** + * falcon.c + * Copyright 2021 astro + 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 "falcon.h" + +void matrix_init_kb(void) +{ + // enable charge + setPinOutput(CHG_EN_PIN); + writePinHigh(CHG_EN_PIN); + + // enable led power + setPinOutput(LED_POWER_PIN); + writePinHigh(LED_POWER_PIN); + +} diff --git a/keyboards/matrix/falcon/falcon.h b/keyboards/matrix/falcon/falcon.h new file mode 100644 index 0000000000..f98ba09504 --- /dev/null +++ b/keyboards/matrix/falcon/falcon.h @@ -0,0 +1,51 @@ +/** + * falcon.h + * Copyright 2021 astro + 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 + +#include "quantum.h" + + +// This a shortcut to help you visually see your layout. +// The first section contains all of the arguements +// The second converts the arguments into a two-dimensional array + +#define LAYOUT_60_hhkb( \ + 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, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, \ + k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \ + k41, k42, k43, k44, k45) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c}, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b,KC_NO}, \ + { k30,KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c}, \ + {KC_NO, k41, k42,KC_NO,KC_NO, k43, k44, k45, k0e, k3d, k2d, k1d, k0d} \ +} + +#define LAYOUT_all( \ + 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, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \ + k41, k42, k43, k44, k45) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c}, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c}, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c}, \ + {KC_NO, k41, k42,KC_NO,KC_NO, k43, k44, k45, k0e, k3d, k2d, k1d, k0d} \ +} diff --git a/keyboards/matrix/falcon/info.json b/keyboards/matrix/falcon/info.json new file mode 100644 index 0000000000..a7c48220c0 --- /dev/null +++ b/keyboards/matrix/falcon/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "Matrix Lab Falcon", + "url": "", + "maintainer": "Astro", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT_60_hhkb": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"~", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Delete", "x":13.5, "y":1, "w":1.5}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Os", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"label":"Alt", "x":11, "y":4, "w":1.5}, {"label":"Os", "x":12.5, "y":4}] + } + } +} \ No newline at end of file diff --git a/keyboards/matrix/falcon/keymaps/default/keymap.c b/keyboards/matrix/falcon/keymaps/default/keymap.c new file mode 100644 index 0000000000..2860d515e9 --- /dev/null +++ b/keyboards/matrix/falcon/keymaps/default/keymap.c @@ -0,0 +1,32 @@ +/** + * keymap.c + * + Copyright 2021 astro + 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_60_hhkb( + 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_LALT, KC_SPC, KC_RALT, KC_RCTL), + + [1] = LAYOUT_60_hhkb( + _______, 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, + RESET, RGB_TOG,RGB_MOD,_______,KC_F13,KC_F14,_______,_______,_______,_______,_______,KC_PGUP,KC_PGDN,_______, + _______, _______,_______,_______,_______,_______,KC_LEFT,KC_DOWN, KC_UP,KC_RIGHT,KC_HOME,KC_END,_______, + _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, + _______,_______, _______, _______,_______), +}; diff --git a/keyboards/matrix/falcon/keymaps/via/keymap.c b/keyboards/matrix/falcon/keymaps/via/keymap.c new file mode 100644 index 0000000000..03f9bab87b --- /dev/null +++ b/keyboards/matrix/falcon/keymaps/via/keymap.c @@ -0,0 +1,46 @@ +/** + * keymap.c + * + Copyright 2021 astro + 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_all( + 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_DEL, KC_BSPC, + 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_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_NUHS, KC_ENT, + KC_LSFT, KC_NUBS, 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_LALT, KC_SPC, KC_RGUI,KC_RALT), + + [1] = LAYOUT_all( + KC_GRV, 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_DEL, + RESET, _______,KC_UP,_______,_______,_______,_______,_______,KC_PAUS,KC_SLCK,KC_PSCR,KC_PGUP,_______,KC_INS, + _______, KC_LEFT,KC_DOWN,KC_RIGHT,_______,_______,_______,_______, _______,_______,KC_HOME,KC_END,_______, _______, + _______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,KC_PGDN,_______,_______, + _______,_______, _______, _______,MO(2)), + + [2] = LAYOUT_all( + _______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______,_______,_______, + _______, _______,KC_VOLU,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, + KC_MUTE, KC_MPRV,KC_VOLD,KC_MNXT,_______,_______,_______,_______, _______,_______,_______,_______,_______, _______, + _______, _______, RGB_TOG,RGB_MOD,RGB_RMOD,RGB_VAI,RGB_VAD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,_______,_______,_______, + _______,_______, KC_MPLY, _______,_______), + + [3] = LAYOUT_all( + _______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______, _______,_______,_______,_______, + _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, + _______, _______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______, + _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, + _______,_______, _______, _______,_______) +}; diff --git a/keyboards/matrix/falcon/keymaps/via/rules.mk b/keyboards/matrix/falcon/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/matrix/falcon/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/matrix/falcon/readme.md b/keyboards/matrix/falcon/readme.md new file mode 100644 index 0000000000..c283650fcf --- /dev/null +++ b/keyboards/matrix/falcon/readme.md @@ -0,0 +1,25 @@ +# Falcon AVR + +PCB using atmega32u4 for the Matrix Falcon + +* Keyboard Maintainer: [astro](https://github.com/yulei) +* Hardware Supported: Matrix Falcon +* Hardware Availability: Limited GB + +Make example for this keyboard (after setting up your build environment): + + make matrix/falcon:default + +Flashing example for this keyboard: + + make matrix/falcon: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 + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard. +* **Physical reset button**: Briefly short cut the *RST* pin with the *GND* pin (pin at the topside of the *RST*) on the back of the PCB. +* **Keycode in layout**: Press the key mapped to `RESET` if it is available. \ No newline at end of file diff --git a/keyboards/matrix/falcon/rules.mk b/keyboards/matrix/falcon/rules.mk new file mode 100644 index 0000000000..9d1fe7ea8a --- /dev/null +++ b/keyboards/matrix/falcon/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# 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 = yes # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +LAYOUTS = 60_hhkb