Move code to info.json,and removed redundant features

This commit is contained in:
jonylee1986 2023-05-26 11:20:14 +08:00
parent ab391abee9
commit 2664dc0a83
6 changed files with 161 additions and 520 deletions

View File

@ -18,9 +18,6 @@
// clang-format off // clang-format off
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
static uint16_t map_current_time = 0;
static bool pwron_flag = false;
const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to IS31 manual for these locations /* Refer to IS31 manual for these locations
* driver * driver
@ -145,141 +142,6 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
{1, J_11, K_11, L_11}, {1, J_11, K_11, L_11},
}; };
led_config_t g_led_config = {
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, NO_LED, NO_LED},
{ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, NO_LED, 28},
{ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, NO_LED, 43},
{ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, NO_LED, 58},
{ 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 60, NO_LED, 71, 72, 73},
{ 74, 75, 76, NO_LED, NO_LED, 77, NO_LED, NO_LED, NO_LED, 78, 79, 80, NO_LED, 81, 82, 83}
},
{
{ 0, 0}, // 0
{ 14, 0}, // 1
{ 29, 0}, // 2
{ 44, 0}, // 3
{ 59, 0}, // 4
{ 74, 0}, // 5
{ 89, 0}, // 6
{104, 0}, // 7
{119, 0}, // 8
{134, 0}, // 9
{149, 0}, // 10
{164, 0}, // 11
{179, 0}, // 12
{194, 0}, // 13
{ 0, 12}, // 14
{ 14, 12}, // 15
{ 28, 12}, // 16
{ 42, 12}, // 17
{ 56, 12}, // 18
{ 70, 12}, // 19
{ 84, 12}, // 20
{ 98, 12}, // 21
{112, 12}, // 22
{126, 12}, // 23
{140, 12}, // 24
{154, 12}, // 25
{168, 12}, // 26
{182, 12}, // 27
{224, 12}, // 28
{ 0, 25}, // 29
{ 14, 25}, // 30
{ 28, 25}, // 31
{ 42, 25}, // 32
{ 56, 25}, // 33
{ 70, 25}, // 34
{ 84, 25}, // 35
{ 98, 25}, // 36
{112, 25}, // 37
{126, 25}, // 38
{140, 25}, // 39
{154, 25}, // 40
{168, 25}, // 41
{182, 25}, // 42
{224, 25}, // 43
{ 0, 38}, // 29
{ 14, 38}, // 30
{ 28, 38}, // 31
{ 42, 38}, // 32
{ 56, 38}, // 33
{ 70, 38}, // 34
{ 84, 38}, // 35
{ 98, 38}, // 36
{112, 38}, // 37
{126, 38}, // 38
{140, 38}, // 39
{154, 38}, // 40
{168, 38}, // 41
{182, 38}, // 42
{224, 38}, // 43
{ 0, 51}, // 29
{ 14, 51}, // 30
{ 28, 51}, // 31
{ 42, 51}, // 32
{ 56, 51}, // 33
{ 70, 51}, // 34
{ 84, 51}, // 35
{ 98, 51}, // 36
{112, 51}, // 37
{126, 51}, // 38
{140, 51}, // 39
{154, 51}, // 40
{168, 51}, // 41
{194, 51}, // 70
{224, 51}, // 71
{ 0, 64}, // 72
{ 14, 64}, // 73
{ 28, 64}, // 74
{ 84, 64}, // 75
{140, 64}, // 76
{154, 64}, // 77
{168, 64}, // 78
{182, 64}, // 80
{194, 64}, // 81
{224, 64}, // 82
{0, 0}, // 68 LED 1
{0, 6}, // 69 LED 2
{0, 13}, // 70 LED 3
{0, 19}, // 71 LED 4
{0, 25}, // 72 LED 5
{0, 32}, // 73 LED 6
{0, 38}, // 74 LED 7
{0, 45}, // 75 LED 8
{0, 51}, // 73 LED 9
{0, 57}, // 74 LED 10
{0, 64}, // 75 LED 11
{224, 0 }, // 78 LED 12
{224, 6 }, // 79 LED 13
{224, 13}, // 80 LED 14
{224, 19}, // 81 LED 15
{224, 25}, // 82 LED 16
{224, 32}, // 83 LED 17
{224, 38}, // 84 LED 18
{224, 45}, // 82 LED 19
{224, 51}, // 83 LED 20
{224, 57}, // 84 LED 21
{224, 64} // 85 LED 22
},
{
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
}
};
#endif #endif
enum __layers { enum __layers {
@ -290,34 +152,8 @@ enum __layers {
MAC_W, MAC_W,
MAC_FN MAC_FN
}; };
enum colors {
WHITE,
RED,
GREEN,
BLUE
};
enum colors led_color_status = WHITE;
// clang-format on // clang-format on
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;
#ifndef DISABLE_M1_KEYCODES
static uint8_t RGB_HSV_level;
static bool fn_make_flag = false;
#endif
HSV hsv;
void led_test(uint8_t color);
void clear_eeprom(void);
void led_init_ports(void) { void led_init_ports(void) {
// set our LED pings as output // set our LED pings as output
setPinOutput(LED_CAPS_LOCK_PIN); // LED1 Num Lock setPinOutput(LED_CAPS_LOCK_PIN); // LED1 Num Lock
@ -371,70 +207,14 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true; return true;
} }
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;
}
keyboard_post_init_user();
if (pwron_flag == false) {
map_current_time = timer_read();
if (map_current_time < 3000) {
map_current_time++;
rgb_matrix_set_color_all(150, 150, 150);
}
if (map_current_time >= 3000) {
pwron_flag = true;
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_set_color_all(0, 0, 0);
} else {
rgb_matrix_set_flags(LED_FLAG_ALL);
}
}
}
return true;
}
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_5075_KEYCODES #ifndef DISABLE_5075_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 TG(WIN_W): case TG(WIN_W):
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();
if (layer_state_cmp(default_layer_state, WIN_W)) { if (layer_state_cmp(default_layer_state, WIN_W)) {
set_single_persistent_default_layer(WIN_B); set_single_persistent_default_layer(WIN_B);
layer_off(WIN_W); layer_off(WIN_W);
@ -445,10 +225,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
} }
return false; return false;
case TG(MAC_W): case TG(MAC_W):
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();
if (layer_state_cmp(default_layer_state, MAC_W)) { if (layer_state_cmp(default_layer_state, MAC_W)) {
set_single_persistent_default_layer(MAC_B); set_single_persistent_default_layer(MAC_B);
layer_off(MAC_W); layer_off(MAC_W);
@ -459,79 +236,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
} }
return false; return false;
case GU_TOGG: case GU_TOGG:
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();
writePin(LED_WIN_LOCK_PIN, !keymap_config.no_gui); writePin(LED_WIN_LOCK_PIN, !keymap_config.no_gui);
} }
return true; return true;
case RGB_HUI:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
RGB_HSV_level = ((uint8_t)rgb_matrix_get_hue() / (UINT8_MAX / 6) + 1) % 7;
rgb_matrix_config.hsv.h = (uint8_t)(UINT8_MAX / 6) * RGB_HSV_level;
}
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
return false;
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_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
return false;
case RGB_VAD:
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)) > 0) {
alarm_cnt = 2;
RGB_HSV_level--;
rgb_matrix_config.hsv.v = (uint8_t)(RGB_MATRIX_MAXIMUM_BRIGHTNESS / 4) * RGB_HSV_level;
}
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
return false;
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) {
RGB_HSV_level++;
rgb_matrix_config.hsv.s = (uint8_t)(UINT8_MAX / 4) * RGB_HSV_level;
alarm_cnt = 2;
}
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
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) {
RGB_HSV_level--;
rgb_matrix_config.hsv.s = (uint8_t)(UINT8_MAX / 4) * RGB_HSV_level;
alarm_cnt = 2;
}
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
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;
case RGB_SPD:
if ((fn_make_flag && record->event.pressed) && (alarm_flag == 0)) {
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;
case RGB_TOG: case RGB_TOG:
if (record->event.pressed) { if (record->event.pressed) {
switch (rgb_matrix_get_flags()) { switch (rgb_matrix_get_flags()) {
@ -553,123 +261,3 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
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)) >= 50) {
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) {
if (default_layer_state & ((1<<MAC_B)|(1<<MAC_W))) {
set_single_persistent_default_layer(MAC_B);
// layer_state_set(1<<MAC_B);
} else {
set_single_persistent_default_layer(WIN_B);
// layer_state_set(1<<WIN_B);
}
layer_off(WIN_W);
layer_off(MAC_W);
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();
}

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,19 +19,14 @@
/* Use 5 dynamic keymap layers */ /* Use 5 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
/*encoder resolution */ /*encoder resolution */
#define ENCODER_RESOLUTION 3 #define ENCODER_DEFAULT_POS 0x3
//#define ENCODER_MAP_KEY_DELAY 20
/* DIP switch */ /* DIP switch */
#define DIP_SWITCH_PINS { A9 } #define DIP_SWITCH_PINS { A9 }
/* LED Indicators */ /* LED Indicators */
#define LED_CAPS_LOCK_PIN A15 // #define LED_CAPS_LOCK_PIN A15
// #define LED_NUM_LOCK_PIN C10 // #define LED_NUM_LOCK_PIN C10
// #define LED_SCROLL_LOCK_PIN C11 // #define LED_SCROLL_LOCK_PIN C11
#define LED_MAC_OS_PIN C10 #define LED_MAC_OS_PIN C10
@ -65,38 +60,10 @@
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL+22) #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL+22)
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended #define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_CENTER {112,32}
#define RGB_TRIGGER_ON_KEYDOWN #define RGB_TRIGGER_ON_KEYDOWN
#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
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
#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_CROSS
#define ENABLE_RGB_MATRIX_MULTISPLASH
#define RGB_MATRIX_VAL_STEP 10
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 180 /* The maximum brightness level */
// #define DISABLE_5075_KEYCODES /*If you need to change or restore the default QMK button function, please open it*/ // #define DISABLE_5075_KEYCODES /*If you need to change or restore the default QMK button function, please open it*/

