1
0
Fork 0

[Keyboard] Add BAMFK-1 (#16409)

Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
Danny 2022-03-14 14:08:10 -04:00 committed by GitHub
parent 6a6a333c75
commit a12d58c6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 368 additions and 0 deletions

View file

@ -0,0 +1,4 @@
// Copyright 2021 Danny Nguyen (@nooges)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "bamfk1.h"

View file

@ -0,0 +1,14 @@
// Copyright 2021 Danny Nguyen (@nooges)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "quantum.h"
#define LAYOUT( \
k00, e01, e02, \
e01a, e01b, e02a, e02b \
) { \
{ k00, e01, e02, KC_NO }, \
{ e01a, e01b, e02a, e02b } \
}

View file

@ -0,0 +1,113 @@
// Copyright 2021 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 0x1111
#define DEVICE_VER 0x0001
#define MANUFACTURER Keebio
#define PRODUCT BAMFK-1
/* key matrix size */
#define MATRIX_ROWS 2
#define MATRIX_COLS 4
/*
* Keyboard Matrix Assignments
*/
#define DIRECT_PINS { \
{ E6, B6, D6, NO_PIN }, \
{ NO_PIN, NO_PIN, NO_PIN, NO_PIN } \
}
#define AUDIO_PIN C6
#ifdef AUDIO_ENABLE
# define STARTUP_SONG SONG(STARTUP_SOUND)
#endif
#define ENCODERS_PAD_A { C7, D7 }
#define ENCODERS_PAD_B { B5, D4 }
#define ENCODERS 2
#define ENCODERS_CW_KEY { { 1, 1 }, { 3, 1 } }
#define ENCODERS_CCW_KEY { { 0, 1 }, { 2, 1 } }
#define RGB_DI_PIN D3
#ifdef RGB_DI_PIN
# define RGBLED_NUM 16
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
# 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
#endif
#define RGBLIGHT_DEFAULT_MODE (RGBLIGHT_MODE_RAINBOW_SWIRL + 2)
/* 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

View file

@ -0,0 +1,19 @@
{
"keyboard_name": "BAMFK-1",
"url": "https://keeb.io",
"maintainer": "nooges",
"layouts": {
"LAYOUT": {
"layout": [
{"label": "k00", "x": 1.5, "y": 0, "h":2, "w": 2},
{"label": "k01", "x": 0.5, "y": 2.25},
{"label": "k02", "x": 3.5, "y": 2.25},
{"label": "k10", "x": 0, "y": 3.5},
{"label": "k11", "x": 1, "y": 3.5},
{"label": "k12", "x": 3, "y": 3.5},
{"label": "k13", "x": 4, "y": 3.5}
]
}
}
}

View file

@ -0,0 +1,39 @@
// 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,
_FN1,
_FN2,
_FN3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT(
KC_A, // Big Switch
MO(1), KC_MUTE, // Encoder presses
KC_DOWN, KC_UP, // Left encoder turns
KC_VOLD, KC_VOLU // Right encoder turns
),
[_FN1] = LAYOUT(
KC_B, // Big Switch
_______, KC_C, // Encoder presses
KC_PGDN, KC_PGUP, // Left encoder turns
KC_VOLU, KC_VOLD // Right encoder turns
),
[_FN2] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
),
[_FN3] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
)
};

View file

@ -0,0 +1 @@
LTO_ENABLE = yes

View file

@ -0,0 +1,39 @@
// 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,
_FN1,
_FN2,
_FN3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT(
RGB_MOD, // Big Switch
FN_MO13, KC_MUTE, // Encoder presses
KC_DOWN, KC_UP, // Left encoder turns
KC_VOLD, KC_VOLU // Right encoder turns
),
[_FN1] = LAYOUT(
KC_B, // Big Switch
_______, KC_C, // Encoder presses
KC_PGDN, KC_PGUP, // Left encoder turns
KC_VOLU, KC_VOLD // Right encoder turns
),
[_FN2] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
),
[_FN3] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
)
};

View file

@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes

View file

@ -0,0 +1,27 @@
# BAMFK-1
![bamfk1](https://cdn.shopify.com/s/files/1/1851/5125/products/bamfk-1-back_1100x.png?v=1635304218)
PCB for the Big Switch with support for horizontal rotary encoders.
* Keyboard Maintainer: [Keebio](https://github.com/nooges)
* Hardware Supported: BAMFK-1 PCB
* Hardware Availability: [Keebio](https://keeb.io/)
Make example for this keyboard (after setting up your build environment):
make keebio/bamfk1:default
Flashing example for this keyboard:
make keebio/bamfk1: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 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

View file

@ -0,0 +1,21 @@
# 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 = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes
SRC += encoder_actions.c

View file

@ -0,0 +1,68 @@
/* Copyright 2020 Neil Brian Ramirez
* Copyright 2021 drashna jael're (@drashna)
*
* 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 3 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 "encoder_actions.h"
#if defined(ENCODER_ENABLE)
# ifdef ENCODERS
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
# endif
void encoder_action_unregister(void) {
# ifdef ENCODERS
for (int index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
# endif
}
void encoder_action_register(uint8_t index, bool clockwise) {
# ifdef ENCODERS
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
# endif
}
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
// don't return user actions, because they are in the keymap
// encoder_update_user(index, clockwise);
return true;
};
#endif

View file

@ -0,0 +1,21 @@
/* Copyright 2020 Neil Brian Ramirez
*
* 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 3 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 "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);