From e59475992e984e3384f48205e2f90855bc4661bf Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Thu, 27 Oct 2022 06:39:17 +1100 Subject: [PATCH] [Keyboard] Add Binepad BNR1 rotary encoder (#18809) Co-authored-by: Joel Challis --- keyboards/binepad/bnr1/info.json | 29 +++++++++++++++++++ .../binepad/bnr1/keymaps/default/keymap.c | 28 ++++++++++++++++++ .../binepad/bnr1/keymaps/default/rules.mk | 6 ++++ keyboards/binepad/bnr1/keymaps/via/config.h | 11 +++++++ keyboards/binepad/bnr1/keymaps/via/keymap.c | 28 ++++++++++++++++++ keyboards/binepad/bnr1/keymaps/via/rules.mk | 7 +++++ keyboards/binepad/bnr1/readme.md | 23 +++++++++++++++ keyboards/binepad/bnr1/rules.mk | 3 ++ keyboards/binepad/bnr1/v1/info.json | 14 +++++++++ keyboards/binepad/bnr1/v1/rules.mk | 1 + 10 files changed, 150 insertions(+) create mode 100755 keyboards/binepad/bnr1/info.json create mode 100644 keyboards/binepad/bnr1/keymaps/default/keymap.c create mode 100644 keyboards/binepad/bnr1/keymaps/default/rules.mk create mode 100644 keyboards/binepad/bnr1/keymaps/via/config.h create mode 100644 keyboards/binepad/bnr1/keymaps/via/keymap.c create mode 100644 keyboards/binepad/bnr1/keymaps/via/rules.mk create mode 100755 keyboards/binepad/bnr1/readme.md create mode 100755 keyboards/binepad/bnr1/rules.mk create mode 100644 keyboards/binepad/bnr1/v1/info.json create mode 100644 keyboards/binepad/bnr1/v1/rules.mk diff --git a/keyboards/binepad/bnr1/info.json b/keyboards/binepad/bnr1/info.json new file mode 100755 index 0000000000..c5f1c05cce --- /dev/null +++ b/keyboards/binepad/bnr1/info.json @@ -0,0 +1,29 @@ +{ + "manufacturer": "Binepad", + "keyboard_name": "BNR1", + "maintainer": "Binpad", + "debounce": 5, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": false, + "encoder": true + }, + "url": "http://binepad.com", + "usb": { + "vid": "0x4249", + "pid": "0x4231", + "device_version": "1.0.0" + }, + "community_layouts": ["ortho_1x1"], + "layouts": { + "LAYOUT_ortho_1x1": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "w": 2, "h": 2} + ] + } + } +} diff --git a/keyboards/binepad/bnr1/keymaps/default/keymap.c b/keyboards/binepad/bnr1/keymaps/default/keymap.c new file mode 100644 index 0000000000..974005afaa --- /dev/null +++ b/keyboards/binepad/bnr1/keymaps/default/keymap.c @@ -0,0 +1,28 @@ +/* Copyright 2022 Binepad (@binpad) */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include QMK_KEYBOARD_H + +enum { + _L0, + _L1 +} keyboard_layers; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_L0] = LAYOUT_ortho_1x1( + LT(_L1, KC_MUTE) + ), + + [_L1] = LAYOUT_ortho_1x1( + _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_L0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_L1] = { ENCODER_CCW_CW(KC_MS_WH_DOWN, KC_MS_WH_UP) } +}; + +#endif diff --git a/keyboards/binepad/bnr1/keymaps/default/rules.mk b/keyboards/binepad/bnr1/keymaps/default/rules.mk new file mode 100644 index 0000000000..7f80bd39c6 --- /dev/null +++ b/keyboards/binepad/bnr1/keymaps/default/rules.mk @@ -0,0 +1,6 @@ +# Copyright 2022 Binepad (@binpad) +# SPDX-License-Identifier: GPL-2.0-or-later + +LTO_ENABLE = yes + +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/binepad/bnr1/keymaps/via/config.h b/keyboards/binepad/bnr1/keymaps/via/config.h new file mode 100644 index 0000000000..ed7a62296f --- /dev/null +++ b/keyboards/binepad/bnr1/keymaps/via/config.h @@ -0,0 +1,11 @@ +/* Copyright 2022 Binepad (@binpad) */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#define TAPPING_TERM 175 + +#ifdef DYNAMIC_KEYMAP_LAYER_COUNT + #undef DYNAMIC_KEYMAP_LAYER_COUNT +#endif +#define DYNAMIC_KEYMAP_LAYER_COUNT 2 diff --git a/keyboards/binepad/bnr1/keymaps/via/keymap.c b/keyboards/binepad/bnr1/keymaps/via/keymap.c new file mode 100644 index 0000000000..974005afaa --- /dev/null +++ b/keyboards/binepad/bnr1/keymaps/via/keymap.c @@ -0,0 +1,28 @@ +/* Copyright 2022 Binepad (@binpad) */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include QMK_KEYBOARD_H + +enum { + _L0, + _L1 +} keyboard_layers; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_L0] = LAYOUT_ortho_1x1( + LT(_L1, KC_MUTE) + ), + + [_L1] = LAYOUT_ortho_1x1( + _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_L0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_L1] = { ENCODER_CCW_CW(KC_MS_WH_DOWN, KC_MS_WH_UP) } +}; + +#endif diff --git a/keyboards/binepad/bnr1/keymaps/via/rules.mk b/keyboards/binepad/bnr1/keymaps/via/rules.mk new file mode 100644 index 0000000000..746edfaa56 --- /dev/null +++ b/keyboards/binepad/bnr1/keymaps/via/rules.mk @@ -0,0 +1,7 @@ +# Copyright 2022 Binepad (@binpad) +# SPDX-License-Identifier: GPL-2.0-or-later + +LTO_ENABLE = yes +VIA_ENABLE = yes + +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/binepad/bnr1/readme.md b/keyboards/binepad/bnr1/readme.md new file mode 100755 index 0000000000..5a8afe2be9 --- /dev/null +++ b/keyboards/binepad/bnr1/readme.md @@ -0,0 +1,23 @@ +# BINEPAD BNR1 + +The BNR1 is a multifunction knob, which can be rotated, pressed, and rotated while pressed. + +* Keyboard Maintainer: [Binpad](https://github.com/binepad) +* Hardware Supported: **BNR1** & **BNR1 R2** *("V1" ft. ATMega32u4 MCU)* +* Hardware Availability: [Binepad.com](https://www.binepad.com/bnr1) + +Make example for this keyboard (after setting up your build environment): + + make binepad/bnr1/v1: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). + + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the knob while plugging in the keyboard's USB cable +* **Physical reset button**: Briefly press the button on the underside of the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` *(or `RESET`)* if it is available diff --git a/keyboards/binepad/bnr1/rules.mk b/keyboards/binepad/bnr1/rules.mk new file mode 100755 index 0000000000..b1b1126ff4 --- /dev/null +++ b/keyboards/binepad/bnr1/rules.mk @@ -0,0 +1,3 @@ +# This file intentionally left blank + +DEFAULT_FOLDER = binepad/bnr1/v1 diff --git a/keyboards/binepad/bnr1/v1/info.json b/keyboards/binepad/bnr1/v1/info.json new file mode 100644 index 0000000000..44edbf87d3 --- /dev/null +++ b/keyboards/binepad/bnr1/v1/info.json @@ -0,0 +1,14 @@ +{ + "bootloader": "atmel-dfu", + "processor": "atmega32u4", + "diode_direction": "COL2ROW", + "matrix_pins": { + "cols": ["B0"], + "rows": ["E6"] + }, + "encoder": { + "rotary": [ + { "pin_a": "D6", "pin_b": "D7" } + ] + } +} diff --git a/keyboards/binepad/bnr1/v1/rules.mk b/keyboards/binepad/bnr1/v1/rules.mk new file mode 100644 index 0000000000..6e7633bfe0 --- /dev/null +++ b/keyboards/binepad/bnr1/v1/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank