Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BAMFK-1 #16409

Merged
merged 10 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions keyboards/keebio/bamfk1/bamfk1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright 2021 Danny Nguyen (@nooges)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "bamfk1.h"
14 changes: 14 additions & 0 deletions keyboards/keebio/bamfk1/bamfk1.h
Original file line number Diff line number Diff line change
@@ -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 } \
}
117 changes: 117 additions & 0 deletions keyboards/keebio/bamfk1/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// 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

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
nooges marked this conversation as resolved.
Show resolved Hide resolved

/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
19 changes: 19 additions & 0 deletions keyboards/keebio/bamfk1/info.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
}
}
39 changes: 39 additions & 0 deletions keyboards/keebio/bamfk1/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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
)
};
1 change: 1 addition & 0 deletions keyboards/keebio/bamfk1/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LTO_ENABLE = yes
39 changes: 39 additions & 0 deletions keyboards/keebio/bamfk1/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -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
)
};
2 changes: 2 additions & 0 deletions keyboards/keebio/bamfk1/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
27 changes: 27 additions & 0 deletions keyboards/keebio/bamfk1/readme.md
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions keyboards/keebio/bamfk1/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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
# 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
nooges marked this conversation as resolved.
Show resolved Hide resolved
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
68 changes: 68 additions & 0 deletions keyboards/keebio/encoder_actions.c
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions keyboards/keebio/encoder_actions.h
Original file line number Diff line number Diff line change
@@ -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);