update skyloong/gk104/q1

This commit is contained in:
NaturalZh 2024-10-26 16:15:41 +08:00
parent 930e25adf4
commit 302e03710e
5 changed files with 40 additions and 29 deletions

View File

@ -30,7 +30,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_WIN_INDEX] = LAYOUT_all( [_WIN_INDEX] = LAYOUT_all(
_______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, _______, KC_F14, KC_F15, G(KC_TAB), KC_WSCH, G(C(KC_S)), KC_SLEP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG,
_______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, _______, _______, _______, DF(_WIN), DF(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT,
@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAC_INDEX] = LAYOUT_all( [_MAC_INDEX] = LAYOUT_all(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, G(KC_SPC), RCS(KC_SPC), G(RCS(KC_4)), KC_MUTE, RGB_TOG,
_______, _______, _______, _______, _______, _______, TO(_WIN), TO(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, _______, _______, _______, DF(_WIN), DF(_MAC), _______, _______, RGB_TOG, RGB_RMOD, RGB_MOD, KC_DEL, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT,
@ -58,7 +58,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
#if defined(DIP_SWITCH_MAP_ENABLE) #if defined(DIP_SWITCH_MAP_ENABLE)
const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = { const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = {
DIP_SWITCH_OFF_ON(TO(0), TO(1)), DIP_SWITCH_OFF_ON(DF(_WIN), DF(_MAC)),
}; };
#endif #endif

View File

@ -1,2 +1,3 @@
CUSTOM_MATRIX = lite CUSTOM_MATRIX = lite
SRC += matrix.c SRC += matrix.c
SRC += led_hc595.c

View File

@ -1,6 +1,6 @@
// Copyright 2023 NaturalZh (@NaturalZh) // Copyright 2023 NaturalZh (@NaturalZh)
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h" #include "led_hc595.h"
#ifndef HC595_ST_PIN #ifndef HC595_ST_PIN
# error hc595: no storage register clock pins defined! # error hc595: no storage register clock pins defined!
@ -14,25 +14,6 @@
# error hc595: no serial data input pins defined! # error hc595: no serial data input pins defined!
#endif #endif
/*
*LED display driver.74HC595 Serial to parallel control LED field on/off.
* data(default):1-on/0-off (left low bit)
* bit0 --- NUM indicator
* bit1 --- CAPS indicator
* bit2 --- SCR indicator
* bit3 --- WinLock indicator
* bit4 --- Skyloong LOGO display
* bit5 --- Win layer indicator
* bit6 --- MAC layer indicator
*/
#define NUM_ON 0b10000000
#define CAPS_ON 0b01000000
#define SCR_ON 0b00100000
#define WINLK_ON 0b00010000
#define SKYLOONG 0b00001000
#define WIN_ON 0b00000010
#define MAC_ON 0b00000100
#define CLOCK_TIME 15 #define CLOCK_TIME 15
static inline void gpio_set_pin_output_write_low(pin_t pin) { static inline void gpio_set_pin_output_write_low(pin_t pin) {
@ -63,7 +44,8 @@ static inline void clockPulse(uint16_t n) {
gpio_write_pin_low(HC595_ST_PIN); gpio_write_pin_low(HC595_ST_PIN);
} }
static void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function void s_serial_to_parallel(uint8_t data) __attribute__((unused));
void s_serial_to_parallel(uint8_t data) { // Serial port to parallel port function
gpio_set_pin_output_write_low(HC595_DS); gpio_set_pin_output_write_low(HC595_DS);
gpio_set_pin_output_write_low(HC595_SH_PIN); gpio_set_pin_output_write_low(HC595_SH_PIN);
gpio_set_pin_output_write_low(HC595_ST_PIN); gpio_set_pin_output_write_low(HC595_ST_PIN);

View File

@ -0,0 +1,31 @@
// Copyright 2023 NaturalZh (@NaturalZh)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
//#include "quantum.h"
#include "atomic_util.h"
#include "gpio.h"
#define HC595_ST_PIN B1 //74HC595 storage register clock input
#define HC595_SH_PIN B0 //74HC595 shift register clock input
#define HC595_DS B3 // 74HC595 serial data input
/*
*LED display driver.74HC595 Serial to parallel control LED field on/off.
* data(default):1-on/0-off (left low bit)
* bit0 --- NUM indicator
* bit1 --- CAPS indicator
* bit2 --- SCR indicator
* bit3 --- WinLock indicator
* bit4 --- Skyloong LOGO display
* bit5 --- Win layer indicator
* bit6 --- MAC layer indicator
*/
#define NUM_ON 0b10000000
#define CAPS_ON 0b01000000
#define SCR_ON 0b00100000
#define WINLK_ON 0b00010000
#define SKYLOONG 0b00001000
#define WIN_ON 0b00000010
#define MAC_ON 0b00000100
void s_serial_to_parallel(uint8_t data);

View File

@ -1,15 +1,12 @@
// Copyright 2023 NaturalZh (@NaturalZh) // Copyright 2023 NaturalZh (@NaturalZh)
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h" #include "quantum.h"
#include "led_hc595.h"
#define HC595_ST_PIN B1 //74HC595 storage register clock input
#define HC595_SH_PIN B0 //74HC595 shift register clock input
#define HC595_DS B3 // 74HC595 serial data input
#include "led_hc595.c"
uint8_t IND = 0; //buffer of LED Display uint8_t IND = 0; //buffer of LED Display
int FN_ON = 0; int FN_ON = 0;
_Bool WIN_LOCK = 0; bool WIN_LOCK = 0;
#if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/ #if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/
const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = { const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT] = {