Rename some variables in the code.

This commit is contained in:
nuphy-src 2024-04-01 20:14:28 +08:00
parent 29502d6a40
commit 8d4f887847
5 changed files with 42 additions and 42 deletions

View File

@ -29,7 +29,7 @@ extern uint16_t no_act_time;
extern uint8_t rf_sw_temp;
extern uint16_t rf_sw_press_delay;
extern uint16_t rf_linking_time;
extern user_config_t user_config;
extern kb_config_t kb_config;
extern DEV_INFO_STRUCT dev_info;
@ -197,10 +197,10 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
case SLEEP_MODE:
if (record->event.pressed) {
if(user_config.sleep_enable) user_config.sleep_enable = false;
else user_config.sleep_enable = true;
if(kb_config.sleep_enable) kb_config.sleep_enable = false;
else kb_config.sleep_enable = true;
f_sleep_show = 1;
eeconfig_update_kb_datablock(&user_config);
eeconfig_update_kb_datablock(&kb_config);
}
return false;

View File

@ -78,7 +78,7 @@ const uint8_t side_led_index_tab[SIDE_LINE][2] = {
};
extern DEV_INFO_STRUCT dev_info;
extern user_config_t user_config;
extern kb_config_t kb_config;
extern uint8_t rf_blink_cnt;
extern uint16_t rf_link_show_time;
extern bool f_bat_hold;
@ -123,8 +123,8 @@ void side_light_contol(uint8_t dir) {
} else
side_light--;
}
user_config.ee_side_light = side_light;
eeconfig_update_kb_datablock(&user_config);
kb_config.ee_side_light = side_light;
eeconfig_update_kb_datablock(&kb_config);
}
/**
@ -140,8 +140,8 @@ void side_speed_contol(uint8_t dir) {
} else {
if ((side_speed) < SIDE_SPEED_MAX) side_speed++;
}
user_config.ee_side_speed = side_speed;
eeconfig_update_kb_datablock(&user_config);
kb_config.ee_side_speed = side_speed;
eeconfig_update_kb_datablock(&kb_config);
}
/**
@ -179,9 +179,9 @@ void side_colour_control(uint8_t dir) {
}
}
}
user_config.ee_side_rgb = side_rgb;
user_config.ee_side_colour = side_colour;
eeconfig_update_kb_datablock(&user_config);
kb_config.ee_side_rgb = side_rgb;
kb_config.ee_side_colour = side_colour;
eeconfig_update_kb_datablock(&kb_config);
}
/**
@ -203,8 +203,8 @@ void side_mode_control(uint8_t dir) {
}
}
side_play_point = 0;
user_config.ee_side_mode = side_mode;
eeconfig_update_kb_datablock(&user_config);
kb_config.ee_side_mode = side_mode;
eeconfig_update_kb_datablock(&kb_config);
}
/**
@ -273,7 +273,7 @@ void sleep_sw_led_show(void) {
}
if (sleep_show_flag) {
if (user_config.sleep_enable) {
if (kb_config.sleep_enable) {
r_temp = 0x00;
g_temp = 0x80;
b_temp = 0x00;
@ -762,14 +762,14 @@ void device_reset_init(void) {
rgb_matrix_set_speed(255 - RGB_MATRIX_SPD_STEP * 2);
rgb_matrix_sethsv(255, 255, RGB_MATRIX_MAXIMUM_BRIGHTNESS - RGB_MATRIX_VAL_STEP * 2);
user_config.default_brightness_flag = 0xA5;
user_config.ee_side_mode = side_mode;
user_config.ee_side_light = side_light;
user_config.ee_side_speed = side_speed;
user_config.ee_side_rgb = side_rgb;
user_config.ee_side_colour = side_colour;
user_config.sleep_enable = true;
eeconfig_update_kb_datablock(&user_config);
kb_config.default_brightness_flag = 0xA5;
kb_config.ee_side_mode = side_mode;
kb_config.ee_side_light = side_light;
kb_config.ee_side_speed = side_speed;
kb_config.ee_side_rgb = side_rgb;
kb_config.ee_side_colour = side_colour;
kb_config.sleep_enable = true;
eeconfig_update_kb_datablock(&kb_config);
}
/**

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "hal_usb.h"
#include "usb_main.h"
extern user_config_t user_config;
extern kb_config_t kb_config;
extern DEV_INFO_STRUCT dev_info;
extern uint16_t rf_linking_time;
extern uint16_t no_act_time;
@ -45,7 +45,7 @@ void sleep_handle(void) {
if (f_goto_sleep) {
f_goto_sleep = 0;
if(user_config.sleep_enable) {
if(kb_config.sleep_enable) {
if (dev_info.rf_state == RF_CONNECT)
uart_send_cmd(CMD_SET_CONFIG, 5, 5);
else

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "usb_main.h"
#include "rf_driver.h"
user_config_t user_config;
kb_config_t kb_config;
DEV_INFO_STRUCT dev_info = {
.rf_baterry = 100,
.link_mode = LINK_USB,
@ -397,23 +397,23 @@ void timer_pro(void) {
* @brief londing eeprom data.
*/
void londing_eeprom_data(void) {
eeconfig_read_kb_datablock(&user_config);
if (user_config.default_brightness_flag != 0xA5) {
eeconfig_read_kb_datablock(&kb_config);
if (kb_config.default_brightness_flag != 0xA5) {
/* first power on, set rgb matrix brightness at middle level*/
rgb_matrix_sethsv(255, 255, RGB_MATRIX_MAXIMUM_BRIGHTNESS - RGB_MATRIX_VAL_STEP * 2);
user_config.default_brightness_flag = 0xA5;
user_config.ee_side_mode = side_mode;
user_config.ee_side_light = side_light;
user_config.ee_side_speed = side_speed;
user_config.ee_side_rgb = side_rgb;
user_config.ee_side_colour = side_colour;
user_config.sleep_enable = true;
eeconfig_update_kb_datablock(&user_config);
kb_config.default_brightness_flag = 0xA5;
kb_config.ee_side_mode = side_mode;
kb_config.ee_side_light = side_light;
kb_config.ee_side_speed = side_speed;
kb_config.ee_side_rgb = side_rgb;
kb_config.ee_side_colour = side_colour;
kb_config.sleep_enable = true;
eeconfig_update_kb_datablock(&kb_config);
} else {
side_mode = user_config.ee_side_mode;
side_light = user_config.ee_side_light;
side_speed = user_config.ee_side_speed;
side_rgb = user_config.ee_side_rgb;
side_colour = user_config.ee_side_colour;
side_mode = kb_config.ee_side_mode;
side_light = kb_config.ee_side_light;
side_speed = kb_config.ee_side_speed;
side_rgb = kb_config.ee_side_rgb;
side_colour = kb_config.ee_side_colour;
}
}

View File

@ -139,7 +139,7 @@ typedef struct
uint8_t sleep_enable;
uint8_t retain1;
uint8_t retain2;
} user_config_t;
} kb_config_t;
void dev_sts_sync(void);
void rf_uart_init(void);