From fc8346e0b3d601aadf37fd7a1e708910cee22f75 Mon Sep 17 00:00:00 2001 From: Brandon Claveria <48102030+swiftrax@users.noreply.github.com> Date: Sat, 8 Jan 2022 16:13:37 -0800 Subject: [PATCH] [keyboard] BumbleBee handwired (#14908) * add bumblebee * change keymaps * change PID * update info.json * Apply suggestions from code review * Update keyboards/handwired/swiftrax/bumblebee/rules.mk * update readme.md * Update keyboards/handwired/swiftrax/bumblebee/info.json * edit keymaps * Update keyboards/handwired/swiftrax/bumblebee/rules.mk * Update keyboards/handwired/swiftrax/bumblebee/bumblebee.h * Update keyboards/handwired/swiftrax/bumblebee/info.json * Update keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c * Update keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c --- .../handwired/swiftrax/bumblebee/bumblebee.c | 56 ++++++++++++++++++ .../handwired/swiftrax/bumblebee/bumblebee.h | 39 +++++++++++++ .../handwired/swiftrax/bumblebee/config.h | 58 +++++++++++++++++++ .../handwired/swiftrax/bumblebee/info.json | 10 ++++ .../bumblebee/keymaps/default/keymap.c | 47 +++++++++++++++ .../bumblebee/keymaps/default/rules.mk | 2 + .../swiftrax/bumblebee/keymaps/via/keymap.c | 53 +++++++++++++++++ .../swiftrax/bumblebee/keymaps/via/rules.mk | 4 ++ .../handwired/swiftrax/bumblebee/readme.md | 21 +++++++ .../handwired/swiftrax/bumblebee/rules.mk | 19 ++++++ 10 files changed, 309 insertions(+) create mode 100644 keyboards/handwired/swiftrax/bumblebee/bumblebee.c create mode 100644 keyboards/handwired/swiftrax/bumblebee/bumblebee.h create mode 100644 keyboards/handwired/swiftrax/bumblebee/config.h create mode 100644 keyboards/handwired/swiftrax/bumblebee/info.json create mode 100644 keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c create mode 100644 keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk create mode 100644 keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c create mode 100644 keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk create mode 100644 keyboards/handwired/swiftrax/bumblebee/readme.md create mode 100644 keyboards/handwired/swiftrax/bumblebee/rules.mk diff --git a/keyboards/handwired/swiftrax/bumblebee/bumblebee.c b/keyboards/handwired/swiftrax/bumblebee/bumblebee.c new file mode 100644 index 0000000000..613a1fa1b3 --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/bumblebee.c @@ -0,0 +1,56 @@ +/* +Copyright 2021 Swiftrax + +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 "bumblebee.h" + +// Encoder +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) + return false; + if (clockwise) + tap_code16(KC_VOLU); + else + tap_code16(KC_VOLD); + return true; +} + +// Initialize all RGB indicators to 'off' +__attribute__((weak)) +void keyboard_post_init_user(void) { + rgblight_setrgb_at(0, 0, 0, 0); // [..., 0] = top LED + rgblight_setrgb_at(0, 0, 0, 1); // [..., 1] = middle LED + rgblight_setrgb_at(0, 0, 0, 2); // [..., 2] = bottom LED +} + +// RGB Layer Indicators +layer_state_t layer_state_set_kb(layer_state_t state) { + if (get_highest_layer(state) == 0) { + rgblight_setrgb_at(255, 0, 0, 0); //red + } else { + rgblight_setrgb_at(0, 0, 0, 0); + } + if (get_highest_layer(state) == 1){ + rgblight_setrgb_at(0, 0, 255, 1); //green + } else{ + rgblight_setrgb_at(0, 0, 0, 1); + } + if (get_highest_layer(state) == 2){ + rgblight_setrgb_at(0, 255, 0, 2); //blue + } else{ + rgblight_setrgb_at(0, 0, 0, 2); + } + return layer_state_set_user(state); +} \ No newline at end of file diff --git a/keyboards/handwired/swiftrax/bumblebee/bumblebee.h b/keyboards/handwired/swiftrax/bumblebee/bumblebee.h new file mode 100644 index 0000000000..2d1fdf7a46 --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/bumblebee.h @@ -0,0 +1,39 @@ +/* +Copyright 2021 Swiftrax + +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 + +#define KC_NO XXX + +#include "quantum.h" + + #define LAYOUT_all( \ + K00, K10, K01, K11, K02, K12, K03, K13, K04, K14, K05, K15, K06, K16, K07, K17, \ + K20, K30, K21, K31, K22, K32, K23, K33, K24, K34, K25, K35, K26, K36, K27, \ + K40, K50, K41, K51, K42, K52, K43, K53, K44, K54, K45, K55, K46, K56, K47, \ + K60, K70, K62, K72, K63, K74, K65, K66, K76, K67 \ + ) \ + { \ + { K00, K01, K02, K03, K04, K05, K06, K07 }, \ + { K10, K11, K12, K13, K14, K15, K16, XXX }, \ + { K20, K21, K22, K23, K24, K25, K26, K27 }, \ + { K30, K31, K32, K33, K34, K35, K36, XXX }, \ + { K40, K41, K42, K43, K44, K45, K46, K47 }, \ + { K50, K51, K52, K53, K54, K55, K56, XXX }, \ + { K60, XXX, K62, K63, XXX, K65, K66, K67 }, \ + { K70, XXX, K72, XXX, K74, XXX, K76, XXX } \ + } + diff --git a/keyboards/handwired/swiftrax/bumblebee/config.h b/keyboards/handwired/swiftrax/bumblebee/config.h new file mode 100644 index 0000000000..89b51a762f --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/config.h @@ -0,0 +1,58 @@ +/* +Copyright 2021 Swiftrax + +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 0x04D8 +#define PRODUCT_ID 0xE881 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Swiftrax +#define PRODUCT BumbleBee +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 8 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS { B0, B1, B2, B3, F4, F5, F6, F7 } +#define MATRIX_COL_PINS { C7, D3, D5, D4, D6, D7, B4, B5 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Encoder */ +#define ENCODERS_PAD_A { C6 } +#define ENCODERS_PAD_B { B6 } + +/* RGB Indicators */ +#define RGB_DI_PIN E6 +#define RGBLED_NUM 3 + +/* Solenid Pin */ +#define SOLENOID_PIN D2 + +/* Piezo Buzzer */ +#define AUDIO_PIN B7 \ No newline at end of file diff --git a/keyboards/handwired/swiftrax/bumblebee/info.json b/keyboards/handwired/swiftrax/bumblebee/info.json new file mode 100644 index 0000000000..3d9a8730a6 --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/info.json @@ -0,0 +1,10 @@ +{ + "keyboard_name": "BumbleBee", + "url": "https://www.github.com/swiftrax", + "maintainer": "swiftrax", + "layouts": { + "LAYOUT_all": { + "layout": [{"label":"0,0", "x":0, "y":0}, {"label":"1,0", "x":1, "y":0, "w":1.5}, {"label":"0,1", "x":2.5, "y":0}, {"label":"1,1", "x":3.5, "y":0}, {"label":"0,2", "x":4.5, "y":0}, {"label":"1,2", "x":5.5, "y":0}, {"label":"0,3", "x":6.5, "y":0}, {"label":"1,3", "x":7.5, "y":0}, {"label":"0,4", "x":8.5, "y":0}, {"label":"1,4", "x":9.5, "y":0}, {"label":"0,5", "x":10.5, "y":0}, {"label":"1,5", "x":11.5, "y":0}, {"label":"0,6", "x":12.5, "y":0}, {"label":"1,6", "x":13.5, "y":0}, {"label":"0,7", "x":14.5, "y":0, "w":1.5}, {"label":"1,7", "x":16, "y":0}, {"label":"2,0", "x":0, "y":1}, {"label":"3,0", "x":1, "y":1, "w":1.75}, {"label":"2,1", "x":2.75, "y":1}, {"label":"3,1", "x":3.75, "y":1}, {"label":"2,2", "x":4.75, "y":1}, {"label":"3,2", "x":5.75, "y":1}, {"label":"2,3", "x":6.75, "y":1}, {"label":"3,3", "x":7.75, "y":1}, {"label":"2,4", "x":8.75, "y":1}, {"label":"3,4", "x":9.75, "y":1}, {"label":"2,5", "x":10.75, "y":1}, {"label":"3,5", "x":11.75, "y":1}, {"label":"2,6", "x":12.75, "y":1}, {"label":"3,6", "x":13.75, "y":1, "w":2.25}, {"label":"2,7", "x":16, "y":1}, {"label":"4,0", "x":0, "y":2}, {"label":"5,0", "x":1, "y":2, "w":2.25}, {"label":"4,1", "x":3.25, "y":2}, {"label":"5,1", "x":4.25, "y":2}, {"label":"4,2", "x":5.25, "y":2}, {"label":"5,2", "x":6.25, "y":2}, {"label":"4,3", "x":7.25, "y":2}, {"label":"5,3", "x":8.25, "y":2}, {"label":"4,4", "x":9.25, "y":2}, {"label":"5,4", "x":10.25, "y":2}, {"label":"4,5", "x":11.25, "y":2}, {"label":"5,5", "x":12.25, "y":2}, {"label":"4,6", "x":13.25, "y":2, "w":1.75}, {"label":"5,6", "x":15, "y":2}, {"label":"4,7", "x":16, "y":2}, {"label":"6,0", "x":0, "y":3}, {"label":"7,0", "x":1, "y":3, "w":1.5}, {"label":"6,2", "x":3.88, "y":3, "w":1.5}, {"label":"7,2", "x":5.38, "y":3, "w":2.75}, {"label":"6,3", "x":8.13, "y":3}, {"label":"7,4", "x":9.13, "y":3, "w":2}, {"label":"6,5", "x":11.13, "y":3, "w":1.5}, {"label":"6,6", "x":14, "y":3}, {"label":"7,6", "x":15, "y":3}, {"label":"6,7", "x":16, "y":3}] + } + } +} \ No newline at end of file diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c new file mode 100644 index 0000000000..7e7247c80f --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/keymap.c @@ -0,0 +1,47 @@ +/* +Copyright 2021 Swiftrax + +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 + +#define SOLENOID_DEFAULT_BUZZ 1 +#define FB_ERM_LRA 0 +#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ +#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ + +/* Please refer to your datasheet for the optimal setting for your specific motor. */ +#define RATED_VOLTAGE 3 +#define V_PEAK 5 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC , 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_DEL , + KC_F13 , 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_HOME, + KC_F14 , 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_UP , KC_END , + KC_F15 , KC_LCTL, KC_LALT, KC_SPC , KC_MUTE, MO(1) , MO(2) , KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_all( + _______, _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT_all( + _______, _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk new file mode 100644 index 0000000000..9c6098640a --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +AUDIO_ENABLE = yes +HAPTIC_ENABLE += SOLENOID \ No newline at end of file diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c new file mode 100644 index 0000000000..a48f998100 --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/keymap.c @@ -0,0 +1,53 @@ +/* +Copyright 2021 Swiftrax + +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 + +#define SOLENOID_DEFAULT_BUZZ 1 +#define FB_ERM_LRA 0 +#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ +#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ + +/* Please refer to your datasheet for the optimal setting for your specific motor. */ +#define RATED_VOLTAGE 3 +#define V_PEAK 5 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC , 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_DEL , + KC_F13 , 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_HOME, + KC_F14 , 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_UP , KC_END , + KC_F15 , KC_LCTL, KC_LALT, KC_SPC , KC_MUTE, MO(1) , MO(2) , KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_all( + _______, _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT_all( + _______, _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [3] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk new file mode 100644 index 0000000000..e0ef178896 --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes +#HAPTIC_ENABLE += SOLENOID +AUDIO_ENABLE = yes +#either solenoid or audio not both can be enabled \ No newline at end of file diff --git a/keyboards/handwired/swiftrax/bumblebee/readme.md b/keyboards/handwired/swiftrax/bumblebee/readme.md new file mode 100644 index 0000000000..32091cb83b --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/readme.md @@ -0,0 +1,21 @@ +# BumbleBee + +A 50% keyboard with a bunch of fun features + +* Keyboard Maintainer: Swiftrax +* Hardware Supported: BumbleBee +* Hardware Availability: https://github.com/swiftrax + +## 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 press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +Make example for this keyboard (after setting up your build environment): + + make handwired/swiftrax/bumblebee:default + +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/handwired/swiftrax/bumblebee/rules.mk b/keyboards/handwired/swiftrax/bumblebee/rules.mk new file mode 100644 index 0000000000..e0590e039a --- /dev/null +++ b/keyboards/handwired/swiftrax/bumblebee/rules.mk @@ -0,0 +1,19 @@ +# 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 = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes # Rotary Encoder