Move code to info.json,and removed redundant features

This commit is contained in:
jonylee1986 2023-05-24 10:05:45 +08:00
parent 48664ebc05
commit 4a87c853cb
8 changed files with 168 additions and 497 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,21 +19,13 @@
/* Use 6 dynamic keymap layers */ /* Use 6 dynamic keymap layers */
#define DYNAMIC_KEYMAP_LAYER_COUNT 6 #define DYNAMIC_KEYMAP_LAYER_COUNT 6
/* Force NKRO on boot up regardless of the setting saved in the EEPROM (uncomment to enable it) */
#define FORCE_NKRO
/* LED Indicators */ /* LED Indicators */
#define LED_NUM_LOCK_PIN A15
#define LED_CAPS_LOCK_PIN C10
// #define LED_SCROLL_LOCK_PIN C11
#define LED_WIN_LOCK_PIN C11 #define LED_WIN_LOCK_PIN C11
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
/* sets the number of milliseconds to pause after sending a wakeup packet. Disabled by default, you might want to set this to 200 (or higher) if the keyboard does not wake up properly after suspending.*/
#define USB_SUSPEND_WAKEUP_DELAY 400
/* SPI Config for spi flash*/ /* SPI Config for spi flash*/
#define SPI_DRIVER SPIDQ #define SPI_DRIVER SPIDQ
@ -49,7 +41,6 @@
#define DRIVER_COUNT 2 #define DRIVER_COUNT 2
#define DRIVER_ADDR_1 0b1110100 #define DRIVER_ADDR_1 0b1110100
#define DRIVER_ADDR_2 0b1110111 #define DRIVER_ADDR_2 0b1110111
#define I2C1_OPMODE OPMODE_I2C #define I2C1_OPMODE OPMODE_I2C
#define I2C1_CLOCK_SPEED 400000 /* 400000 */ #define I2C1_CLOCK_SPEED 400000 /* 400000 */
@ -62,30 +53,3 @@
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_KEYRELEASES #define RGB_MATRIX_KEYRELEASES
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
#define ENABLE_RGB_MATRIX_SOLID_COLOR // Static single hue, no speed support
#define ENABLE_RGB_MATRIX_BREATHING
#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_RAINDROPS
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP
// 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_NEXUS
#define ENABLE_RGB_MATRIX_MULTISPLASH
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 /* The maximum brightness level */
//#define DISABLE_M2_KEYCODES /*if you need to change or restore the default QMK button function, please open it*/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -5,8 +5,12 @@
"usb": { "usb": {
"vid": "0xFFFE", "vid": "0xFFFE",
"pid": "0x0008", "pid": "0x0008",
"device_version": "1.0.4" "device_version": "1.0.4",
"suspend_wakeup_delay": 400,
"force_nkro": true
}, },
"processor": "WB32FQ95",
"bootloader": "wb32-dfu",
"features": { "features": {
"bootmagic": true, "bootmagic": true,
"mousekey": false, "mousekey": false,
@ -14,7 +18,6 @@
"console": false, "console": false,
"command": false, "command": false,
"nkro": true, "nkro": true,
"encoder": false,
"rgb_matrix": true "rgb_matrix": true
}, },
"matrix_pins": { "matrix_pins": {
@ -22,8 +25,139 @@
"rows": ["B15", "C6", "C7", "C8", "C9", "A8"] "rows": ["B15", "C6", "C7", "C8", "C9", "A8"]
}, },
"diode_direction": "ROW2COL", "diode_direction": "ROW2COL",
"processor": "WB32FQ95", "indicators": {
"bootloader": "wb32-dfu", "num_lock": "C10",
"caps_lock": "A15"
},
"rgb_matrix": {
"driver": "IS31FL3733",
"max_brightness": 200,
"val_steps": 20,
"animations": {
"breathing": true,
"cycle_all": true,
"cycle_left_right": true,
"cycle_up_down": true,
"rainbow_moving_chevron": true,
"cycle_out_in": true,
"cycle_out_in_dual": true,
"cycle_pinwheel": true,
"cycle_spiral": true,
"dual_beacon": true,
"rainbow_beacon": true,
"raindrops": true,
"typing_heatmap": true,
"solid_reactive_simple": true,
"solid_reactive": true,
"solid_reactive_cross": true,
"multisplash": true
},
"layout":[
{ "flags": 4, "matrix": [0, 0], "x": 0, "y": 0 },
{ "flags": 4, "matrix": [0, 1], "x": 13, "y": 0 },
{ "flags": 4, "matrix": [0, 2], "x": 26, "y": 0 },
{ "flags": 4, "matrix": [0, 3], "x": 39, "y": 0 },
{ "flags": 4, "matrix": [0, 4], "x": 52, "y": 0 },
{ "flags": 4, "matrix": [0, 5], "x": 65, "y": 0 },
{ "flags": 4, "matrix": [0, 6], "x": 79, "y": 0 },
{ "flags": 4, "matrix": [0, 7], "x": 92, "y": 0 },
{ "flags": 4, "matrix": [0, 8], "x":105, "y": 0 },
{ "flags": 4, "matrix": [0, 9], "x":118, "y": 0 },
{ "flags": 4, "matrix": [0, 10], "x":131, "y": 0 },
{ "flags": 4, "matrix": [0, 11], "x":144, "y": 0 },
{ "flags": 4, "matrix": [0, 12], "x":158, "y": 0 },
{ "flags": 4, "matrix": [0, 13], "x":171, "y": 0 },
{ "flags": 4, "matrix": [0, 17], "x":184, "y": 0 },
{ "flags": 4, "matrix": [0, 18], "x":197, "y": 0 },
{ "flags": 4, "matrix": [0, 19], "x":210, "y": 0 },
{ "flags": 4, "matrix": [0, 20], "x":224, "y": 0 },
{ "flags": 4, "matrix": [0, 0], "x":0, "y": 12},
{ "flags": 4, "matrix": [1, 1], "x":13, "y": 12},
{ "flags": 4, "matrix": [1, 2], "x":26, "y": 12},
{ "flags": 4, "matrix": [1, 3], "x":39, "y": 12},
{ "flags": 4, "matrix": [1, 4], "x":52, "y": 12},
{ "flags": 4, "matrix": [1, 5], "x":65, "y": 12},
{ "flags": 4, "matrix": [1, 6], "x":79, "y": 12},
{ "flags": 4, "matrix": [1, 7], "x":92, "y": 12},
{ "flags": 4, "matrix": [1, 8], "x":105, "y": 12},
{ "flags": 4, "matrix": [1, 9], "x":118, "y": 12},
{ "flags": 4, "matrix": [1, 10], "x":131, "y": 12},
{ "flags": 4, "matrix": [1, 11], "x":144, "y": 12},
{ "flags": 4, "matrix": [1, 12], "x":158, "y": 12},
{ "flags": 4, "matrix": [1, 13], "x":171, "y": 12},
{ "flags": 4, "matrix": [1, 17], "x":184, "y": 12},
{ "flags": 4, "matrix": [1, 18], "x":197, "y": 12},
{ "flags": 4, "matrix": [1, 19], "x":210, "y": 12},
{ "flags": 4, "matrix": [2, 20], "x":224, "y": 12},
{ "flags": 4, "matrix": [2, 0], "x":0, "y": 25},
{ "flags": 4, "matrix": [2, 1], "x":13, "y": 25},
{ "flags": 4, "matrix": [2, 2], "x":26, "y": 25},
{ "flags": 4, "matrix": [2, 3], "x":39, "y": 25},
{ "flags": 4, "matrix": [2, 4], "x":52, "y": 25},
{ "flags": 4, "matrix": [2, 5], "x":65, "y": 25},
{ "flags": 4, "matrix": [2, 6], "x":79, "y": 25},
{ "flags": 4, "matrix": [2, 7], "x":92, "y": 25},
{ "flags": 4, "matrix": [2, 8], "x":105, "y": 25},
{ "flags": 4, "matrix": [2, 9], "x":118, "y": 25},
{ "flags": 4, "matrix": [2, 10], "x":131, "y": 25},
{ "flags": 4, "matrix": [2, 11], "x":144, "y": 25},
{ "flags": 4, "matrix": [2, 12], "x":158, "y": 25},
{ "flags": 4, "matrix": [2, 13], "x":171, "y": 25},
{ "flags": 4, "matrix": [2, 17], "x":184, "y": 25},
{ "flags": 4, "matrix": [2, 18], "x":197, "y": 25},
{ "flags": 4, "matrix": [2, 19], "x":210, "y": 25},
{ "flags": 4, "matrix": [2, 20], "x":224, "y": 25},
{ "flags": 4, "matrix": [3, 0], "x":0, "y": 38},
{ "flags": 4, "matrix": [3, 1], "x":13, "y": 38},
{ "flags": 4, "matrix": [3, 2], "x":26, "y": 38},
{ "flags": 4, "matrix": [3, 3], "x":39, "y": 38},
{ "flags": 4, "matrix": [3, 4], "x":52, "y": 38},
{ "flags": 4, "matrix": [3, 5], "x":65, "y": 38},
{ "flags": 4, "matrix": [3, 6], "x":79, "y": 38},
{ "flags": 4, "matrix": [3, 7], "x":92, "y": 38},
{ "flags": 4, "matrix": [3, 8], "x":105, "y": 38},
{ "flags": 4, "matrix": [3, 9], "x":118, "y": 38},
{ "flags": 4, "matrix": [3, 10], "x":131, "y": 38},
{ "flags": 4, "matrix": [3, 11], "x":144, "y": 38},
{ "flags": 4, "matrix": [3, 13], "x":163, "y": 38},
{ "flags": 4, "matrix": [3, 17], "x":184, "y": 38},
{ "flags": 4, "matrix": [3, 18], "x":197, "y": 38},
{ "flags": 4, "matrix": [3, 19], "x":210, "y": 38},
{ "flags": 4, "matrix": [4, 0], "x":0, "y": 51},
{ "flags": 4, "matrix": [4, 1], "x":26, "y": 51},
{ "flags": 4, "matrix": [4, 2], "x":39, "y": 51},
{ "flags": 4, "matrix": [4, 3], "x":52, "y": 51},
{ "flags": 4, "matrix": [4, 4], "x":65, "y": 51},
{ "flags": 4, "matrix": [4, 5], "x":79, "y": 51},
{ "flags": 4, "matrix": [4, 6], "x":92, "y": 51},
{ "flags": 4, "matrix": [4, 7], "x":105, "y": 51},
{ "flags": 4, "matrix": [4, 8], "x":118, "y": 51},
{ "flags": 4, "matrix": [4, 9], "x":131, "y": 51},
{ "flags": 4, "matrix": [4, 10], "x":144, "y": 51},
{ "flags": 4, "matrix": [4, 13], "x":158, "y": 51},
{ "flags": 4, "matrix": [4, 15], "x":171, "y": 51},
{ "flags": 4, "matrix": [4, 17], "x":184, "y": 51},
{ "flags": 4, "matrix": [4, 18], "x":197, "y": 51},
{ "flags": 4, "matrix": [4, 19], "x":210, "y": 51},
{ "flags": 4, "matrix": [4, 20], "x":224, "y": 51},
{ "flags": 4, "matrix": [5, 0], "x": 0, "y": 64},
{ "flags": 4, "matrix": [5, 1], "x": 18, "y": 64},
{ "flags": 4, "matrix": [5, 2], "x": 37, "y": 64},
{ "flags": 4, "matrix": [5, 5], "x": 92, "y": 64},
{ "flags": 4, "matrix": [5, 9], "x":130, "y": 64},
{ "flags": 4, "matrix": [5, 10], "x":145, "y": 64},
{ "flags": 4, "matrix": [5, 11], "x":158, "y": 64},
{ "flags": 4, "matrix": [5, 15], "x":171, "y": 64},
{ "flags": 4, "matrix": [5, 16], "x":184, "y": 64},
{ "flags": 4, "matrix": [5, 18], "x":197, "y": 64},
{ "flags": 4, "matrix": [5, 19], "x":210, "y": 64}
]
},
"layouts": { "layouts": {
"LAYOUT": { "LAYOUT": {
"layout": [ "layout": [

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -128,131 +128,6 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
{1, J_5, K_5, L_5}, {1, J_5, K_5, L_5},
{1, J_6, K_6, L_6}, {1, J_6, K_6, L_6},
}; };
led_config_t g_led_config = {
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, NO_LED, NO_LED, NO_LED, 14, 15, 16, 17},
{ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, NO_LED, NO_LED, NO_LED, 32, 33, 34, 35},
{ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, NO_LED, NO_LED, NO_LED, 50, 51, 52, 53},
{ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, NO_LED, 66, NO_LED, NO_LED, NO_LED, 67, 68, 69, NO_LED},
{ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, NO_LED, NO_LED, 81, NO_LED, 82, NO_LED, 83, 84, 85, 86},
{ 87, 88, 89, NO_LED, NO_LED, 90, NO_LED, NO_LED, NO_LED, 91, 92, 93, NO_LED, NO_LED, NO_LED, 94, 95,NO_LED, 96, 97, NO_LED}
},
{
{ 0, 0}, // 0
{ 13, 0}, // 1
{ 26, 0}, // 2
{ 39, 0}, // 3
{ 52, 0}, // 4
{ 65, 0}, // 5
{ 79, 0}, // 6
{ 92, 0}, // 7
{105, 0}, // 8
{118, 0}, // 9
{131, 0}, // 10
{144, 0}, // 11
{158, 0}, // 12
{171, 0}, // 13
{184, 0}, // 14
{197, 0}, // 15
{210, 0}, // 16
{224, 0}, // 17
{ 0, 12}, // 18
{ 13, 12}, // 19
{ 26, 12}, // 20
{ 39, 12}, // 21
{ 52, 12}, // 22
{ 65, 12}, // 23
{ 79, 12}, // 24
{ 92, 12}, // 25
{105, 12}, // 26
{118, 12}, // 27
{131, 12}, // 28
{144, 12}, // 29
{158, 12}, // 30
{171, 12}, // 31
{184, 12}, // 32
{197, 12}, // 33
{210, 12}, // 34
{224, 12}, // 35
{ 0, 25}, // 36
{ 13, 25}, // 37
{ 26, 25}, // 38
{ 39, 25}, // 39
{ 52, 25}, // 40
{ 65, 25}, // 41
{ 79, 25}, // 42
{ 92, 25}, // 43
{105, 25}, // 44
{118, 25}, // 45
{131, 25}, // 46
{144, 25}, // 47
{158, 25}, // 48
{171, 25}, // 49
{184, 25}, // 50
{197, 25}, // 51
{210, 25}, // 52
{224, 25}, // 53
{ 0, 38}, // 54
{ 13, 38}, // 55
{ 26, 38}, // 56
{ 39, 38}, // 57
{ 52, 38}, // 58
{ 65, 38}, // 59
{ 79, 38}, // 60
{ 92, 38}, // 61
{105, 38}, // 62
{118, 38}, // 63
{131, 38}, // 64
{144, 38}, // 65
{163, 38}, // 66
{184, 38}, // 67
{197, 38}, // 68
{210, 38}, // 69
{ 0, 51}, // 70
{ 26, 51}, // 71
{ 39, 51}, // 72
{ 52, 51}, // 73
{ 65, 51}, // 74
{ 79, 51}, // 75
{ 92, 51}, // 76
{105, 51}, // 77
{118, 51}, // 78
{131, 51}, // 79
{144, 51}, // 80
{158, 51}, // 81
{171, 51}, // 82
{184, 51}, // 83
{197, 51}, // 84
{210, 51}, // 85
{224, 51}, // 86
{ 0, 64}, // 87
{ 18, 64}, // 88
{ 37, 64}, // 89
{ 92, 64}, // 90
{130, 64}, // 91
{145, 64}, // 92
{158, 64}, // 93
{171, 64}, // 94
{184, 64}, // 95
{197, 64}, // 96
{210, 64}, // 97
},
{
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, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
}
};
#endif //RGB_MATRIX_ENABLE #endif //RGB_MATRIX_ENABLE
enum __layers { enum __layers {
@ -263,66 +138,14 @@ enum __layers {
MAC_WASD, MAC_WASD,
MAC_FN MAC_FN
}; };
enum colors {
WHITE,
RED,
GREEN,
BLUE
};
enum colors led_color_status = WHITE;
static bool fn_make_flag = false;
static bool Lkey_flag = false;
static bool reset_glint_flag = false;
static bool while_test_flag = false;
static bool alarm_flag = false;
static uint16_t current_time = 0;
static uint8_t glint_cnt = 0;
static uint16_t scancode = 0;
static uint8_t alarm_cnt = 0;
static uint8_t RGB_HSV_level;
HSV hsv;
void led_test(uint8_t color);
void clear_eeprom(void);
void rgb_hsv_updata_user(void);
#ifdef RGB_MATRIX_ENABLE
static uint16_t map_current_time = 0;
static bool pwron_flag = false;
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
return false;
}
if(pwron_flag == false){
map_current_time = timer_read();
if(map_current_time<3000){
map_current_time++;
for (uint8_t i = led_min; i < led_max; i++) {
rgb_matrix_set_color(i, 150, 150, 150);
}
}
if(map_current_time >= 3000)
pwron_flag = true;
}
return true;
}
#endif //RGB_MATRIX_ENABLE
void led_init_ports(void){ void led_init_ports(void){
//set our LED pings as output //set our LED pings as output
setPinOutput(LED_NUM_LOCK_PIN); // LED1 Num Lock setPinOutput(LED_NUM_LOCK_PIN); // LED1 Num Lock
writePinHigh(LED_NUM_LOCK_PIN); writePinLow(LED_NUM_LOCK_PIN);
setPinOutput(LED_CAPS_LOCK_PIN); // LDE2 Caps Lock setPinOutput(LED_CAPS_LOCK_PIN); // LDE2 Caps Lock
writePinHigh(LED_CAPS_LOCK_PIN); writePinLow(LED_CAPS_LOCK_PIN);
setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock setPinOutput(LED_WIN_LOCK_PIN); // LED3 Win Lock
writePinHigh(LED_WIN_LOCK_PIN); writePinLow(LED_WIN_LOCK_PIN);
} }
bool led_update_kb(led_t led_state) { bool led_update_kb(led_t led_state) {
@ -342,289 +165,41 @@ bool led_update_kb(led_t led_state) {
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) { if (!process_record_user(keycode, record)) {
return false; return false;
} }
switch (keycode) { switch (keycode) {
#ifndef DISABLE_M2_KEYCODES
case MO(WIN_FN):
case MO(MAC_FN):
fn_make_flag = record->event.pressed;
return true;
case KC_GRV:
if (fn_make_flag && record->event.pressed) {
Lkey_flag = true;
current_time = timer_read();
scancode = KC_GRV;
return false;
} else {
Lkey_flag = 0;
}
return true;
case KC_LCTL:
if (fn_make_flag && record->event.pressed) {
if(while_test_flag)
{
while_test_flag = false;
rgb_matrix_init();
}
else
{
Lkey_flag = true;
current_time = timer_read();
scancode = KC_LCTL;
}
return false;
} else {
Lkey_flag = 0;
}
return true;
case DF(WIN_B): case DF(WIN_B):
if ((fn_make_flag && record->event.pressed)&&(alarm_flag == 0)) { if (record->event.pressed) {
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
layer_state_set(WIN_B);
set_single_persistent_default_layer(WIN_B); set_single_persistent_default_layer(WIN_B);
return false; layer_state_set(1<<WIN_B);
} }
return true; return false;
case DF(MAC_B): case DF(MAC_B):
if ((fn_make_flag && record->event.pressed)&&(alarm_flag == 0)) { if (record->event.pressed) {
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
keymap_config.no_gui = 0;
eeconfig_update_keymap(keymap_config.raw);
// layer_state_set(MAC_B);
set_single_persistent_default_layer(MAC_B); set_single_persistent_default_layer(MAC_B);
return false; layer_state_set(1<<MAC_B);
} keymap_config.no_gui = 0;
return true; eeconfig_update_keymap(keymap_config.raw);
case TG(WIN_WASD):
if ((fn_make_flag && record->event.pressed)&&(alarm_flag == 0)) {
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
// set_single_persistent_default_layer(WIN_WASD);
return false;
}
return true;
case TG(MAC_WASD):
if ((fn_make_flag && record->event.pressed)&&(alarm_flag == 0)) {
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
// set_single_persistent_default_layer(MAC_WASD);
return false;
}
return true;
case MAGIC_TOGGLE_GUI:
if ((fn_make_flag && record->event.pressed)&&(alarm_flag == 0)) {
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
writePin(LED_WIN_LOCK_PIN, !keymap_config.no_gui);
}
return true;
case RGB_VAI:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_val() / (RGB_MATRIX_MAXIMUM_BRIGHTNESS / 4)) < 4) {
alarm_cnt = 2;
RGB_HSV_level++;
rgb_matrix_config.hsv.v = (uint8_t)(RGB_MATRIX_MAXIMUM_BRIGHTNESS / 4) * RGB_HSV_level;
}
rgb_hsv_updata_user();
} }
return false; return false;
case RGB_VAD: case RGB_TOG:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) { if (record->event.pressed) {
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_val() / (RGB_MATRIX_MAXIMUM_BRIGHTNESS / 4)) > 0) { switch (rgb_matrix_get_flags()) {
alarm_cnt = 2; case LED_FLAG_ALL: {
RGB_HSV_level--; rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_config.hsv.v = (uint8_t)(RGB_MATRIX_MAXIMUM_BRIGHTNESS / 4) * RGB_HSV_level; rgb_matrix_set_color_all(0, 0, 0);
} } break;
rgb_hsv_updata_user(); default: {
} rgb_matrix_set_flags(LED_FLAG_ALL);
return false; } break;
case RGB_SAI:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_sat() / (UINT8_MAX / 4)) < 4) {
alarm_cnt = 2;
RGB_HSV_level++;
rgb_matrix_config.hsv.s = (uint8_t)(UINT8_MAX / 4) * RGB_HSV_level;
}
rgb_hsv_updata_user();
}
return false;
case RGB_SAD:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_sat() / (UINT8_MAX / 4)) > 0) {
alarm_cnt = 2;
RGB_HSV_level--;
rgb_matrix_config.hsv.s = (uint8_t)(UINT8_MAX / 4) * RGB_HSV_level;
}
rgb_hsv_updata_user();
}
return false;
case RGB_HUI:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
alarm_cnt = 2;
RGB_HSV_level = (uint8_t)rgb_matrix_get_hue() / (UINT8_MAX / 6);
RGB_HSV_level++;
RGB_HSV_level %= 7;
rgb_matrix_config.hsv.h = (uint8_t)(UINT8_MAX / 6) * RGB_HSV_level;
rgb_hsv_updata_user();
}
return false;
case RGB_SPI:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_speed() / (UINT8_MAX / 4)) < 4) {
alarm_cnt = 2;
RGB_HSV_level++;
rgb_matrix_set_speed((uint8_t)(UINT8_MAX / 4) * RGB_HSV_level);
} }
} }
return false; if (!rgb_matrix_is_enabled()) {
case RGB_SPD: rgb_matrix_set_flags(LED_FLAG_ALL);
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) { rgb_matrix_enable();
if ((RGB_HSV_level = (uint8_t)rgb_matrix_get_speed() / (UINT8_MAX / 4)) > 0) {
alarm_cnt = 2;
RGB_HSV_level--;
rgb_matrix_set_speed((uint8_t)(UINT8_MAX / 4) * RGB_HSV_level);
}
} }
return false; return false;
#endif//DISABLE_M2_KEYCODES
default: default:
return true; return true;
} }
} }
void housekeeping_task_kb(void) {
if(Lkey_flag){
if(scancode == KC_GRV){
if (timer_elapsed(current_time) >= 3000) {
Lkey_flag = false;
clear_eeprom();
current_time = timer_read();
reset_glint_flag = true;
glint_cnt = 0;
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
rgb_matrix_sethsv_noeeprom(HSV_OFF);
}
}
else if(scancode == KC_LCTL){
if (timer_elapsed(current_time) >= 3000) {
Lkey_flag = false;
clear_eeprom();
while_test_flag = true;
glint_cnt = 0;
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
rgb_matrix_sethsv_noeeprom(HSV_WHITE);
}
}
}
else if(reset_glint_flag){
if ((timer_elapsed(current_time)) >= 300) {
current_time = timer_read();
if (((glint_cnt++) & 0x01 )== 0) {
rgb_matrix_sethsv_noeeprom(HSV_WHITE);
} else {
rgb_matrix_sethsv_noeeprom(HSV_OFF);
}
if (glint_cnt >= 3) {
glint_cnt = 0;
reset_glint_flag = false;
rgb_matrix_init();
}
}
}
else if(while_test_flag){
if ((timer_elapsed(current_time)) >= 1000) {
current_time = timer_read();
if ((glint_cnt%4) == 0) {
rgb_matrix_sethsv_noeeprom(HSV_RED);
} else if ((glint_cnt%4)== 1) {
rgb_matrix_sethsv_noeeprom(HSV_GREEN);
} else if ((glint_cnt%4)== 2) {
rgb_matrix_sethsv_noeeprom(HSV_BLUE);
} else if ((glint_cnt%4)== 3) {
rgb_matrix_sethsv_noeeprom(HSV_WHITE);
}
glint_cnt++;
if(glint_cnt>=30)
{
glint_cnt = 0;
while_test_flag = false;
rgb_matrix_init();
}
}
}
else if(alarm_cnt != 0)
{
alarm_cnt--;
if(alarm_cnt == 0){
alarm_flag = true;
rgb_matrix_toggle_noeeprom();
current_time = timer_read();
}
}
else if(alarm_flag){
if ((timer_elapsed(current_time)) >= 200) {
rgb_matrix_toggle_noeeprom();
alarm_flag = 0;
}
}
}
void led_test(uint8_t color) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
switch (color) {
case WHITE:
rgb_matrix_sethsv_noeeprom(HSV_WHITE);
break;
case RED:
rgb_matrix_sethsv_noeeprom(HSV_RED);
break;
case GREEN:
rgb_matrix_sethsv_noeeprom(HSV_GREEN);
break;
case BLUE:
rgb_matrix_sethsv_noeeprom(HSV_BLUE);
break;
}
}
void clear_eeprom(void) {
layer_state_t default_layer_temp = default_layer_state;
eeconfig_init();
layer_state_set(default_layer_temp);
default_layer_set(default_layer_temp);
keymap_config.no_gui = 0;
eeconfig_update_keymap(keymap_config.raw);
#ifdef VIA_ENABLE
// This resets the layout options
via_set_layout_options(VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT);
// This resets the keymaps in EEPROM to what is in flash.
dynamic_keymap_reset();
// This resets the macros in EEPROM to nothing.
dynamic_keymap_macro_reset();
#endif
rgb_matrix_enable_noeeprom();
}
void rgb_hsv_updata_user(void)
{
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2022 jonylee@hfd /* Copyright (C) 2023 jonylee@hfd
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,6 @@
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable
# #
RGB_MATRIX_DRIVER = IS31FL3733
EEPROM_DRIVER = wear_leveling EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = spi_flash WEAR_LEVELING_DRIVER = spi_flash
#RGB_MATRIX_CUSTOM_USER = yes #Add turnoff LED