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

[Keyboard] Add BL75 #18548

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 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
136 changes: 136 additions & 0 deletions keyboards/yandrstudio/bl75/bl75.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/* Copyright 2022 JasonRen(biu)
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "bl75.h"

#ifdef RGB_MATRIX_ENABLE

led_config_t g_led_config = {
{
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14},
{29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15},
{30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44},
{58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, NO_LED, 46, 45},
{59, NO_LED, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72},
{83, 82, 81, NO_LED, 80, NO_LED, 79, NO_LED, 78, NO_LED, 77, 76, 75, 74, 73}
},
{
{0,0},{16,0},{32,0},{48,0},{64,0},{80,0},{96,0},{112,0},{128,0},{144,0},{160,0},{176,0},{192,0},{208,0},{224,0},
{224,13},{208,13},{192,13},{176,13},{160,13},{144,13},{128,13},{112,13},{96,13},{80,13},{64,13},{48,13},{32,13},{16,13},{0,13},
{0,26},{16,26},{32,26},{48,26},{64,26},{80,26},{96,26},{112,26},{128,26},{144,26},{160,26},{176,26},{192,26},{208,26},{224,26},
{224,38},{208,38}, {176,38},{160,38},{144,38},{128,38},{112,38},{96,38},{80,38},{64,38},{48,38},{32,38},{16,38},{0,38},
{0,51}, {32,51},{48,51},{64,51},{80,51},{96,51},{112,51},{128,51},{144,51},{160,51},{176,51},{192,51},{208,51},{224,51},
{224,64},{208,64},{192,64},{176,64},{160,64}, {128,64}, {96,64}, {64,64}, {32,64},{16,64},{0,64},
{0,0},{15,0},{30,0},{45,0},{60,0},{75,0},{90,0},{105,0},{119,0},{134,0},{149,0},{164,0},{179,0},{194,0},{209,0},{224,0},
{224,64},{209,64},{194,64},{179,64},{164,64},{149,64},{134,64},{119,64},{105,64},{90,64},{75,64},{60,64},{45,64},{30,64},{15,64},{0,64}
},
{
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2
}
};



void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
jiaxin96 marked this conversation as resolved.
Show resolved Hide resolved
drashna marked this conversation as resolved.
Show resolved Hide resolved
if (rgb_matrix_is_enabled()) {
if (kb_config.underground_rgb_sw == 1) {
for (uint8_t i = led_min; i < led_max; ++i) {
if ((g_led_config.flags[i] == 4)) {
rgb_matrix_set_color(i, 0, 0, 0);
}
}
} else if (kb_config.underground_rgb_sw == 2) {
for (uint8_t i = led_min; i < led_max; ++i) {
if ((g_led_config.flags[i] == 2)) {
rgb_matrix_set_color(i, 0, 0, 0);
}
}
}
} else {
rgb_matrix_set_color_all(0, 0, 0);
}
rgb_matrix_indicators_advanced_user(led_min, led_max);
}
jiaxin96 marked this conversation as resolved.
Show resolved Hide resolved

void eeconfig_init_kb(void) {
kb_config.raw = 0;
eeconfig_update_kb(kb_config.raw);
eeconfig_init_user();
}

void keyboard_post_init_kb(void) {
kb_config.underground_rgb_sw = eeconfig_read_kb();
rgb_matrix_reload_from_eeprom();
keyboard_post_init_user();
}

#endif


bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
#ifdef RGB_MATRIX_ENABLE
case RGB_KG_T:
if (rgb_matrix_config.enable && record->event.pressed) {
kb_config.underground_rgb_sw += 1;
kb_config.underground_rgb_sw %= 3;
eeconfig_update_kb(kb_config.raw);
}
return false;
#endif
case KC_LG:
if (record->event.pressed) {
process_magic(GUI_TOG, record);
}
return false;
case KC_MACOS:
if (record->event.pressed) {
process_magic(CG_TOGG, record);
}
return false;
case KC_MCTL:
if (record->event.pressed) {
host_consumer_send(0x29F);
} else {
host_consumer_send(0);
}
return false;
case KC_LPAD:
if (record->event.pressed) {
host_consumer_send(0x2A0);
} else {
host_consumer_send(0);
}
return false;
default:
return true;
}
return true;
}
74 changes: 74 additions & 0 deletions keyboards/yandrstudio/bl75/bl75.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* Copyright 2022 JasonRen(biu)
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"

#define LAYOUT( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \
K400, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414, \
K500, K501, K502, K506, K510, K511, K512, K513, K514 \
)\
{ \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \
{ K400, KC_NO, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 }, \
{ K500, K501, K502, KC_NO, KC_NO, KC_NO, K506, KC_NO, KC_NO, KC_NO, K510, K511, K512, K513, K514 } \
}

enum keyboard_keycodes {
#ifdef VIA_ENABLE
LOCK_GUI = USER00,
#ifdef RGB_MATRIX_ENABLE
KC_KEY_UNDER_RGBSW,
#endif
TOG_MACOS_KEYMAP,
KC_MISSION_CONTROL,
KC_LAUNCHPAD,
NEW_SAFE_RANGE = SAFE_RANGE // Important!
#else
LOCK_GUI = SAFE_RANGE,
#ifdef RGB_MATRIX_ENABLE
KC_KEY_UNDER_RGBSW,
#endif
TOG_MACOS_KEYMAP,
KC_MISSION_CONTROL,
KC_LAUNCHPAD,
NEW_SAFE_RANGE // Important!
#endif
};
jiaxin96 marked this conversation as resolved.
Show resolved Hide resolved

#define KC_LG LOCK_GUI
#define KC_MACOS TOG_MACOS_KEYMAP
#define KC_MCTL KC_MISSION_CONTROL
#define KC_LPAD KC_LAUNCHPAD

#ifdef RGB_MATRIX_ENABLE

# define RGB_KG_T KC_KEY_UNDER_RGBSW

/* global */
typedef union {
uint32_t raw;
uint8_t underground_rgb_sw : 8;
} kb_config_t;
kb_config_t kb_config;

