update skyloong/gk87/q1

This commit is contained in:
NaturalZh 2025-05-07 17:27:33 +08:00
parent 429032b558
commit aec4246a88
3 changed files with 9 additions and 29 deletions

View File

@ -10,7 +10,7 @@
# error hc595: no shift register clock pins defined! # error hc595: no shift register clock pins defined!
#endif #endif
#ifndef LED_HC595_DS #ifndef LED_HC595_DS_PIN
# error hc595: no serial data input pins defined! # error hc595: no serial data input pins defined!
#endif #endif
@ -46,14 +46,14 @@ static inline void clockPulse(uint16_t n) {
void s_serial_to_parallel(uint8_t data) __attribute__((unused)); void s_serial_to_parallel(uint8_t data) __attribute__((unused));
void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function
gpio_set_pin_output_write_low(LED_HC595_DS); gpio_set_pin_output_write_low(LED_HC595_DS_PIN);
gpio_set_pin_output_write_low(LED_HC595_SH_PIN); gpio_set_pin_output_write_low(LED_HC595_SH_PIN);
gpio_set_pin_output_write_low(LED_HC595_ST_PIN); gpio_set_pin_output_write_low(LED_HC595_ST_PIN);
for(uint8_t i = 0; i < 8; i++) { for(uint8_t i = 0; i < 8; i++) {
if(data & 0x01){ if(data & 0x01){
gpio_write_pin_high(LED_HC595_DS); gpio_write_pin_high(LED_HC595_DS_PIN);
}else{ }else{
gpio_write_pin_low(LED_HC595_DS); gpio_write_pin_low(LED_HC595_DS_PIN);
} }
clockPulse(LED_CLOCK_TIME); clockPulse(LED_CLOCK_TIME);
data >>= 1; // Move the data one digit to the right data >>= 1; // Move the data one digit to the right

View File

@ -6,7 +6,7 @@
#define LED_HC595_ST_PIN B5 //74HC595 storage register clock input #define LED_HC595_ST_PIN B5 //74HC595 storage register clock input
#define LED_HC595_SH_PIN B4 //74HC595 shift register clock input #define LED_HC595_SH_PIN B4 //74HC595 shift register clock input
#define LED_HC595_DS B3 // 74HC595 serial data input #define LED_HC595_DS_PIN B3 // 74HC595 serial data input
/* /*
*LED display driver.74HC595 Serial to parallel control LED field on/off. *LED display driver.74HC595 Serial to parallel control LED field on/off.

View File

@ -114,6 +114,9 @@ const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = {
}; };
#endif #endif
static bool is_function_layer_on(void) {
return (layer_state_is(2) || layer_state_is(3));
}
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)) {
@ -139,32 +142,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return true; return true;
# endif # endif
case MO(1):
if (record->event.pressed) {
FN_ON = 1;
} else {
FN_ON = 0;
}
return true;
case MO(2):
if (record->event.pressed) {
FN_ON = 1;
} else {
FN_ON = 0;
}
return true;
case MO(3):
if (record->event.pressed) {
FN_ON = 1;
} else {
FN_ON = 0;
}
return true;
case KC_LGUI: case KC_LGUI:
if (FN_ON){ if (is_function_layer_on()){
if ( record->event.pressed){ if ( record->event.pressed){
WIN_LOCK = !WIN_LOCK ; //change win lock state WIN_LOCK = !WIN_LOCK ; //change win lock state
} }