From 3448558eca6dc910d34ff7073608ed574a0bb7a0 Mon Sep 17 00:00:00 2001 From: Emily Lane Date: Wed, 10 Aug 2022 17:10:04 -0400 Subject: [PATCH 1/3] add BAMFK-4 --- keyboards/keebio/bamfk4/bamfk4.c | 90 +++++++++++ keyboards/keebio/bamfk4/bamfk4.h | 12 ++ keyboards/keebio/bamfk4/config.h | 153 ++++++++++++++++++ keyboards/keebio/bamfk4/info.json | 20 +++ .../keebio/bamfk4/keymaps/default/keymap.c | 18 +++ keyboards/keebio/bamfk4/keymaps/via/keymap.c | 15 ++ keyboards/keebio/bamfk4/keymaps/via/rules.mk | 3 + keyboards/keebio/bamfk4/rules.mk | 23 +++ 8 files changed, 334 insertions(+) create mode 100644 keyboards/keebio/bamfk4/bamfk4.c create mode 100644 keyboards/keebio/bamfk4/bamfk4.h create mode 100644 keyboards/keebio/bamfk4/config.h create mode 100644 keyboards/keebio/bamfk4/info.json create mode 100644 keyboards/keebio/bamfk4/keymaps/default/keymap.c create mode 100644 keyboards/keebio/bamfk4/keymaps/via/keymap.c create mode 100644 keyboards/keebio/bamfk4/keymaps/via/rules.mk create mode 100644 keyboards/keebio/bamfk4/rules.mk diff --git a/keyboards/keebio/bamfk4/bamfk4.c b/keyboards/keebio/bamfk4/bamfk4.c new file mode 100644 index 000000000000..321bbd81deb0 --- /dev/null +++ b/keyboards/keebio/bamfk4/bamfk4.c @@ -0,0 +1,90 @@ +// Copyright 2022 Danny Nguyen (@nooges) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bamfk4.h" + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + // Key Matrix to LED Index + { NO_LED, NO_LED, NO_LED, NO_LED }, +}, { + // LED Index to Physical Position + //through switch + { 26.6, 10 }, { 4.3, 10 }, { 3.8, 49.3 }, { 23.3, 49.3 }, + { 69.4, 49.3 }, { 68.9, 10 }, { 90.6, 10 }, { 89.5, 49.3 }, + { 134, 49.3 }, { 132.9, 10 }, { 155.7, 10 }, { 155.1, 49.3 }, + { 199.6, 49.3 }, { 199.6, 10 }, { 219.1, 10 }, { 219.1, 49.3 }, + + //underglow + { 218, 62.2 }, { 188.7, 62.2 }, { 159.5, 62.2 }, { 123.7, 62.2 }, //bottom right + { 100.3, 62.2 }, { 59.1, 62.2 }, { 35.3, 62.2 }, { 5.4, 62.2 }, //bottom left + { 6, 6.4 }, { 35.3, 6.4 }, { 59.1, 6.4 }, { 100.3, 6.4 }, //top left + { 123.7, 6.4 }, { 159.5, 6.4 }, { 188.7, 6.4 }, { 218, 6.4 } //top right +}, { + // LED Index to Flag + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 2, 2, 2, 2, + 2, 2, 2, 2, + 2, 2, 2, 2, + 2, 2, 2, 2 +} }; + + +# if defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) + +// VIA supports only 4 discrete values for effect speed; map these to some +// useful speed values for RGB Matrix. +enum speed_values { + RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects + RGBLIGHT_SPEED_1 = UINT8_MAX / 4, + RGBLIGHT_SPEED_2 = UINT8_MAX / 2, // matches the default value + RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast +}; + +static uint8_t speed_from_rgblight(uint8_t rgblight_speed) { + switch (rgblight_speed) { + case 0: + return RGBLIGHT_SPEED_0; + case 1: + return RGBLIGHT_SPEED_1; + case 2: + default: + return RGBLIGHT_SPEED_2; + case 3: + return RGBLIGHT_SPEED_3; + } +} + +static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) { + if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) { + return 0; + } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) { + return 1; + } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) { + return 2; + } else { + return 3; + } +} + +void raw_hid_receive_kb(uint8_t *data, uint8_t length) { + switch (data[0]) { + case id_lighting_get_value: + if (data[1] == id_qmk_rgblight_effect_speed) { + data[2] = speed_to_rgblight(rgb_matrix_get_speed()); + } + break; + case id_lighting_set_value: + if (data[1] == id_qmk_rgblight_effect_speed) { + rgb_matrix_set_speed_noeeprom(speed_from_rgblight(data[2])); + } + break; + } +} + +# endif // defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) + +#endif \ No newline at end of file diff --git a/keyboards/keebio/bamfk4/bamfk4.h b/keyboards/keebio/bamfk4/bamfk4.h new file mode 100644 index 000000000000..0bdc2f602f18 --- /dev/null +++ b/keyboards/keebio/bamfk4/bamfk4.h @@ -0,0 +1,12 @@ +// Copyright 2022 Danny Nguyen (@nooges) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + k00, k01, k02, k03 \ +) { \ + { k00, k01, k02, k03 }, \ +} diff --git a/keyboards/keebio/bamfk4/config.h b/keyboards/keebio/bamfk4/config.h new file mode 100644 index 000000000000..9d67418e0d91 --- /dev/null +++ b/keyboards/keebio/bamfk4/config.h @@ -0,0 +1,153 @@ +// Copyright 2022 Danny Nguyen (@nooges) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCB10 +#define PRODUCT_ID 0x1114 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Keebio +#define PRODUCT BAMFK-4 + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + */ +#define MATRIX_ROW_PINS { F0 } +#define MATRIX_COL_PINS { E6, D5, B6, B7 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define RGB_DI_PIN D3 +#ifdef RGB_DI_PIN +# define RGBLED_NUM 32 +# define RGBLIGHT_HUE_STEP 8 +# define RGBLIGHT_SAT_STEP 8 +# define RGBLIGHT_VAL_STEP 8 +# define RGBLIGHT_LIMIT_VAL 120 /* The maximum brightness level */ +# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== enabled animations ==*/ +# 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_DEFAULT_VAL 120 +# define RGBLIGHT_DEFAULT_MODE (RGBLIGHT_MODE_RAINBOW_SWIRL + 2) +// RGB Matrix +//# ifdef RGB_MATRIX_ENABLE +# define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +# define ENABLE_RGB_MATRIX_SOLID_SPLASH +# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 160 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define DRIVER_LED_TOTAL RGBLED_NUM +# define RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_MATRIX_KEYPRESSES +//# endif +#endif + +#define VIA_QMK_RGBLIGHT_ENABLE + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* 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 useful 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 + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/keebio/bamfk4/info.json b/keyboards/keebio/bamfk4/info.json new file mode 100644 index 000000000000..1d04f4348bd9 --- /dev/null +++ b/keyboards/keebio/bamfk4/info.json @@ -0,0 +1,20 @@ +{ + "keyboard_name": "BAMFK-4", + "url": "https://keeb.io", + "maintainer": "nooges", + "usb": { + "vid": "0xCB10", + "pid": "0x1114", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0, "y": 0, "w": 2, "h": 2}, + {"x": 2, "y": 0, "w": 2, "h": 2}, + {"x": 4, "y": 0, "w": 2, "h": 2}, + {"x": 6, "y": 0, "w": 2, "h": 2} + ] + } + } +} diff --git a/keyboards/keebio/bamfk4/keymaps/default/keymap.c b/keyboards/keebio/bamfk4/keymaps/default/keymap.c new file mode 100644 index 000000000000..960c436da396 --- /dev/null +++ b/keyboards/keebio/bamfk4/keymaps/default/keymap.c @@ -0,0 +1,18 @@ +// Copyright 2021 Danny Nguyen (@nooges) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _MAIN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_MAIN] = LAYOUT( + KC_A, + KC_B, + KC_C, + KC_D + ) +}; \ No newline at end of file diff --git a/keyboards/keebio/bamfk4/keymaps/via/keymap.c b/keyboards/keebio/bamfk4/keymaps/via/keymap.c new file mode 100644 index 000000000000..454d9c6d6265 --- /dev/null +++ b/keyboards/keebio/bamfk4/keymaps/via/keymap.c @@ -0,0 +1,15 @@ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _MAIN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_MAIN] = LAYOUT( + KC_A, + KC_B, + KC_C, + KC_D + ) +}; \ No newline at end of file diff --git a/keyboards/keebio/bamfk4/keymaps/via/rules.mk b/keyboards/keebio/bamfk4/keymaps/via/rules.mk new file mode 100644 index 000000000000..25da8e7e8568 --- /dev/null +++ b/keyboards/keebio/bamfk4/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes +MOUSEKEY_ENABLE = yes \ No newline at end of file diff --git a/keyboards/keebio/bamfk4/rules.mk b/keyboards/keebio/bamfk4/rules.mk new file mode 100644 index 000000000000..b8ae25441376 --- /dev/null +++ b/keyboards/keebio/bamfk4/rules.mk @@ -0,0 +1,23 @@ +# 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 = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # 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 = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = no +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 + +LTO_ENABLE = yes From 1137d4a950f08f77564d369facb12a092fcc6e7e Mon Sep 17 00:00:00 2001 From: emlah <88459992+emlah@users.noreply.github.com> Date: Thu, 11 Aug 2022 22:10:08 -0400 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Drashna Jaelre --- keyboards/keebio/bamfk4/bamfk4.c | 53 -------------------------------- keyboards/keebio/bamfk4/config.h | 1 - 2 files changed, 54 deletions(-) diff --git a/keyboards/keebio/bamfk4/bamfk4.c b/keyboards/keebio/bamfk4/bamfk4.c index 321bbd81deb0..6a382bfaf63e 100644 --- a/keyboards/keebio/bamfk4/bamfk4.c +++ b/keyboards/keebio/bamfk4/bamfk4.c @@ -33,58 +33,5 @@ led_config_t g_led_config = { { } }; -# if defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) - -// VIA supports only 4 discrete values for effect speed; map these to some -// useful speed values for RGB Matrix. -enum speed_values { - RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects - RGBLIGHT_SPEED_1 = UINT8_MAX / 4, - RGBLIGHT_SPEED_2 = UINT8_MAX / 2, // matches the default value - RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast -}; - -static uint8_t speed_from_rgblight(uint8_t rgblight_speed) { - switch (rgblight_speed) { - case 0: - return RGBLIGHT_SPEED_0; - case 1: - return RGBLIGHT_SPEED_1; - case 2: - default: - return RGBLIGHT_SPEED_2; - case 3: - return RGBLIGHT_SPEED_3; - } -} - -static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) { - if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) { - return 0; - } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) { - return 1; - } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) { - return 2; - } else { - return 3; - } -} - -void raw_hid_receive_kb(uint8_t *data, uint8_t length) { - switch (data[0]) { - case id_lighting_get_value: - if (data[1] == id_qmk_rgblight_effect_speed) { - data[2] = speed_to_rgblight(rgb_matrix_get_speed()); - } - break; - case id_lighting_set_value: - if (data[1] == id_qmk_rgblight_effect_speed) { - rgb_matrix_set_speed_noeeprom(speed_from_rgblight(data[2])); - } - break; - } -} - -# endif // defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) #endif \ No newline at end of file diff --git a/keyboards/keebio/bamfk4/config.h b/keyboards/keebio/bamfk4/config.h index 9d67418e0d91..50ae473b6de5 100644 --- a/keyboards/keebio/bamfk4/config.h +++ b/keyboards/keebio/bamfk4/config.h @@ -93,7 +93,6 @@ //# endif #endif -#define VIA_QMK_RGBLIGHT_ENABLE /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 From c1991551e219e29e5362cb2a4bffee1bb014b23f Mon Sep 17 00:00:00 2001 From: emlah <88459992+emlah@users.noreply.github.com> Date: Fri, 12 Aug 2022 15:01:22 -0400 Subject: [PATCH 3/3] removed usb descriptor from config.h Co-authored-by: Drashna Jaelre --- keyboards/keebio/bamfk4/config.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/keyboards/keebio/bamfk4/config.h b/keyboards/keebio/bamfk4/config.h index 50ae473b6de5..b18b94da1063 100644 --- a/keyboards/keebio/bamfk4/config.h +++ b/keyboards/keebio/bamfk4/config.h @@ -5,12 +5,6 @@ #include "config_common.h" -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xCB10 -#define PRODUCT_ID 0x1114 -#define DEVICE_VER 0x0001 -#define MANUFACTURER Keebio -#define PRODUCT BAMFK-4 /* key matrix size */ #define MATRIX_ROWS 1