Update 5075.c

This commit is contained in:
jonylee@hfd 2024-10-22 14:02:16 +08:00 committed by GitHub
parent d519e07df1
commit 72edeeabef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,35 +143,20 @@ const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT] = {
}; };
#endif #endif
enum __layers {
WIN_B,
WIN_W,
WIN_FN,
MAC_B,
MAC_W,
MAC_FN
};
// clang-format on // clang-format on
void led_init_ports(void) { void keyboard_pre_init_kb(void) {
// set our LED pings as output // set our LED pings as output
gpio_set_pin_output(LED_CAPS_LOCK_PIN); // LED1 Num Lock
gpio_write_pin_low(LED_CAPS_LOCK_PIN);
gpio_set_pin_output(LED_MAC_OS_PIN); // LDE2 MAC\WIN gpio_set_pin_output(LED_MAC_OS_PIN); // LDE2 MAC\WIN
gpio_write_pin_low(LED_MAC_OS_PIN); gpio_write_pin_low(LED_MAC_OS_PIN);
gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock gpio_set_pin_output(LED_WIN_LOCK_PIN); // LED3 Win Lock
gpio_write_pin_low(LED_WIN_LOCK_PIN); gpio_write_pin_low(LED_WIN_LOCK_PIN);
housekeeping_task_kb();
} }
void housekeeping_task_kb(void) { void housekeeping_task_kb(void) {
/* Execute every 1ms */ gpio_write_pin(LED_MAC_OS_PIN, ((get_highest_layer(default_layer_state | layer_state) == 2) || (get_highest_layer(default_layer_state | layer_state) == 3)));
static uint32_t last_time = 0; gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
if (timer_elapsed32(last_time) >= 1) {
last_time = timer_read32();
gpio_write_pin(LED_MAC_OS_PIN, default_layer_state & ((1<<MAC_B)|(1<<MAC_W)));
gpio_write_pin(LED_WIN_LOCK_PIN, keymap_config.no_gui);
}
} }
bool dip_switch_update_kb(uint8_t index, bool active) { bool dip_switch_update_kb(uint8_t index, bool active) {
@ -190,31 +175,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
} }
return true; return true;
} }
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
#ifndef DISABLE_CA5075_KEYCODES
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
} break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
} break;
}
}
if (!rgb_matrix_is_enabled()) {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable();
}
return false;
#endif//DISABLE_CA5075_KEYCODES
default:
return true;
}
}