From 148568dbd6cfb39d0a1055a7b47cc2224c74d286 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Wed, 6 Dec 2023 05:40:00 +1100 Subject: [PATCH 01/14] Initial upload for rev B pcb --- keyboards/binepad/bnk9/bkn9.h | 23 ++++ keyboards/binepad/bnk9/bkn9_via.c | 122 ++++++++++++++++++++ keyboards/binepad/bnk9/config.h | 27 +++++ keyboards/binepad/bnk9/info.json | 93 +++++++++++++++ keyboards/binepad/bnk9/keymaps/via/keymap.c | 28 +++++ keyboards/binepad/bnk9/keymaps/via/rules.mk | 3 + keyboards/binepad/bnk9/mcuconf.h | 15 +++ keyboards/binepad/bnk9/readme.md | 27 +++++ keyboards/binepad/bnk9/rgb_matrix_kb.inc | 39 +++++++ keyboards/binepad/bnk9/rules.mk | 5 + 10 files changed, 382 insertions(+) create mode 100644 keyboards/binepad/bnk9/bkn9.h create mode 100644 keyboards/binepad/bnk9/bkn9_via.c create mode 100644 keyboards/binepad/bnk9/config.h create mode 100644 keyboards/binepad/bnk9/info.json create mode 100644 keyboards/binepad/bnk9/keymaps/via/keymap.c create mode 100644 keyboards/binepad/bnk9/keymaps/via/rules.mk create mode 100644 keyboards/binepad/bnk9/mcuconf.h create mode 100644 keyboards/binepad/bnk9/readme.md create mode 100644 keyboards/binepad/bnk9/rgb_matrix_kb.inc create mode 100644 keyboards/binepad/bnk9/rules.mk diff --git a/keyboards/binepad/bnk9/bkn9.h b/keyboards/binepad/bnk9/bkn9.h new file mode 100644 index 000000000000..1af0a1232d29 --- /dev/null +++ b/keyboards/binepad/bnk9/bkn9.h @@ -0,0 +1,23 @@ +// Copyright 2023 binepad (@binepad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#ifdef VIA_ENABLE // Only works if VIA is enabled + +#define EEPROM_USER_CONFIG_ADDRESS (VIA_EEPROM_CUSTOM_CONFIG_ADDR + 1) + +#include "color.h" + +typedef struct PACKED { + uint8_t h; + uint8_t s; +} HS; + +typedef struct { + HS color[9]; +} user_config_t; + +extern user_config_t user_config; + +#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/bkn9_via.c b/keyboards/binepad/bnk9/bkn9_via.c new file mode 100644 index 000000000000..1f336278f34b --- /dev/null +++ b/keyboards/binepad/bnk9/bkn9_via.c @@ -0,0 +1,122 @@ +// Copyright 2023 Binepad (@binpad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "quantum.h" + +#ifdef VIA_ENABLE // Only works if VIA is enabled + +#include "color.h" +#include "progmem.h" +#include "quantum/color.h" +#include "eeprom.h" +#include "bkn9.h" + +#ifndef EEPROM_USER_CONFIG_ADDRESS + #error EEPROM_USER_CONFIG_ADDRESS not defined +#endif +#if EEPROM_USER_CONFIG_ADDRESS == 0 + #error EEPROM_USER_CONFIG_ADDRESS = 0 +#endif + +#define RGB_PER_KEY_DEFAULT_COLOR { .h = RGB_MATRIX_DEFAULT_HUE, .s = RGB_MATRIX_DEFAULT_SAT } + +user_config_t user_config = { + .color = { + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR, + RGB_PER_KEY_DEFAULT_COLOR + } +}; + +enum via_per_key_value { + id_custom_color = 1 +}; + +// *** Helpers *** + +void bkn9_config_set_value( uint8_t *data ) { + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch ( *value_id ) { + case id_custom_color: { + uint8_t i = value_data[0]; + user_config.color[ i ].h = value_data[1]; + user_config.color[ i ].s = value_data[2]; + break; + } + } +} + +void bkn9_config_get_value( uint8_t *data ) { + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch ( *value_id ) { + case id_custom_color: { + uint8_t i = value_data[0]; + value_data[1] = user_config.color[ i ].h; + value_data[2] = user_config.color[ i ].s; + break; + } + } +} + +void bkn9_config_load(void) { + eeprom_read_block( + &user_config, + ((void*)EEPROM_USER_CONFIG_ADDRESS), + sizeof(user_config_t) ); +} + +void bkn9_config_save(void) { + eeprom_update_block( + &user_config, + ((void*)EEPROM_USER_CONFIG_ADDRESS), + sizeof(user_config_t) ); +} + +void via_custom_value_command_kb(uint8_t *data, uint8_t length) { + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + + if ( *channel_id == id_custom_channel ) { + switch ( *command_id ) { + case id_custom_set_value: + bkn9_config_set_value(value_id_and_data); + break; + case id_custom_get_value: + bkn9_config_get_value(value_id_and_data); + break; + case id_custom_save: + bkn9_config_save(); + break; + default: + // Unhandled message. + *command_id = id_unhandled; + break; + } + return; + } + + *command_id = id_unhandled; +} + +void via_init_kb(void) { + // This checks both an EEPROM reset (from bootmagic lite, keycodes) + // and also firmware build date (from via_eeprom_is_valid()) + if (eeconfig_is_enabled()) { + bkn9_config_load(); + } else { + bkn9_config_save(); + } +} + +#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/config.h b/keyboards/binepad/bnk9/config.h new file mode 100644 index 000000000000..3715f12c1721 --- /dev/null +++ b/keyboards/binepad/bnk9/config.h @@ -0,0 +1,27 @@ +// Copyright 2023 binepad (@binepad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define ENCODER_DEFAULT_POS 0x3 // enable 1:1 resolution + +#ifdef RGB_MATRIX_ENABLE + #define WS2812_PIO_USE_PIO1 + // #define RGB_MATRIX_TIMEOUT 600000 // 10 minutes + #define RGB_DISABLE_WITH_FADE_OUTS + #define RGB_DISABLE_WHEN_USB_SUSPENDED + #define RGB_MATRIX_LED_PROCESS_LIMIT 9 // All nine keys + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 // Not too bright so that the LED's don't burn out + + // Timing for SK6812 + #undef WS2812_TIMING + #undef WS2812_T0H + #undef WS2812_T0L + #undef WS2812_T1H + #undef WS2812_T1L + #define WS2812_TIMING 1250 + #define WS2812_T0H 350 + #define WS2812_T0L (WS2812_TIMING - WS2812_T0H) + #define WS2812_T1H 650 + #define WS2812_T1L (WS2812_TIMING - WS2812_T1H) +#endif diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json new file mode 100644 index 000000000000..75b6fe176eee --- /dev/null +++ b/keyboards/binepad/bnk9/info.json @@ -0,0 +1,93 @@ +{ + "manufacturer": "binepad", + "keyboard_name": "BNK9", + "url": "https://www.binepad.com/product-page/bnk9", + "maintainer": "binepad", + "processor": "RP2040", + "bootloader": "rp2040", + "diode_direction": "COL2ROW", + "usb": { + "vid": "0x4249", + "pid": "0x4E39", + "device_version": "1.0.0" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "encoder": true, + "rgb_matrix": true, + "sleep_led": false + }, + "ws2812": { + "driver": "vendor", + "pin": "GP11" + }, + "matrix_pins": { + "cols": ["GP1", "GP2", "GP3"], + "rows": ["GP12", "GP4", "GP5", "GP6"] + }, + "encoder": { + "rotary": [ + { + "pin_a": "GP13", + "pin_b": "GP14" + } + ] + }, + "rgb_matrix": { + "driver": "ws2812", + "animations": { + "solid_color": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_pinwheel": true, + "jellybean_raindrops": true, + "solid_reactive_simple": true, + "solid_reactive": true, + "splash": true, + "solid_splash": true, + "starlight": true, + "starlight_dual_hue": true, + "starlight_dual_sat": true, + "riverflow": true + }, + "layout": [ + {"flags": 4, "matrix": [1, 0], "x": 80, "y": 0}, + {"flags": 4, "matrix": [1, 1], "x": 112, "y": 0}, + {"flags": 4, "matrix": [1, 2], "x": 144, "y": 0}, + + {"flags": 4, "matrix": [2, 2], "x": 144, "y": 32}, + {"flags": 4, "matrix": [2, 1], "x": 112, "y": 32}, + {"flags": 4, "matrix": [2, 0], "x": 80, "y": 32}, + + {"flags": 4, "matrix": [3, 0], "x": 80, "y": 64}, + {"flags": 4, "matrix": [3, 1], "x": 112, "y": 64}, + {"flags": 4, "matrix": [3, 2], "x": 144, "y": 64} + ] + } + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix": [0, 0], "label": "Encoder", "x": 0, "y": 0, "w": 3, "h": 3 }, + + { "matrix": [1, 0], "label": "F1", "x": 3.25, "y": 0 }, + { "matrix": [1, 1], "label": "F2", "x": 4.25, "y": 0 }, + { "matrix": [1, 2], "label": "F3", "x": 5.25, "y": 0 }, + + { "matrix": [2, 0], "label": "F4", "x": 3.25, "y": 1 }, + { "matrix": [2, 1], "label": "F5", "x": 4.25, "y": 1 }, + { "matrix": [2, 2], "label": "F6", "x": 5.25, "y": 1 }, + + { "matrix": [3, 0], "label": "F7", "x": 3.25, "y": 2 }, + { "matrix": [3, 1], "label": "F8", "x": 4.25, "y": 2 }, + { "matrix": [3, 2], "label": "F9", "x": 5.25, "y": 2 } + ] + } + } +} diff --git a/keyboards/binepad/bnk9/keymaps/via/keymap.c b/keyboards/binepad/bnk9/keymaps/via/keymap.c new file mode 100644 index 000000000000..2fbde5c90aa5 --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/via/keymap.c @@ -0,0 +1,28 @@ +// Copyright 2023 Binepad (@binpad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_MUTE, + KC_F16, KC_F17, KC_F18, + KC_F19, KC_F20, KC_F21, + KC_F22, KC_F23, LT(1, KC_F24) + ), + [1] = LAYOUT( + RGB_TOG, + RGB_HUI, RGB_SAI, RGB_SPI, + RGB_HUD, RGB_SAD, RGB_SPD, + RGB_RMOD, RGB_MOD, _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) } +}; + +#endif diff --git a/keyboards/binepad/bnk9/keymaps/via/rules.mk b/keyboards/binepad/bnk9/keymaps/via/rules.mk new file mode 100644 index 000000000000..82b46f5873fc --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/via/rules.mk @@ -0,0 +1,3 @@ + +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/binepad/bnk9/mcuconf.h b/keyboards/binepad/bnk9/mcuconf.h new file mode 100644 index 000000000000..cbee38a7487a --- /dev/null +++ b/keyboards/binepad/bnk9/mcuconf.h @@ -0,0 +1,15 @@ +#pragma once + +#include_next + +// Don't need SPI +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 FALSE + +// Don't need I2C +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 FALSE + +// Don't need ADC +#undef RP_ADC_USE_ADC1 +#define RP_ADC_USE_ADC1 FALSE diff --git a/keyboards/binepad/bnk9/readme.md b/keyboards/binepad/bnk9/readme.md new file mode 100644 index 000000000000..0471b428c12a --- /dev/null +++ b/keyboards/binepad/bnk9/readme.md @@ -0,0 +1,27 @@ +# BINEPAD BNK9 + +![BINEPAD BNK9](https://placehold.co/600x400/FFF/EA5823?text=BINEPAD+BNK9) + +*A 3x3 macropad with a large rotary encoder* + +* Keyboard Maintainer: [binepad](https://github.com/binepad) +* Hardware Supported: BINPAD BNK9 +* Hardware Availability: [binepad.com](https://www.binepad.com/product-page/bnk9) + +Make example for this keyboard (after setting up your build environment): + + make binepad/bnk9:default + +Flashing example for this keyboard: + + make binepad/bnk9: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 (0x0) in the matrix (the top left key) and plug in the keyboard +* **Physical reset button**: Briefly press the PCB button located on the back of the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` or `RESET` if it is available diff --git a/keyboards/binepad/bnk9/rgb_matrix_kb.inc b/keyboards/binepad/bnk9/rgb_matrix_kb.inc new file mode 100644 index 000000000000..6b9954867b06 --- /dev/null +++ b/keyboards/binepad/bnk9/rgb_matrix_kb.inc @@ -0,0 +1,39 @@ +// Copyright 2023 Binepad (@binpad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#ifdef VIA_ENABLE + +// Declare custom effects using the RGB_MATRIX_EFFECT macro +RGB_MATRIX_EFFECT(bnk9_per_key_effect) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "eeprom.h" +#include "eeconfig.h" +#include "via.h" +#include "bkn9.h" + +// Per-key color effect + +static bool bnk9_per_key_effect(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + HSV hsv; + RGB rgb; + + // Assuming `user_config` is set prior + + hsv.v = rgb_matrix_get_val(); + for (uint8_t i = led_min; i < led_max; i++) { + if (i < 9) { + hsv.h = user_config.color[i].h; + hsv.s = user_config.color[i].s; + rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + + return rgb_matrix_check_finished_leds(led_max); +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/rules.mk b/keyboards/binepad/bnk9/rules.mk new file mode 100644 index 000000000000..c94b5edbb854 --- /dev/null +++ b/keyboards/binepad/bnk9/rules.mk @@ -0,0 +1,5 @@ +# @see `info.json` for config + +BOARD = GENERIC_RP_RP2040 +RGB_MATRIX_CUSTOM_KB = yes +SRC += bkn9_via.c From 74924c13e4b298e0bf839325cd4e44c0b7d44653 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Thu, 4 Jan 2024 08:20:12 +1100 Subject: [PATCH 02/14] Update keymap.c --- keyboards/binepad/bnk9/keymaps/via/keymap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/keyboards/binepad/bnk9/keymaps/via/keymap.c b/keyboards/binepad/bnk9/keymaps/via/keymap.c index 2fbde5c90aa5..9ae1e4541f62 100644 --- a/keyboards/binepad/bnk9/keymaps/via/keymap.c +++ b/keyboards/binepad/bnk9/keymaps/via/keymap.c @@ -6,15 +6,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( KC_MUTE, - KC_F16, KC_F17, KC_F18, - KC_F19, KC_F20, KC_F21, - KC_F22, KC_F23, LT(1, KC_F24) + KC_P1, KC_P2, KC_P3, + KC_P4, KC_P5, KC_P6, + KC_P7, KC_P8, LT(1, KC_P9) ), [1] = LAYOUT( RGB_TOG, - RGB_HUI, RGB_SAI, RGB_SPI, - RGB_HUD, RGB_SAD, RGB_SPD, - RGB_RMOD, RGB_MOD, _______ + RGB_HUI, RGB_SAI, RGB_SPI, + RGB_HUD, RGB_SAD, RGB_SPD, + RGB_RMOD, RGB_MOD, _______ ) }; From 89ffe58d6ff4c8843cefa631664008093923e9e3 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Sat, 6 Jan 2024 03:23:38 +1100 Subject: [PATCH 03/14] prepare for pr --- keyboards/binepad/bnk9/{bkn9.h => bnk9.h} | 0 .../bnk9/{bkn9_via.c => bnk9_effect.c} | 2 +- keyboards/binepad/bnk9/info.json | 23 ++++++++------- .../binepad/bnk9/keymaps/default/keymap.c | 28 +++++++++++++++++++ keyboards/binepad/bnk9/keymaps/via/rules.mk | 2 +- keyboards/binepad/bnk9/readme.md | 8 +++--- keyboards/binepad/bnk9/rgb_matrix_kb.inc | 2 +- keyboards/binepad/bnk9/rules.mk | 3 +- 8 files changed, 49 insertions(+), 19 deletions(-) rename keyboards/binepad/bnk9/{bkn9.h => bnk9.h} (100%) rename keyboards/binepad/bnk9/{bkn9_via.c => bnk9_effect.c} (99%) create mode 100644 keyboards/binepad/bnk9/keymaps/default/keymap.c diff --git a/keyboards/binepad/bnk9/bkn9.h b/keyboards/binepad/bnk9/bnk9.h similarity index 100% rename from keyboards/binepad/bnk9/bkn9.h rename to keyboards/binepad/bnk9/bnk9.h diff --git a/keyboards/binepad/bnk9/bkn9_via.c b/keyboards/binepad/bnk9/bnk9_effect.c similarity index 99% rename from keyboards/binepad/bnk9/bkn9_via.c rename to keyboards/binepad/bnk9/bnk9_effect.c index 1f336278f34b..15ac9c4390a9 100644 --- a/keyboards/binepad/bnk9/bkn9_via.c +++ b/keyboards/binepad/bnk9/bnk9_effect.c @@ -9,7 +9,7 @@ #include "progmem.h" #include "quantum/color.h" #include "eeprom.h" -#include "bkn9.h" +#include "bnk9.h" #ifndef EEPROM_USER_CONFIG_ADDRESS #error EEPROM_USER_CONFIG_ADDRESS not defined diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index 75b6fe176eee..0e6866950cbe 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -3,8 +3,10 @@ "keyboard_name": "BNK9", "url": "https://www.binepad.com/product-page/bnk9", "maintainer": "binepad", + "board": "GENERIC_RP_RP2040", "processor": "RP2040", "bootloader": "rp2040", + "bootloader_instructions": "Hold down the key at (0x0) in the matrix (the 'knob' / rotary encoder) and plug in the keyboard.", "diode_direction": "COL2ROW", "usb": { "vid": "0x4249", @@ -19,6 +21,7 @@ "mousekey": true, "nkro": true, "encoder": true, + "encoder_map": true, "rgb_matrix": true, "sleep_led": false }, @@ -74,19 +77,19 @@ "layouts": { "LAYOUT": { "layout": [ - { "matrix": [0, 0], "label": "Encoder", "x": 0, "y": 0, "w": 3, "h": 3 }, + { "matrix": [0, 0], "label": "Knob", "x": 0, "y": 0, "w": 3, "h": 3 }, - { "matrix": [1, 0], "label": "F1", "x": 3.25, "y": 0 }, - { "matrix": [1, 1], "label": "F2", "x": 4.25, "y": 0 }, - { "matrix": [1, 2], "label": "F3", "x": 5.25, "y": 0 }, + { "matrix": [1, 0], "label": "1", "x": 3.25, "y": 0 }, + { "matrix": [1, 1], "label": "2", "x": 4.25, "y": 0 }, + { "matrix": [1, 2], "label": "3", "x": 5.25, "y": 0 }, - { "matrix": [2, 0], "label": "F4", "x": 3.25, "y": 1 }, - { "matrix": [2, 1], "label": "F5", "x": 4.25, "y": 1 }, - { "matrix": [2, 2], "label": "F6", "x": 5.25, "y": 1 }, + { "matrix": [2, 0], "label": "4", "x": 3.25, "y": 1 }, + { "matrix": [2, 1], "label": "5", "x": 4.25, "y": 1 }, + { "matrix": [2, 2], "label": "6", "x": 5.25, "y": 1 }, - { "matrix": [3, 0], "label": "F7", "x": 3.25, "y": 2 }, - { "matrix": [3, 1], "label": "F8", "x": 4.25, "y": 2 }, - { "matrix": [3, 2], "label": "F9", "x": 5.25, "y": 2 } + { "matrix": [3, 0], "label": "7", "x": 3.25, "y": 2 }, + { "matrix": [3, 1], "label": "8", "x": 4.25, "y": 2 }, + { "matrix": [3, 2], "label": "9", "x": 5.25, "y": 2 } ] } } diff --git a/keyboards/binepad/bnk9/keymaps/default/keymap.c b/keyboards/binepad/bnk9/keymaps/default/keymap.c new file mode 100644 index 000000000000..9ae1e4541f62 --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/default/keymap.c @@ -0,0 +1,28 @@ +// Copyright 2023 Binepad (@binpad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_MUTE, + KC_P1, KC_P2, KC_P3, + KC_P4, KC_P5, KC_P6, + KC_P7, KC_P8, LT(1, KC_P9) + ), + [1] = LAYOUT( + RGB_TOG, + RGB_HUI, RGB_SAI, RGB_SPI, + RGB_HUD, RGB_SAD, RGB_SPD, + RGB_RMOD, RGB_MOD, _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) } +}; + +#endif diff --git a/keyboards/binepad/bnk9/keymaps/via/rules.mk b/keyboards/binepad/bnk9/keymaps/via/rules.mk index 82b46f5873fc..88f876ccb08c 100644 --- a/keyboards/binepad/bnk9/keymaps/via/rules.mk +++ b/keyboards/binepad/bnk9/keymaps/via/rules.mk @@ -1,3 +1,3 @@ VIA_ENABLE = yes -ENCODER_MAP_ENABLE = yes + diff --git a/keyboards/binepad/bnk9/readme.md b/keyboards/binepad/bnk9/readme.md index 0471b428c12a..add54ef0148d 100644 --- a/keyboards/binepad/bnk9/readme.md +++ b/keyboards/binepad/bnk9/readme.md @@ -1,6 +1,6 @@ # BINEPAD BNK9 -![BINEPAD BNK9](https://placehold.co/600x400/FFF/EA5823?text=BINEPAD+BNK9) +![BINEPAD BNK9](https://i.imgur.com/FrkVRhhh.jpg) *A 3x3 macropad with a large rotary encoder* @@ -22,6 +22,6 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to Enter the bootloader in 3 ways: -* **Bootmagic reset**: Hold down the key at (0x0) in the matrix (the top left key) and plug in the keyboard -* **Physical reset button**: Briefly press the PCB button located on the back of the PCB -* **Keycode in layout**: Press the key mapped to `QK_BOOT` or `RESET` if it is available +* **Bootmagic reset**: Hold down the key at (0x0) in the matrix (the 'knob' / rotary encoder) and plug in the keyboard. +* **Physical reset button**: Briefly press the PCB button located on the back of the PCB. +* **Keycode in layout**: Press the key mapped to `QK_BOOT` *(or* `RESET` *in VIA)* if it is available. diff --git a/keyboards/binepad/bnk9/rgb_matrix_kb.inc b/keyboards/binepad/bnk9/rgb_matrix_kb.inc index 6b9954867b06..4b065fe37c4f 100644 --- a/keyboards/binepad/bnk9/rgb_matrix_kb.inc +++ b/keyboards/binepad/bnk9/rgb_matrix_kb.inc @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(bnk9_per_key_effect) #include "eeprom.h" #include "eeconfig.h" #include "via.h" -#include "bkn9.h" +#include "bnk9.h" // Per-key color effect diff --git a/keyboards/binepad/bnk9/rules.mk b/keyboards/binepad/bnk9/rules.mk index c94b5edbb854..fc94bd971383 100644 --- a/keyboards/binepad/bnk9/rules.mk +++ b/keyboards/binepad/bnk9/rules.mk @@ -1,5 +1,4 @@ # @see `info.json` for config -BOARD = GENERIC_RP_RP2040 RGB_MATRIX_CUSTOM_KB = yes -SRC += bkn9_via.c +SRC += bnk9_effect.c From 328e973a8dc860398b1a6b2edcb37e7f223aceaf Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Sun, 7 Jan 2024 18:32:31 +1100 Subject: [PATCH 04/14] post- drashna review fixes --- keyboards/binepad/bnk9/bnk9.h | 12 ++++++------ keyboards/binepad/bnk9/config.h | 5 ----- keyboards/binepad/bnk9/keymaps/via/rules.mk | 2 +- keyboards/binepad/bnk9/mcuconf.h | 3 +++ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/keyboards/binepad/bnk9/bnk9.h b/keyboards/binepad/bnk9/bnk9.h index 1af0a1232d29..87de4ff4a7b2 100644 --- a/keyboards/binepad/bnk9/bnk9.h +++ b/keyboards/binepad/bnk9/bnk9.h @@ -3,15 +3,15 @@ #pragma once -#ifdef VIA_ENABLE // Only works if VIA is enabled +#ifdef VIA_ENABLE // Only works if VIA is enabled -#define EEPROM_USER_CONFIG_ADDRESS (VIA_EEPROM_CUSTOM_CONFIG_ADDR + 1) +# define EEPROM_USER_CONFIG_ADDRESS (VIA_EEPROM_CUSTOM_CONFIG_ADDR + 1) -#include "color.h" +# include "color.h" typedef struct PACKED { - uint8_t h; - uint8_t s; + uint8_t h; + uint8_t s; } HS; typedef struct { @@ -20,4 +20,4 @@ typedef struct { extern user_config_t user_config; -#endif // VIA_ENABLE +#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/config.h b/keyboards/binepad/bnk9/config.h index 3715f12c1721..c5a6ecd194ff 100644 --- a/keyboards/binepad/bnk9/config.h +++ b/keyboards/binepad/bnk9/config.h @@ -14,11 +14,6 @@ #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 // Not too bright so that the LED's don't burn out // Timing for SK6812 - #undef WS2812_TIMING - #undef WS2812_T0H - #undef WS2812_T0L - #undef WS2812_T1H - #undef WS2812_T1L #define WS2812_TIMING 1250 #define WS2812_T0H 350 #define WS2812_T0L (WS2812_TIMING - WS2812_T0H) diff --git a/keyboards/binepad/bnk9/keymaps/via/rules.mk b/keyboards/binepad/bnk9/keymaps/via/rules.mk index 88f876ccb08c..a7c02ede6458 100644 --- a/keyboards/binepad/bnk9/keymaps/via/rules.mk +++ b/keyboards/binepad/bnk9/keymaps/via/rules.mk @@ -1,3 +1,3 @@ +# @see `info.json` for config VIA_ENABLE = yes - diff --git a/keyboards/binepad/bnk9/mcuconf.h b/keyboards/binepad/bnk9/mcuconf.h index cbee38a7487a..ed66af9c46fd 100644 --- a/keyboards/binepad/bnk9/mcuconf.h +++ b/keyboards/binepad/bnk9/mcuconf.h @@ -1,3 +1,6 @@ +// Copyright 2023 binepad (@binepad) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include_next From 388b4e0f1b95ff8380ef5c923727baee6ff77223 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Tue, 9 Jan 2024 00:39:29 +1100 Subject: [PATCH 05/14] post- zvecr review fixes & move vendor keymap to vendor sub-folder --- keyboards/binepad/bnk9/config.h | 11 +------- keyboards/binepad/bnk9/info.json | 3 ++ .../binepad/bnk9/{ => keymaps/binepad}/bnk9.h | 0 .../bnk9/{ => keymaps/binepad}/bnk9_effect.c | 0 .../binepad/bnk9/keymaps/binepad/keymap.c | 28 +++++++++++++++++++ .../{ => keymaps/binepad}/rgb_matrix_kb.inc | 0 .../binepad/bnk9/keymaps/binepad/rules.mk | 5 ++++ .../binepad/bnk9/keymaps/default/rules.mk | 1 + keyboards/binepad/bnk9/keymaps/via/rules.mk | 3 +- keyboards/binepad/bnk9/rules.mk | 5 +--- 10 files changed, 40 insertions(+), 16 deletions(-) rename keyboards/binepad/bnk9/{ => keymaps/binepad}/bnk9.h (100%) rename keyboards/binepad/bnk9/{ => keymaps/binepad}/bnk9_effect.c (100%) create mode 100644 keyboards/binepad/bnk9/keymaps/binepad/keymap.c rename keyboards/binepad/bnk9/{ => keymaps/binepad}/rgb_matrix_kb.inc (100%) create mode 100644 keyboards/binepad/bnk9/keymaps/binepad/rules.mk create mode 100644 keyboards/binepad/bnk9/keymaps/default/rules.mk diff --git a/keyboards/binepad/bnk9/config.h b/keyboards/binepad/bnk9/config.h index c5a6ecd194ff..058889ed5e2c 100644 --- a/keyboards/binepad/bnk9/config.h +++ b/keyboards/binepad/bnk9/config.h @@ -7,16 +7,7 @@ #ifdef RGB_MATRIX_ENABLE #define WS2812_PIO_USE_PIO1 - // #define RGB_MATRIX_TIMEOUT 600000 // 10 minutes - #define RGB_DISABLE_WITH_FADE_OUTS - #define RGB_DISABLE_WHEN_USB_SUSPENDED - #define RGB_MATRIX_LED_PROCESS_LIMIT 9 // All nine keys - #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 // Not too bright so that the LED's don't burn out // Timing for SK6812 - #define WS2812_TIMING 1250 - #define WS2812_T0H 350 - #define WS2812_T0L (WS2812_TIMING - WS2812_T0H) - #define WS2812_T1H 650 - #define WS2812_T1L (WS2812_TIMING - WS2812_T1H) + #define WS2812_T1H 650 #endif diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index 0e6866950cbe..bb7c37f9ec79 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -43,6 +43,9 @@ }, "rgb_matrix": { "driver": "ws2812", + "led_process_limit": 9, + "max_brightness": 180, + "sleep": true, "animations": { "solid_color": true, "breathing": true, diff --git a/keyboards/binepad/bnk9/bnk9.h b/keyboards/binepad/bnk9/keymaps/binepad/bnk9.h similarity index 100% rename from keyboards/binepad/bnk9/bnk9.h rename to keyboards/binepad/bnk9/keymaps/binepad/bnk9.h diff --git a/keyboards/binepad/bnk9/bnk9_effect.c b/keyboards/binepad/bnk9/keymaps/binepad/bnk9_effect.c similarity index 100% rename from keyboards/binepad/bnk9/bnk9_effect.c rename to keyboards/binepad/bnk9/keymaps/binepad/bnk9_effect.c diff --git a/keyboards/binepad/bnk9/keymaps/binepad/keymap.c b/keyboards/binepad/bnk9/keymaps/binepad/keymap.c new file mode 100644 index 000000000000..9ae1e4541f62 --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/binepad/keymap.c @@ -0,0 +1,28 @@ +// Copyright 2023 Binepad (@binpad) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_MUTE, + KC_P1, KC_P2, KC_P3, + KC_P4, KC_P5, KC_P6, + KC_P7, KC_P8, LT(1, KC_P9) + ), + [1] = LAYOUT( + RGB_TOG, + RGB_HUI, RGB_SAI, RGB_SPI, + RGB_HUD, RGB_SAD, RGB_SPD, + RGB_RMOD, RGB_MOD, _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) } +}; + +#endif diff --git a/keyboards/binepad/bnk9/rgb_matrix_kb.inc b/keyboards/binepad/bnk9/keymaps/binepad/rgb_matrix_kb.inc similarity index 100% rename from keyboards/binepad/bnk9/rgb_matrix_kb.inc rename to keyboards/binepad/bnk9/keymaps/binepad/rgb_matrix_kb.inc diff --git a/keyboards/binepad/bnk9/keymaps/binepad/rules.mk b/keyboards/binepad/bnk9/keymaps/binepad/rules.mk new file mode 100644 index 000000000000..32f8e0e0d225 --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/binepad/rules.mk @@ -0,0 +1,5 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes + +RGB_MATRIX_CUSTOM_KB = yes +SRC += bnk9_effect.c diff --git a/keyboards/binepad/bnk9/keymaps/default/rules.mk b/keyboards/binepad/bnk9/keymaps/default/rules.mk new file mode 100644 index 000000000000..ee325681483f --- /dev/null +++ b/keyboards/binepad/bnk9/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/binepad/bnk9/keymaps/via/rules.mk b/keyboards/binepad/bnk9/keymaps/via/rules.mk index a7c02ede6458..f1adcab005e8 100644 --- a/keyboards/binepad/bnk9/keymaps/via/rules.mk +++ b/keyboards/binepad/bnk9/keymaps/via/rules.mk @@ -1,3 +1,2 @@ -# @see `info.json` for config - VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/binepad/bnk9/rules.mk b/keyboards/binepad/bnk9/rules.mk index fc94bd971383..6e7633bfe015 100644 --- a/keyboards/binepad/bnk9/rules.mk +++ b/keyboards/binepad/bnk9/rules.mk @@ -1,4 +1 @@ -# @see `info.json` for config - -RGB_MATRIX_CUSTOM_KB = yes -SRC += bnk9_effect.c +# This file intentionally left blank From c061dcb8aabb51807b419f5ab8fa454136a80a41 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Tue, 9 Jan 2024 12:33:30 +1100 Subject: [PATCH 06/14] Update info.json --- keyboards/binepad/bnk9/info.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index bb7c37f9ec79..984a8bbe528d 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -21,7 +21,6 @@ "mousekey": true, "nkro": true, "encoder": true, - "encoder_map": true, "rgb_matrix": true, "sleep_led": false }, @@ -43,9 +42,6 @@ }, "rgb_matrix": { "driver": "ws2812", - "led_process_limit": 9, - "max_brightness": 180, - "sleep": true, "animations": { "solid_color": true, "breathing": true, @@ -75,7 +71,10 @@ {"flags": 4, "matrix": [3, 0], "x": 80, "y": 64}, {"flags": 4, "matrix": [3, 1], "x": 112, "y": 64}, {"flags": 4, "matrix": [3, 2], "x": 144, "y": 64} - ] + ], + "led_process_limit": 9, + "max_brightness": 180, + "sleep": true } "layouts": { "LAYOUT": { From 70072f951822c0062fac084946d99d1273f3b75d Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:52:18 +1100 Subject: [PATCH 07/14] Update info.json Co-authored-by: Joel Challis --- keyboards/binepad/bnk9/info.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index 984a8bbe528d..a706d94eab7a 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -21,8 +21,7 @@ "mousekey": true, "nkro": true, "encoder": true, - "rgb_matrix": true, - "sleep_led": false + "rgb_matrix": true }, "ws2812": { "driver": "vendor", From c95a5cdd3d94e476ce423b6874a03d809f00aaf5 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Wed, 10 Jan 2024 00:42:40 +1100 Subject: [PATCH 08/14] Update config.h --- keyboards/binepad/bnk9/config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/binepad/bnk9/config.h b/keyboards/binepad/bnk9/config.h index 058889ed5e2c..1de354a7d03d 100644 --- a/keyboards/binepad/bnk9/config.h +++ b/keyboards/binepad/bnk9/config.h @@ -6,6 +6,7 @@ #define ENCODER_DEFAULT_POS 0x3 // enable 1:1 resolution #ifdef RGB_MATRIX_ENABLE + // Default PIO0 cases flickering in this board. Setting to PIO1 resolves this issue. #define WS2812_PIO_USE_PIO1 // Timing for SK6812 From c59bf26a20f1a3744f3fe9aa464096a88b16ae3c Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Wed, 10 Jan 2024 01:10:41 +1100 Subject: [PATCH 09/14] Renane vendor keymap to new PR checklist rules --- keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/bnk9.h | 0 .../binepad/bnk9/keymaps/{binepad => via_binepad}/bnk9_effect.c | 0 keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/keymap.c | 0 .../bnk9/keymaps/{binepad => via_binepad}/rgb_matrix_kb.inc | 0 keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/rules.mk | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/bnk9.h (100%) rename keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/bnk9_effect.c (100%) rename keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/keymap.c (100%) rename keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/rgb_matrix_kb.inc (100%) rename keyboards/binepad/bnk9/keymaps/{binepad => via_binepad}/rules.mk (100%) diff --git a/keyboards/binepad/bnk9/keymaps/binepad/bnk9.h b/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h similarity index 100% rename from keyboards/binepad/bnk9/keymaps/binepad/bnk9.h rename to keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h diff --git a/keyboards/binepad/bnk9/keymaps/binepad/bnk9_effect.c b/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c similarity index 100% rename from keyboards/binepad/bnk9/keymaps/binepad/bnk9_effect.c rename to keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c diff --git a/keyboards/binepad/bnk9/keymaps/binepad/keymap.c b/keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c similarity index 100% rename from keyboards/binepad/bnk9/keymaps/binepad/keymap.c rename to keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c diff --git a/keyboards/binepad/bnk9/keymaps/binepad/rgb_matrix_kb.inc b/keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc similarity index 100% rename from keyboards/binepad/bnk9/keymaps/binepad/rgb_matrix_kb.inc rename to keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc diff --git a/keyboards/binepad/bnk9/keymaps/binepad/rules.mk b/keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk similarity index 100% rename from keyboards/binepad/bnk9/keymaps/binepad/rules.mk rename to keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk From a52858e0a3bf02e4f2de73f62669dfdfeb7592f4 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:42:08 +1100 Subject: [PATCH 10/14] moved vendor keymap to vendor userspace --- .../binepad/bnk9/keymaps/via_binepad/bnk9.h | 23 ---- .../bnk9/keymaps/via_binepad/bnk9_effect.c | 122 ------------------ .../binepad/bnk9/keymaps/via_binepad/keymap.c | 28 ---- .../keymaps/via_binepad/rgb_matrix_kb.inc | 39 ------ .../binepad/bnk9/keymaps/via_binepad/rules.mk | 5 - 5 files changed, 217 deletions(-) delete mode 100644 keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h delete mode 100644 keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c delete mode 100644 keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c delete mode 100644 keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc delete mode 100644 keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk diff --git a/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h b/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h deleted file mode 100644 index 87de4ff4a7b2..000000000000 --- a/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2023 binepad (@binepad) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#ifdef VIA_ENABLE // Only works if VIA is enabled - -# define EEPROM_USER_CONFIG_ADDRESS (VIA_EEPROM_CUSTOM_CONFIG_ADDR + 1) - -# include "color.h" - -typedef struct PACKED { - uint8_t h; - uint8_t s; -} HS; - -typedef struct { - HS color[9]; -} user_config_t; - -extern user_config_t user_config; - -#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c b/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c deleted file mode 100644 index 15ac9c4390a9..000000000000 --- a/keyboards/binepad/bnk9/keymaps/via_binepad/bnk9_effect.c +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2023 Binepad (@binpad) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "quantum.h" - -#ifdef VIA_ENABLE // Only works if VIA is enabled - -#include "color.h" -#include "progmem.h" -#include "quantum/color.h" -#include "eeprom.h" -#include "bnk9.h" - -#ifndef EEPROM_USER_CONFIG_ADDRESS - #error EEPROM_USER_CONFIG_ADDRESS not defined -#endif -#if EEPROM_USER_CONFIG_ADDRESS == 0 - #error EEPROM_USER_CONFIG_ADDRESS = 0 -#endif - -#define RGB_PER_KEY_DEFAULT_COLOR { .h = RGB_MATRIX_DEFAULT_HUE, .s = RGB_MATRIX_DEFAULT_SAT } - -user_config_t user_config = { - .color = { - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR, - RGB_PER_KEY_DEFAULT_COLOR - } -}; - -enum via_per_key_value { - id_custom_color = 1 -}; - -// *** Helpers *** - -void bkn9_config_set_value( uint8_t *data ) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - - switch ( *value_id ) { - case id_custom_color: { - uint8_t i = value_data[0]; - user_config.color[ i ].h = value_data[1]; - user_config.color[ i ].s = value_data[2]; - break; - } - } -} - -void bkn9_config_get_value( uint8_t *data ) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - - switch ( *value_id ) { - case id_custom_color: { - uint8_t i = value_data[0]; - value_data[1] = user_config.color[ i ].h; - value_data[2] = user_config.color[ i ].s; - break; - } - } -} - -void bkn9_config_load(void) { - eeprom_read_block( - &user_config, - ((void*)EEPROM_USER_CONFIG_ADDRESS), - sizeof(user_config_t) ); -} - -void bkn9_config_save(void) { - eeprom_update_block( - &user_config, - ((void*)EEPROM_USER_CONFIG_ADDRESS), - sizeof(user_config_t) ); -} - -void via_custom_value_command_kb(uint8_t *data, uint8_t length) { - uint8_t *command_id = &(data[0]); - uint8_t *channel_id = &(data[1]); - uint8_t *value_id_and_data = &(data[2]); - - if ( *channel_id == id_custom_channel ) { - switch ( *command_id ) { - case id_custom_set_value: - bkn9_config_set_value(value_id_and_data); - break; - case id_custom_get_value: - bkn9_config_get_value(value_id_and_data); - break; - case id_custom_save: - bkn9_config_save(); - break; - default: - // Unhandled message. - *command_id = id_unhandled; - break; - } - return; - } - - *command_id = id_unhandled; -} - -void via_init_kb(void) { - // This checks both an EEPROM reset (from bootmagic lite, keycodes) - // and also firmware build date (from via_eeprom_is_valid()) - if (eeconfig_is_enabled()) { - bkn9_config_load(); - } else { - bkn9_config_save(); - } -} - -#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c b/keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c deleted file mode 100644 index 9ae1e4541f62..000000000000 --- a/keyboards/binepad/bnk9/keymaps/via_binepad/keymap.c +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2023 Binepad (@binpad) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include QMK_KEYBOARD_H - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( - KC_MUTE, - KC_P1, KC_P2, KC_P3, - KC_P4, KC_P5, KC_P6, - KC_P7, KC_P8, LT(1, KC_P9) - ), - [1] = LAYOUT( - RGB_TOG, - RGB_HUI, RGB_SAI, RGB_SPI, - RGB_HUD, RGB_SAD, RGB_SPD, - RGB_RMOD, RGB_MOD, _______ - ) -}; - -#if defined(ENCODER_MAP_ENABLE) - -const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, - [1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) } -}; - -#endif diff --git a/keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc b/keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc deleted file mode 100644 index 4b065fe37c4f..000000000000 --- a/keyboards/binepad/bnk9/keymaps/via_binepad/rgb_matrix_kb.inc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2023 Binepad (@binpad) -// SPDX-License-Identifier: GPL-2.0-or-later - -#ifdef VIA_ENABLE - -// Declare custom effects using the RGB_MATRIX_EFFECT macro -RGB_MATRIX_EFFECT(bnk9_per_key_effect) - -#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS - -#include "eeprom.h" -#include "eeconfig.h" -#include "via.h" -#include "bnk9.h" - -// Per-key color effect - -static bool bnk9_per_key_effect(effect_params_t* params) { - RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv; - RGB rgb; - - // Assuming `user_config` is set prior - - hsv.v = rgb_matrix_get_val(); - for (uint8_t i = led_min; i < led_max; i++) { - if (i < 9) { - hsv.h = user_config.color[i].h; - hsv.s = user_config.color[i].s; - rgb = hsv_to_rgb(hsv); - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); - } - } - - return rgb_matrix_check_finished_leds(led_max); -} - -#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // VIA_ENABLE diff --git a/keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk b/keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk deleted file mode 100644 index 32f8e0e0d225..000000000000 --- a/keyboards/binepad/bnk9/keymaps/via_binepad/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -VIA_ENABLE = yes -ENCODER_MAP_ENABLE = yes - -RGB_MATRIX_CUSTOM_KB = yes -SRC += bnk9_effect.c From 9efee331ed277421b3e4f47c7c5f051692f047fa Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:31:13 +1100 Subject: [PATCH 11/14] post- drashna review 2 --- keyboards/binepad/bnk9/config.h | 10 ++++------ keyboards/binepad/bnk9/mcuconf.h | 18 ------------------ 2 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 keyboards/binepad/bnk9/mcuconf.h diff --git a/keyboards/binepad/bnk9/config.h b/keyboards/binepad/bnk9/config.h index 1de354a7d03d..c774a0f2b096 100644 --- a/keyboards/binepad/bnk9/config.h +++ b/keyboards/binepad/bnk9/config.h @@ -5,10 +5,8 @@ #define ENCODER_DEFAULT_POS 0x3 // enable 1:1 resolution -#ifdef RGB_MATRIX_ENABLE - // Default PIO0 cases flickering in this board. Setting to PIO1 resolves this issue. - #define WS2812_PIO_USE_PIO1 +// Default PIO0 cases flickering in this board. Setting to PIO1 resolves this issue. +#define WS2812_PIO_USE_PIO1 - // Timing for SK6812 - #define WS2812_T1H 650 -#endif +// Timing for SK6812 +#define WS2812_T1H 650 diff --git a/keyboards/binepad/bnk9/mcuconf.h b/keyboards/binepad/bnk9/mcuconf.h deleted file mode 100644 index ed66af9c46fd..000000000000 --- a/keyboards/binepad/bnk9/mcuconf.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2023 binepad (@binepad) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include_next - -// Don't need SPI -#undef RP_SPI_USE_SPI0 -#define RP_SPI_USE_SPI0 FALSE - -// Don't need I2C -#undef RP_I2C_USE_I2C1 -#define RP_I2C_USE_I2C1 FALSE - -// Don't need ADC -#undef RP_ADC_USE_ADC1 -#define RP_ADC_USE_ADC1 FALSE From a5ebae9db44a0551de0efb2a2b4ff660ff87f9e5 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Sun, 14 Jan 2024 15:59:12 +1100 Subject: [PATCH 12/14] qmk format-json -1 info.json --- keyboards/binepad/bnk9/info.json | 96 +++++++++++++++----------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index a706d94eab7a..49ed4913936a 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -1,97 +1,89 @@ { "manufacturer": "binepad", "keyboard_name": "BNK9", - "url": "https://www.binepad.com/product-page/bnk9", "maintainer": "binepad", "board": "GENERIC_RP_RP2040", - "processor": "RP2040", "bootloader": "rp2040", "bootloader_instructions": "Hold down the key at (0x0) in the matrix (the 'knob' / rotary encoder) and plug in the keyboard.", "diode_direction": "COL2ROW", - "usb": { - "vid": "0x4249", - "pid": "0x4E39", - "device_version": "1.0.0" + "encoder": { + "rotary": [ + {"pin_a": "GP13", "pin_b": "GP14"} + ] }, "features": { "bootmagic": true, "command": false, "console": false, + "encoder": true, "extrakey": true, "mousekey": true, "nkro": true, - "encoder": true, "rgb_matrix": true }, - "ws2812": { - "driver": "vendor", - "pin": "GP11" - }, "matrix_pins": { "cols": ["GP1", "GP2", "GP3"], "rows": ["GP12", "GP4", "GP5", "GP6"] }, - "encoder": { - "rotary": [ - { - "pin_a": "GP13", - "pin_b": "GP14" - } - ] - }, + "processor": "RP2040", "rgb_matrix": { - "driver": "ws2812", "animations": { - "solid_color": true, "breathing": true, "cycle_all": true, "cycle_left_right": true, - "cycle_up_down": true, "cycle_pinwheel": true, + "cycle_up_down": true, "jellybean_raindrops": true, - "solid_reactive_simple": true, + "riverflow": true, + "solid_color": true, "solid_reactive": true, - "splash": true, + "solid_reactive_simple": true, "solid_splash": true, + "splash": true, "starlight": true, "starlight_dual_hue": true, - "starlight_dual_sat": true, - "riverflow": true + "starlight_dual_sat": true }, + "driver": "ws2812", "layout": [ - {"flags": 4, "matrix": [1, 0], "x": 80, "y": 0}, - {"flags": 4, "matrix": [1, 1], "x": 112, "y": 0}, - {"flags": 4, "matrix": [1, 2], "x": 144, "y": 0}, - - {"flags": 4, "matrix": [2, 2], "x": 144, "y": 32}, - {"flags": 4, "matrix": [2, 1], "x": 112, "y": 32}, - {"flags": 4, "matrix": [2, 0], "x": 80, "y": 32}, - - {"flags": 4, "matrix": [3, 0], "x": 80, "y": 64}, - {"flags": 4, "matrix": [3, 1], "x": 112, "y": 64}, - {"flags": 4, "matrix": [3, 2], "x": 144, "y": 64} + {"matrix": [1, 0], "x": 80, "y": 0, "flags": 4}, + {"matrix": [1, 1], "x": 112, "y": 0, "flags": 4}, + {"matrix": [1, 2], "x": 144, "y": 0, "flags": 4}, + {"matrix": [2, 2], "x": 144, "y": 32, "flags": 4}, + {"matrix": [2, 1], "x": 112, "y": 32, "flags": 4}, + {"matrix": [2, 0], "x": 80, "y": 32, "flags": 4}, + {"matrix": [3, 0], "x": 80, "y": 64, "flags": 4}, + {"matrix": [3, 1], "x": 112, "y": 64, "flags": 4}, + {"matrix": [3, 2], "x": 144, "y": 64, "flags": 4} ], "led_process_limit": 9, "max_brightness": 180, "sleep": true - } + }, + "url": "https://www.binepad.com/product-page/bnk9", + "usb": { + "device_version": "1.0.0", + "pid": "0x4E39", + "vid": "0x4249" + }, + "ws2812": { + "driver": "vendor", + "pin": "GP11" + }, "layouts": { "LAYOUT": { "layout": [ - { "matrix": [0, 0], "label": "Knob", "x": 0, "y": 0, "w": 3, "h": 3 }, - - { "matrix": [1, 0], "label": "1", "x": 3.25, "y": 0 }, - { "matrix": [1, 1], "label": "2", "x": 4.25, "y": 0 }, - { "matrix": [1, 2], "label": "3", "x": 5.25, "y": 0 }, - - { "matrix": [2, 0], "label": "4", "x": 3.25, "y": 1 }, - { "matrix": [2, 1], "label": "5", "x": 4.25, "y": 1 }, - { "matrix": [2, 2], "label": "6", "x": 5.25, "y": 1 }, - - { "matrix": [3, 0], "label": "7", "x": 3.25, "y": 2 }, - { "matrix": [3, 1], "label": "8", "x": 4.25, "y": 2 }, - { "matrix": [3, 2], "label": "9", "x": 5.25, "y": 2 } + {"label": "Knob", "matrix": [0, 0], "x": 0, "y": 0, "w": 3, "h": 3}, + {"label": "1", "matrix": [1, 0], "x": 3.25, "y": 0}, + {"label": "2", "matrix": [1, 1], "x": 4.25, "y": 0}, + {"label": "3", "matrix": [1, 2], "x": 5.25, "y": 0}, + {"label": "4", "matrix": [2, 0], "x": 3.25, "y": 1}, + {"label": "5", "matrix": [2, 1], "x": 4.25, "y": 1}, + {"label": "6", "matrix": [2, 2], "x": 5.25, "y": 1}, + {"label": "7", "matrix": [3, 0], "x": 3.25, "y": 2}, + {"label": "8", "matrix": [3, 1], "x": 4.25, "y": 2}, + {"label": "9", "matrix": [3, 2], "x": 5.25, "y": 2} ] } } -} +} \ No newline at end of file From e315ad18e6a01c941315277c657bd709f906bf5e Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:31:40 +1100 Subject: [PATCH 13/14] Post- fauxpark and lesshonor review changes Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com> Co-authored-by: Ryan --- keyboards/binepad/bnk9/info.json | 4 +--- keyboards/binepad/bnk9/readme.md | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index 49ed4913936a..0c1601b5b09f 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -13,8 +13,6 @@ }, "features": { "bootmagic": true, - "command": false, - "console": false, "encoder": true, "extrakey": true, "mousekey": true, @@ -73,7 +71,7 @@ "layouts": { "LAYOUT": { "layout": [ - {"label": "Knob", "matrix": [0, 0], "x": 0, "y": 0, "w": 3, "h": 3}, + {"label": "Knob", "matrix": [0, 0], "x": 0, "y": 0, "w": 3, "h": 3, "encoder": 0}, {"label": "1", "matrix": [1, 0], "x": 3.25, "y": 0}, {"label": "2", "matrix": [1, 1], "x": 4.25, "y": 0}, {"label": "3", "matrix": [1, 2], "x": 5.25, "y": 0}, diff --git a/keyboards/binepad/bnk9/readme.md b/keyboards/binepad/bnk9/readme.md index add54ef0148d..f8e6633b1434 100644 --- a/keyboards/binepad/bnk9/readme.md +++ b/keyboards/binepad/bnk9/readme.md @@ -2,7 +2,7 @@ ![BINEPAD BNK9](https://i.imgur.com/FrkVRhhh.jpg) -*A 3x3 macropad with a large rotary encoder* +A 3x3 macropad with a large rotary encoder. * Keyboard Maintainer: [binepad](https://github.com/binepad) * Hardware Supported: BINPAD BNK9 From e20d255a629413fd5e3f24da423a50dd050741c8 Mon Sep 17 00:00:00 2001 From: Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:10:30 +1100 Subject: [PATCH 14/14] post zvecr fix Co-authored-by: Joel Challis --- keyboards/binepad/bnk9/info.json | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/binepad/bnk9/info.json b/keyboards/binepad/bnk9/info.json index 0c1601b5b09f..1f3b7cb7b0f0 100644 --- a/keyboards/binepad/bnk9/info.json +++ b/keyboards/binepad/bnk9/info.json @@ -33,7 +33,6 @@ "cycle_up_down": true, "jellybean_raindrops": true, "riverflow": true, - "solid_color": true, "solid_reactive": true, "solid_reactive_simple": true, "solid_splash": true,