#endif
21 changes: 21 additions & 0 deletions keyboards/yandrstudio/bl75/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2022 JasonRen(biu)
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once

#include_next "board.h"

#undef STM32_HSECLK
#define STM32_HSECLK 16000000
89 changes: 89 additions & 0 deletions keyboards/yandrstudio/bl75/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* Copyright 2022 JasonRen(biu)
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"

#ifdef ENCODER_ENABLE
# define ENCODERS_PAD_A { B12 }
# define ENCODERS_PAD_B { B13 }
#endif

/* RGB Matrix */
#ifdef RGB_MATRIX_ENABLE

# define RGB_DI_PIN A7
# define RGBLED_NUM 116
# define DRIVER_LED_TOTAL RGBLED_NUM

# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
# define RGBLIGHT_VAL_STEP 5
# define RGB_DISABLE_WHEN_USB_SUSPENDED
# define RGB_MATRIX_CENTER { 112, 32 }
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS

# define ENABLE_RGB_MATRIX_ALPHAS_MODS
# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
# define ENABLE_RGB_MATRIX_BREATHING
# define ENABLE_RGB_MATRIX_BAND_SAT
# define ENABLE_RGB_MATRIX_BAND_VAL
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
# define ENABLE_RGB_MATRIX_CYCLE_ALL
# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
# define ENABLE_RGB_MATRIX_DUAL_BEACON
# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# define ENABLE_RGB_MATRIX_RAINDROPS
# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
# define ENABLE_RGB_MATRIX_HUE_BREATHING
# define ENABLE_RGB_MATRIX_HUE_PENDULUM
# define ENABLE_RGB_MATRIX_HUE_WAVE
# define ENABLE_RGB_MATRIX_PIXEL_RAIN
# define ENABLE_RGB_MATRIX_PIXEL_FLOW
# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
# define ENABLE_RGB_MATRIX_SPLASH
# define ENABLE_RGB_MATRIX_MULTISPLASH
# define ENABLE_RGB_MATRIX_SOLID_SPLASH
# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH

# define WS2812_PWM_DRIVER PWMD3 // default: PWMD2
# define WS2812_PWM_CHANNEL 2 // default: 2
# define WS2812_DMA_STREAM STM32_DMA1_STREAM3 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
# define WS2812_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.

#endif
21 changes: 21 additions & 0 deletions keyboards/yandrstudio/bl75/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2022 JasonRen(biu)
*
* 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 <http://www.gnu.org/licenses/>.
*/

#pragma once
#include_next <halconf.h>

#undef HAL_USE_PWM
#define HAL_USE_PWM TRUE
Loading