From 87ab49e4033db5afe835863c4ebab8858cbe3e2d Mon Sep 17 00:00:00 2001 From: Danny Date: Wed, 23 Jan 2019 20:58:04 -0500 Subject: [PATCH] [Keyboard] Add BDN9 (#4919) --- keyboards/bdn9/bdn9.c | 1 + keyboards/bdn9/bdn9.h | 35 ++++++++++++ keyboards/bdn9/config.h | 74 +++++++++++++++++++++++++ keyboards/bdn9/info.json | 0 keyboards/bdn9/keymaps/default/keymap.c | 41 ++++++++++++++ keyboards/bdn9/readme.md | 15 +++++ keyboards/bdn9/rules.mk | 50 +++++++++++++++++ 7 files changed, 216 insertions(+) create mode 100644 keyboards/bdn9/bdn9.c create mode 100644 keyboards/bdn9/bdn9.h create mode 100644 keyboards/bdn9/config.h create mode 100644 keyboards/bdn9/info.json create mode 100644 keyboards/bdn9/keymaps/default/keymap.c create mode 100644 keyboards/bdn9/readme.md create mode 100644 keyboards/bdn9/rules.mk diff --git a/keyboards/bdn9/bdn9.c b/keyboards/bdn9/bdn9.c new file mode 100644 index 000000000..0ff55fd6d --- /dev/null +++ b/keyboards/bdn9/bdn9.c @@ -0,0 +1 @@ +#include "bdn9.h" diff --git a/keyboards/bdn9/bdn9.h b/keyboards/bdn9/bdn9.h new file mode 100644 index 000000000..26b043560 --- /dev/null +++ b/keyboards/bdn9/bdn9.h @@ -0,0 +1,35 @@ +/* Copyright 2019 Danny Nguyen + * + * 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 arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + KA1, KA2, KA3, \ + KB1, KB2, KB3, \ + KC1, KC2, KC3 \ +) \ +{ \ + { KA1, KA2, KA3, KB1, KB2, KB3, KC1, KC2, KC3 } \ +} diff --git a/keyboards/bdn9/config.h b/keyboards/bdn9/config.h new file mode 100644 index 000000000..604da5ef4 --- /dev/null +++ b/keyboards/bdn9/config.h @@ -0,0 +1,74 @@ +/* +Copyright 2019 Danny Nguyen + +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 0xCB10 +#define PRODUCT_ID 0x1133 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT BDN9 +#define DESCRIPTION 3x3 Macropad with Rotary Encoders + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 9 + +/* Keyboard Matrix Assignments */ +#define NO_PIN (~0) +#define MATRIX_ROW_PINS { NO_PIN } +#define MATRIX_COL_PINS { D2, D4, F4, D7, B1, B3, E6, B4, B2 } + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +#define NUMBER_OF_ENCODERS 2 +#define ENCODERS_PAD_A { D1, F5 } +#define ENCODERS_PAD_B { D0, F6 } + + +#define BACKLIGHT_PIN B5 +// #define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 7 + +#define RGB_DI_PIN D3 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 3 + #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 */ + /*== all animations enable ==*/ + #define RGBLIGHT_ANIMATIONS +#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* 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 + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) diff --git a/keyboards/bdn9/info.json b/keyboards/bdn9/info.json new file mode 100644 index 000000000..e69de29bb diff --git a/keyboards/bdn9/keymaps/default/keymap.c b/keyboards/bdn9/keymaps/default/keymap.c new file mode 100644 index 000000000..66b9a3eb6 --- /dev/null +++ b/keyboards/bdn9/keymaps/default/keymap.c @@ -0,0 +1,41 @@ +/* Copyright 2019 Danny Nguyen + * + * 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( + KC_A, KC_B, KC_C, \ + BL_STEP, KC_UP, RGB_MOD, \ + KC_LEFT, KC_DOWN, KC_RGHT \ + ), +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + } + else if (index == 1) { + if (clockwise) { + tap_code(KC_DOWN); + } else { + tap_code(KC_UP); + } + } +} diff --git a/keyboards/bdn9/readme.md b/keyboards/bdn9/readme.md new file mode 100644 index 000000000..c9d5ed0b3 --- /dev/null +++ b/keyboards/bdn9/readme.md @@ -0,0 +1,15 @@ +# BDN9 + +![BDN9](https://cdn.shopify.com/s/files/1/1851/5125/products/image_bd8d9423-950e-4aad-bea5-665d896f879a_530x@2x.jpg?v=1547909493) + +A 3x3 macropad with support for a rotary encoder at the upper two corners. + +Keyboard Maintainer: [Bakingpy/nooges](https://github.com/nooges) +Hardware Supported: Pro Micro, Elite-C, Proton C +Hardware Availability: [Keebio - BDN9](https://keeb.io/products/bdn9-3x3-9-key-macropad-rotary-encoder-support) + +Make example for this keyboard (after setting up your build environment): + + make bdn9: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/bdn9/rules.mk b/keyboards/bdn9/rules.mk new file mode 100644 index 000000000..3ab849108 --- /dev/null +++ b/keyboards/bdn9/rules.mk @@ -0,0 +1,50 @@ +MCU = atmega32u4 +F_CPU = 16000000 +ARCH = AVR8 +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID +BOOTLOADER = caterina + + +# If you don't know the bootloader type, then you can specify the +# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +# OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # 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 = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) +ENCODER_ENABLE = yes