View File

@ -6,7 +6,9 @@
"usb": { "usb": {
"vid": "0xFFFE", "vid": "0xFFFE",
"pid": "0x000B", "pid": "0x000B",
"device_version": "1.0.3" "device_version": "1.0.3",
"force_nkro": true,
"suspend_wakeup_delay": 400
}, },
"processor": "WB32FQ95", "processor": "WB32FQ95",
"bootloader": "wb32-dfu", "bootloader": "wb32-dfu",
@ -31,6 +33,147 @@
{ "pin_a": "B14", "pin_b": "B13" } { "pin_a": "B14", "pin_b": "B13" }
] ]
}, },
"indicators": {
"caps_lock": "A15"
},
"rgb_matrix": {
"driver": "IS31FL3733",
"max_brightness": 180,
"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": 14, "y": 0 },
{ "flags": 4, "matrix": [0, 2], "x": 29, "y": 0 },
{ "flags": 4, "matrix": [0, 3], "x": 44, "y": 0 },
{ "flags": 4, "matrix": [0, 4], "x": 59, "y": 0 },
{ "flags": 4, "matrix": [0, 5], "x": 74, "y": 0 },
{ "flags": 4, "matrix": [0, 6], "x": 89, "y": 0 },
{ "flags": 4, "matrix": [0, 7], "x":104, "y": 0 },
{ "flags": 4, "matrix": [0, 8], "x":119, "y": 0 },
{ "flags": 4, "matrix": [0, 9], "x":134, "y": 0 },
{ "flags": 4, "matrix": [0, 10], "x":149, "y": 0 },
{ "flags": 4, "matrix": [0, 11], "x":164, "y": 0 },
{ "flags": 4, "matrix": [0, 12], "x":179, "y": 0 },
{ "flags": 4, "matrix": [0, 13], "x":196, "y": 0 },
{ "flags": 4, "matrix": [1, 0], "x": 0, "y": 12},
{ "flags": 4, "matrix": [1, 1], "x": 14, "y": 12},
{ "flags": 4, "matrix": [1, 2], "x": 28, "y": 12},
{ "flags": 4, "matrix": [1, 3], "x": 42, "y": 12},
{ "flags": 4, "matrix": [1, 4], "x": 56, "y": 12},
{ "flags": 4, "matrix": [1, 5], "x": 70, "y": 12},
{ "flags": 4, "matrix": [1, 6], "x": 84, "y": 12},
{ "flags": 4, "matrix": [1, 7], "x": 98, "y": 12},
{ "flags": 4, "matrix": [1, 8], "x":112, "y": 12},
{ "flags": 4, "matrix": [1, 9], "x":126, "y": 12},
{ "flags": 4, "matrix": [1, 10], "x":140, "y": 12},
{ "flags": 4, "matrix": [1, 11], "x":154, "y": 12},
{ "flags": 4, "matrix": [1, 12], "x":168, "y": 12},
{ "flags": 4, "matrix": [1, 13], "x":182, "y": 12},
{ "flags": 4, "matrix": [1, 15], "x":224, "y": 12},
{ "flags": 4, "matrix": [2, 0], "x": 0, "y": 25},
{ "flags": 4, "matrix": [2, 1], "x": 14, "y": 25},
{ "flags": 4, "matrix": [2, 2], "x": 28, "y": 25},
{ "flags": 4, "matrix": [2, 3], "x": 42, "y": 25},
{ "flags": 4, "matrix": [2, 4], "x": 56, "y": 25},
{ "flags": 4, "matrix": [2, 5], "x": 70, "y": 25},
{ "flags": 4, "matrix": [2, 6], "x": 84, "y": 25},
{ "flags": 4, "matrix": [2, 7], "x": 98, "y": 25},
{ "flags": 4, "matrix": [2, 8], "x":112, "y": 25},
{ "flags": 4, "matrix": [2, 9], "x":126, "y": 25},
{ "flags": 4, "matrix": [2, 10], "x":140, "y": 25},
{ "flags": 4, "matrix": [2, 11], "x":154, "y": 25},
{ "flags": 4, "matrix": [2, 12], "x":168, "y": 25},
{ "flags": 4, "matrix": [2, 13], "x":182, "y": 25},
{ "flags": 4, "matrix": [2, 15], "x":224, "y": 25},
{ "flags": 4, "matrix": [3, 0], "x": 0, "y": 38},
{ "flags": 4, "matrix": [3, 1], "x": 28, "y": 38},
{ "flags": 4, "matrix": [3, 2], "x": 42, "y": 38},
{ "flags": 4, "matrix": [3, 3], "x": 56, "y": 38},
{ "flags": 4, "matrix": [3, 4], "x": 70, "y": 38},
{ "flags": 4, "matrix": [3, 5], "x": 84, "y": 38},
{ "flags": 4, "matrix": [3, 6], "x": 98, "y": 38},
{ "flags": 4, "matrix": [3, 7], "x":112, "y": 38},
{ "flags": 4, "matrix": [3, 8], "x":126, "y": 38},
{ "flags": 4, "matrix": [3, 9], "x":140, "y": 38},
{ "flags": 4, "matrix": [3, 10], "x":154, "y": 38},
{ "flags": 4, "matrix": [3, 11], "x":168, "y": 38},
{ "flags": 4, "matrix": [3, 12], "x":182, "y": 38},
{ "flags": 4, "matrix": [3, 13], "x":196, "y": 38},
{ "flags": 4, "matrix": [3, 15], "x":224, "y": 38},
{ "flags": 4, "matrix": [4, 0], "x": 0, "y": 51},
{ "flags": 4, "matrix": [4, 11], "x": 18, "y": 51},
{ "flags": 4, "matrix": [4, 1], "x": 32, "y": 51},
{ "flags": 4, "matrix": [4, 2], "x": 46, "y": 51},
{ "flags": 4, "matrix": [4, 3], "x": 61, "y": 51},
{ "flags": 4, "matrix": [4, 4], "x": 75, "y": 51},
{ "flags": 4, "matrix": [4, 5], "x": 90, "y": 51},
{ "flags": 4, "matrix": [4, 6], "x":104, "y": 51},
{ "flags": 4, "matrix": [4, 7], "x":129, "y": 51},
{ "flags": 4, "matrix": [4, 8], "x":143, "y": 51},
{ "flags": 4, "matrix": [4, 9], "x":157, "y": 51},
{ "flags": 4, "matrix": [4, 10], "x":172, "y": 51},
{ "flags": 4, "matrix": [4, 13], "x":186, "y": 51},
{ "flags": 4, "matrix": [4, 14], "x":205, "y": 51},
{ "flags": 4, "matrix": [4, 15], "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": 90, "y": 64},
{ "flags": 4, "matrix": [5, 9], "x":144, "y": 64},
{ "flags": 4, "matrix": [5, 10], "x":158, "y": 64},
{ "flags": 4, "matrix": [5, 11], "x":173, "y": 64},
{ "flags": 4, "matrix": [5, 13], "x":191, "y": 64},
{ "flags": 4, "matrix": [5, 14], "x":205, "y": 64},
{ "flags": 4, "matrix": [5, 15], "x":220, "y": 64},
{ "flags": 2, "x":0, "y":0},
{ "flags": 2, "x":0, "y":6},
{ "flags": 2, "x":0, "y":13},
{ "flags": 2, "x":0, "y":19},
{ "flags": 2, "x":0, "y":25},
{ "flags": 2, "x":0, "y":32},
{ "flags": 2, "x":0, "y":38},
{ "flags": 2, "x":0, "y":45},
{ "flags": 2, "x":0, "y":51},
{ "flags": 2, "x":0, "y":57},
{ "flags": 2, "x":0, "y":64},
{ "flags": 2, "x":224, "y":0},
{ "flags": 2, "x":224, "y":6},
{ "flags": 2, "x":224, "y":13},
{ "flags": 2, "x":224, "y":19},
{ "flags": 2, "x":224, "y":25},
{ "flags": 2, "x":224, "y":32},
{ "flags": 2, "x":224, "y":38},
{ "flags": 2, "x":224, "y":45},
{ "flags": 2, "x":224, "y":51},
{ "flags": 2, "x":224, "y":57},
{ "flags": 2, "x":224, "y":64}
]
},
"layouts": { "layouts": {
"LAYOUT": { "LAYOUT": {
"layout": [ "layout": [
@ -49,6 +192,7 @@
{ "label": "F12", "matrix": [0, 12], "x": 12.75, "y": 0 }, { "label": "F12", "matrix": [0, 12], "x": 12.75, "y": 0 },
{ "label": "Del", "matrix": [0, 13], "x": 14, "y": 0 }, { "label": "Del", "matrix": [0, 13], "x": 14, "y": 0 },
{ "label": "Mute", "matrix": [0, 15], "x": 15.5, "y": 0 }, { "label": "Mute", "matrix": [0, 15], "x": 15.5, "y": 0 },
{ "label": "~", "matrix": [1, 0], "x": 0, "y": 1.25 }, { "label": "~", "matrix": [1, 0], "x": 0, "y": 1.25 },
{ "label": "!", "matrix": [1, 1], "x": 1, "y": 1.25 }, { "label": "!", "matrix": [1, 1], "x": 1, "y": 1.25 },
{ "label": "@", "matrix": [1, 2], "x": 2, "y": 1.25 }, { "label": "@", "matrix": [1, 2], "x": 2, "y": 1.25 },
@ -64,6 +208,7 @@
{ "label": "+", "matrix": [1, 12], "x": 12, "y": 1.25 }, { "label": "+", "matrix": [1, 12], "x": 12, "y": 1.25 },
{ "label": "Bksp", "matrix": [1, 13], "w": 2, "x": 13, "y": 1.25 }, { "label": "Bksp", "matrix": [1, 13], "w": 2, "x": 13, "y": 1.25 },
{ "label": "Home", "matrix": [1, 15], "x": 15.5, "y": 1.25 }, { "label": "Home", "matrix": [1, 15], "x": 15.5, "y": 1.25 },
{ "label": "Tab", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.25 }, { "label": "Tab", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.25 },
{ "label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25 }, { "label": "Q", "matrix": [2, 1], "x": 1.5, "y": 2.25 },
{ "label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25 }, { "label": "W", "matrix": [2, 2], "x": 2.5, "y": 2.25 },
@ -79,6 +224,7 @@
{ "label": "}", "matrix": [2, 12], "x": 12.5, "y": 2.25 }, { "label": "}", "matrix": [2, 12], "x": 12.5, "y": 2.25 },
{ "label": "|", "matrix": [2, 13], "w": 1.5, "x": 13.5, "y": 2.25 }, { "label": "|", "matrix": [2, 13], "w": 1.5, "x": 13.5, "y": 2.25 },
{ "label": "PageUp", "matrix": [2, 15], "x": 15.5, "y": 2.25 }, { "label": "PageUp", "matrix": [2, 15], "x": 15.5, "y": 2.25 },
{ "label": "Caps Lock", "matrix": [3, 0], "w": 1.75, "x": 0, "y": 3.25 }, { "label": "Caps Lock", "matrix": [3, 0], "w": 1.75, "x": 0, "y": 3.25 },
{ "label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25 }, { "label": "A", "matrix": [3, 1], "x": 1.75, "y": 3.25 },
{ "label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25 }, { "label": "S", "matrix": [3, 2], "x": 2.75, "y": 3.25 },
@ -94,6 +240,7 @@
{ "label": ":", "matrix": [3, 12], "x": 12.75, "y": 3.25 }, { "label": ":", "matrix": [3, 12], "x": 12.75, "y": 3.25 },
{ "label": "Enter", "matrix": [3, 13], "w": 1.25, "x": 13.75, "y": 3.25 }, { "label": "Enter", "matrix": [3, 13], "w": 1.25, "x": 13.75, "y": 3.25 },
{ "label": "PageDn", "matrix": [3, 15], "x": 15.5, "y": 3.25 }, { "label": "PageDn", "matrix": [3, 15], "x": 15.5, "y": 3.25 },
{ "label": "Shift", "matrix": [4, 0], "w": 1.25, "x": 0, "y": 4.25 }, { "label": "Shift", "matrix": [4, 0], "w": 1.25, "x": 0, "y": 4.25 },
{ "label": ":", "matrix": [4, 11], "x": 1.25, "y": 4.25 }, { "label": ":", "matrix": [4, 11], "x": 1.25, "y": 4.25 },
{ "label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25 }, { "label": "Z", "matrix": [4, 1], "x": 2.25, "y": 4.25 },
@ -109,6 +256,7 @@
{ "label": "Shift", "matrix": [4, 13], "w": 1.75, "x": 12.25, "y": 4.25 }, { "label": "Shift", "matrix": [4, 13], "w": 1.75, "x": 12.25, "y": 4.25 },
{ "label": "Up", "matrix": [4, 14], "x": 14.25, "y": 4.25 }, { "label": "Up", "matrix": [4, 14], "x": 14.25, "y": 4.25 },
{ "label": "End", "matrix": [4, 15], "x": 15.5, "y": 4.25 }, { "label": "End", "matrix": [4, 15], "x": 15.5, "y": 4.25 },
{ "label": "Ctrl", "matrix": [5, 0], "w": 1.25, "x": 0, "y": 5.25 }, { "label": "Ctrl", "matrix": [5, 0], "w": 1.25, "x": 0, "y": 5.25 },
{ "label": "Win", "matrix": [5, 1], "w": 1.25, "x": 1.25, "y": 5.25 }, { "label": "Win", "matrix": [5, 1], "w": 1.25, "x": 1.25, "y": 5.25 },
{ "label": "Alt", "matrix": [5, 2], "w": 1.25, "x": 2.5, "y": 5.25 }, { "label": "Alt", "matrix": [5, 2], "w": 1.25, "x": 2.5, "y": 5.25 },

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
@ -24,15 +24,9 @@ enum __layers {
MAC_W, MAC_W,
MAC_FN MAC_FN
}; };
enum custom_keycodes {
ENC_VAI = SAFE_RANGE,
ENC_VAD
};
#define KC_TASK LGUI(KC_TAB) #define KC_TASK LGUI(KC_TAB)
#define KC_FLXP LGUI(KC_E) #define KC_FLXP LGUI(KC_E)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[WIN_B] = LAYOUT( /* Base */ [WIN_B] = LAYOUT( /* Base */
@ -89,33 +83,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[WIN_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [WIN_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[WIN_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [WIN_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[WIN_FN] = { ENCODER_CCW_CW(ENC_VAI, ENC_VAD) }, [WIN_FN] = { ENCODER_CCW_CW(RGB_VAI, RGB_VAD) },
[MAC_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [MAC_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[MAC_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [MAC_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[MAC_FN] = { ENCODER_CCW_CW(ENC_VAI, ENC_VAD) } [MAC_FN] = { ENCODER_CCW_CW(RGB_VAI, RGB_VAD) }
}; };
#endif #endif
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case ENC_VAI:
if (record->event.pressed){
if(rgb_matrix_get_val() < RGB_MATRIX_MAXIMUM_BRIGHTNESS){
rgb_matrix_config.hsv.v = rgb_matrix_get_val() + RGB_MATRIX_VAL_STEP;
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
}
return false;
case ENC_VAD:
if (record->event.pressed){
if(rgb_matrix_get_val() > 0){
rgb_matrix_config.hsv.v = rgb_matrix_get_val() - RGB_MATRIX_VAL_STEP;
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
}
return false;
}
return true;
}

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
@ -24,15 +24,9 @@ enum __layers {
MAC_W, MAC_W,
MAC_FN MAC_FN
}; };
enum custom_keycodes {
ENC_VAI = SAFE_RANGE,
ENC_VAD
};
#define KC_TASK LGUI(KC_TAB) #define KC_TASK LGUI(KC_TAB)
#define KC_FLXP LGUI(KC_E) #define KC_FLXP LGUI(KC_E)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[WIN_B] = LAYOUT( /* Base */ [WIN_B] = LAYOUT( /* Base */
@ -89,33 +83,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[WIN_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [WIN_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[WIN_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [WIN_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[WIN_FN] = { ENCODER_CCW_CW(ENC_VAI, ENC_VAD) }, [WIN_FN] = { ENCODER_CCW_CW(RGB_VAI, RGB_VAD) },
[MAC_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [MAC_B] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[MAC_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }, [MAC_W] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[MAC_FN] = { ENCODER_CCW_CW(ENC_VAI, ENC_VAD) } [MAC_FN] = { ENCODER_CCW_CW(RGB_VAI, RGB_VAD) }
}; };
#endif #endif
// clang-format on
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case ENC_VAI:
if (record->event.pressed){
if(rgb_matrix_get_val() < RGB_MATRIX_MAXIMUM_BRIGHTNESS){
rgb_matrix_config.hsv.v = rgb_matrix_get_val() + RGB_MATRIX_VAL_STEP;
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
}
return false;
case ENC_VAD:
if (record->event.pressed){
if(rgb_matrix_get_val() > 0){
rgb_matrix_config.hsv.v = rgb_matrix_get_val() - RGB_MATRIX_VAL_STEP;
rgb_matrix_sethsv(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
}
}
return false;
}
return true;
}

View File

@ -1,9 +1,5 @@
# 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_KB = yes #Add turnoff LED