diff --git a/keyboards/rk/b87/b87.c b/keyboards/rk/b87/b87.c new file mode 100644 index 000000000000..6d13833eab11 --- /dev/null +++ b/keyboards/rk/b87/b87.c @@ -0,0 +1,275 @@ +// Copyright 2024 yangzheng20003 (@yangzheng20003) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +typedef union { + uint32_t raw; + struct { + uint8_t flag : 1; + uint8_t devs : 3; + }; +} confinfo_t; +confinfo_t confinfo; + +typedef struct { + bool active; + uint32_t timer; + uint32_t interval; + uint32_t times; + uint8_t index; + RGB rgb; +} hs_rgb_indicator_t; + +enum layers { + _BL = 0, + _FL, + _MBL, + _MFL, + _FBL, +}; + +hs_rgb_indicator_t hs_rgb_indicators[HS_RGB_INDICATOR_COUNT]; +hs_rgb_indicator_t hs_rgb_bat[HS_RGB_BAT_COUNT]; + +void rgb_blink_dir(void); +void hs_reset_settings(void); +void rgb_matrix_hs_indicator(void); +void rgb_matrix_hs_indicator_set(uint8_t index, RGB rgb, uint32_t interval, uint8_t times); + +#define keymap_is_mac_system() ((get_highest_layer(default_layer_state) == _MBL) || (get_highest_layer(default_layer_state) == _MFL)) +#define keymap_is_base_layer() ((get_highest_layer(default_layer_state) == _BL) || (get_highest_layer(default_layer_state) == _FL)) + +uint32_t bat_indicator_cnt = true; +static uint32_t ee_clr_timer = 0; + +void eeconfig_confinfo_update(uint32_t raw) { + + eeconfig_update_kb(raw); +} + +uint32_t eeconfig_confinfo_read(void) { + + return eeconfig_read_kb(); +} + +void eeconfig_confinfo_default(void) { + + confinfo.flag = true; + eeconfig_confinfo_update(confinfo.raw); +} + +void eeconfig_confinfo_init(void) { + + confinfo.raw = eeconfig_confinfo_read(); + if (!confinfo.raw) { + eeconfig_confinfo_default(); + } +} + +void keyboard_post_init_kb(void) { + +#ifdef CONSOLE_ENABLE + debug_enable = true; +#endif + + eeconfig_confinfo_init(); + +#ifdef LED_POWER_EN_PIN + gpio_set_pin_output(LED_POWER_EN_PIN); + gpio_write_pin_high(LED_POWER_EN_PIN); + gpio_set_pin_output(A9); + gpio_write_pin_high(A9); + + gpio_set_pin_output(D2); + gpio_write_pin_high(D2); + +#endif + +#ifdef USB_POWER_EN_PIN + gpio_write_pin_low(USB_POWER_EN_PIN); + gpio_set_pin_output(USB_POWER_EN_PIN); +#endif + +#ifdef HS_BAT_CABLE_PIN + setPinInputHigh(HS_BAT_CABLE_PIN); +#endif + keyboard_post_init_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + + if (process_record_user(keycode, record) != true) { + return false; + } + switch (keycode) { + case EE_CLR:{ + if (record->event.pressed) { + ee_clr_timer = timer_read32(); + } else { + ee_clr_timer = 0; + } + return false; + break; + } + case RGB_SPI:{ + if (record->event.pressed) { + if (rgb_matrix_get_speed() >= (RGB_MATRIX_SPD_STEP * 5)) { + rgb_blink_dir(); + } + } + return true; + } break; + + case RGB_SPD: { + if (record->event.pressed) { + if (rgb_matrix_get_speed() <= RGB_MATRIX_SPD_STEP) { + rgb_blink_dir(); + rgb_matrix_set_speed(RGB_MATRIX_SPD_STEP); + return false; + } + } + return true; + } break; + + case RGB_VAI: { + if (record->event.pressed) { + if (rgb_matrix_get_val() >= (RGB_MATRIX_MAXIMUM_BRIGHTNESS - RGB_MATRIX_VAL_STEP)) { + rgb_blink_dir(); + } + } + return true; + } break; + + case RGB_VAD: { + if (record->event.pressed) { + if (rgb_matrix_get_val() <= RGB_MATRIX_VAL_STEP) { + rgb_blink_dir(); + rgb_matrix_set_color_all(0x00, 0x00, 0x00); + } + } + return true; + } break; + + case TO(_BL): { + if (record->event.pressed) { + rgb_matrix_hs_indicator_set(HS_RGB_BLINK_INDEX_WIN, (RGB){RGB_WHITE}, 250, 3); + if (keymap_is_mac_system()) { + set_single_persistent_default_layer(_BL); + layer_move(0); + } + } + return false; + } break; + + case TO(_MBL): { + if (record->event.pressed) { + rgb_matrix_hs_indicator_set(HS_RGB_BLINK_INDEX_MAC, (RGB){RGB_WHITE}, 250, 3); + if (!keymap_is_mac_system()) { + set_single_persistent_default_layer(_MBL); + layer_move(0); + } + } + return false; + } break; + default: + return true; + } + + return false; +} + +void rgb_blink_dir(void){ + rgb_matrix_hs_indicator_set(HS_RGB_BLINK_INDEX_VAI, (RGB){RGB_WHITE}, 250, 3); + rgb_matrix_hs_indicator_set(HS_RGB_BLINK_INDEX_VAD, (RGB){RGB_WHITE}, 250, 3); + rgb_matrix_hs_indicator_set(HS_RGB_BLINK_INDEX_SPI, (RGB){RGB_WHITE}, 250, 3); + +} + +bool hs_reset_settings_user(void) { + + for(uint8_t i = 0; i < HS_RGB_INDICATOR_COUNT; i ++){ + rgb_matrix_hs_indicator_set(i, (RGB){RGB_WHITE}, 250, 3); + } + + return true; +} +void rgb_matrix_hs_indicator_set(uint8_t index, RGB rgb, uint32_t interval, uint8_t times) { + for (int i = 0; i < HS_RGB_INDICATOR_COUNT; i++) { + if (!hs_rgb_indicators[i].active) { + hs_rgb_indicators[i].active = true; + hs_rgb_indicators[i].timer = timer_read32(); + hs_rgb_indicators[i].interval = interval; + hs_rgb_indicators[i].times = times * 2; + hs_rgb_indicators[i].index = index; + hs_rgb_indicators[i].rgb = rgb; + break; + } + } +} + +void rgb_matrix_hs_indicator(void) { + for (int i = 0; i < HS_RGB_INDICATOR_COUNT; i++) { + if (hs_rgb_indicators[i].active) { + if (timer_elapsed32(hs_rgb_indicators[i].timer) >= hs_rgb_indicators[i].interval) { + hs_rgb_indicators[i].timer = timer_read32(); + + if (hs_rgb_indicators[i].times) { + hs_rgb_indicators[i].times--; + } + + if (hs_rgb_indicators[i].times <= 0) { + hs_rgb_indicators[i].active = false; + hs_rgb_indicators[i].timer = 0x00; + } + } + + if (hs_rgb_indicators[i].times % 2) { + rgb_matrix_set_color(hs_rgb_indicators[i].index, hs_rgb_indicators[i].rgb.r, hs_rgb_indicators[i].rgb.g, hs_rgb_indicators[i].rgb.b); + } else { + rgb_matrix_set_color(hs_rgb_indicators[i].index, 0x00, 0x00, 0x00); + } + } + } +} + +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + + if (rgb_matrix_indicators_advanced_user(led_min, led_max) != true) { + return false; + } + + if (ee_clr_timer && timer_elapsed32(ee_clr_timer) > 3000) { + hs_reset_settings(); + ee_clr_timer = 0; + } + + if (host_keyboard_led_state().caps_lock) + rgb_matrix_set_color(HS_RGB_INDEX_CAPS, RGB_WHITE); + else + rgb_matrix_set_color(HS_RGB_INDEX_CAPS, RGB_BLACK); + if (!keymap_is_mac_system() && keymap_config.no_gui) + rgb_matrix_set_color(HS_RGB_INDEX_WIN_LOCK, RGB_WHITE); + else + rgb_matrix_set_color(HS_RGB_INDEX_WIN_LOCK, RGB_BLACK); + rgb_matrix_set_color(2, RGB_BLACK); + + rgb_matrix_hs_indicator(); + + return true; +} + +void hs_reset_settings(void) { + eeconfig_init(); + eeconfig_update_rgb_matrix_default(); + + keymap_config.raw = eeconfig_read_keymap(); +#if defined(NKRO_ENABLE) && defined(FORCE_NKRO) + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); +#endif + if (hs_reset_settings_user() != true) { + return; + } + keyboard_post_init_kb(); +} diff --git a/keyboards/rk/b87/config.h b/keyboards/rk/b87/config.h new file mode 100644 index 000000000000..f860ba0d8bdb --- /dev/null +++ b/keyboards/rk/b87/config.h @@ -0,0 +1,46 @@ +// Copyright 2024 yangzheng20003 (@yangzheng20003) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define USB_POWER_EN_PIN B1 //USB ENABLE pin +#define LED_POWER_EN_PIN A5 //LED ENABLE pin +#define HS_BAT_CABLE_PIN A7 //USB insertion detection pin + +#define BAT_FULL_PIN A15 +#define BAT_FULL_STATE 1 + +#define HS_RGB_INDICATOR_COUNT 99 +#define HS_RGB_BAT_COUNT 1 + +/* Status Indicator Lamp */ +#define HS_RGB_INDEX_CAPS 0 +#define HS_RGB_INDEX_WIN_LOCK 1 +#define HS_RGB_BLINK_INDEX_VAI 0 +#define HS_RGB_BLINK_INDEX_VAD 1 +#define HS_RGB_BLINK_INDEX_SPI 2 + +#define HS_RGB_BLINK_INDEX_WIN 55 +#define HS_RGB_BLINK_INDEX_MAC 56 + +/* Encoder */ +#define ENCODER_MAP_KEY_DELAY 1 + +/* SPI */ +#define SPI_DRIVER SPIDQ +#define SPI_SCK_PIN B3 +#define SPI_MOSI_PIN B5 +#define SPI_MISO_PIN B4 + +/* Flash */ +#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN C12 +#define WEAR_LEVELING_LOGICAL_SIZE (WEAR_LEVELING_BACKING_SIZE / 2) + +/* RGB Matrix */ +#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES + +/* WS2812 */ +#define WS2812_SPI_DRIVER SPIDM2 +#define WS2812_SPI_DIVISOR 32 diff --git a/keyboards/rk/b87/halconf.h b/keyboards/rk/b87/halconf.h new file mode 100644 index 000000000000..628acad1494d --- /dev/null +++ b/keyboards/rk/b87/halconf.h @@ -0,0 +1,9 @@ +// Copyright 2024 yangzheng20003 (@yangzheng20003) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_SPI TRUE +#define PAL_USE_CALLBACKS TRUE + +#include_next diff --git a/keyboards/rk/b87/keyboard.json b/keyboards/rk/b87/keyboard.json new file mode 100644 index 000000000000..17963b067e93 --- /dev/null +++ b/keyboards/rk/b87/keyboard.json @@ -0,0 +1,301 @@ +{ + "manufacturer": "RK", + "keyboard_name": "ilovbee B87", + "maintainer": "yangzheng20003", + "bootloader": "wb32-dfu", + "bootmagic": { + "matrix": [0, 0] + }, + "debounce": 1, + "diode_direction": "ROW2COL", + "eeprom": { + "driver": "wear_leveling", + "wear_leveling": { + "backing_size": 4096, + "driver": "spi_flash" + } + }, + "encoder": { + "rotary": [ + {"pin_a": "B7", "pin_b": "B6"} + ] + }, + "features": { + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true, + "deferred_exec": true, + "rgblight": false, + "encoder": true + }, + "dynamic_keymap": { + "layer_count": 5 + }, + "matrix_pins": { + "cols": ["C0", "C1", "C2", "C3", "A6", "B10", "B11", "B12", "B13", "B14", "A10", "C6", "C7", "C8", "C9", "A8", "C4"], + "rows": ["A0", "A1", "A2", "A3", "A4", "C13"] + }, + "processor": "WB32FQ95", + "rgb_matrix": { + "animations": { + "alphas_mods": true, + "band_pinwheel_sat": true, + "band_pinwheel_val": true, + "band_sat": true, + "band_spiral_sat": true, + "band_spiral_val": true, + "band_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "gradient_left_right": true, + "gradient_up_down": true, + "hue_breathing": true, + "hue_pendulum": true, + "hue_wave": true, + "jellybean_raindrops": true, + "multisplash": true, + "pixel_flow": true, + "pixel_fractal": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "rainbow_pinwheels": true, + "raindrops": true, + "solid_color": true, + "solid_multisplash": true, + "solid_reactive": true, + "solid_reactive_cross": true, + "solid_reactive_multicross": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_nexus": true, + "solid_reactive_simple": true, + "solid_reactive_wide": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + }, + "driver": "ws2812", + "layout": [ + {"matrix": [3, 14], "x": 196, "y": 38, "flags": 4}, + {"matrix": [3, 15], "x": 210, "y": 38, "flags": 4}, + {"matrix": [3, 16], "x": 224, "y": 38, "flags": 4}, + {"matrix": [2, 16], "x": 224, "y": 26, "flags": 4}, + {"matrix": [1, 16], "x": 224, "y": 13, "flags": 4}, + {"matrix": [0, 16], "x": 224, "y": 0, "flags": 4}, + {"matrix": [0, 15], "x": 210, "y": 0, "flags": 4}, + {"matrix": [0, 14], "x": 196, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 182, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 168, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 154, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 140, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 126, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 112, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 98, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 84, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 70, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 56, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 42, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 28, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 14, "y": 0, "flags": 4}, + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 13, "flags": 4}, + {"matrix": [1, 1], "x": 14, "y": 13, "flags": 4}, + {"matrix": [1, 2], "x": 28, "y": 13, "flags": 4}, + {"matrix": [1, 3], "x": 42, "y": 13, "flags": 4}, + {"matrix": [1, 4], "x": 56, "y": 13, "flags": 4}, + {"matrix": [1, 5], "x": 70, "y": 13, "flags": 4}, + {"matrix": [1, 6], "x": 84, "y": 13, "flags": 4}, + {"matrix": [1, 7], "x": 98, "y": 13, "flags": 4}, + {"matrix": [1, 8], "x": 112, "y": 13, "flags": 4}, + {"matrix": [1, 9], "x": 126, "y": 13, "flags": 4}, + {"matrix": [1, 10], "x": 140, "y": 13, "flags": 4}, + {"matrix": [1, 11], "x": 154, "y": 13, "flags": 4}, + {"matrix": [1, 12], "x": 168, "y": 13, "flags": 4}, + {"matrix": [1, 13], "x": 182, "y": 13, "flags": 4}, + {"matrix": [1, 14], "x": 196, "y": 13, "flags": 4}, + {"matrix": [1, 15], "x": 210, "y": 13, "flags": 4}, + {"matrix": [2, 15], "x": 210, "y": 26, "flags": 4}, + {"matrix": [2, 14], "x": 196, "y": 26, "flags": 4}, + {"matrix": [2, 13], "x": 182, "y": 26, "flags": 4}, + {"matrix": [2, 12], "x": 168, "y": 26, "flags": 4}, + {"matrix": [2, 11], "x": 154, "y": 26, "flags": 4}, + {"matrix": [2, 10], "x": 140, "y": 26, "flags": 4}, + {"matrix": [2, 9], "x": 126, "y": 26, "flags": 4}, + {"matrix": [2, 8], "x": 112, "y": 26, "flags": 4}, + {"matrix": [2, 7], "x": 98, "y": 26, "flags": 4}, + {"matrix": [2, 6], "x": 84, "y": 26, "flags": 4}, + {"matrix": [2, 5], "x": 70, "y": 26, "flags": 4}, + {"matrix": [2, 4], "x": 56, "y": 26, "flags": 4}, + {"matrix": [2, 3], "x": 42, "y": 26, "flags": 4}, + {"matrix": [2, 2], "x": 28, "y": 26, "flags": 4}, + {"matrix": [2, 1], "x": 14, "y": 26, "flags": 4}, + {"matrix": [2, 0], "x": 0, "y": 26, "flags": 4}, + {"matrix": [3, 0], "x": 0, "y": 38, "flags": 4}, + {"matrix": [3, 1], "x": 14, "y": 38, "flags": 4}, + {"matrix": [3, 2], "x": 28, "y": 38, "flags": 4}, + {"matrix": [3, 3], "x": 42, "y": 38, "flags": 4}, + {"matrix": [3, 4], "x": 56, "y": 38, "flags": 4}, + {"matrix": [3, 5], "x": 70, "y": 38, "flags": 4}, + {"matrix": [3, 6], "x": 84, "y": 38, "flags": 4}, + {"matrix": [3, 7], "x": 98, "y": 38, "flags": 4}, + {"matrix": [3, 8], "x": 112, "y": 38, "flags": 4}, + {"matrix": [3, 9], "x": 126, "y": 38, "flags": 4}, + {"matrix": [3, 10], "x": 140, "y": 38, "flags": 4}, + {"matrix": [3, 11], "x": 154, "y": 38, "flags": 4}, + {"matrix": [3, 12], "x": 168, "y": 38, "flags": 4}, + {"matrix": [4, 15], "x": 210, "y": 51, "flags": 4}, + {"matrix": [4, 12], "x": 168, "y": 51, "flags": 4}, + {"matrix": [4, 11], "x": 154, "y": 51, "flags": 4}, + {"matrix": [4, 10], "x": 140, "y": 51, "flags": 4}, + {"matrix": [4, 9], "x": 126, "y": 51, "flags": 4}, + {"matrix": [4, 8], "x": 112, "y": 51, "flags": 4}, + {"matrix": [4, 7], "x": 98, "y": 51, "flags": 4}, + {"matrix": [4, 6], "x": 84, "y": 51, "flags": 4}, + {"matrix": [4, 5], "x": 70, "y": 51, "flags": 4}, + {"matrix": [4, 4], "x": 56, "y": 51, "flags": 4}, + {"matrix": [4, 3], "x": 42, "y": 51, "flags": 4}, + {"matrix": [4, 2], "x": 28, "y": 51, "flags": 4}, + {"matrix": [4, 0], "x": 0, "y": 51, "flags": 4}, + {"matrix": [5, 0], "x": 0, "y": 64, "flags": 4}, + {"matrix": [5, 1], "x": 14, "y": 64, "flags": 4}, + {"matrix": [5, 2], "x": 28, "y": 64, "flags": 4}, + {"matrix": [5, 6], "x": 84, "y": 64, "flags": 4}, + {"matrix": [5, 10], "x": 140, "y": 64, "flags": 4}, + {"matrix": [5, 11], "x": 154, "y": 64, "flags": 4}, + {"matrix": [5, 12], "x": 168, "y": 64, "flags": 4}, + {"matrix": [5, 13], "x": 182, "y": 64, "flags": 4}, + {"matrix": [5, 14],"x": 196, "y": 64, "flags": 4}, + {"matrix": [5, 15],"x": 210, "y": 64, "flags": 4}, + {"matrix": [5, 16],"x": 224, "y": 64, "flags": 4} + ], + "max_brightness": 200, + "val_steps": 40, + "speed_steps": 51, + "default": { + "val" :153, + "speed" :204 + }, + "sleep": true, + "timeout": 60000 + }, + "tap_keycode_delay": 10, + "url": "http://www.rkgaming.com", + "usb": { + "device_version": "0.3.0", + "force_nkro": true, + "pid": "0xE4B7", + "suspend_wakeup_delay": 1000, + "vid": "0x342D" + }, + "ws2812": { + "pin": "B15", + "driver": "spi" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0.25}, + {"matrix": [0, 1], "x": 1.25, "y": 0.25}, + {"matrix": [0, 2], "x": 2.25, "y": 0.25}, + {"matrix": [0, 3], "x": 3.25, "y": 0.25}, + {"matrix": [0, 4], "x": 4.25, "y": 0.25}, + {"matrix": [0, 5], "x": 5.5, "y": 0.25}, + {"matrix": [0, 6], "x": 6.5, "y": 0.25}, + {"matrix": [0, 7], "x": 7.5, "y": 0.25}, + {"matrix": [0, 8], "x": 8.5, "y": 0.25}, + {"matrix": [0, 9], "x": 9.75, "y": 0.25}, + {"matrix": [0, 10], "x": 10.75, "y": 0.25}, + {"matrix": [0, 11], "x": 11.75, "y": 0.25}, + {"matrix": [0, 12], "x": 12.75, "y": 0.25}, + {"matrix": [0, 13], "x": 14, "y": 0.25}, + {"matrix": [0, 14], "x": 15.25, "y": 0.25}, + {"matrix": [0, 15], "x": 16.25, "y": 0.25}, + {"matrix": [0, 16], "x": 17.25, "y": 0.25}, + {"matrix": [1, 0], "x": 0, "y": 1.5}, + {"matrix": [1, 1], "x": 1, "y": 1.5}, + {"matrix": [1, 2], "x": 2, "y": 1.5}, + {"matrix": [1, 3], "x": 3, "y": 1.5}, + {"matrix": [1, 4], "x": 4, "y": 1.5}, + {"matrix": [1, 5], "x": 5, "y": 1.5}, + {"matrix": [1, 6], "x": 6, "y": 1.5}, + {"matrix": [1, 7], "x": 7, "y": 1.5}, + {"matrix": [1, 8], "x": 8, "y": 1.5}, + {"matrix": [1, 9], "x": 9, "y": 1.5}, + {"matrix": [1, 10], "x": 10, "y": 1.5}, + {"matrix": [1, 11], "x": 11, "y": 1.5}, + {"matrix": [1, 12], "x": 12, "y": 1.5}, + {"matrix": [1, 13], "x": 13, "y": 1.5, "w": 2}, + {"matrix": [1, 14], "x": 15.25, "y": 1.5}, + {"matrix": [1, 15], "x": 16.25, "y": 1.5}, + {"matrix": [1, 16], "x": 17.25, "y": 1.5}, + {"matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5}, + {"matrix": [2, 1], "x": 1.5, "y": 2.5}, + {"matrix": [2, 2], "x": 2.5, "y": 2.5}, + {"matrix": [2, 3], "x": 3.5, "y": 2.5}, + {"matrix": [2, 4], "x": 4.5, "y": 2.5}, + {"matrix": [2, 5], "x": 5.5, "y": 2.5}, + {"matrix": [2, 6], "x": 6.5, "y": 2.5}, + {"matrix": [2, 7], "x": 7.5, "y": 2.5}, + {"matrix": [2, 8], "x": 8.5, "y": 2.5}, + {"matrix": [2, 9], "x": 9.5, "y": 2.5}, + {"matrix": [2, 10], "x": 10.5, "y": 2.5}, + {"matrix": [2, 11], "x": 11.5, "y": 2.5}, + {"matrix": [2, 12], "x": 12.5, "y": 2.5}, + {"matrix": [2, 13], "x": 13.5, "y": 2.5, "w": 1.5}, + {"matrix": [2, 14], "x": 15.25, "y": 2.5}, + {"matrix": [2, 15], "x": 16.25, "y": 2.5}, + {"matrix": [2, 16], "x": 17.25, "y": 2.5}, + {"matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75}, + {"matrix": [3, 1], "x": 1.75, "y": 3.5}, + {"matrix": [3, 2], "x": 2.75, "y": 3.5}, + {"matrix": [3, 3], "x": 3.75, "y": 3.5}, + {"matrix": [3, 4], "x": 4.75, "y": 3.5}, + {"matrix": [3, 5], "x": 5.75, "y": 3.5}, + {"matrix": [3, 6], "x": 6.75, "y": 3.5}, + {"matrix": [3, 7], "x": 7.75, "y": 3.5}, + {"matrix": [3, 8], "x": 8.75, "y": 3.5}, + {"matrix": [3, 9], "x": 9.75, "y": 3.5}, + {"matrix": [3, 10], "x": 10.75, "y": 3.5}, + {"matrix": [3, 11], "x": 11.75, "y": 3.5}, + {"matrix": [3, 12], "x": 12.75, "y": 3.5, "w": 2.25}, + {"matrix": [3, 13], "x": 15, "y": 3.5}, + {"matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25}, + {"matrix": [4, 2], "x": 2.25, "y": 4.5}, + {"matrix": [4, 3], "x": 3.25, "y": 4.5}, + {"matrix": [4, 4], "x": 4.25, "y": 4.5}, + {"matrix": [4, 5], "x": 5.25, "y": 4.5}, + {"matrix": [4, 6], "x": 6.25, "y": 4.5}, + {"matrix": [4, 7], "x": 7.25, "y": 4.5}, + {"matrix": [4, 8], "x": 8.25, "y": 4.5}, + {"matrix": [4, 9], "x": 9.25, "y": 4.5}, + {"matrix": [4, 1], "x": 10.25, "y": 4.5}, + {"matrix": [4, 11], "x": 11.25, "y": 4.5}, + {"matrix": [4, 12], "x": 12.25, "y": 4.5, "w": 2.75}, + {"matrix": [4, 15], "x": 16.25, "y": 4.5}, + {"matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25}, + {"matrix": [5, 1], "x": 1.25, "y": 5.5, "w": 1.25}, + {"matrix": [5, 2], "x": 2.5, "y": 5.5, "w": 1.25}, + {"matrix": [5, 6], "x": 3.75, "y": 5.5, "w": 6.25}, + {"matrix": [5, 10], "x": 10, "y": 5.5, "w": 1.25}, + {"matrix": [5, 11], "x": 11.25, "y": 5.5, "w": 1.25}, + {"matrix": [5, 12], "x": 12.5, "y": 5.5, "w": 1.25}, + {"matrix": [5, 13], "x": 13.75, "y": 5.5, "w": 1.25}, + {"matrix": [5, 14], "x": 15.25, "y": 5.5}, + {"matrix": [5, 15], "x": 16.25, "y": 5.5}, + {"matrix": [5, 16], "x": 17.25, "y": 5.5} + ] + } + } +} diff --git a/keyboards/rk/b87/keymaps/default/keymap.c b/keyboards/rk/b87/keymaps/default/keymap.c new file mode 100644 index 000000000000..04e7c7c05e42 --- /dev/null +++ b/keyboards/rk/b87/keymaps/default/keymap.c @@ -0,0 +1,67 @@ +// Copyright 2024 yangzheng20003 (@yangzheng20003) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +enum layers { + _BL = 0, + _FL, + _MBL, + _MFL, + _FBL, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BL] = LAYOUT( /* Base */ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 , KC_F12, KC_CALC, KC_PSCR, KC_SCRL, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_MUTE, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FL), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [_FL] = LAYOUT( /* Base */ + _______, KC_MYCM, KC_WHOM, KC_MAIL, KC_CALC, KC_MSEL, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_MOD, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, RGB_HUI, KC_PAUSE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_NO, TO(_MBL), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, MO(_FBL), RGB_VAI, + _______, GU_TOGG, _______, EE_CLR, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI ), + + [_MBL] = LAYOUT( /* Base */ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 , KC_F12, KC_CALC, KC_PSCR, KC_SCRL, KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_MUTE, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(_MFL), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [_MFL] = LAYOUT( /* Base */ + _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_MOD, KC_PAUSE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, RGB_HUI, KC_PAUSE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, TO(_BL), KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, MO(_FBL), RGB_VAI, + _______, _______, _______, EE_CLR, _______, _______, _______, _______, RGB_SPD, RGB_VAD, RGB_SPI ), + [_FBL] = LAYOUT( /* Base */ + QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) + +}; + +#ifdef 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(_______, _______)}, + [2] = {ENCODER_CCW_CW(_______, _______)}, + [3] = {ENCODER_CCW_CW(_______, _______)}, + [4] = {ENCODER_CCW_CW(_______, _______)}, +}; +#endif +// clang-format on diff --git a/keyboards/rk/b87/mcuconf.h b/keyboards/rk/b87/mcuconf.h new file mode 100644 index 000000000000..dbfb79c641fb --- /dev/null +++ b/keyboards/rk/b87/mcuconf.h @@ -0,0 +1,32 @@ +// Copyright 2024 yangzheng20003 (@yangzheng20003) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next + +#undef WB32_USB_HOST_WAKEUP_DURATION +#define WB32_USB_HOST_WAKEUP_DURATION 2 + +#undef WB32_SPI_USE_SPIM2 +#define WB32_SPI_USE_SPIM2 TRUE + +#undef WB32_SPI_USE_QSPI +#define WB32_SPI_USE_QSPI TRUE + +// The interrupt priority of the WS2812 driver must be higher than that of other SPI devices. +#undef WB32_SPI_SPIM2_IRQ_PRIORITY +#define WB32_SPI_SPIM2_IRQ_PRIORITY 9 + +#undef WB32_SPI_QSPI_IRQ_PRIORITY +#define WB32_SPI_QSPI_IRQ_PRIORITY 10 + +/* system clock set to 96Mhz */ +#undef WB32_PLLDIV_VALUE +#define WB32_PLLDIV_VALUE 2 + +#undef WB32_PLLMUL_VALUE +#define WB32_PLLMUL_VALUE 16 + +#undef WB32_USBPRE +#define WB32_USBPRE WB32_USBPRE_DIV2 diff --git a/keyboards/rk/b87/readme.md b/keyboards/rk/b87/readme.md new file mode 100644 index 000000000000..bb83da018354 --- /dev/null +++ b/keyboards/rk/b87/readme.md @@ -0,0 +1,21 @@ +# ilovbee B87 + +* Keyboard Maintainer: [yangzheng20003](https://github.com/yangzheng20003) +* Hardware Supported: ilovbee B87 +* Hardware Availability: [RK](http://www.rkgaming.com) + +Make example for this keyboard (after setting up your build environment): + + make rk/b87:default + +Flashing example for this keyboard: + + make rk/b87:default:flash + +To reset the board into bootloader mode, do one of the following: + +* Hold the Reset switch mounted on the bottom side of the PCB while connecting the USB cable +* Hold the Escape key while connecting the USB cable (also erases persistent settings) +* Fn+R_Shift+Esc will reset the board to bootloader mode if you have flashed the default QMK keymap + +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).