diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 094eda6fef64..e7018ce21db1 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -348,7 +348,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) endif LED_MATRIX_ENABLE ?= no -VALID_LED_MATRIX_TYPES := is31fl3731 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 custom +VALID_LED_MATRIX_TYPES := is31fl3731 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 snled27351_spi custom # TODO: is31fl3733 is31fl3737 is31fl3741 ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) @@ -412,11 +412,17 @@ endif QUANTUM_LIB_SRC += i2c_master.c endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), snled27351_spi) + OPT_DEFS += -DSNLED27351_SPI -DSTM32_SPI -DHAL_USE_SPI=TRUE + COMMON_VPATH += $(DRIVER_PATH)/led + SRC += snled27351-simple-spi.c + QUANTUM_LIB_SRC += spi_master.c + endif endif RGB_MATRIX_ENABLE ?= no -VALID_RGB_MATRIX_TYPES := aw20216 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 ws2812 custom +VALID_RGB_MATRIX_TYPES := aw20216 is31fl3731 is31fl3733 is31fl3736 is31fl3737 is31fl3741 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 snled27351_spi ws2812 custom ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),) $(call CATASTROPHIC_ERROR,Invalid RGB_MATRIX_DRIVER,RGB_MATRIX_DRIVER="$(RGB_MATRIX_DRIVER)" is not a valid matrix type) @@ -514,6 +520,13 @@ endif QUANTUM_LIB_SRC += i2c_master.c endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), snled27351_spi) + OPT_DEFS += -DSNLED27351_SPI -DSTM32_SPI -DHAL_USE_SPI=TRUE + COMMON_VPATH += $(DRIVER_PATH)/led + SRC += snled27351-spi.c + QUANTUM_LIB_SRC += spi_master.c + endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), ws2812) OPT_DEFS += -DWS2812 WS2812_DRIVER_REQUIRED := yes diff --git a/drivers/led/snled27351-simple-spi.c b/drivers/led/snled27351-simple-spi.c new file mode 100644 index 000000000000..37097c853990 --- /dev/null +++ b/drivers/led/snled27351-simple-spi.c @@ -0,0 +1,235 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "snled27351-simple-spi.h" +#include "spi_master.h" + +#define SNLED27351_PWM_REGISTER_COUNT 192 +#define SNLED27351_LED_CONTROL_REGISTER_COUNT 24 + + +#ifndef SNLED27351_PHASE_CHANNEL +# define SNLED27351_PHASE_CHANNEL MSKPHASE_12CHANNEL +#endif + +#ifndef SNLED27351_CURRENT_TUNE +# define SNLED27351_CURRENT_TUNE \ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } +#endif + +#define SNLED27351_WRITE (0 << 7) +#define SNLED27351_READ (1 << 7) +#define SNLED27351_PATTERN (2 << 4) + +#ifdef DRIVER_CS_PINS +pin_t cs_pins[] = DRIVER_CS_PINS; +#else +error "no DRIVER_CS_PINS defined" +#endif + +// These buffers match the snled27351 PWM registers. +// The control buffers match the PG0 LED On/Off registers. +// Storing them like this is optimal for I2C transfers to the registers. +// We could optimize this and take out the unused registers from these +// buffers and the transfers in snled27351_write_pwm_buffer() but it's +// probably not worth the extra complexity. +uint8_t g_pwm_buffer[SNLED27351_DRIVER_COUNT][SNLED27351_PWM_REGISTER_COUNT]; +bool g_pwm_buffer_update_required[SNLED27351_DRIVER_COUNT] = {false}; + +uint8_t g_led_control_registers[SNLED27351_DRIVER_COUNT][SNLED27351_LED_CONTROL_REGISTER_COUNT] = {0}; +bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT] = {false}; + + + +bool snled27351_write(uint8_t index, uint8_t page, uint8_t reg, uint8_t *data, uint8_t len) { + static uint8_t spi_transfer_buffer[2] = {0}; + + if (index > ARRAY_SIZE(((pin_t[])DRIVER_CS_PINS)) - 1) return false; + + if (!spi_start(cs_pins[index], false, 0, SNLED23751_SPI_DIVISOR)) { + spi_stop(); + return false; + } + + spi_transfer_buffer[0] = SNLED27351_WRITE | SNLED27351_PATTERN | (page & 0x0F); + spi_transfer_buffer[1] = reg; + + if (spi_transmit(spi_transfer_buffer, 2) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + if (spi_transmit(data, len) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + spi_stop(); + return true; +} + +bool snled27351_write_register(uint8_t index, uint8_t page, uint8_t reg, uint8_t data) { + return snled27351_write(index, page, reg, &data, 1); +} + +bool snled27351_write_pwm_buffer(uint8_t index, uint8_t *pwm_buffer) { + if (g_pwm_buffer_update_required[index]) { + snled27351_write(index, LED_PWM_PAGE, 0, g_pwm_buffer[index], SNLED27351_PWM_REGISTER_COUNT); + } + g_pwm_buffer_update_required[index] = false; + return true; +} + +void snled27351_init_drivers(void) { +#if defined(LED_DRIVER_SHUTDOWN_PIN) + setPinOutput(LED_DRIVER_SHUTDOWN_PIN); + writePinHigh(LED_DRIVER_SHUTDOWN_PIN); +#endif + + spi_init(); + + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_init(i); + + for (int index = 0; index < SNLED27351_LED_COUNT; index++) { + snled27351_set_led_control_register(index, true); + } + + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_update_led_control_registers(i); +} + +void snled27351_init(uint8_t index) { + setPinOutput(cs_pins[index]); + writePinHigh(cs_pins[index]); + // Setting LED driver to shutdown mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); + // Setting internal channel pulldown/pullup + snled27351_write_register(index, FUNCTION_PAGE, PDU_REG, MSKSET_CA_CB_CHANNEL); + // Select number of scan phase + snled27351_write_register(index, FUNCTION_PAGE, SCAN_PHASE_REG, SNLED27351_PHASE_CHANNEL); + // Setting PWM Delay Phase + snled27351_write_register(index, FUNCTION_PAGE, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE); + // Setting Driving/Sinking Channel Slew Rate + snled27351_write_register(index, FUNCTION_PAGE, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE); + // Setting Iref + snled27351_write_register(index, FUNCTION_PAGE, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE); + + // Set LED CONTROL PAGE (Page 0) + uint8_t on_off_reg[LED_CONTROL_ON_OFF_LENGTH] = {0}; + snled27351_write(index, LED_CONTROL_PAGE, 0, on_off_reg, LED_CONTROL_ON_OFF_LENGTH); + + // Set PWM PAGE (Page 1) + uint8_t pwm_reg[LED_PWM_LENGTH]; + memset(pwm_reg, 0, LED_PWM_LENGTH); + snled27351_write(index, LED_PWM_PAGE, 0, pwm_reg, LED_PWM_LENGTH); + + // Set CURRENT PAGE (Page 4) + uint8_t current_tune_reg[LED_CURRENT_TUNE_LENGTH] = SNLED27351_CURRENT_TUNE; + snled27351_write(index, CURRENT_TUNE_PAGE, 0, current_tune_reg, LED_CURRENT_TUNE_LENGTH); + + // // Enable LEDs ON/OFF + // memset(on_off_reg, 0xFF, LED_CONTROL_ON_OFF_LENGTH); + // snled27351_write(index, LED_CONTROL_PAGE, 0, on_off_reg, LED_CONTROL_ON_OFF_LENGTH); + + // Setting LED driver to normal mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_NORMAL_MODE); +} + +void snled27351_set_value(int index, uint8_t value) { + snled27351_led_t led; + if (index >= 0 && index < SNLED27351_LED_COUNT) { + memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); + + g_pwm_buffer[led.driver][led.v] = value; + g_pwm_buffer_update_required[led.driver] = true; + } +} + +void snled27351_set_value_all(uint8_t value) { + for (int i = 0; i < SNLED27351_LED_COUNT; i++) { + snled27351_set_value(i, value); + } +} + +void snled27351_set_led_control_register(uint8_t index, bool value) { + snled27351_led_t led; + memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); + + uint8_t control_register = led.v / 8; + uint8_t bit_value = led.v % 8; + + if (value) { + g_led_control_registers[led.driver][control_register] |= (1 << bit_value); + } else { + g_led_control_registers[led.driver][control_register] &= ~(1 << bit_value); + } + + g_led_control_registers_update_required[led.driver] = true; +} + +void snled27351_update_pwm_buffers(uint8_t index) { + if (g_pwm_buffer_update_required[index]) { + if (!snled27351_write_pwm_buffer(index, g_pwm_buffer[index])) { + g_led_control_registers_update_required[index] = true; + } + } + g_pwm_buffer_update_required[index] = false; +} + +void snled27351_update_led_control_registers(uint8_t index) { + if (g_led_control_registers_update_required[index]) { + snled27351_write(index, LED_CONTROL_PAGE, 0, g_led_control_registers[index], 24); + } + g_led_control_registers_update_required[index] = false; +} + +void snled27351_flush(void) { + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_update_pwm_buffers(i); +} + +void snled27351_shutdown(void) { +# if defined(LED_DRIVER_SHUTDOWN_PIN) + writePinLow(LED_DRIVER_SHUTDOWN_PIN); +# else + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_sw_shutdown(i); +# endif +} + +void snled27351_exit_shutdown(void) { +# if defined(LED_DRIVER_SHUTDOWN_PIN) + writePinHigh(LED_DRIVER_SHUTDOWN_PIN); +# else + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_sw_return_normal(i); +# endif +} + +void snled27351_sw_return_normal(uint8_t index) { + // Select to function page + // Setting LED driver to normal mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_NORMAL_MODE); +} + +void snled27351_sw_shutdown(uint8_t index) { + // Select to function page + // Setting LED driver to shutdown mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); + // Write SW Sleep Register + snled27351_write_register(index, FUNCTION_PAGE, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE); +} diff --git a/drivers/led/snled27351-simple-spi.h b/drivers/led/snled27351-simple-spi.h new file mode 100644 index 000000000000..465b63ca6d8b --- /dev/null +++ b/drivers/led/snled27351-simple-spi.h @@ -0,0 +1,346 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include "progmem.h" +#include "util.h" + +#if defined(LED_MATRIX_SNLED27351_SPI) +# define SNLED27351_LED_COUNT LED_MATRIX_LED_COUNT +#endif + +#define SNLED27351_DRIVER_COUNT (sizeof(cs_pins) / sizeof(pin_t)) +typedef struct snled27351_led_t { + uint8_t driver : 2; + uint8_t v; +} PACKED snled27351_led_t; + +extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; + +void snled27351_init_drivers(void); +void snled27351_init(uint8_t index); +bool snled27351_write_register(uint8_t index, uint8_t page, uint8_t reg, uint8_t data); +bool snled27351_write_pwm_buffer(uint8_t index, uint8_t *pwm_buffer); + +void snled27351_set_value(int index, uint8_t value); +void snled27351_set_value_all(uint8_t value); + +void snled27351_set_led_control_register(uint8_t index, bool value); + +// This should not be called from an interrupt +// (eg. from a timer interrupt). +// Call this while idle (in between matrix scans). +// If the buffer is dirty, it will update the driver with the buffer. +void snled27351_update_pwm_buffers(uint8_t index); +void snled27351_update_led_control_registers(uint8_t index); +void snled27351_flush(void); +void snled27351_shutdown(void); +void snled27351_exit_shutdown(void); +void snled27351_sw_return_normal(uint8_t index); +void snled27351_sw_shutdown(uint8_t index); + +// Registers Page Define +#define CONFIGURE_CMD_PAGE 0xFD +#define LED_CONTROL_PAGE 0x00 +#define LED_PWM_PAGE 0x01 +#define FUNCTION_PAGE 0x03 +#define CURRENT_TUNE_PAGE 0x04 + +// Function Register: address 0x00 +#define CONFIGURATION_REG 0x00 +#define MSKSW_SHUT_DOWN_MODE (0x0 << 0) +#define MSKSW_NORMAL_MODE (0x1 << 0) + +#define DRIVER_ID_REG 0x11 +#define SNLED27351_ID 0x8A + +#define PDU_REG 0x13 +#define MSKSET_CA_CB_CHANNEL 0xAA +#define MSKCLR_CA_CB_CHANNEL 0x00 + +#define SCAN_PHASE_REG 0x14 +#define MSKPHASE_12CHANNEL 0x00 +#define MSKPHASE_11CHANNEL 0x01 +#define MSKPHASE_10CHANNEL 0x02 +#define MSKPHASE_9CHANNEL 0x03 +#define MSKPHASE_8CHANNEL 0x04 +#define MSKPHASE_7CHANNEL 0x05 +#define MSKPHASE_6CHANNEL 0x06 +#define MSKPHASE_5CHANNEL 0x07 +#define MSKPHASE_4CHANNEL 0x08 +#define MSKPHASE_3CHANNEL 0x09 +#define MSKPHASE_2CHANNEL 0x0A +#define MSKPHASE_1CHANNEL 0x0B + +#define SLEW_RATE_CONTROL_MODE1_REG 0x15 +#define MSKPWM_DELAY_PHASE_ENABLE 0x04 +#define MSKPWM_DELAY_PHASE_DISABLE 0x00 + +#define SLEW_RATE_CONTROL_MODE2_REG 0x16 +#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE 0xC0 +#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_DISABLE 0x00 + +#define OPEN_SHORT_ENABLE_REG 0x17 +#define MSKOPEN_DETECTION_ENABLE (0x01 << 7) +#define MSKOPEN_DETECTION_DISABLE (0x00) + +#define MSKSHORT_DETECTION_ENABLE (0x01 << 6) +#define MSKSHORT_DETECTION_DISABLE (0x00) + +#define OPEN_SHORT_DUTY_REG 0x18 +#define OPEN_SHORT_FLAG_REG 0x19 + +#define MSKOPEN_DETECTION_INTERRUPT_ENABLE (0x01 << 7) +#define MSKOPEN_DETECTION_INTERRUPT_DISABLE (0x00) + +#define MSKSHORT_DETECTION_INTERRUPT_ENABLE (0x01 << 6) +#define MSKSHORT_DETECTION_INTERRUPT_DISABLE (0x00) + +#define SOFTWARE_SLEEP_REG 0x1A +#define MSKSLEEP_ENABLE 0x02 +#define MSKSLEEP_DISABLE 0x00 + +// LED Control Registers +#define LED_CONTROL_ON_OFF_FIRST_ADDR 0x0 +#define LED_CONTROL_ON_OFF_LAST_ADDR 0x17 +#define LED_CONTROL_ON_OFF_LENGTH ((LED_CONTROL_ON_OFF_LAST_ADDR - LED_CONTROL_ON_OFF_FIRST_ADDR) + 1) + +#define LED_CONTROL_OPEN_FIRST_ADDR 0x18 +#define LED_CONTROL_OPEN_LAST_ADDR 0x2F +#define LED_CONTROL_OPEN_LENGTH ((LED_CONTROL_OPEN_LAST_ADDR - LED_CONTROL_OPEN_FIRST_ADDR) + 1) + +#define LED_CONTROL_SHORT_FIRST_ADDR 0x30 +#define LED_CONTROL_SHORT_LAST_ADDR 0x47 +#define LED_CONTROL_SHORT_LENGTH ((LED_CONTROL_SHORT_LAST_ADDR - LED_CONTROL_SHORT_FIRST_ADDR) + 1) + +#define LED_CONTROL_PAGE_LENGTH 0x48 + +// LED Control Registers +#define LED_PWM_FIRST_ADDR 0x00 +#define LED_PWM_LAST_ADDR 0xBF +#define LED_PWM_LENGTH 0xC0 + +// Current Tune Registers +#define LED_CURRENT_TUNE_FIRST_ADDR 0x00 +#define LED_CURRENT_TUNE_LAST_ADDR 0x0B +#define LED_CURRENT_TUNE_LENGTH 0x0C + +#define A_1 0x00 +#define A_2 0x01 +#define A_3 0x02 +#define A_4 0x03 +#define A_5 0x04 +#define A_6 0x05 +#define A_7 0x06 +#define A_8 0x07 +#define A_9 0x08 +#define A_10 0x09 +#define A_11 0x0A +#define A_12 0x0B +#define A_13 0x0C +#define A_14 0x0D +#define A_15 0x0E +#define A_16 0x0F + +#define B_1 0x10 +#define B_2 0x11 +#define B_3 0x12 +#define B_4 0x13 +#define B_5 0x14 +#define B_6 0x15 +#define B_7 0x16 +#define B_8 0x17 +#define B_9 0x18 +#define B_10 0x19 +#define B_11 0x1A +#define B_12 0x1B +#define B_13 0x1C +#define B_14 0x1D +#define B_15 0x1E +#define B_16 0x1F + +#define C_1 0x20 +#define C_2 0x21 +#define C_3 0x22 +#define C_4 0x23 +#define C_5 0x24 +#define C_6 0x25 +#define C_7 0x26 +#define C_8 0x27 +#define C_9 0x28 +#define C_10 0x29 +#define C_11 0x2A +#define C_12 0x2B +#define C_13 0x2C +#define C_14 0x2D +#define C_15 0x2E +#define C_16 0x2F + +#define D_1 0x30 +#define D_2 0x31 +#define D_3 0x32 +#define D_4 0x33 +#define D_5 0x34 +#define D_6 0x35 +#define D_7 0x36 +#define D_8 0x37 +#define D_9 0x38 +#define D_10 0x39 +#define D_11 0x3A +#define D_12 0x3B +#define D_13 0x3C +#define D_14 0x3D +#define D_15 0x3E +#define D_16 0x3F + +#define E_1 0x40 +#define E_2 0x41 +#define E_3 0x42 +#define E_4 0x43 +#define E_5 0x44 +#define E_6 0x45 +#define E_7 0x46 +#define E_8 0x47 +#define E_9 0x48 +#define E_10 0x49 +#define E_11 0x4A +#define E_12 0x4B +#define E_13 0x4C +#define E_14 0x4D +#define E_15 0x4E +#define E_16 0x4F + +#define F_1 0x50 +#define F_2 0x51 +#define F_3 0x52 +#define F_4 0x53 +#define F_5 0x54 +#define F_6 0x55 +#define F_7 0x56 +#define F_8 0x57 +#define F_9 0x58 +#define F_10 0x59 +#define F_11 0x5A +#define F_12 0x5B +#define F_13 0x5C +#define F_14 0x5D +#define F_15 0x5E +#define F_16 0x5F + +#define G_1 0x60 +#define G_2 0x61 +#define G_3 0x62 +#define G_4 0x63 +#define G_5 0x64 +#define G_6 0x65 +#define G_7 0x66 +#define G_8 0x67 +#define G_9 0x68 +#define G_10 0x69 +#define G_11 0x6A +#define G_12 0x6B +#define G_13 0x6C +#define G_14 0x6D +#define G_15 0x6E +#define G_16 0x6F + +#define H_1 0x70 +#define H_2 0x71 +#define H_3 0x72 +#define H_4 0x73 +#define H_5 0x74 +#define H_6 0x75 +#define H_7 0x76 +#define H_8 0x77 +#define H_9 0x78 +#define H_10 0x79 +#define H_11 0x7A +#define H_12 0x7B +#define H_13 0x7C +#define H_14 0x7D +#define H_15 0x7E +#define H_16 0x7F + +#define I_1 0x80 +#define I_2 0x81 +#define I_3 0x82 +#define I_4 0x83 +#define I_5 0x84 +#define I_6 0x85 +#define I_7 0x86 +#define I_8 0x87 +#define I_9 0x88 +#define I_10 0x89 +#define I_11 0x8A +#define I_12 0x8B +#define I_13 0x8C +#define I_14 0x8D +#define I_15 0x8E +#define I_16 0x8F + +#define J_1 0x90 +#define J_2 0x91 +#define J_3 0x92 +#define J_4 0x93 +#define J_5 0x94 +#define J_6 0x95 +#define J_7 0x96 +#define J_8 0x97 +#define J_9 0x98 +#define J_10 0x99 +#define J_11 0x9A +#define J_12 0x9B +#define J_13 0x9C +#define J_14 0x9D +#define J_15 0x9E +#define J_16 0x9F + +#define K_1 0xA0 +#define K_2 0xA1 +#define K_3 0xA2 +#define K_4 0xA3 +#define K_5 0xA4 +#define K_6 0xA5 +#define K_7 0xA6 +#define K_8 0xA7 +#define K_9 0xA8 +#define K_10 0xA9 +#define K_11 0xAA +#define K_12 0xAB +#define K_13 0xAC +#define K_14 0xAD +#define K_15 0xAE +#define K_16 0xAF + +#define L_1 0xB0 +#define L_2 0xB1 +#define L_3 0xB2 +#define L_4 0xB3 +#define L_5 0xB4 +#define L_6 0xB5 +#define L_7 0xB6 +#define L_8 0xB7 +#define L_9 0xB8 +#define L_10 0xB9 +#define L_11 0xBA +#define L_12 0xBB +#define L_13 0xBC +#define L_14 0xBD +#define L_15 0xBE +#define L_16 0xBF diff --git a/drivers/led/snled27351-spi.c b/drivers/led/snled27351-spi.c new file mode 100644 index 000000000000..a6d810a6c2fd --- /dev/null +++ b/drivers/led/snled27351-spi.c @@ -0,0 +1,250 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "snled27351-spi.h" +#include "spi_master.h" + +#define SNLED27351_PWM_REGISTER_COUNT 192 +#define SNLED27351_LED_CONTROL_REGISTER_COUNT 24 + +#ifndef SNLED27351_PHASE_CHANNEL +# define SNLED27351_PHASE_CHANNEL MSKPHASE_12CHANNEL +#endif + +#ifndef SNLED27351_CURRENT_TUNE +# define SNLED27351_CURRENT_TUNE \ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } +#endif + +#define SNLED27351_WRITE (0 << 7) +#define SNLED27351_READ (1 << 7) +#define SNLED27351_PATTERN (2 << 4) + +#ifdef DRIVER_CS_PINS +pin_t cs_pins[] = DRIVER_CS_PINS; +#else +error "no DRIVER_CS_PINS defined" +#endif + +// These buffers match the snled27351 PWM registers. +// The control buffers match the PG0 LED On/Off registers. +// Storing them like this is optimal for I2C transfers to the registers. +// We could optimize this and take out the unused registers from these +// buffers and the transfers in snled27351_write_pwm_buffer() but it's +// probably not worth the extra complexity. +uint8_t g_pwm_buffer[SNLED27351_DRIVER_COUNT][SNLED27351_PWM_REGISTER_COUNT]; +bool g_pwm_buffer_update_required[SNLED27351_DRIVER_COUNT] = {false}; + +uint8_t g_led_control_registers[SNLED27351_DRIVER_COUNT][SNLED27351_LED_CONTROL_REGISTER_COUNT] = {0}; +bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT] = {false}; + + + +bool snled27351_write(uint8_t index, uint8_t page, uint8_t reg, uint8_t *data, uint8_t len) { + static uint8_t spi_transfer_buffer[2] = {0}; + + if (index > ARRAY_SIZE(((pin_t[])DRIVER_CS_PINS)) - 1) return false; + + if (!spi_start(cs_pins[index], false, 0, SNLED27351_SPI_DIVISOR)) { + spi_stop(); + return false; + } + + spi_transfer_buffer[0] = SNLED27351_WRITE | SNLED27351_PATTERN | (page & 0x0F); + spi_transfer_buffer[1] = reg; + + if (spi_transmit(spi_transfer_buffer, 2) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + if (spi_transmit(data, len) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + spi_stop(); + return true; +} + +bool snled27351_write_register(uint8_t index, uint8_t page, uint8_t reg, uint8_t data) { + return snled27351_write(index, page, reg, &data, 1); +} + +bool snled27351_write_pwm_buffer(uint8_t index, uint8_t *pwm_buffer) { + if (g_pwm_buffer_update_required[index]) { + snled27351_write(index, LED_PWM_PAGE, 0, g_pwm_buffer[index], SNLED27351_PWM_REGISTER_COUNT); + } + g_pwm_buffer_update_required[index] = false; + return true; +} + +void snled27351_init_drivers(void) { +#if defined(LED_DRIVER_SHUTDOWN_PIN) + setPinOutput(LED_DRIVER_SHUTDOWN_PIN); + writePinHigh(LED_DRIVER_SHUTDOWN_PIN); +#endif + + spi_init(); + + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_init(i); + + for (int index = 0; index < SNLED27351_LED_COUNT; index++) { + snled27351_set_led_control_register(index, true, true, true); + } + + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_update_led_control_registers(i); +} + +void snled27351_init(uint8_t index) { + setPinOutput(cs_pins[index]); + writePinHigh(cs_pins[index]); + // Setting LED driver to shutdown mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); + // Setting internal channel pulldown/pullup + snled27351_write_register(index, FUNCTION_PAGE, PDU_REG, MSKSET_CA_CB_CHANNEL); + // Select number of scan phase + snled27351_write_register(index, FUNCTION_PAGE, SCAN_PHASE_REG, SNLED27351_PHASE_CHANNEL); + // Setting PWM Delay Phase + snled27351_write_register(index, FUNCTION_PAGE, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE); + // Setting Driving/Sinking Channel Slew Rate + snled27351_write_register(index, FUNCTION_PAGE, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE); + // Setting Iref + snled27351_write_register(index, FUNCTION_PAGE, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE); + + // Set LED CONTROL PAGE (Page 0) + uint8_t on_off_reg[LED_CONTROL_ON_OFF_LENGTH] = {0}; + snled27351_write(index, LED_CONTROL_PAGE, 0, on_off_reg, LED_CONTROL_ON_OFF_LENGTH); + + // Set PWM PAGE (Page 1) + uint8_t pwm_reg[LED_PWM_LENGTH]; + memset(pwm_reg, 0, LED_PWM_LENGTH); + snled27351_write(index, LED_PWM_PAGE, 0, pwm_reg, LED_PWM_LENGTH); + + // Set CURRENT PAGE (Page 4) + uint8_t current_tune_reg[LED_CURRENT_TUNE_LENGTH] = SNLED27351_CURRENT_TUNE; + snled27351_write(index, CURRENT_TUNE_PAGE, 0, current_tune_reg, LED_CURRENT_TUNE_LENGTH); + + // // Enable LEDs ON/OFF + // memset(on_off_reg, 0xFF, LED_CONTROL_ON_OFF_LENGTH); + // snled27351_write(index, LED_CONTROL_PAGE, 0, on_off_reg, LED_CONTROL_ON_OFF_LENGTH); + + // Setting LED driver to normal mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_NORMAL_MODE); +} + +void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { + snled27351_led_t led; + if (index >= 0 && index < SNLED27351_LED_COUNT) { + memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); + + g_pwm_buffer[led.driver][led.r] = red; + g_pwm_buffer[led.driver][led.g] = green; + g_pwm_buffer[led.driver][led.b] = blue; + g_pwm_buffer_update_required[led.driver] = true; + } +} + +void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { + for (int i = 0; i < SNLED27351_LED_COUNT; i++) { + snled27351_set_color(i, red, green, blue); + } +} + +void snled27351_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { + snled27351_led_t led; + memcpy_P(&led, (&g_snled27351_leds[index]), sizeof(led)); + + uint8_t control_register_r = led.r / 8; + uint8_t control_register_g = led.g / 8; + uint8_t control_register_b = led.b / 8; + uint8_t bit_r = led.r % 8; + uint8_t bit_g = led.g % 8; + uint8_t bit_b = led.b % 8; + + if (red) { + g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); + } else { + g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); + } + if (green) { + g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); + } else { + g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); + } + if (blue) { + g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); + } else { + g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); + } + + g_led_control_registers_update_required[led.driver] = true; +} + +void snled27351_update_pwm_buffers(uint8_t index) { + if (g_pwm_buffer_update_required[index]) { + if (!snled27351_write_pwm_buffer(index, g_pwm_buffer[index])) { + g_led_control_registers_update_required[index] = true; + } + } + g_pwm_buffer_update_required[index] = false; +} + +void snled27351_update_led_control_registers(uint8_t index) { + if (g_led_control_registers_update_required[index]) { + snled27351_write(index, LED_CONTROL_PAGE, 0, g_led_control_registers[index], 24); + } + g_led_control_registers_update_required[index] = false; +} + +void snled27351_flush(void) { + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_update_pwm_buffers(i); +} + +void snled27351_shutdown(void) { +# if defined(LED_DRIVER_SHUTDOWN_PIN) + writePinLow(LED_DRIVER_SHUTDOWN_PIN); +# else + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_sw_shutdown(i); +# endif +} + +void snled27351_exit_shutdown(void) { +# if defined(LED_DRIVER_SHUTDOWN_PIN) + writePinHigh(LED_DRIVER_SHUTDOWN_PIN); +# else + for (uint8_t i = 0; i < SNLED27351_DRIVER_COUNT; i++) + snled27351_sw_return_normal(i); +# endif +} + +void snled27351_sw_return_normal(uint8_t index) { + // Select to function page + // Setting LED driver to normal mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_NORMAL_MODE); +} + +void snled27351_sw_shutdown(uint8_t index) { + // Select to function page + // Setting LED driver to shutdown mode + snled27351_write_register(index, FUNCTION_PAGE, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE); + // Write SW Sleep Register + snled27351_write_register(index, FUNCTION_PAGE, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE); +} diff --git a/drivers/led/snled27351-spi.h b/drivers/led/snled27351-spi.h new file mode 100644 index 000000000000..92cad6e52d1b --- /dev/null +++ b/drivers/led/snled27351-spi.h @@ -0,0 +1,349 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include "progmem.h" +#include "util.h" + +#if defined(SNLED27351_SPI) +# define SNLED27351_LED_COUNT RGB_MATRIX_LED_COUNT +#endif + +# define SNLED27351_DRIVER_COUNT (sizeof(cs_pins)/sizeof(pin_t)) + +typedef struct snled27351_led_t { + uint8_t driver : 2; + uint8_t r; + uint8_t g; + uint8_t b; +} __attribute__((packed)) snled27351_led_t; + +extern const snled27351_led_t g_snled27351_leds[SNLED27351_LED_COUNT]; + +void snled27351_init_drivers(void); +void snled27351_init(uint8_t index); +bool snled27351_write_register(uint8_t index, uint8_t page, uint8_t reg, uint8_t data); +bool snled27351_write_pwm_buffer(uint8_t index, uint8_t *pwm_buffer); + +void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); +void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue); + +void snled27351_set_led_control_register(uint8_t index, bool red, bool green, bool blue); + +// This should not be called from an interrupt +// (eg. from a timer interrupt). +// Call this while idle (in between matrix scans). +// If the buffer is dirty, it will update the driver with the buffer. +void snled27351_update_pwm_buffers(uint8_t index); +void snled27351_update_led_control_registers(uint8_t index); +void snled27351_flush(void); +void snled27351_shutdown(void); +void snled27351_exit_shutdown(void); +void snled27351_sw_return_normal(uint8_t index); +void snled27351_sw_shutdown(uint8_t index); + +// Registers Page Define +#define CONFIGURE_CMD_PAGE 0xFD +#define LED_CONTROL_PAGE 0x00 +#define LED_PWM_PAGE 0x01 +#define FUNCTION_PAGE 0x03 +#define CURRENT_TUNE_PAGE 0x04 + +// Function Register: address 0x00 +#define CONFIGURATION_REG 0x00 +#define MSKSW_SHUT_DOWN_MODE (0x0 << 0) +#define MSKSW_NORMAL_MODE (0x1 << 0) + +#define DRIVER_ID_REG 0x11 +#define SNLED27351_ID 0x8A + +#define PDU_REG 0x13 +#define MSKSET_CA_CB_CHANNEL 0xAA +#define MSKCLR_CA_CB_CHANNEL 0x00 + +#define SCAN_PHASE_REG 0x14 +#define MSKPHASE_12CHANNEL 0x00 +#define MSKPHASE_11CHANNEL 0x01 +#define MSKPHASE_10CHANNEL 0x02 +#define MSKPHASE_9CHANNEL 0x03 +#define MSKPHASE_8CHANNEL 0x04 +#define MSKPHASE_7CHANNEL 0x05 +#define MSKPHASE_6CHANNEL 0x06 +#define MSKPHASE_5CHANNEL 0x07 +#define MSKPHASE_4CHANNEL 0x08 +#define MSKPHASE_3CHANNEL 0x09 +#define MSKPHASE_2CHANNEL 0x0A +#define MSKPHASE_1CHANNEL 0x0B + +#define SLEW_RATE_CONTROL_MODE1_REG 0x15 +#define MSKPWM_DELAY_PHASE_ENABLE 0x04 +#define MSKPWM_DELAY_PHASE_DISABLE 0x00 + +#define SLEW_RATE_CONTROL_MODE2_REG 0x16 +#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE 0xC0 +#define MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_DISABLE 0x00 + +#define OPEN_SHORT_ENABLE_REG 0x17 +#define MSKOPEN_DETECTION_ENABLE (0x01 << 7) +#define MSKOPEN_DETECTION_DISABLE (0x00) + +#define MSKSHORT_DETECTION_ENABLE (0x01 << 6) +#define MSKSHORT_DETECTION_DISABLE (0x00) + +#define OPEN_SHORT_DUTY_REG 0x18 +#define OPEN_SHORT_FLAG_REG 0x19 + +#define MSKOPEN_DETECTION_INTERRUPT_ENABLE (0x01 << 7) +#define MSKOPEN_DETECTION_INTERRUPT_DISABLE (0x00) + +#define MSKSHORT_DETECTION_INTERRUPT_ENABLE (0x01 << 6) +#define MSKSHORT_DETECTION_INTERRUPT_DISABLE (0x00) + +#define SOFTWARE_SLEEP_REG 0x1A +#define MSKSLEEP_ENABLE 0x02 +#define MSKSLEEP_DISABLE 0x00 + +// LED Control Registers +#define LED_CONTROL_ON_OFF_FIRST_ADDR 0x0 +#define LED_CONTROL_ON_OFF_LAST_ADDR 0x17 +#define LED_CONTROL_ON_OFF_LENGTH ((LED_CONTROL_ON_OFF_LAST_ADDR - LED_CONTROL_ON_OFF_FIRST_ADDR) + 1) + +#define LED_CONTROL_OPEN_FIRST_ADDR 0x18 +#define LED_CONTROL_OPEN_LAST_ADDR 0x2F +#define LED_CONTROL_OPEN_LENGTH ((LED_CONTROL_OPEN_LAST_ADDR - LED_CONTROL_OPEN_FIRST_ADDR) + 1) + +#define LED_CONTROL_SHORT_FIRST_ADDR 0x30 +#define LED_CONTROL_SHORT_LAST_ADDR 0x47 +#define LED_CONTROL_SHORT_LENGTH ((LED_CONTROL_SHORT_LAST_ADDR - LED_CONTROL_SHORT_FIRST_ADDR) + 1) + +#define LED_CONTROL_PAGE_LENGTH 0x48 + +// LED Control Registers +#define LED_PWM_FIRST_ADDR 0x00 +#define LED_PWM_LAST_ADDR 0xBF +#define LED_PWM_LENGTH 0xC0 + +// Current Tune Registers +#define LED_CURRENT_TUNE_FIRST_ADDR 0x00 +#define LED_CURRENT_TUNE_LAST_ADDR 0x0B +#define LED_CURRENT_TUNE_LENGTH 0x0C + +#define A_1 0x00 +#define A_2 0x01 +#define A_3 0x02 +#define A_4 0x03 +#define A_5 0x04 +#define A_6 0x05 +#define A_7 0x06 +#define A_8 0x07 +#define A_9 0x08 +#define A_10 0x09 +#define A_11 0x0A +#define A_12 0x0B +#define A_13 0x0C +#define A_14 0x0D +#define A_15 0x0E +#define A_16 0x0F + +#define B_1 0x10 +#define B_2 0x11 +#define B_3 0x12 +#define B_4 0x13 +#define B_5 0x14 +#define B_6 0x15 +#define B_7 0x16 +#define B_8 0x17 +#define B_9 0x18 +#define B_10 0x19 +#define B_11 0x1A +#define B_12 0x1B +#define B_13 0x1C +#define B_14 0x1D +#define B_15 0x1E +#define B_16 0x1F + +#define C_1 0x20 +#define C_2 0x21 +#define C_3 0x22 +#define C_4 0x23 +#define C_5 0x24 +#define C_6 0x25 +#define C_7 0x26 +#define C_8 0x27 +#define C_9 0x28 +#define C_10 0x29 +#define C_11 0x2A +#define C_12 0x2B +#define C_13 0x2C +#define C_14 0x2D +#define C_15 0x2E +#define C_16 0x2F + +#define D_1 0x30 +#define D_2 0x31 +#define D_3 0x32 +#define D_4 0x33 +#define D_5 0x34 +#define D_6 0x35 +#define D_7 0x36 +#define D_8 0x37 +#define D_9 0x38 +#define D_10 0x39 +#define D_11 0x3A +#define D_12 0x3B +#define D_13 0x3C +#define D_14 0x3D +#define D_15 0x3E +#define D_16 0x3F + +#define E_1 0x40 +#define E_2 0x41 +#define E_3 0x42 +#define E_4 0x43 +#define E_5 0x44 +#define E_6 0x45 +#define E_7 0x46 +#define E_8 0x47 +#define E_9 0x48 +#define E_10 0x49 +#define E_11 0x4A +#define E_12 0x4B +#define E_13 0x4C +#define E_14 0x4D +#define E_15 0x4E +#define E_16 0x4F + +#define F_1 0x50 +#define F_2 0x51 +#define F_3 0x52 +#define F_4 0x53 +#define F_5 0x54 +#define F_6 0x55 +#define F_7 0x56 +#define F_8 0x57 +#define F_9 0x58 +#define F_10 0x59 +#define F_11 0x5A +#define F_12 0x5B +#define F_13 0x5C +#define F_14 0x5D +#define F_15 0x5E +#define F_16 0x5F + +#define G_1 0x60 +#define G_2 0x61 +#define G_3 0x62 +#define G_4 0x63 +#define G_5 0x64 +#define G_6 0x65 +#define G_7 0x66 +#define G_8 0x67 +#define G_9 0x68 +#define G_10 0x69 +#define G_11 0x6A +#define G_12 0x6B +#define G_13 0x6C +#define G_14 0x6D +#define G_15 0x6E +#define G_16 0x6F + +#define H_1 0x70 +#define H_2 0x71 +#define H_3 0x72 +#define H_4 0x73 +#define H_5 0x74 +#define H_6 0x75 +#define H_7 0x76 +#define H_8 0x77 +#define H_9 0x78 +#define H_10 0x79 +#define H_11 0x7A +#define H_12 0x7B +#define H_13 0x7C +#define H_14 0x7D +#define H_15 0x7E +#define H_16 0x7F + +#define I_1 0x80 +#define I_2 0x81 +#define I_3 0x82 +#define I_4 0x83 +#define I_5 0x84 +#define I_6 0x85 +#define I_7 0x86 +#define I_8 0x87 +#define I_9 0x88 +#define I_10 0x89 +#define I_11 0x8A +#define I_12 0x8B +#define I_13 0x8C +#define I_14 0x8D +#define I_15 0x8E +#define I_16 0x8F + +#define J_1 0x90 +#define J_2 0x91 +#define J_3 0x92 +#define J_4 0x93 +#define J_5 0x94 +#define J_6 0x95 +#define J_7 0x96 +#define J_8 0x97 +#define J_9 0x98 +#define J_10 0x99 +#define J_11 0x9A +#define J_12 0x9B +#define J_13 0x9C +#define J_14 0x9D +#define J_15 0x9E +#define J_16 0x9F + +#define K_1 0xA0 +#define K_2 0xA1 +#define K_3 0xA2 +#define K_4 0xA3 +#define K_5 0xA4 +#define K_6 0xA5 +#define K_7 0xA6 +#define K_8 0xA7 +#define K_9 0xA8 +#define K_10 0xA9 +#define K_11 0xAA +#define K_12 0xAB +#define K_13 0xAC +#define K_14 0xAD +#define K_15 0xAE +#define K_16 0xAF + +#define L_1 0xB0 +#define L_2 0xB1 +#define L_3 0xB2 +#define L_4 0xB3 +#define L_5 0xB4 +#define L_6 0xB5 +#define L_7 0xB6 +#define L_8 0xB7 +#define L_9 0xB8 +#define L_10 0xB9 +#define L_11 0xBA +#define L_12 0xBB +#define L_13 0xBC +#define L_14 0xBD +#define L_15 0xBE +#define L_16 0xBF diff --git a/keyboards/keychron/c1_pro/ansi/rgb/rules.mk b/keyboards/keychron/c1_pro/ansi/rgb/rules.mk deleted file mode 100644 index 7307f9f9e79a..000000000000 --- a/keyboards/keychron/c1_pro/ansi/rgb/rules.mk +++ /dev/null @@ -1 +0,0 @@ -# Build Options diff --git a/keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/rules.mk deleted file mode 100644 index 495e8907b48c..000000000000 --- a/keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/c1_pro/ansi/white/rules.mk b/keyboards/keychron/c1_pro/ansi/white/rules.mk deleted file mode 100644 index 7307f9f9e79a..000000000000 --- a/keyboards/keychron/c1_pro/ansi/white/rules.mk +++ /dev/null @@ -1 +0,0 @@ -# Build Options diff --git a/keyboards/keychron/c1_pro/ansi_v1/ansi_v1.c b/keyboards/keychron/c1_pro/ansi_v1/ansi_v1.c new file mode 100755 index 000000000000..038689a23dee --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/ansi_v1.c @@ -0,0 +1,208 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +// clang-format off +const matrix_row_t matrix_mask[] = { + 0b1111111111111111, + 0b1111111111111111, + 0b1111111111111111, + 0b1111111111111111, + 0b1111111111111111, + 0b1111111111101111, +}; + +// clang-format on +#ifdef DIP_SWITCH_ENABLE +bool dip_switch_update_kb(uint8_t index, bool active) { + if (!dip_switch_update_user(index, active)) { + return false; + } + if (index == 0) { + default_layer_set(1UL << (active ? 2 : 0)); + } + return true; +} +#endif + +#if defined(RGB_MATRIX_ENABLE) + +extern void rgb_matrix_update_pwm_buffers(void); + +bool rgb_matrix_indicators_kb(void) { + if (!rgb_matrix_indicators_user()) { + return false; + } + if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 255, 255); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 0, 255); + } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 255, 0); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 0, 0); + } + return true; +} + +void rgb_matrix_indicators_none_kb(void) { + rgb_matrix_indicators_kb(); + rgb_matrix_update_pwm_buffers(); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + + if (rgb_matrix_is_enabled() +# if defined(ENABLE_RGB_MATRIX_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_JELLYBEAN_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_PIXEL_RAIN) + && (rgb_matrix_get_mode() != RGB_MATRIX_PIXEL_RAIN) +# endif + ) { + return res; + } + + if (res) { +# if defined(CAPS_MAC_WIN_IND_LED_INDEX) + if ((led_state.caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 255, 255); + } else if ((!led_state.caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 0, 255); + } else if ((led_state.caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 255, 0); + } else if ((!led_state.caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 0, 0); + } +# endif + rgb_matrix_update_pwm_buffers(); + } + + return res; +} + +void housekeeping_task_kb(void) { +# if defined(RGB_MATRIX_ENABLE) && defined(CAPS_MAC_WIN_IND_LED_INDEX) + if (!rgb_matrix_is_enabled()) { + if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 255, 255); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 0, 0, 255); + } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 255, 0); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + rgb_matrix_set_color(CAPS_MAC_WIN_IND_LED_INDEX, 255, 0, 0); + } + rgb_matrix_update_pwm_buffers(); + } +# endif +} + +#endif + +#if defined(LED_MATRIX_ENABLE) + +extern void led_matrix_update_pwm_buffers(void); + +bool led_matrix_indicators_kb(void) { + if (!led_matrix_indicators_user()) { + return false; + } + if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } + return true; +} + +void led_matrix_indicators_none_kb(void) { + led_matrix_indicators_kb(); + led_matrix_update_pwm_buffers(); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + + if (res) { +# if defined(CAPS_LOCK_LED_INDEX) && defined(MAC_OS_LED_INDEX) && defined(WIN_OS_LED_INDEX) + if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } + led_matrix_update_pwm_buffers(); +# endif + } + + return res; +} + +void housekeeping_task_kb(void) { +# if defined(LED_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) && defined(MAC_OS_LED_INDEX) && defined(WIN_OS_LED_INDEX) + if (!led_matrix_is_enabled()) { + if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 255); + led_matrix_set_value(WIN_OS_LED_INDEX, 0); + } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { + led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); + led_matrix_set_value(MAC_OS_LED_INDEX, 0); + led_matrix_set_value(WIN_OS_LED_INDEX, 255); + } + led_matrix_update_pwm_buffers(); + } +# endif +} + +#endif diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.h b/keyboards/keychron/c1_pro/ansi_v1/config.h old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.h rename to keyboards/keychron/c1_pro/ansi_v1/config.h index dead4541676d..dcdb95e25273 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.h +++ b/keyboards/keychron/c1_pro/ansi_v1/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Grayson Carr +/* Copyright 2022 @ Keychron(https://www.keychron.com) * * 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 @@ -16,9 +16,15 @@ #pragma once -void rgb_matrix_init_user(void); +/* DIP switch */ +#define DIP_SWITCH_MATRIX_GRID { {5, 4}, } -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); +/* Disable DIP switch in matrix data */ +#define MATRIX_MASKED -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); +/* Increase I2C speed to 1000 KHz */ +#define I2C1_TIMINGR_PRESC 0U +#define I2C1_TIMINGR_SCLDEL 3U +#define I2C1_TIMINGR_SDADEL 0U +#define I2C1_TIMINGR_SCLH 15U +#define I2C1_TIMINGR_SCLL 51U diff --git a/keyboards/keychron/c1_pro/halconf.h b/keyboards/keychron/c1_pro/ansi_v1/halconf.h old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c1_pro/halconf.h rename to keyboards/keychron/c1_pro/ansi_v1/halconf.h diff --git a/keyboards/keychron/c1_pro/ansi_v1/info.json b/keyboards/keychron/c1_pro/ansi_v1/info.json new file mode 100755 index 000000000000..f3003487096b --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/info.json @@ -0,0 +1,12 @@ +{ + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] + }, + "diode_direction": "ROW2COL", + "community_layouts": [ + "tkl_ansi" + ] +} diff --git a/keyboards/keychron/c1_pro/mcuconf.h b/keyboards/keychron/c1_pro/ansi_v1/mcuconf.h old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c1_pro/mcuconf.h rename to keyboards/keychron/c1_pro/ansi_v1/mcuconf.h diff --git a/keyboards/keychron/c1_pro/ansi/rgb/config.h b/keyboards/keychron/c1_pro/ansi_v1/rgb/config.h old mode 100644 new mode 100755 similarity index 63% rename from keyboards/keychron/c1_pro/ansi/rgb/config.h rename to keyboards/keychron/c1_pro/ansi_v1/rgb/config.h index a103d190d0e3..be22bbb493a0 --- a/keyboards/keychron/c1_pro/ansi/rgb/config.h +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/config.h @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -19,30 +19,29 @@ /* If PH3 used with a stronger pull resistor then the following definition needs be included */ // #define MATRIX_UNSELECT_DRIVE_HIGH +#ifdef RGB_MATRIX_ENABLE /* RGB Matrix Driver Configuration */ -#define DRIVER_COUNT 2 -#define DRIVER_ADDR_1 0b1110111 -#define DRIVER_ADDR_2 0b1110100 +# define DRIVER_COUNT 2 +# define DRIVER_ADDR_1 0b1110111 +# define DRIVER_ADDR_2 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 49 -#define DRIVER_2_LED_TOTAL 39 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +# define RGB_MATRIX_LED_COUNT 88 /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ -#define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set led driver current */ -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } /* turn off effects when suspended */ -#define RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_DISABLE_WHEN_USB_SUSPENDED -/* Enable caps_lock, win os and mac os indicator */ -#define CAPS_MAC_WIN_LED_INDEX 63 +/* Indication led index */ +# define CAPS_MAC_WIN_IND_LED_INDEX 87 // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +# define RGB_MATRIX_KEYPRESSES +#endif diff --git a/keyboards/keychron/c1_pro/ansi/rgb/info.json b/keyboards/keychron/c1_pro/ansi_v1/rgb/info.json old mode 100644 new mode 100755 similarity index 99% rename from keyboards/keychron/c1_pro/ansi/rgb/info.json rename to keyboards/keychron/c1_pro/ansi_v1/rgb/info.json index c6011a28370a..9f72f3ce56fe --- a/keyboards/keychron/c1_pro/ansi/rgb/info.json +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/info.json @@ -1,7 +1,7 @@ { "usb": { "pid": "0x0510", - "device_version": "1.0.0" + "device_version": "1.0.1" }, "features": { "rgb_matrix": true diff --git a/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/default/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/default/keymap.c new file mode 100755 index 000000000000..905ceb16dce2 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, _______, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..62941adb13ac --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/keymap.c @@ -0,0 +1,78 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/via/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/via/keymap.c new file mode 100755 index 000000000000..91249241763c --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/via/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c1_pro/ansi/rgb/keymaps/via/rules.mk rename to keyboards/keychron/c1_pro/ansi_v1/rgb/keymaps/via/rules.mk diff --git a/keyboards/keychron/c1_pro/ansi/rgb/rgb.c b/keyboards/keychron/c1_pro/ansi_v1/rgb/rgb.c old mode 100644 new mode 100755 similarity index 67% rename from keyboards/keychron/c1_pro/ansi/rgb/rgb.c rename to keyboards/keychron/c1_pro/ansi_v1/rgb/rgb.c index 04565f3b014b..205e3642ae13 --- a/keyboards/keychron/c1_pro/ansi/rgb/rgb.c +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/rgb.c @@ -1,5 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) - * +/* Copyright 2022 @ Keychron (https://www.keychron.com) * 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 * the Free Software Foundation, either version 2 of the License, or @@ -92,7 +91,7 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, I_12, G_12, H_12}, {1, I_14, G_14, H_14}, - {0, I_14, G_14, H_14}, // CAPS_MAC_WIN_LED_INDEX + {0, I_14, G_14, H_14}, // Indication led {1, C_1, A_1, B_1}, {1, C_3, A_3, B_3}, @@ -120,49 +119,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, {1, C_15, A_15, B_15}, }; - -// clang-format on - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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; - } - 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; - } - if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { - rgb_matrix_set_color(CAPS_MAC_WIN_LED_INDEX, 0, 255, 255); - } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { - rgb_matrix_set_color(CAPS_MAC_WIN_LED_INDEX, 0, 0, 255); - } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { - rgb_matrix_set_color(CAPS_MAC_WIN_LED_INDEX, 255, 255, 0); - } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { - rgb_matrix_set_color(CAPS_MAC_WIN_LED_INDEX, 255, 0, 0); - } - return true; -} - #endif diff --git a/keyboards/keychron/c1_pro/ansi_v1/rgb/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/rgb/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/rgb/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c1_pro/ansi/white/config.h b/keyboards/keychron/c1_pro/ansi_v1/white/config.h old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/c1_pro/ansi/white/config.h rename to keyboards/keychron/c1_pro/ansi_v1/white/config.h index dd3e1da477bf..c18ec8f8c447 --- a/keyboards/keychron/c1_pro/ansi/white/config.h +++ b/keyboards/keychron/c1_pro/ansi_v1/white/config.h @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -19,30 +19,30 @@ /* If PH3 used with a stronger pull resistor then the following definition needs be included */ // #define MATRIX_UNSELECT_DRIVE_HIGH -/* LED Matrix Driver Configuration */ -#define DRIVER_COUNT 1 -#define DRIVER_ADDR_1 0b1110100 +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 -/* LED Matrix Configuration */ -#define LED_MATRIX_LED_COUNT 90 +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 90 /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ -#define PHASE_CHANNEL MSKPHASE_9CHANNEL -/* Set led driver current */ -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } /* turn off effects when suspended */ -#define LED_DISABLE_WHEN_USB_SUSPENDED +# define LED_DISABLE_WHEN_USB_SUSPENDED -/* Enbale caps_lcok, win os and mac os indicator */ -#define CAPS_LOCK_LED_INDEX 63 -#define MAC_LOCK_LED_INDEX 64 -#define WIN_LOCK_LED_INDEX 65 +# define CAPS_LOCK_LED_INDEX 87 +# define MAC_OS_LED_INDEX 88 +# define WIN_OS_LED_INDEX 89 // LED Matrix Animation modes. Explicitly enabled // For full list of effects, see: // https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects // #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) -#define LED_MATRIX_KEYPRESSES -#define LED_MATRIX_KEYRELEASES +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/c1_pro/ansi/white/info.json b/keyboards/keychron/c1_pro/ansi_v1/white/info.json old mode 100644 new mode 100755 similarity index 99% rename from keyboards/keychron/c1_pro/ansi/white/info.json rename to keyboards/keychron/c1_pro/ansi_v1/white/info.json index 070ed6c4270f..7ca474fe8088 --- a/keyboards/keychron/c1_pro/ansi/white/info.json +++ b/keyboards/keychron/c1_pro/ansi_v1/white/info.json @@ -1,7 +1,7 @@ { "usb": { "pid": "0x0513", - "device_version": "1.0.0" + "device_version": "1.0.1" }, "features": { "led_matrix": true diff --git a/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/default/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/default/keymap.c new file mode 100755 index 000000000000..e01ac37fb6dd --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, _______, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..8dc5b1cf9dc3 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/keymap.c @@ -0,0 +1,78 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/via/keymap.c b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/via/keymap.c new file mode 100755 index 000000000000..69661bab2383 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, _______, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c1_pro/ansi/white/keymaps/via/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/white/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c1_pro/ansi/white/keymaps/via/rules.mk rename to keyboards/keychron/c1_pro/ansi_v1/white/keymaps/via/rules.mk diff --git a/keyboards/keychron/c1_pro/ansi_v1/white/rules.mk b/keyboards/keychron/c1_pro/ansi_v1/white/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v1/white/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c1_pro/ansi/white/white.c b/keyboards/keychron/c1_pro/ansi_v1/white/white.c old mode 100644 new mode 100755 similarity index 57% rename from keyboards/keychron/c1_pro/ansi/white/white.c rename to keyboards/keychron/c1_pro/ansi_v1/white/white.c index 72e9ad4db139..23005fb900e0 --- a/keyboards/keychron/c1_pro/ansi/white/white.c +++ b/keyboards/keychron/c1_pro/ansi_v1/white/white.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -71,7 +71,7 @@ const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { {0, C_6}, // p {0, C_5}, // [{ {0, C_4}, // ]} - {0, C_3}, // \| + {0, C_3}, // \\| {0, C_2}, // DEL {0, C_1}, // END {0, G_6}, // PGDN @@ -120,57 +120,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { {0, F_1}, // down {0, G_13}, // right }; - -// clang-format on - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { - case BL_TOGG: - if (record->event.pressed) { - switch (led_matrix_get_flags()) { - case LED_FLAG_ALL: { - led_matrix_set_flags(LED_FLAG_NONE); - led_matrix_set_value_all(0); - } break; - default: { - led_matrix_set_flags(LED_FLAG_ALL); - } break; - } - } - if (!led_matrix_is_enabled()) { - led_matrix_set_flags(LED_FLAG_ALL); - led_matrix_enable(); - } - return false; - } - return true; -} - -bool led_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { - if (!led_matrix_indicators_advanced_user(led_min, led_max)) { - return false; - } - if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { - led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); - led_matrix_set_value(MAC_LOCK_LED_INDEX, 255); - led_matrix_set_value(WIN_LOCK_LED_INDEX, 0); - } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 0))) { - led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); - led_matrix_set_value(MAC_LOCK_LED_INDEX, 255); - led_matrix_set_value(WIN_LOCK_LED_INDEX, 0); - } else if ((host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { - led_matrix_set_value(CAPS_LOCK_LED_INDEX, 255); - led_matrix_set_value(MAC_LOCK_LED_INDEX, 0); - led_matrix_set_value(WIN_LOCK_LED_INDEX, 255); - } else if ((!host_keyboard_led_state().caps_lock) && (default_layer_state == (1 << 2))) { - led_matrix_set_value(CAPS_LOCK_LED_INDEX, 0); - led_matrix_set_value(MAC_LOCK_LED_INDEX, 0); - led_matrix_set_value(WIN_LOCK_LED_INDEX, 255); - } - return true; -} - #endif diff --git a/keyboards/keychron/c1_pro/c1_pro.c b/keyboards/keychron/c1_pro/ansi_v2/ansi_v2.c old mode 100644 new mode 100755 similarity index 65% rename from keyboards/keychron/c1_pro/c1_pro.c rename to keyboards/keychron/c1_pro/ansi_v2/ansi_v2.c index 607cd958ade9..19b39614f867 --- a/keyboards/keychron/c1_pro/c1_pro.c +++ b/keyboards/keychron/c1_pro/ansi_v2/ansi_v2.c @@ -16,29 +16,29 @@ #include "quantum.h" -// clang-format off - -const matrix_row_t matrix_mask[] = { - 0b1111111111111111, - 0b1111111111111111, - 0b1111111111111111, - 0b1111111111111111, - 0b1111111111111111, - 0b1111111111101111, -}; - -// clang-format on - #ifdef DIP_SWITCH_ENABLE - bool dip_switch_update_kb(uint8_t index, bool active) { if (!dip_switch_update_user(index, active)) { return false; } if (index == 0) { - default_layer_set(1UL << (active ? 2 : 0)); + default_layer_set(1UL << (active ? 0 : 2)); } return true; } +#endif -#endif // DIP_SWITCH_ENABLE +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_MAC_OS_PIN); + setPinOutputPushPull(LED_WIN_OS_PIN); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + + keyboard_post_init_user(); +} + +void suspend_power_down_kb(void) { + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + suspend_power_down_user(); +} diff --git a/keyboards/keychron/c1_pro/ansi_v2/config.h b/keyboards/keychron/c1_pro/ansi_v2/config.h new file mode 100755 index 000000000000..ceccf1212c63 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/config.h @@ -0,0 +1,36 @@ +/* Copyright 2022 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* DIP switch */ +#define DIP_SWITCH_PINS { D2 } + +/* Increase I2C speed to 1000 KHz */ +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* System indication led */ +#define LED_MAC_OS_PIN C10 +#define LED_WIN_OS_PIN C11 +#define LED_OS_PIN_ON_STATE 1 + +/* The SPI Driver Configuration */ +// #define SPI_DRIVER SPID1 +// #define SPI_SCK_PIN A5 +// #define SPI_MOSI_PIN A7 +// #define SPI_MISO_PIN A6 +// #define CKLED2001_SPI_DIVISOR 21 diff --git a/keyboards/keychron/c2_pro/halconf.h b/keyboards/keychron/c1_pro/ansi_v2/halconf.h old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c2_pro/halconf.h rename to keyboards/keychron/c1_pro/ansi_v2/halconf.h diff --git a/keyboards/keychron/c1_pro/ansi_v2/info.json b/keyboards/keychron/c1_pro/ansi_v2/info.json new file mode 100755 index 000000000000..555db67c2bee --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/info.json @@ -0,0 +1,113 @@ +{ + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["A0", "A1", "A2", "A3", "C0", "C1", "C2", "C3", "A8", "C12", "B9", "C6", "C7", "C4", "C5", "A15", "B10"], + "rows": ["B0", "B1", "B8", "B3", "B4", "B5"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "C9" + }, + "community_layouts": [ + "tkl_ansi" + ], + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap_user.h b/keyboards/keychron/c1_pro/ansi_v2/mcuconf.h old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap_user.h rename to keyboards/keychron/c1_pro/ansi_v2/mcuconf.h index 87b1baf47f23..494b71483ff9 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap_user.h +++ b/keyboards/keychron/c1_pro/ansi_v2/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Mike Killewald +/* Copyright 2020 QMK * * 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 @@ -16,18 +16,19 @@ #pragma once -// clang-format off +#include_next -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U -// clang-format on +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 -bool get_caps_lock_light_tab(void); -bool get_caps_lock_light_alphas(void); -bool get_fn_layer_transparent_keys_off(void); -bool get_fn_layer_color_enable(void); \ No newline at end of file +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/info.json b/keyboards/keychron/c1_pro/ansi_v2/non_light/info.json new file mode 100755 index 000000000000..f5e6d54ff396 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/info.json @@ -0,0 +1,6 @@ +{ + "usb": { + "pid": "0x051C", + "device_version": "1.0.0" + } +} diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/default/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/default/keymap.c new file mode 100755 index 000000000000..dd38d7a611e5 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..55d35b47aaaf --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/keymap.c @@ -0,0 +1,73 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..ae08d15e5100 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/keychron/rules.mk @@ -0,0 +1,6 @@ +VIA_ENABLE = yes + +VPATH += keyboards/keychron/common +SRC += \ + keychron_common.c \ + keychron_ft_c1_pro_ansi_v2_non_light.c diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/via/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/via/keymap.c new file mode 100755 index 000000000000..2afe6640785b --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, KC_SLEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/via/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c2_pro/ansi/rgb/keymaps/via/rules.mk rename to keyboards/keychron/c1_pro/ansi_v2/non_light/keymaps/via/rules.mk diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/non_light.c b/keyboards/keychron/c1_pro/ansi_v2/non_light/non_light.c new file mode 100755 index 000000000000..4e257bb6509e --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/non_light.c @@ -0,0 +1,43 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" +#include "keychron_ft_c1_pro_ansi_v2_non_light.h" + +void housekeeping_task_kb(void) { + if (!factory_reset_flag) { + if (default_layer_state == (1 << 0)) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + } + if (default_layer_state == (1 << 2)) { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + } + } + factory_reset_task(); + factory_reset_ind_task(); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res && (!factory_reset_flag)) { +#ifdef LED_CAPS_LOCK_PIN + writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock); +#endif + } + return res; +} diff --git a/keyboards/keychron/c1_pro/ansi_v2/non_light/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/non_light/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/non_light/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/config.h b/keyboards/keychron/c1_pro/ansi_v2/rgb/config.h old mode 100644 new mode 100755 similarity index 53% rename from keyboards/keychron/q2/ansi/keymaps/ladduro/config.h rename to keyboards/keychron/c1_pro/ansi_v2/rgb/config.h index a8ad37d0036e..ba4f2216a9b4 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/config.h +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/config.h @@ -1,4 +1,4 @@ -/* Copyright 2022 @ Ionut Micu +/* Copyright 2023 @ Keychron (https://www.keychron.com) * * 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 @@ -16,10 +16,26 @@ #pragma once -/* RGB Matrix Configuration */ #ifdef RGB_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 2 +# define DRIVER_ADDR_1 0b1110111 +# define DRIVER_ADDR_2 0b1110100 + +/* RGB Matrix Configuration */ +# define RGB_MATRIX_LED_COUNT 87 + +/* turn off effects when suspended */ # define RGB_DISABLE_WHEN_USB_SUSPENDED -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define CAPS_LOCK_INDICATOR_LIGHT_ALPHAS -# define FN_LAYER_TRANSPARENT_KEYS_OFF -#endif \ No newline at end of file + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28 } + +/* RGB Matrix Animation modes. Explicitly enabled + * For full list of effects, see: + * https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects + */ +# define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif diff --git a/keyboards/keychron/c1_pro/ansi_v2/rgb/info.json b/keyboards/keychron/c1_pro/ansi_v2/rgb/info.json new file mode 100755 index 000000000000..07ae68bd5cfe --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/info.json @@ -0,0 +1,129 @@ +{ + "usb": { + "pid": "0x0516", + "device_version": "1.0.0" + }, + "features": { + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "breathing": true, + "band_spiral_val": 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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[0, 16], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[1, 16], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":20, "y":27}, + {"matrix":[2, 2], "flags":4, "x":33, "y":27}, + {"matrix":[2, 3], "flags":4, "x":46, "y":27}, + {"matrix":[2, 4], "flags":4, "x":59, "y":27}, + {"matrix":[2, 5], "flags":4, "x":72, "y":27}, + {"matrix":[2, 6], "flags":4, "x":85, "y":27}, + {"matrix":[2, 7], "flags":4, "x":98, "y":27}, + {"matrix":[2, 8], "flags":4, "x":111, "y":27}, + {"matrix":[2, 9], "flags":4, "x":124, "y":27}, + {"matrix":[2, 10], "flags":4, "x":137, "y":27}, + {"matrix":[2, 11], "flags":4, "x":150, "y":27}, + {"matrix":[2, 12], "flags":4, "x":163, "y":27}, + {"matrix":[2, 13], "flags":1, "x":179, "y":27}, + {"matrix":[2, 14], "flags":1, "x":198, "y":27}, + {"matrix":[2, 15], "flags":1, "x":211, "y":27}, + {"matrix":[2, 16], "flags":1, "x":224, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":39}, + {"matrix":[3, 1], "flags":4, "x":23, "y":39}, + {"matrix":[3, 2], "flags":4, "x":36, "y":39}, + {"matrix":[3, 3], "flags":4, "x":49, "y":39}, + {"matrix":[3, 4], "flags":4, "x":62, "y":39}, + {"matrix":[3, 5], "flags":4, "x":75, "y":39}, + {"matrix":[3, 6], "flags":4, "x":88, "y":39}, + {"matrix":[3, 7], "flags":4, "x":101, "y":39}, + {"matrix":[3, 8], "flags":4, "x":114, "y":39}, + {"matrix":[3, 9], "flags":4, "x":127, "y":39}, + {"matrix":[3, 10], "flags":4, "x":140, "y":39}, + {"matrix":[3, 11], "flags":4, "x":153, "y":39}, + {"matrix":[3, 13], "flags":1, "x":174, "y":39}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":82, "y":52}, + {"matrix":[4, 7], "flags":4, "x":95, "y":52}, + {"matrix":[4, 8], "flags":4, "x":108, "y":52}, + {"matrix":[4, 9], "flags":4, "x":121, "y":52}, + {"matrix":[4, 10], "flags":4, "x":134, "y":52}, + {"matrix":[4, 11], "flags":4, "x":147, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":132, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":165, "y":64}, + {"matrix":[5, 13], "flags":1, "x":181, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[5, 16], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/default/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/default/keymap.c old mode 100644 new mode 100755 similarity index 97% rename from keyboards/keychron/c1_pro/ansi/rgb/keymaps/default/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/default/keymap.c index 636e83b52752..5337215bc6e6 --- a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/default/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/default/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, @@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), [WIN_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, _______, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, diff --git a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/keymap.c old mode 100644 new mode 100755 similarity index 94% rename from keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/keymap.c index 2b5a1957cd6c..b914ea2b6931 --- a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -62,11 +64,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/via/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/via/keymap.c old mode 100644 new mode 100755 similarity index 98% rename from keyboards/keychron/c1_pro/ansi/rgb/keymaps/via/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/via/keymap.c index 636e83b52752..b0312e1137e7 --- a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/via/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, diff --git a/keyboards/keychron/c2_pro/ansi/white/keymaps/via/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c2_pro/ansi/white/keymaps/via/rules.mk rename to keyboards/keychron/c1_pro/ansi_v2/rgb/keymaps/via/rules.mk diff --git a/keyboards/keychron/c1_pro/ansi_v2/rgb/rgb.c b/keyboards/keychron/c1_pro/ansi_v2/rgb/rgb.c new file mode 100755 index 000000000000..da824ef11828 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/rgb.c @@ -0,0 +1,134 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef RGB_MATRIX_ENABLE + +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, I_1, G_1, H_1}, + {0, I_2, G_2, H_2}, + {0, I_3, G_3, H_3}, + {0, I_4, G_4, H_4}, + {0, I_5, G_5, H_5}, + {0, I_6, G_6, H_6}, + {0, I_7, G_7, H_7}, + {0, I_8, G_8, H_8}, + {0, I_9, G_9, H_9}, + {0, I_10, G_10, H_10}, + {0, I_11, G_11, H_11}, + {0, I_12, G_12, H_12}, + {0, I_13, G_13, H_13}, + {0, I_15, G_15, H_15}, + {0, I_16, G_16, H_16}, + {0, L_5, J_5, K_5}, + + {0, C_1, A_1, B_1}, + {0, C_2, A_2, B_2}, + {0, C_3, A_3, B_3}, + {0, C_4, A_4, B_4}, + {0, C_5, A_5, B_5}, + {0, C_6, A_6, B_6}, + {0, C_7, A_7, B_7}, + {0, C_8, A_8, B_8}, + {0, C_9, A_9, B_9}, + {0, C_10, A_10, B_10}, + {0, C_11, A_11, B_11}, + {0, C_12, A_12, B_12}, + {0, C_13, A_13, B_13}, + {0, C_14, A_14, B_14}, + {0, C_15, A_15, B_15}, + {0, C_16, A_16, B_16}, + {0, L_9, J_9, K_9}, + + {0, F_1, D_1, E_1}, + {0, F_2, D_2, E_2}, + {0, F_3, D_3, E_3}, + {0, F_4, D_4, E_4}, + {0, F_5, D_5, E_5}, + {0, F_6, D_6, E_6}, + {0, F_7, D_7, E_7}, + {0, F_8, D_8, E_8}, + {0, F_9, D_9, E_9}, + {0, F_10, D_10, E_10}, + {0, F_11, D_11, E_11}, + {0, F_12, D_12, E_12}, + {0, F_13, D_13, E_13}, + {0, F_14, D_14, E_14}, + {0, F_15, D_15, E_15}, + {0, F_16, D_16, E_16}, + {0, L_14, J_14, K_14}, + + {1, C_16, A_16, B_16}, + {1, C_15, A_15, B_15}, + {1, C_14, A_14, B_14}, + {1, C_13, A_13, B_13}, + {1, C_12, A_12, B_12}, + {1, C_11, A_11, B_11}, + {1, C_10, A_10, B_10}, + {1, C_9, A_9, B_9}, + {1, C_8, A_8, B_8}, + {1, C_7, A_7, B_7}, + {1, C_6, A_6, B_6}, + {1, C_5, A_5, B_5}, + {1, C_3, A_3, B_3}, + + {1, I_16, G_16, H_16}, + {1, I_14, G_14, H_14}, + {1, I_13, G_13, H_13}, + {1, I_12, G_12, H_12}, + {1, I_11, G_11, H_11}, + {1, I_10, G_10, H_10}, + {1, I_9, G_9, H_9}, + {1, I_8, G_8, H_8}, + {1, I_7, G_7, H_7}, + {1, I_6, G_6, H_6}, + {1, I_5, G_5, H_5}, + {1, I_3, G_3, H_3}, + {1, I_1, G_1, H_1}, + + {1, F_16, D_16, E_16}, + {1, F_15, D_15, E_15}, + {1, F_14, D_14, E_14}, + {1, F_10, D_10, E_10}, + {1, F_6, D_6, E_6}, + {1, F_5, D_5, E_5}, + {1, F_4, D_4, E_4}, + {1, F_3, D_3, E_3}, + {1, F_2, D_2, E_2}, + {1, F_1, D_1, E_1}, + {1, L_10, J_10, K_10}, +}; +#endif // RGB_MATRIX_ENABLE + +// clang-format on +void housekeeping_task_kb(void) { + if (default_layer_state == (1 << 0)) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + } + if (default_layer_state == (1 << 2)) { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + } +} diff --git a/keyboards/keychron/c1_pro/ansi_v2/rgb/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/rgb/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/rgb/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c1_pro/ansi_v2/white/config.h b/keyboards/keychron/c1_pro/ansi_v2/white/config.h new file mode 100755 index 000000000000..4d2b19e7fcc0 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/white/config.h @@ -0,0 +1,41 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 87 + +/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/c1_pro/ansi_v2/white/info.json b/keyboards/keychron/c1_pro/ansi_v2/white/info.json new file mode 100755 index 000000000000..e87577387266 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/white/info.json @@ -0,0 +1,124 @@ +{ + "usb": { + "pid": "0x0519", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[0, 16], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[1, 16], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":20, "y":27}, + {"matrix":[2, 2], "flags":4, "x":33, "y":27}, + {"matrix":[2, 3], "flags":4, "x":46, "y":27}, + {"matrix":[2, 4], "flags":4, "x":59, "y":27}, + {"matrix":[2, 5], "flags":4, "x":72, "y":27}, + {"matrix":[2, 6], "flags":4, "x":85, "y":27}, + {"matrix":[2, 7], "flags":4, "x":98, "y":27}, + {"matrix":[2, 8], "flags":4, "x":111, "y":27}, + {"matrix":[2, 9], "flags":4, "x":124, "y":27}, + {"matrix":[2, 10], "flags":4, "x":137, "y":27}, + {"matrix":[2, 11], "flags":4, "x":150, "y":27}, + {"matrix":[2, 12], "flags":4, "x":163, "y":27}, + {"matrix":[2, 13], "flags":1, "x":179, "y":27}, + {"matrix":[2, 14], "flags":1, "x":198, "y":27}, + {"matrix":[2, 15], "flags":1, "x":211, "y":27}, + {"matrix":[2, 16], "flags":1, "x":224, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":39}, + {"matrix":[3, 1], "flags":4, "x":23, "y":39}, + {"matrix":[3, 2], "flags":4, "x":36, "y":39}, + {"matrix":[3, 3], "flags":4, "x":49, "y":39}, + {"matrix":[3, 4], "flags":4, "x":62, "y":39}, + {"matrix":[3, 5], "flags":4, "x":75, "y":39}, + {"matrix":[3, 6], "flags":4, "x":88, "y":39}, + {"matrix":[3, 7], "flags":4, "x":101, "y":39}, + {"matrix":[3, 8], "flags":4, "x":114, "y":39}, + {"matrix":[3, 9], "flags":4, "x":127, "y":39}, + {"matrix":[3, 10], "flags":4, "x":140, "y":39}, + {"matrix":[3, 11], "flags":4, "x":153, "y":39}, + {"matrix":[3, 13], "flags":1, "x":174, "y":39}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":82, "y":52}, + {"matrix":[4, 7], "flags":4, "x":95, "y":52}, + {"matrix":[4, 8], "flags":4, "x":108, "y":52}, + {"matrix":[4, 9], "flags":4, "x":121, "y":52}, + {"matrix":[4, 10], "flags":4, "x":134, "y":52}, + {"matrix":[4, 11], "flags":4, "x":147, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":132, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":165, "y":64}, + {"matrix":[5, 13], "flags":1, "x":181, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[5, 16], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/c1_pro/ansi/white/keymaps/default/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/default/keymap.c old mode 100644 new mode 100755 similarity index 98% rename from keyboards/keychron/c1_pro/ansi/white/keymaps/default/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/white/keymaps/default/keymap.c index a829c1189226..6430412635b2 --- a/keyboards/keychron/c1_pro/ansi/white/keymaps/default/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 202 @ Keychron (https://www.keychron.com) * * 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 @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, diff --git a/keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/keymap.c old mode 100644 new mode 100755 similarity index 93% rename from keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/keymap.c index e17d67eb7188..851d51d2f12e --- a/keyboards/keychron/c1_pro/ansi/white/keymaps/keychron/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -58,13 +60,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; +// clang-format on + void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c1_pro/ansi/white/keymaps/via/keymap.c b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/via/keymap.c old mode 100644 new mode 100755 similarity index 98% rename from keyboards/keychron/c1_pro/ansi/white/keymaps/via/keymap.c rename to keyboards/keychron/c1_pro/ansi_v2/white/keymaps/via/keymap.c index a829c1189226..d90c149768a6 --- a/keyboards/keychron/c1_pro/ansi/white/keymaps/via/keymap.c +++ b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, diff --git a/keyboards/keychron/q1/ansi/keymaps/via/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/white/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/q1/ansi/keymaps/via/rules.mk rename to keyboards/keychron/c1_pro/ansi_v2/white/keymaps/via/rules.mk diff --git a/keyboards/keychron/c1_pro/ansi_v2/white/rules.mk b/keyboards/keychron/c1_pro/ansi_v2/white/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/white/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c1_pro/ansi_v2/white/white.c b/keyboards/keychron/c1_pro/ansi_v2/white/white.c new file mode 100755 index 000000000000..9243b5278f66 --- /dev/null +++ b/keyboards/keychron/c1_pro/ansi_v2/white/white.c @@ -0,0 +1,132 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, A_16}, + {0, A_15}, + {0, A_14}, + {0, A_13}, + {0, A_12}, + {0, A_11}, + {0, A_10}, + {0, A_9 }, + {0, A_8 }, + {0, A_7 }, + {0, A_6 }, + {0, A_5 }, + {0, A_4 }, + {0, A_2 }, + {0, A_1 }, + {0, G_1 }, + + {0, B_16}, + {0, B_15}, + {0, B_14}, + {0, B_13}, + {0, B_12}, + {0, B_11}, + {0, B_10}, + {0, B_9 }, + {0, B_8 }, + {0, B_7 }, + {0, B_6 }, + {0, B_5 }, + {0, B_4 }, + {0, B_3 }, + {0, B_2 }, + {0, B_1 }, + {0, H_1 }, + + {0, C_16}, + {0, C_15}, + {0, C_14}, + {0, C_13}, + {0, C_12}, + {0, C_11}, + {0, C_10}, + {0, C_9 }, + {0, C_8 }, + {0, C_7 }, + {0, C_6 }, + {0, C_5 }, + {0, C_4 }, + {0, C_3 }, + {0, C_2 }, + {0, C_1 }, + {0, G_6 }, + + {0, D_16}, + {0, D_15}, + {0, D_14}, + {0, D_13}, + {0, D_12}, + {0, D_11}, + {0, D_10}, + {0, D_9 }, + {0, D_8 }, + {0, D_7 }, + {0, D_6 }, + {0, D_5 }, + {0, D_3 }, + + {0, E_16}, + {0, E_14}, + {0, E_13}, + {0, E_12}, + {0, E_11}, + {0, E_10}, + {0, E_9 }, + {0, E_8 }, + {0, E_7 }, + {0, E_6 }, + {0, E_5 }, + {0, E_3 }, + {0, E_1 }, + + {0, F_16}, + {0, F_15}, + {0, F_14}, + {0, F_10}, + {0, F_6 }, + {0, F_5 }, + {0, F_4 }, + {0, F_3 }, + {0, F_2 }, + {0, F_1 }, + {0, G_13}, +}; +#endif + +// clang-format on +void housekeeping_task_kb(void) { + if (default_layer_state == (1 << 0)) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + } + if (default_layer_state == (1 << 2)) { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + } +} + diff --git a/keyboards/keychron/c1_pro/config.h b/keyboards/keychron/c1_pro/config.h old mode 100644 new mode 100755 index 2d8149047125..473da47b3ef0 --- a/keyboards/keychron/c1_pro/config.h +++ b/keyboards/keychron/c1_pro/config.h @@ -16,22 +16,10 @@ #pragma once -/* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } } - -/* Disable DIP switch in matrix data */ -#define MATRIX_MASKED - /* EEPROM Driver Configuration */ #define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) -/* Increase I2C speed to 1000 KHz */ -#define I2C1_TIMINGR_PRESC 0U -#define I2C1_TIMINGR_SCLDEL 3U -#define I2C1_TIMINGR_SDADEL 0U -#define I2C1_TIMINGR_SCLH 15U -#define I2C1_TIMINGR_SCLL 51U - -/* Old default behavior of mod-taps */ -#define HOLD_ON_OTHER_KEY_PRESS +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/c1_pro/info.json b/keyboards/keychron/c1_pro/info.json old mode 100644 new mode 100755 index 9c9b4bf16f85..87967a5c3056 --- a/keyboards/keychron/c1_pro/info.json +++ b/keyboards/keychron/c1_pro/info.json @@ -3,8 +3,6 @@ "manufacturer": "Keychron", "url": "https://github.com/Keychron", "maintainer": "lalalademaxiya1", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "usb": { "vid": "0x3434" }, @@ -16,11 +14,5 @@ "extrakey": true, "mousekey": true, "nkro": true - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"], - "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "community_layouts": ["tkl_ansi"] + } } diff --git a/keyboards/keychron/c1_pro/readme.md b/keyboards/keychron/c1_pro/readme.md old mode 100644 new mode 100755 index 7e9d0e905870..163ede264f5d --- a/keyboards/keychron/c1_pro/readme.md +++ b/keyboards/keychron/c1_pro/readme.md @@ -10,14 +10,25 @@ A customizable 80% TKL keyboard. Make example for this keyboard (after setting up your build environment): - make keychron/c1/ansi/rgb:default - make keychron/c1/ansi/white:default + make keychron/c1/ansi_v1/rgb:default + make keychron/c1/ansi_v1/white:default + make keychron/c1/ansi_v2/rgb:default + make keychron/c1/ansi_v2/white:default + make keychron/c1/ansi_v2/non_light:default Flashing example for this keyboard: - make keychron/c1/ansi/rgb:default:flash - make keychron/c1/ansi/white:default:flash + make keychron/c1/ansi_v1/rgb:default:flash + make keychron/c1/ansi_v1/white:default:flash + make keychron/c1/ansi_v2/rgb:default:flash + make keychron/c1/ansi_v2/white:default:flash + make keychron/c1/ansi_v2/non_light:default:flash -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_rgb.json b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_rgb.json new file mode 100755 index 000000000000..3d0bcb7f7d61 --- /dev/null +++ b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_rgb.json @@ -0,0 +1,285 @@ +{ + "name": "Keychron C1 Pro ANSI RGB", + "vendorId": "0x3434", + "productId": "0x0510", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "matrix": {"rows": 6, "cols": 16}, + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "3,14" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "3,15" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "w": 1.5, + "c": "#aaaaaa" + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "3,12" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "4,14" + ] + ] + } +} diff --git a/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_white.json b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_white.json new file mode 100755 index 000000000000..ba0789c97a20 --- /dev/null +++ b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v1_white.json @@ -0,0 +1,224 @@ +{ + "name": "Keychron C1 Pro ANSI White", + "vendorId": "0x3434", + "productId": "0x0513", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 16}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,13" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "3,12" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "3,14" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "3,15" + ] + ] + } +} diff --git a/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_non_light.json b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_non_light.json new file mode 100755 index 000000000000..80c8bdf9a15a --- /dev/null +++ b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_non_light.json @@ -0,0 +1,223 @@ +{ + "name": "Keychron C1 Pro V2 ANSI Non Light", + "vendorId": "0x3434", + "productId": "0x051C", + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_rgb.json b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_rgb.json new file mode 100755 index 000000000000..4114ce78f29e --- /dev/null +++ b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_rgb.json @@ -0,0 +1,285 @@ +{ + "name": "Keychron C1 Pro V2 ANSI RGB", + "vendorId": "0x3434", + "productId": "0x0516", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "customKeycodes": [ + {"name": "Mission Control", "title": "Mission Control in macOS", "shortName": "MCtrl"}, + {"name": "Launch Pad", "title": "Launch Pad in macOS", "shortName": "LPad"}, + {"name": "Left Option", "title": "Left Option in macOS", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option in macOS", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command in macOS", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command in macOS", "shortName": "RCmd"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in windows", "shortName": "File"}, + {"name": "Screen Shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in windows", "shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_white.json b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_white.json new file mode 100755 index 000000000000..e1e8dbb12320 --- /dev/null +++ b/keyboards/keychron/c1_pro/via_json/c1_pro_ansi_v2_white.json @@ -0,0 +1,224 @@ +{ + "name": "Keychron C1 Pro V2 ANSI White", + "vendorId": "0x3434", + "productId": "0x0519", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/rules.mk deleted file mode 100644 index 495e8907b48c..000000000000 --- a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/c2_pro/ansi/rgb/rules.mk b/keyboards/keychron/c2_pro/ansi/rgb/rules.mk deleted file mode 100644 index dab155104922..000000000000 --- a/keyboards/keychron/c2_pro/ansi/rgb/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -# Build Options -SRC += matrix.c diff --git a/keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/rules.mk deleted file mode 100644 index 495e8907b48c..000000000000 --- a/keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/c2_pro/ansi/white/rules.mk b/keyboards/keychron/c2_pro/ansi/white/rules.mk deleted file mode 100644 index dab155104922..000000000000 --- a/keyboards/keychron/c2_pro/ansi/white/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -# Build Options -SRC += matrix.c diff --git a/keyboards/keychron/c2_pro/c2_pro.c b/keyboards/keychron/c2_pro/ansi_v1/ansi_v1.c old mode 100644 new mode 100755 similarity index 52% rename from keyboards/keychron/c2_pro/c2_pro.c rename to keyboards/keychron/c2_pro/ansi_v1/ansi_v1.c index 2cd58ab4d796..554b7ac67123 --- a/keyboards/keychron/c2_pro/c2_pro.c +++ b/keyboards/keychron/c2_pro/ansi_v1/ansi_v1.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -42,12 +42,9 @@ bool dip_switch_update_kb(uint8_t index, bool active) { #endif // DIP_SWITCH_ENABLE +#if (defined(RGB_MATRIX_ENABLE) || defined(LED_MATRIX_ENABLE)) + # ifdef RGB_MATRIX_ENABLE -# define LED_SET_FLAGS rgb_matrix_set_flags -# define LED_GET_FLAGS rgb_matrix_get_flags -# define LED_SET_ALL_OFF rgb_matrix_set_color_all(COLOR_BLACK) -# define LED_IS_ENABLED rgb_matrix_is_enabled -# define LED_ENABLE rgb_matrix_enable # define LED_MATRIX_INDICATORS_KB rgb_matrix_indicators_kb # define LED_MATRIX_INDICATORS_USER rgb_matrix_indicators_user # define LED_MATRIX_SET_COLOR rgb_matrix_set_color @@ -59,11 +56,6 @@ bool dip_switch_update_kb(uint8_t index, bool active) { # endif # ifdef LED_MATRIX_ENABLE -# define LED_SET_FLAGS led_matrix_set_flags -# define LED_GET_FLAGS led_matrix_get_flags -# define LED_SET_ALL_OFF led_matrix_set_value_all(COLOR_BLACK) -# define LED_IS_ENABLED led_matrix_is_enabled -# define LED_ENABLE led_matrix_enable # define LED_MATRIX_INDICATORS_KB led_matrix_indicators_kb # define LED_MATRIX_INDICATORS_USER led_matrix_indicators_user # define LED_MATRIX_SET_COLOR led_matrix_set_value @@ -72,58 +64,91 @@ bool dip_switch_update_kb(uint8_t index, bool active) { # define LED_MATRIX_IS_ENABLED led_matrix_is_enabled # define COLOR_WHITE 255 # define COLOR_BLACK 0 +# endif -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { - case RGB_TOG: - if (record->event.pressed) { - switch (LED_GET_FLAGS()) { - case LED_FLAG_ALL: { - LED_SET_FLAGS(LED_FLAG_NONE); - LED_SET_ALL_OFF; - } break; - default: { - LED_SET_FLAGS(LED_FLAG_ALL); - } break; - } - } - if (!LED_IS_ENABLED()) { - LED_SET_FLAGS(LED_FLAG_ALL); - LED_ENABLE(); - } - return false; - } - return true; -} +extern void LED_MATRIX_UPDATE_PWN_BUFFERS(void); bool LED_MATRIX_INDICATORS_KB(void) { if (!LED_MATRIX_INDICATORS_USER()) { return false; } if (host_keyboard_led_state().caps_lock) { - LED_MATRIX_SET_COLOR(CAPS_LED_INDEX, COLOR_WHITE); + LED_MATRIX_SET_COLOR(CAPS_LOCK_LED_INDEX, COLOR_WHITE); } else { - LED_MATRIX_SET_COLOR(CAPS_LED_INDEX, COLOR_BLACK); + LED_MATRIX_SET_COLOR(CAPS_LOCK_LED_INDEX, COLOR_BLACK); } if (host_keyboard_led_state().num_lock) { - LED_MATRIX_SET_COLOR(NUM_LED_INDEX, COLOR_WHITE); + LED_MATRIX_SET_COLOR(NUM_LOCK_LED_INDEX, COLOR_WHITE); } else { - LED_MATRIX_SET_COLOR(NUM_LED_INDEX, COLOR_BLACK); + LED_MATRIX_SET_COLOR(NUM_LOCK_LED_INDEX, COLOR_BLACK); } if (default_layer_state == (1 << 0)) { - LED_MATRIX_SET_COLOR(MAC_LED_INDEX, COLOR_WHITE); + LED_MATRIX_SET_COLOR(MAC_OS_LED_INDEX, COLOR_WHITE); } else { - LED_MATRIX_SET_COLOR(MAC_LED_INDEX, COLOR_BLACK); + LED_MATRIX_SET_COLOR(MAC_OS_LED_INDEX, COLOR_BLACK); } if (default_layer_state == (1 << 2)) { - LED_MATRIX_SET_COLOR(WIN_LED_INDEX, COLOR_WHITE); + LED_MATRIX_SET_COLOR(WIN_OS_LED_INDEX, COLOR_WHITE); } else { - LED_MATRIX_SET_COLOR(WIN_LED_INDEX, COLOR_BLACK); + LED_MATRIX_SET_COLOR(WIN_OS_LED_INDEX, COLOR_BLACK); } return true; } +void LED_MATRIX_INDICATORS_NONE_KB(void) { + LED_MATRIX_INDICATORS_KB(); + LED_MATRIX_UPDATE_PWN_BUFFERS(); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + + if (LED_MATRIX_IS_ENABLED() +# if defined(RGB_MATRIX_ENABLE) +# if defined(ENABLE_RGB_MATRIX_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_JELLYBEAN_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_PIXEL_RAIN) + && (rgb_matrix_get_mode() != RGB_MATRIX_PIXEL_RAIN) +# endif +# endif + ) { + return res; + } + + if (res) { + if (led_state.num_lock) { + LED_MATRIX_SET_COLOR(NUM_LOCK_LED_INDEX, COLOR_WHITE); + } else { + LED_MATRIX_SET_COLOR(NUM_LOCK_LED_INDEX, COLOR_BLACK); + } + if (led_state.caps_lock) { + LED_MATRIX_SET_COLOR(CAPS_LOCK_LED_INDEX, COLOR_WHITE); + } else { + LED_MATRIX_SET_COLOR(CAPS_LOCK_LED_INDEX, COLOR_BLACK); + } + LED_MATRIX_UPDATE_PWN_BUFFERS(); + } + return res; +} + +void housekeeping_task_kb(void) { + if (!LED_MATRIX_IS_ENABLED()) { + if (default_layer_state == (1 << 0)) { + LED_MATRIX_SET_COLOR(MAC_OS_LED_INDEX, COLOR_WHITE); + } else { + LED_MATRIX_SET_COLOR(MAC_OS_LED_INDEX, COLOR_BLACK); + } + if (default_layer_state == (1 << 2)) { + LED_MATRIX_SET_COLOR(WIN_OS_LED_INDEX, COLOR_WHITE); + } else { + LED_MATRIX_SET_COLOR(WIN_OS_LED_INDEX, COLOR_BLACK); + } + LED_MATRIX_UPDATE_PWN_BUFFERS(); + } +} + #endif diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/keymap_user.h b/keyboards/keychron/c2_pro/ansi_v1/config.h old mode 100644 new mode 100755 similarity index 50% rename from keyboards/keychron/q1/ansi/keymaps/teimor/keymap_user.h rename to keyboards/keychron/c2_pro/ansi_v1/config.h index 57ac5258c267..0353982f6dc2 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/keymap_user.h +++ b/keyboards/keychron/c2_pro/ansi_v1/config.h @@ -1,4 +1,4 @@ -/* Copyright 2022 @ Teimor Epstein +/* Copyright 2022 @ Keychron(https://www.keychron.com) * * 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 @@ -16,33 +16,28 @@ #pragma once -// clang-format off +/* DIP switch */ +#define DIP_SWITCH_MATRIX_GRID { {5, 4}, } -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; +/* Disable DIP switch in matrix data */ +#define MATRIX_MASKED -// clang-format on +/* Increase I2C speed to 1000 KHz */ +#define I2C1_TIMINGR_PRESC 0U +#define I2C1_TIMINGR_SCLDEL 3U +#define I2C1_TIMINGR_SDADEL 0U +#define I2C1_TIMINGR_SCLH 15U +#define I2C1_TIMINGR_SCLL 51U -// Tap dance enums -enum { - MAC_CAPS_LANGUAGE_CHANGE, - WIN_CAPS_LANGUAGE_CHANGE, -}; +/* Enable indicator LED*/ +#define NUM_LOCK_LED_INDEX 16 +#define CAPS_LOCK_LED_INDEX 17 +#define MAC_OS_LED_INDEX 18 +#define WIN_OS_LED_INDEX 19 -#ifdef TAP_DANCE_ENABLE -# define KC_LGMAC TD(MAC_CAPS_LANGUAGE_CHANGE) -# define KC_LGWIN TD(WIN_CAPS_LANGUAGE_CHANGE) -#else -# define KC_LGMAC KC_CAPS -# define KC_LGWIN KC_CAPS -#endif -#define KC_MACFN MO(MAC_FN) -#define KC_WINFN MO(WIN_FN) -#define KC_LMAC C(G(KC_Q)) -#define KC_MACPS G(S(KC_5)) -#define KC_TASK G(KC_TAB) -#define KC_FLXP G(KC_E) +/* HC595 driver definition */ +#define HC595_STCP A0 +#define HC595_SHCP A1 +#define HC595_DS C15 +#define HC595_START_INDEX 11 +#define HC595_END_INDEX 19 diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/keymap_user.h b/keyboards/keychron/c2_pro/ansi_v1/halconf.h old mode 100644 new mode 100755 similarity index 84% rename from keyboards/keychron/q2/ansi/keymaps/ladduro/keymap_user.h rename to keyboards/keychron/c2_pro/ansi_v1/halconf.h index ded78ae1b8eb..41bddcb2799b --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/keymap_user.h +++ b/keyboards/keychron/c2_pro/ansi_v1/halconf.h @@ -1,4 +1,4 @@ -/* Copyright 2022 @ Ionut Micu +/* Copyright 2020 QMK * * 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 @@ -16,12 +16,6 @@ #pragma once -// clang-format off +#define HAL_USE_I2C TRUE -enum layers{ - MAC_BASE, - WIN_BASE, - _FN1, - _FN2, - _FN3, -}; \ No newline at end of file +#include_next diff --git a/keyboards/keychron/c2_pro/ansi_v1/info.json b/keyboards/keychron/c2_pro/ansi_v1/info.json new file mode 100755 index 000000000000..dbbac17193ba --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/info.json @@ -0,0 +1,11 @@ +{ + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", null, null, null, null, null, null, null, null, "C14"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, + "diode_direction": "ROW2COL" +} diff --git a/keyboards/keychron/c2_pro/mcuconf.h b/keyboards/keychron/c2_pro/ansi_v1/mcuconf.h old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/c2_pro/mcuconf.h rename to keyboards/keychron/c2_pro/ansi_v1/mcuconf.h diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/config.h b/keyboards/keychron/c2_pro/ansi_v1/rgb/config.h old mode 100644 new mode 100755 similarity index 54% rename from keyboards/keychron/q1/ansi/keymaps/teimor/config.h rename to keyboards/keychron/c2_pro/ansi_v1/rgb/config.h index 4378af4f5825..92ebb2880249 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/config.h +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/config.h @@ -1,4 +1,4 @@ -/* Copyright 2022 @ Teimor Epstein +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -16,17 +16,25 @@ #pragma once -#undef TAPPING_TERM -#define TAPPING_TERM 200 +#ifdef RGB_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 2 +# define DRIVER_ADDR_1 0b1110111 +# define DRIVER_ADDR_2 0b1110100 /* RGB Matrix Configuration */ -#ifdef RGB_MATRIX_ENABLE +# define RGB_MATRIX_LED_COUNT 108 + +/* turn off effects when suspended */ # define RGB_DISABLE_WHEN_USB_SUSPENDED -# define MAC_LAYER_DEFAULT_COLOR RGB_CYAN -# define WIN_LAYER_DEFAULT_COLOR RGB_GREEN -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define CAPS_LOCK_INDICATOR_LIGHT_60 -# define FN_LAYER_TRANSPARENT_KEYS_OFF -# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR // Sets the default mode, if none has been set -# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56 } + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +# define RGB_MATRIX_KEYPRESSES #endif diff --git a/keyboards/keychron/c2_pro/ansi/rgb/info.json b/keyboards/keychron/c2_pro/ansi_v1/rgb/info.json old mode 100644 new mode 100755 similarity index 99% rename from keyboards/keychron/c2_pro/ansi/rgb/info.json rename to keyboards/keychron/c2_pro/ansi_v1/rgb/info.json index e527af3371c1..5630dfc13b43 --- a/keyboards/keychron/c2_pro/ansi/rgb/info.json +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/info.json @@ -1,13 +1,13 @@ { "usb": { "pid": "0x0520", - "device_version": "1.0.0" + "device_version": "1.0.2" }, "features": { "rgb_matrix": true }, "layouts": { - "LAYOUT": { + "LAYOUT_104_ansi": { "layout": [ {"matrix":[0, 0], "x":0, "y":0}, {"matrix":[0, 1], "x":2, "y":0}, diff --git a/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/default/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/default/keymap.c new file mode 100755 index 000000000000..b4aefb385d73 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..648de119f454 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/keymap.c @@ -0,0 +1,75 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/via/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/via/keymap.c new file mode 100755 index 000000000000..bf28c679f3a8 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/q1/iso/keymaps/via/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/via/rules.mk old mode 100644 new mode 100755 similarity index 100% rename from keyboards/keychron/q1/iso/keymaps/via/rules.mk rename to keyboards/keychron/c2_pro/ansi_v1/rgb/keymaps/via/rules.mk diff --git a/keyboards/keychron/c2_pro/ansi/rgb/rgb.c b/keyboards/keychron/c2_pro/ansi_v1/rgb/rgb.c old mode 100644 new mode 100755 similarity index 98% rename from keyboards/keychron/c2_pro/ansi/rgb/rgb.c rename to keyboards/keychron/c2_pro/ansi_v1/rgb/rgb.c index 998933081f1c..23f014121058 --- a/keyboards/keychron/c2_pro/ansi/rgb/rgb.c +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/rgb.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -16,6 +16,7 @@ #include "quantum.h" +// clang-format off #ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to CKLED2001 manual for these locations @@ -139,4 +140,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_11, J_11, K_11}, {1, L_12, J_12, K_12}, }; -#endif //RGB_MATRIX_ENABLE +#endif diff --git a/keyboards/keychron/c2_pro/ansi_v1/rgb/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/rgb/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rgb/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c2_pro/ansi_v1/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/rules.mk new file mode 100755 index 000000000000..2f2902b17297 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/rules.mk @@ -0,0 +1,2 @@ +VPATH += keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/config.h b/keyboards/keychron/c2_pro/ansi_v1/white/config.h new file mode 100755 index 000000000000..7f81dc885a34 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/config.h @@ -0,0 +1,43 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* LED Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 108 + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +/* Use the first 8 channels of led driver */ +# define PHASE_CHANNEL MSKPHASE_8CHANNEL + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0 } + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/c2_pro/ansi/white/info.json b/keyboards/keychron/c2_pro/ansi_v1/white/info.json old mode 100644 new mode 100755 similarity index 99% rename from keyboards/keychron/c2_pro/ansi/white/info.json rename to keyboards/keychron/c2_pro/ansi_v1/white/info.json index dc58d1943bbd..81b9c08f08d2 --- a/keyboards/keychron/c2_pro/ansi/white/info.json +++ b/keyboards/keychron/c2_pro/ansi_v1/white/info.json @@ -1,13 +1,13 @@ { "usb": { "pid": "0x0523", - "device_version": "1.0.0" + "device_version": "1.0.1" }, "features": { "led_matrix": true }, "layouts": { - "LAYOUT": { + "LAYOUT_104_ansi": { "layout": [ {"matrix":[0, 0], "x":0, "y":0}, {"matrix":[0, 1], "x":2, "y":0}, diff --git a/keyboards/keychron/c2_pro/ansi/white/keymaps/via/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/default/keymap.c old mode 100644 new mode 100755 similarity index 96% rename from keyboards/keychron/c2_pro/ansi/white/keymaps/via/keymap.c rename to keyboards/keychron/c2_pro/ansi_v1/white/keymaps/default/keymap.c index 547521e099b2..7bcfe7750639 --- a/keyboards/keychron/c2_pro/ansi/white/keymaps/via/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -20,14 +20,14 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( + [MAC_BASE] = LAYOUT_104_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..d2c3d2e6a43e --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/keymap.c @@ -0,0 +1,75 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c2_pro/ansi/white/keymaps/default/keymap.c b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/keymap.c old mode 100644 new mode 100755 similarity index 96% rename from keyboards/keychron/c2_pro/ansi/white/keymaps/default/keymap.c rename to keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/keymap.c index 70934e122e33..7bcfe7750639 --- a/keyboards/keychron/c2_pro/ansi/white/keymaps/default/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -16,20 +16,18 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( + [MAC_BASE] = LAYOUT_104_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -37,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -45,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -53,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/rules.mk b/keyboards/keychron/c2_pro/ansi_v1/white/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c2_pro/ansi_v1/white/white.c b/keyboards/keychron/c2_pro/ansi_v1/white/white.c new file mode 100755 index 000000000000..9b0f380d5526 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v1/white/white.c @@ -0,0 +1,140 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, A_16}, + {0, A_15}, + {0, A_14}, + {0, A_13}, + {0, A_12}, + {0, A_11}, + {0, A_10}, + {0, A_9 }, + {0, A_8 }, + {0, A_7 }, + {0, A_6 }, + {0, A_5 }, + {0, A_4 }, + {0, A_2 }, + {0, A_1 }, + {0, G_1 }, + + {0, G_2 }, // CapsLock + {0, G_3 }, // NumLock + {0, G_4 }, // Mac + {0, G_5 }, // Win + + {0, B_16}, + {0, B_15}, + {0, B_14}, + {0, B_13}, + {0, B_12}, + {0, B_11}, + {0, B_10}, + {0, B_9 }, + {0, B_8 }, + {0, B_7 }, + {0, B_6 }, + {0, B_5 }, + {0, B_4 }, + {0, B_3 }, + {0, B_2 }, + {0, B_1 }, + {0, H_1 }, + {0, H_2 }, + {0, H_3 }, + {0, H_4 }, + {0, H_5 }, + + {0, C_16}, + {0, C_15}, + {0, C_14}, + {0, C_13}, + {0, C_12}, + {0, C_11}, + {0, C_10}, + {0, C_9 }, + {0, C_8 }, + {0, C_7 }, + {0, C_6 }, + {0, C_5 }, + {0, C_4 }, + {0, C_3 }, + {0, C_2 }, + {0, C_1 }, + {0, G_6 }, + {0, G_7 }, + {0, G_8 }, + {0, G_9 }, + {0, G_10}, + + {0, D_16}, + {0, D_15}, + {0, D_14}, + {0, D_13}, + {0, D_12}, + {0, D_11}, + {0, D_10}, + {0, D_9 }, + {0, D_8 }, + {0, D_7 }, + {0, D_6 }, + {0, D_5 }, + {0, D_3 }, + {0, H_7 }, + {0, H_8 }, + {0, H_9 }, + + {0, E_16}, + {0, E_14}, + {0, E_13}, + {0, E_12}, + {0, E_11}, + {0, E_10}, + {0, E_9 }, + {0, E_8 }, + {0, E_7 }, + {0, E_6 }, + {0, E_5 }, + {0, E_3 }, + {0, E_1 }, + {0, H_6 }, + {0, H_11}, + {0, H_12}, + {0, H_10}, + + {0, F_16}, + {0, F_15}, + {0, F_14}, + {0, F_10}, + {0, F_6 }, + {0, F_5 }, + {0, F_4 }, + {0, F_3 }, + {0, F_2 }, + {0, F_1 }, + {0, G_13}, + {0, G_11}, + {0, G_12}, +}; +#endif diff --git a/keyboards/keychron/c2_pro/ansi_v2/ansi_v2.c b/keyboards/keychron/c2_pro/ansi_v2/ansi_v2.c new file mode 100755 index 000000000000..e362b6e9650b --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/ansi_v2.c @@ -0,0 +1,55 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef DIP_SWITCH_ENABLE +bool dip_switch_update_kb(uint8_t index, bool active) { + if (!dip_switch_update_user(index, active)) { + return false; + } + if (index == 0) { + default_layer_set(1UL << (active ? 0 : 2)); + } + return true; +} +#endif + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_MAC_OS_PIN); + setPinOutputPushPull(LED_WIN_OS_PIN); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb(void) { + if (default_layer_state == (1 << 0)) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + } + if (default_layer_state == (1 << 2)) { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + } +} + +void suspend_power_down_kb(void) { + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + suspend_power_down_user(); +} diff --git a/keyboards/keychron/c2_pro/ansi_v2/config.h b/keyboards/keychron/c2_pro/ansi_v2/config.h new file mode 100755 index 000000000000..22953ea16f9b --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/config.h @@ -0,0 +1,36 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* DIP switch */ +#define DIP_SWITCH_PINS { D2 } + +/* Indication led */ +#define LED_MAC_OS_PIN C10 +#define LED_WIN_OS_PIN C11 +#define LED_OS_PIN_ON_STATE 1 + +/* The I2C Driver Configuration */ +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* The SPI Driver Configuration */ +// #define SPI_DRIVER SPID1 +// #define SPI_SCK_PIN A5 +// #define SPI_MOSI_PIN A7 +// #define SPI_MISO_PIN A6 +// #define CKLED2001_SPI_DIVISOR 21 diff --git a/keyboards/keychron/q2/chconf.h b/keyboards/keychron/c2_pro/ansi_v2/halconf.h old mode 100644 new mode 100755 similarity index 83% rename from keyboards/keychron/q2/chconf.h rename to keyboards/keychron/c2_pro/ansi_v2/halconf.h index cbbae31079fb..41bddcb2799b --- a/keyboards/keychron/q2/chconf.h +++ b/keyboards/keychron/c2_pro/ansi_v2/halconf.h @@ -16,10 +16,6 @@ #pragma once -#define CH_CFG_ST_FREQUENCY 10000 +#define HAL_USE_I2C TRUE -#define CH_CFG_OPTIMIZE_SPEED FALSE - -#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE - -#include_next +#include_next diff --git a/keyboards/keychron/c2_pro/ansi_v2/info.json b/keyboards/keychron/c2_pro/ansi_v2/info.json new file mode 100755 index 000000000000..4f2312a42318 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/info.json @@ -0,0 +1,128 @@ +{ + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["A0", "A1", "A2", "A3", "C0", "C1", "C2", "C3", "A8", "C12", "B9", "C6", "C7", "C4", "C5","A15", "B10", "B12", "B13", "B14", "B15"], + "rows": ["B0", "B1", "B8", "B3", "B4", "B5"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "C9", + "num_lock": "C8" + }, + "layouts": { + "LAYOUT_104_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + {"matrix":[1,17], "x":18.5, "y":1.25}, + {"matrix":[1,18], "x":19.5, "y":1.25}, + {"matrix":[1,19], "x":20.5, "y":1.25}, + {"matrix":[1,20], "x":21.5, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[2,18], "x":19.5, "y":2.25}, + {"matrix":[2,19], "x":20.5, "y":2.25}, + {"matrix":[2,20], "x":21.5, "y":2.25, "h":2}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + {"matrix":[3,18], "x":19.5, "y":3.25}, + {"matrix":[3,19], "x":20.5, "y":3.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[4,18], "x":19.5, "y":4.25}, + {"matrix":[4,19], "x":20.5, "y":4.25}, + {"matrix":[4,20], "x":21.5, "y":4.25, "h":2}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25}, + {"matrix":[5,17], "x":18.5, "y":5.25, "w":2}, + {"matrix":[5,18], "x":20.5, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.h b/keyboards/keychron/c2_pro/ansi_v2/mcuconf.h old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.h rename to keyboards/keychron/c2_pro/ansi_v2/mcuconf.h index 1fb79c0b2a14..494b71483ff9 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.h +++ b/keyboards/keychron/c2_pro/ansi_v2/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Mike Killewald +/* Copyright 2020 QMK * * 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 @@ -16,11 +16,19 @@ #pragma once -void rgb_matrix_init_user(void); +#include_next -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); -bool is_not_transparent(uint16_t keycode); +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/config.h b/keyboards/keychron/c2_pro/ansi_v2/rgb/config.h new file mode 100755 index 000000000000..b6609fcebe4e --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/config.h @@ -0,0 +1,42 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef RGB_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +// # define DRIVER_CS_PINS { A4, C14 } +# define DRIVER_COUNT 2 +# define DRIVER_ADDR_1 0b1110111 +# define DRIVER_ADDR_2 0b1110100 + +/* RGB Matrix Configuration */ +# define RGB_MATRIX_LED_COUNT 104 + +/* turn off effects when suspended */ +# define RGB_DISABLE_WHEN_USB_SUSPENDED + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28 } + +/* RGB Matrix Animation modes. Explicitly enabled + * For full list of effects, see: + * https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects + */ +# define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/info.json b/keyboards/keychron/c2_pro/ansi_v2/rgb/info.json new file mode 100755 index 000000000000..50d4da60582c --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/info.json @@ -0,0 +1,146 @@ +{ + "usb": { + "pid": "0x0526", + "device_version": "1.0.0" + }, + "features": { + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "breathing": true, + "band_spiral_val": 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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":159, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":4, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[1, 19], "flags":4, "x":214, "y":15}, + {"matrix":[1, 20], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 13], "flags":1, "x":143, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[2, 19], "flags":4, "x":214, "y":27}, + {"matrix":[2, 20], "flags":4, "x":224, "y":34}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":139, "y":40}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 19], "flags":4, "x":214, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 19], "flags":4, "x":214, "y":52}, + {"matrix":[4, 20], "flags":4, "x":224, "y":58}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64} + ] + } +} diff --git a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/default/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/default/keymap.c old mode 100644 new mode 100755 similarity index 97% rename from keyboards/keychron/c2_pro/ansi/rgb/keymaps/default/keymap.c rename to keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/default/keymap.c index 07f523e30a0c..70bd40b6bd44 --- a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/default/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/default/keymap.c @@ -16,20 +16,19 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( + [MAC_BASE] = LAYOUT_104_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -37,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -45,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -53,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/keymap.c old mode 100644 new mode 100755 similarity index 93% rename from keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/keymap.c rename to keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/keymap.c index 9bc6b416bb3b..e62da9e50465 --- a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/keychron/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/keymap.c @@ -16,26 +16,26 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -61,14 +61,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/via/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/keymap.c old mode 100644 new mode 100755 similarity index 97% rename from keyboards/keychron/c2_pro/ansi/rgb/keymaps/via/keymap.c rename to keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/keymap.c index 5120e9bacbf4..70bd40b6bd44 --- a/keyboards/keychron/c2_pro/ansi/rgb/keymaps/via/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/keymap.c @@ -20,14 +20,15 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( + [MAC_BASE] = LAYOUT_104_ansi( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -35,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -51,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/rgb.c b/keyboards/keychron/c2_pro/ansi_v2/rgb/rgb.c new file mode 100755 index 000000000000..68ed0ce5a1b8 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/rgb.c @@ -0,0 +1,137 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef RGB_MATRIX_ENABLE +const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, I_1, G_1, H_1}, + {0, I_2, G_2, H_2}, + {0, I_3, G_3, H_3}, + {0, I_4, G_4, H_4}, + {0, I_5, G_5, H_5}, + {0, I_6, G_6, H_6}, + {0, I_7, G_7, H_7}, + {0, I_8, G_8, H_8}, + {0, I_9, G_9, H_9}, + {0, I_10, G_10, H_10}, + {0, I_11, G_11, H_11}, + {0, I_12, G_12, H_12}, + {0, I_13, G_13, H_13}, + {0, I_15, G_15, H_15}, + {0, I_16, G_16, H_16}, + {0, L_5, J_5, K_5}, + + {0, C_1, A_1, B_1}, + {0, C_2, A_2, B_2}, + {0, C_3, A_3, B_3}, + {0, C_4, A_4, B_4}, + {0, C_5, A_5, B_5}, + {0, C_6, A_6, B_6}, + {0, C_7, A_7, B_7}, + {0, C_8, A_8, B_8}, + {0, C_9, A_9, B_9}, + {0, C_10, A_10, B_10}, + {0, C_11, A_11, B_11}, + {0, C_12, A_12, B_12}, + {0, C_13, A_13, B_13}, + {0, C_14, A_14, B_14}, + {0, C_15, A_15, B_15}, + {0, C_16, A_16, B_16}, + {0, L_9, J_9, K_9}, + {0, L_10, J_10, K_10}, + {0, L_11, J_11, K_11}, + {0, L_12, J_12, K_12}, + {0, L_13, J_13, K_13}, + + {0, F_1, D_1, E_1}, + {0, F_2, D_2, E_2}, + {0, F_3, D_3, E_3}, + {0, F_4, D_4, E_4}, + {0, F_5, D_5, E_5}, + {0, F_6, D_6, E_6}, + {0, F_7, D_7, E_7}, + {0, F_8, D_8, E_8}, + {0, F_9, D_9, E_9}, + {0, F_10, D_10, E_10}, + {0, F_11, D_11, E_11}, + {0, F_12, D_12, E_12}, + {0, F_13, D_13, E_13}, + {0, F_14, D_14, E_14}, + {0, F_15, D_15, E_15}, + {0, F_16, D_16, E_16}, + {0, L_14, J_14, K_14}, + {0, L_15, J_15, K_15}, + {0, L_16, J_16, K_16}, + {1, L_1, J_1, K_1}, + {1, L_2, J_2, K_2}, + + {1, C_16, A_16, B_16}, + {1, C_15, A_15, B_15}, + {1, C_14, A_14, B_14}, + {1, C_13, A_13, B_13}, + {1, C_12, A_12, B_12}, + {1, C_11, A_11, B_11}, + {1, C_10, A_10, B_10}, + {1, C_9, A_9, B_9}, + {1, C_8, A_8, B_8}, + {1, C_7, A_7, B_7}, + {1, C_6, A_6, B_6}, + {1, C_5, A_5, B_5}, + {1, C_3, A_3, B_3}, + {1, L_3, J_3, K_3}, + {1, L_4, J_4, K_4}, + {1, L_5, J_5, K_5}, + + {1, I_16, G_16, H_16}, + {1, I_14, G_14, H_14}, + {1, I_13, G_13, H_13}, + {1, I_12, G_12, H_12}, + {1, I_11, G_11, H_11}, + {1, I_10, G_10, H_10}, + {1, I_9, G_9, H_9}, + {1, I_8, G_8, H_8}, + {1, I_7, G_7, H_7}, + {1, I_6, G_6, H_6}, + {1, I_5, G_5, H_5}, + {1, I_3, G_3, H_3}, + {1, I_1, G_1, H_1}, + {1, L_6, J_6, K_6}, + {1, L_7, J_7, K_7}, + {1, L_8, J_8, K_8}, + {1, L_9, J_9, K_9}, + + {1, F_16, D_16, E_16}, + {1, F_15, D_15, E_15}, + {1, F_14, D_14, E_14}, + {1, F_10, D_10, E_10}, + {1, F_6, D_6, E_6}, + {1, F_5, D_5, E_5}, + {1, F_4, D_4, E_4}, + {1, F_3, D_3, E_3}, + {1, F_2, D_2, E_2}, + {1, F_1, D_1, E_1}, + {1, L_10, J_10, K_10}, + {1, L_11, J_11, K_11}, + {1, L_12, J_12, K_12}, +}; +#endif diff --git a/keyboards/keychron/c2_pro/ansi_v2/rgb/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/rgb/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/rgb/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c2_pro/ansi/white/config.h b/keyboards/keychron/c2_pro/ansi_v2/white/config.h old mode 100644 new mode 100755 similarity index 68% rename from keyboards/keychron/c2_pro/ansi/white/config.h rename to keyboards/keychron/c2_pro/ansi_v2/white/config.h index d2a0e27b5793..de8e6f6b1cec --- a/keyboards/keychron/c2_pro/ansi/white/config.h +++ b/keyboards/keychron/c2_pro/ansi_v2/white/config.h @@ -16,29 +16,29 @@ #pragma once +#ifdef LED_MATRIX_ENABLE /* LED Matrix Driver Configuration */ -#define DRIVER_COUNT 1 -#define DRIVER_ADDR_1 0b1110100 - -/* Set LED driver current */ -#define CKLED2001_CURRENT_TUNE \ - { 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0 } +// # define DRIVER_CS_PINS { C14 } +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 /* LED Matrix Configuration */ -#define LED_MATRIX_LED_COUNT 108 - -/* Enable indicator LED*/ -#define NUM_LED_INDEX 16 -#define CAPS_LED_INDEX 17 -#define MAC_LED_INDEX 18 -#define WIN_LED_INDEX 19 +# define LED_MATRIX_LED_COUNT 104 /* turn off effects when suspended */ -#define LED_DISABLE_WHEN_USB_SUSPENDED +# define LED_DISABLE_WHEN_USB_SUSPENDED + +/* Use the first 8 channels of led driver */ +# define PHASE_CHANNEL MSKPHASE_8CHANNEL + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 } // LED Matrix Animation modes. Explicitly enabled // For full list of effects, see: // https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects // #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) -#define LED_MATRIX_KEYPRESSES -#define LED_MATRIX_KEYRELEASES +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/info.json b/keyboards/keychron/c2_pro/ansi_v2/white/info.json new file mode 100755 index 000000000000..4e77a9bc8960 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/info.json @@ -0,0 +1,141 @@ +{ + "usb": { + "pid": "0x0529", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":159, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":4, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[1, 19], "flags":4, "x":214, "y":15}, + {"matrix":[1, 20], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 13], "flags":1, "x":143, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[2, 19], "flags":4, "x":214, "y":27}, + {"matrix":[2, 20], "flags":4, "x":224, "y":34}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":139, "y":40}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 19], "flags":4, "x":214, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 19], "flags":4, "x":214, "y":52}, + {"matrix":[4, 20], "flags":4, "x":224, "y":58}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64} + ] + } +} diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/default/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/default/keymap.c new file mode 100755 index 000000000000..4c12c63c4e10 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/keymap.c old mode 100644 new mode 100755 similarity index 93% rename from keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/keymap.c rename to keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/keymap.c index 09002c3d7a47..c391c297cd1d --- a/keyboards/keychron/c2_pro/ansi/white/keymaps/keychron/keymap.c +++ b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/keymap.c @@ -16,24 +16,26 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [MAC_FN] = LAYOUT( + [MAC_FN] = LAYOUT_104_ansi( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -41,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [WIN_BASE] = LAYOUT( + [WIN_BASE] = LAYOUT_104_ansi( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, BL_STEP, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -49,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), - [WIN_FN] = LAYOUT( + [WIN_FN] = LAYOUT_104_ansi( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -59,14 +61,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/keymap.c b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/keymap.c new file mode 100755 index 000000000000..4c12c63c4e10 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [MAC_FN] = LAYOUT_104_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, BL_STEP, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/c2_pro/ansi_v2/white/rules.mk b/keyboards/keychron/c2_pro/ansi_v2/white/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c2_pro/ansi_v2/white/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c2_pro/ansi/white/white.c b/keyboards/keychron/c2_pro/ansi_v2/white/white.c old mode 100644 new mode 100755 similarity index 95% rename from keyboards/keychron/c2_pro/ansi/white/white.c rename to keyboards/keychron/c2_pro/ansi_v2/white/white.c index 963ac8755f8a..4588a3cdcfb0 --- a/keyboards/keychron/c2_pro/ansi/white/white.c +++ b/keyboards/keychron/c2_pro/ansi_v2/white/white.c @@ -40,11 +40,6 @@ const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { {0, A_1 }, {0, G_1 }, - {0, G_2 }, - {0, G_3 }, // NumLock - {0, G_4 }, // Mac - {0, G_5 }, // Win - {0, B_16}, {0, B_15}, {0, B_14}, @@ -138,4 +133,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { {0, G_11}, {0, G_12}, }; -#endif //LED_MATRIX_ENABLE +#endif diff --git a/keyboards/keychron/c2_pro/config.h b/keyboards/keychron/c2_pro/config.h old mode 100644 new mode 100755 index 6971ebd1aa8c..69d9ff4e7c45 --- a/keyboards/keychron/c2_pro/config.h +++ b/keyboards/keychron/c2_pro/config.h @@ -16,29 +16,10 @@ #pragma once -/* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } } - -/* Disable DIP switch in matrix data */ -#define MATRIX_MASKED - /* EEPROM Driver Configuration */ #define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) -/* Increase I2C speed to 1000 KHz */ -#define I2C1_TIMINGR_PRESC 0U -#define I2C1_TIMINGR_SCLDEL 3U -#define I2C1_TIMINGR_SDADEL 0U -#define I2C1_TIMINGR_SCLH 15U -#define I2C1_TIMINGR_SCLL 51U - -/* Old default behavior of mod-taps */ -#define HOLD_ON_OTHER_KEY_PRESS - -/* HC595 used pins definiton */ -#define HC595_STCP A0 -#define HC595_SHCP A1 -#define HC595_DS C15 -#define SHIFT_COL_START 11 -#define SHIFT_COL_END 18 +/* Factory Reset Key Definition */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/c2_pro/info.json b/keyboards/keychron/c2_pro/info.json old mode 100644 new mode 100755 index dd97dd7adf24..e433e8ded2bf --- a/keyboards/keychron/c2_pro/info.json +++ b/keyboards/keychron/c2_pro/info.json @@ -3,8 +3,6 @@ "manufacturer": "Keychron", "url": "https://github.com/Keychron", "maintainer": "lalalademaxiya1", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "usb": { "vid": "0x3434" }, @@ -16,12 +14,5 @@ "extrakey": true, "mousekey": true, "nkro": true - }, - "matrix_pins": { - "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "C14"], - "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], - "custom": true, - "custom_lite": true - }, - "diode_direction": "ROW2COL" + } } diff --git a/keyboards/keychron/c2_pro/readme.md b/keyboards/keychron/c2_pro/readme.md old mode 100644 new mode 100755 index c0715929dfe7..129814fff9b1 --- a/keyboards/keychron/c2_pro/readme.md +++ b/keyboards/keychron/c2_pro/readme.md @@ -1,23 +1,34 @@ # Keychron C2 Pro -![Keychron C2 Pro](https://i.imgur.com/BQE1tFOh.jpg) +![Keychron C2 Pro](https://i.imgur.com/BQE1tFO.jpg) A customizable 100% keyboard. +Rev1 is based on STM32L432 and rev2 is based on STM32F402. + * Keyboard Maintainer: [Keychron](https://github.com/keychron) * Hardware Supported: Keychron C2 Pro -* Hardware Availability: [Keychron](https://www.keychron.com) +* Hardware Availability: [Keychron C2 Pro QMK/VIA Wired Mechanical Keyboard](https://www.keychron.com/products/keychron-c2-pro-qmk-via-wired-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): - make keychron/c2/ansi/rgb:default - make keychron/c2/ansi/white:default + make keychron/c2_pro/ansi_v1/rgb:default + make keychron/c2_pro/ansi_v1/white:default + make keychron/c2_pro/ansi_v2/rgb:default + make keychron/c2_pro/ansi_v2/white:default Flashing example for this keyboard: - make keychron/c2/ansi/rgb:default:flash - make keychron/c2/ansi/white:default:flash + make keychron/c2_pro/ansi_v1/rgb:default:flash + make keychron/c2_pro/ansi_v1/white:default:flash + make keychron/c2_pro/ansi_v2/rgb:default:flash + make keychron/c2_pro/ansi_V2/white:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_rgb.json b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_rgb.json new file mode 100755 index 000000000000..190ee5c34b4b --- /dev/null +++ b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_rgb.json @@ -0,0 +1,375 @@ +{ + "name": "Keychron C2 Pro ANSI RGB", + "vendorId": "0x3434", + "productId": "0x0520", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "matrix": {"rows": 6, "cols": 20}, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "0,17", + "0,18" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "w": 1.5, + "c": "#aaaaaa" + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "3,14", + { + "h": 2 + }, + "3,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,16" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,14", + { + "h": 2 + }, + "4,16" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,18" + ] + ] + } +} diff --git a/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_white.json b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_white.json new file mode 100755 index 000000000000..121d3b2e4696 --- /dev/null +++ b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v1_white.json @@ -0,0 +1,270 @@ +{ + "name": "Keychron C2 Pro ANSI White", + "vendorId": "0x3434", + "productId": "0x0523", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 20}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "1,19", + "0,17" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "2,19", + { + "h": 2 + }, + "0,18" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,19" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,19", + { + "h": 2 + }, + "0,19" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,19" + ] + ] + } +} diff --git a/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_rgb.json b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_rgb.json new file mode 100755 index 000000000000..66424c4341c6 --- /dev/null +++ b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_rgb.json @@ -0,0 +1,331 @@ +{ + "name": "Keychron C2 Pro V2 ANSI RGB", + "vendorId": "0x3434", + "productId": "0x0526", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "customKeycodes": [ + {"name": "Mission Control", "title": "Mission Control in macOS", "shortName": "MCtrl"}, + {"name": "Launch Pad", "title": "Launch Pad in macOS", "shortName": "LPad"}, + {"name": "Left Option", "title": "Left Option in macOS", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option in macOS", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command in macOS", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command in macOS", "shortName": "RCmd"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in windows", "shortName": "File"}, + {"name": "Screen Shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in windows", "shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 21}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "1,19", + "1,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "2,19", + { + "h": 2 + }, + "2,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,19" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,19", + { + "h": 2 + }, + "4,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,18" + ] + ] + } +} diff --git a/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_white.json b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_white.json new file mode 100755 index 000000000000..992bddbc8e18 --- /dev/null +++ b/keyboards/keychron/c2_pro/via_json/c2_pro_ansi_v2_white.json @@ -0,0 +1,270 @@ +{ + "name": "Keychron C2 Pro V2 ANSI White", + "vendorId": "0x3434", + "productId": "0x0529", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control", "title": "Mission Control in macOS", "shortName": "MCtrl"}, + {"name": "Launch Pad", "title": "Launch Pad in macOS", "shortName": "LPad"}, + {"name": "Left Option", "title": "Left Option in macOS", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option in macOS", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command in macOS", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command in macOS", "shortName": "RCmd"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in windows", "shortName": "File"}, + {"name": "Screen Shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in windows", "shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 21}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "1,19", + "1,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "2,19", + { + "h": 2 + }, + "2,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,19" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,19", + { + "h": 2 + }, + "4,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,18" + ] + ] + } +} diff --git a/keyboards/keychron/c3_pro/ansi/red/config.h b/keyboards/keychron/c3_pro/ansi/red/config.h new file mode 100755 index 000000000000..753982df3aa5 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/config.h @@ -0,0 +1,44 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* Indication led */ +#define LED_MAC_OS_PIN A4 +#define LED_WIN_OS_PIN A5 +#define LED_OS_PIN_ON_STATE 1 + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT (87 + 12) + +/* Use first 7 channels of LED driver */ +# define PHASE_CHANNEL MSKPHASE_7CHANNEL + +/* Set LED driver current */ +# define CKLED2001_CURRENT_TUNE \ + { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +/* Enable Reactive Animation */ +# define LED_MATRIX_KEYPRESSES +#endif diff --git a/keyboards/keychron/c3_pro/ansi/red/info.json b/keyboards/keychron/c3_pro/ansi/red/info.json new file mode 100755 index 000000000000..6b74c4f9fffd --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/info.json @@ -0,0 +1,246 @@ +{ + "usb": { + "pid": "0x0430", + "device_version": "1.0.1" + }, + "features": { + "led_matrix": true + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "A15", "C10", "C11", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0","A1", "A2"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "ROW2COL", + "indicators": { + "caps_lock": "A3" + }, + "community_layouts": [ + "tkl_ansi" + ], + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,2], "x":2, "y":0}, + {"matrix":[0,3], "x":3, "y":0}, + {"matrix":[0,4], "x":4, "y":0}, + {"matrix":[0,5], "x":5, "y":0}, + {"matrix":[0,6], "x":6.5, "y":0}, + {"matrix":[0,7], "x":7.5, "y":0}, + {"matrix":[0,8], "x":8.5, "y":0}, + {"matrix":[0,9], "x":9.5, "y":0}, + {"matrix":[0,10], "x":11, "y":0}, + {"matrix":[0,11], "x":12, "y":0}, + {"matrix":[0,12], "x":13, "y":0}, + {"matrix":[0,13], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25} + ] + } + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":26, "y":0}, + {"matrix":[0, 3], "flags":1, "x":39, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":65, "y":0}, + {"matrix":[0, 6], "flags":1, "x":84, "y":0}, + {"matrix":[0, 7], "flags":1, "x":97, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":123, "y":0}, + {"matrix":[0, 10], "flags":1, "x":143, "y":0}, + {"matrix":[0, 11], "flags":1, "x":156, "y":0}, + {"matrix":[0, 12], "flags":1, "x":169, "y":0}, + {"matrix":[0, 13], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[0, 16], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":16}, + {"matrix":[1, 1], "flags":4, "x":13, "y":16}, + {"matrix":[1, 2], "flags":4, "x":26, "y":16}, + {"matrix":[1, 3], "flags":4, "x":39, "y":16}, + {"matrix":[1, 4], "flags":4, "x":52, "y":16}, + {"matrix":[1, 5], "flags":4, "x":65, "y":16}, + {"matrix":[1, 6], "flags":4, "x":78, "y":16}, + {"matrix":[1, 7], "flags":4, "x":91, "y":16}, + {"matrix":[1, 8], "flags":4, "x":104, "y":16}, + {"matrix":[1, 9], "flags":4, "x":117, "y":16}, + {"matrix":[1, 10], "flags":4, "x":130, "y":16}, + {"matrix":[1, 11], "flags":4, "x":143, "y":16}, + {"matrix":[1, 12], "flags":4, "x":156, "y":16}, + {"matrix":[1, 13], "flags":1, "x":175, "y":16}, + {"matrix":[1, 14], "flags":1, "x":198, "y":16}, + {"matrix":[1, 15], "flags":1, "x":211, "y":16}, + {"matrix":[1, 16], "flags":1, "x":224, "y":16}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":19, "y":28}, + {"matrix":[2, 2], "flags":4, "x":32, "y":28}, + {"matrix":[2, 3], "flags":4, "x":45, "y":28}, + {"matrix":[2, 4], "flags":4, "x":58, "y":28}, + {"matrix":[2, 5], "flags":4, "x":71, "y":28}, + {"matrix":[2, 6], "flags":4, "x":84, "y":28}, + {"matrix":[2, 7], "flags":4, "x":97, "y":28}, + {"matrix":[2, 8], "flags":4, "x":110, "y":28}, + {"matrix":[2, 9], "flags":4, "x":123, "y":28}, + {"matrix":[2, 10], "flags":4, "x":136, "y":28}, + {"matrix":[2, 11], "flags":4, "x":149, "y":28}, + {"matrix":[2, 12], "flags":4, "x":162, "y":28}, + {"matrix":[2, 13], "flags":1, "x":178, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[2, 16], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":126, "y":40}, + {"matrix":[3, 10], "flags":4, "x":139, "y":40}, + {"matrix":[3, 11], "flags":4, "x":152, "y":40}, + {"matrix":[3, 13], "flags":1, "x":173, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 13], "flags":1, "x":170, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":131, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":164, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[5, 16], "flags":1, "x":224, "y":64}, + + {"flags":1, "x":0, "y":0}, + {"flags":1, "x":0, "y":16}, + {"flags":1, "x":0, "y":28}, + {"flags":1, "x":0, "y":40}, + {"flags":1, "x":0, "y":52}, + {"flags":1, "x":0, "y":64}, + {"flags":1, "x":224, "y":0}, + {"flags":1, "x":224, "y":16}, + {"flags":1, "x":224, "y":28}, + {"flags":1, "x":224, "y":40}, + {"flags":1, "x":224, "y":52}, + {"flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/c3_pro/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/c3_pro/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..a916ada8036e --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,63 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_TRNS, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN),KC_TRNS, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + diff --git a/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..e544a5f64e5f --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,76 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_TRNS, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN),KC_TRNS, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_SIRI, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_OSSW, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_OSSW, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..cff90cc05af3 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk \ No newline at end of file diff --git a/keyboards/keychron/c3_pro/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/c3_pro/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..62341acba8a6 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_TRNS, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN),KC_TRNS, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/c3_pro/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/c3_pro/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/c3_pro/ansi/red/red.c b/keyboards/keychron/c3_pro/ansi/red/red.c new file mode 100755 index 000000000000..3f1cfcc37730 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/red.c @@ -0,0 +1,132 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1}, + {0, F_3}, + {0, F_4}, + {0, F_5}, + {0, F_6}, + {0, F_7}, + {0, F_8}, + {0, F_9}, + {0, F_10}, + {0, F_11}, + {0, F_12}, + {0, F_13}, + {0, F_14}, + {0, F_15}, + {0, F_16}, + {0, C_13}, + + {0, E_1}, + {0, E_2}, + {0, E_3}, + {0, E_4}, + {0, E_5}, + {0, E_6}, + {0, E_7}, + {0, E_8}, + {0, E_9}, + {0, E_10}, + {0, E_11}, + {0, E_12}, + {0, E_13}, + {0, E_14}, + {0, E_15}, + {0, E_16}, + {0, C_15}, + + {0, D_1}, + {0, D_2}, + {0, D_3}, + {0, D_4}, + {0, D_5}, + {0, D_6}, + {0, D_7}, + {0, D_8}, + {0, D_9}, + {0, D_10}, + {0, D_11}, + {0, D_12}, + {0, D_13}, + {0, D_14}, + {0, D_15}, + {0, D_16}, + {0, C_16}, + + {0, C_1}, + {0, C_2}, + {0, C_3}, + {0, C_4}, + {0, C_5}, + {0, C_6}, + {0, C_7}, + {0, C_8}, + {0, C_9}, + {0, C_10}, + {0, C_11}, + {0, C_12}, + {0, C_14}, + + {0, B_1}, + {0, B_3}, + {0, B_4}, + {0, B_5}, + {0, B_6}, + {0, B_7}, + {0, B_8}, + {0, B_9}, + {0, B_10}, + {0, B_11}, + {0, B_12}, + {0, B_14}, + {0, B_16}, + + {0, A_1}, + {0, A_2}, + {0, A_3}, + {0, A_7}, + {0, A_11}, + {0, A_12}, + {0, A_13}, + {0, A_14}, + {0, A_15}, + {0, A_16}, + {0, B_15}, + + {0, G_1}, + {0, G_2}, + {0, G_3}, + {0, G_4}, + {0, G_5}, + {0, G_6}, + {0, G_12}, + {0, G_11}, + {0, G_10}, + {0, G_9}, + {0, G_8}, + {0, G_7}, +}; +#endif diff --git a/keyboards/keychron/c3_pro/ansi/red/rules.mk b/keyboards/keychron/c3_pro/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/c2_pro/ansi/rgb/config.h b/keyboards/keychron/c3_pro/ansi/rgb/config.h similarity index 71% rename from keyboards/keychron/c2_pro/ansi/rgb/config.h rename to keyboards/keychron/c3_pro/ansi/rgb/config.h index d62b756f5a8b..ac944f0632e7 100644 --- a/keyboards/keychron/c2_pro/ansi/rgb/config.h +++ b/keyboards/keychron/c3_pro/ansi/rgb/config.h @@ -1,4 +1,4 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) +/* Copyright 2024 @ Keychron (https://www.keychron.com) * * 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 @@ -16,25 +16,23 @@ #pragma once +/* Enable indicator LED*/ +#define LED_MAC_OS_PIN A6 +#define LED_WIN_OS_PIN A7 +#define LED_OS_PIN_ON_STATE 1 + +#ifdef RGB_MATRIX_ENABLE /* RGB Matrix Driver Configuration */ -#define DRIVER_COUNT 2 -#define DRIVER_ADDR_1 0b1110111 -#define DRIVER_ADDR_2 0b1110100 +# define DRIVER_COUNT 2 +# define DRIVER_ADDR_1 0b1110111 +# define DRIVER_ADDR_2 0b1110100 /* Set LED driver current */ #define CKLED2001_CURRENT_TUNE \ - { 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56, 0xAA, 0xAA, 0x56 } + { 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 } /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 60 -#define DRIVER_2_LED_TOTAL 48 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Enable indicator LED*/ -#define NUM_LED_INDEX 16 -#define CAPS_LED_INDEX 17 -#define MAC_LED_INDEX 18 -#define WIN_LED_INDEX 19 +#define RGB_MATRIX_LED_COUNT 99 /* turn off effects when suspended */ #define RGB_DISABLE_WHEN_USB_SUSPENDED @@ -44,3 +42,5 @@ // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES +#endif + diff --git a/keyboards/keychron/c3_pro/ansi/rgb/info.json b/keyboards/keychron/c3_pro/ansi/rgb/info.json new file mode 100644 index 000000000000..05727f0c0c93 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/info.json @@ -0,0 +1,251 @@ +{ + "usb": { + "pid": "0x0433", + "device_version": "1.0.1" + }, + "features": { + "rgb_matrix": true + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "B7", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0", "A1", "A2", "A3", "A4"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "ROW2COL", + "indicators": { + "caps_lock": "A5" + }, + "community_layouts": [ + "tkl_ansi" + ], + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"matrix":[0, 0], "x":0, "y":0}, + {"matrix":[0, 2], "x":3, "y":0}, + {"matrix":[0, 3], "x":4, "y":0}, + {"matrix":[0, 4], "x":5, "y":0}, + {"matrix":[0, 5], "x":6.5, "y":0}, + {"matrix":[0, 6], "x":7.5, "y":0}, + {"matrix":[0, 7], "x":8.5, "y":0}, + {"matrix":[0, 8], "x":9.5, "y":0}, + {"matrix":[0, 9], "x":10, "y":0}, + {"matrix":[0,10], "x":11, "y":0}, + {"matrix":[0,11], "x":12, "y":0}, + {"matrix":[0,12], "x":13, "y":0}, + {"matrix":[0,13], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1, 0], "x":0, "y":1.25}, + {"matrix":[1, 1], "x":1, "y":1.25}, + {"matrix":[1, 2], "x":2, "y":1.25}, + {"matrix":[1, 3], "x":3, "y":1.25}, + {"matrix":[1, 4], "x":4, "y":1.25}, + {"matrix":[1, 5], "x":5, "y":1.25}, + {"matrix":[1, 6], "x":6, "y":1.25}, + {"matrix":[1, 7], "x":7, "y":1.25}, + {"matrix":[1, 8], "x":8, "y":1.25}, + {"matrix":[1, 9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + + {"matrix":[2, 0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2, 1], "x":1.5, "y":2.25}, + {"matrix":[2, 2], "x":2.5, "y":2.25}, + {"matrix":[2, 3], "x":3.5, "y":2.25}, + {"matrix":[2, 4], "x":4.5, "y":2.25}, + {"matrix":[2, 5], "x":5.5, "y":2.25}, + {"matrix":[2, 6], "x":6.5, "y":2.25}, + {"matrix":[2, 7], "x":7.5, "y":2.25}, + {"matrix":[2, 8], "x":8.5, "y":2.25}, + {"matrix":[2, 9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + + {"matrix":[3, 0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3, 1], "x":1.75, "y":3.25}, + {"matrix":[3, 2], "x":2.75, "y":3.25}, + {"matrix":[3, 3], "x":3.75, "y":3.25}, + {"matrix":[3, 4], "x":4.75, "y":3.25}, + {"matrix":[3, 5], "x":5.75, "y":3.25}, + {"matrix":[3, 6], "x":6.75, "y":3.25}, + {"matrix":[3, 7], "x":7.75, "y":3.25}, + {"matrix":[3, 8], "x":8.75, "y":3.25}, + {"matrix":[3, 9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + + {"matrix":[4, 0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4, 2], "x":2.25, "y":4.25}, + {"matrix":[4, 3], "x":3.25, "y":4.25}, + {"matrix":[4, 4], "x":4.25, "y":4.25}, + {"matrix":[4, 5], "x":5.25, "y":4.25}, + {"matrix":[4, 6], "x":6.25, "y":4.25}, + {"matrix":[4, 7], "x":7.25, "y":4.25}, + {"matrix":[4, 8], "x":8.25, "y":4.25}, + {"matrix":[4, 9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + + {"matrix":[5, 0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5, 1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5, 2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5, 6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25} + ] + } + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "breathing": true, + "band_spiral_val": 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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":20, "y":0}, + {"matrix":[0, 3], "flags":1, "x":30, "y":0}, + {"matrix":[0, 4], "flags":1, "x":40, "y":0}, + {"matrix":[0, 5], "flags":1, "x":50, "y":0}, + {"matrix":[0, 6], "flags":1, "x":65, "y":0}, + {"matrix":[0, 7], "flags":1, "x":75, "y":0}, + {"matrix":[0, 8], "flags":1, "x":85, "y":0}, + {"matrix":[0, 9], "flags":1, "x":95, "y":0}, + {"matrix":[0, 10], "flags":1, "x":110, "y":0}, + {"matrix":[0, 11], "flags":1, "x":120, "y":0}, + {"matrix":[0, 12], "flags":1, "x":130, "y":0}, + {"matrix":[0, 13], "flags":1, "x":140, "y":0}, + {"matrix":[0, 14], "flags":1, "x":155, "y":0}, + {"matrix":[0, 15], "flags":1, "x":165, "y":0}, + {"matrix":[0, 16], "flags":1, "x":175, "y":0}, + + {"matrix":[1, 0], "flags":4, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":20, "y":15}, + {"matrix":[1, 3], "flags":4, "x":30, "y":15}, + {"matrix":[1, 4], "flags":4, "x":40, "y":15}, + {"matrix":[1, 5], "flags":4, "x":50, "y":15}, + {"matrix":[1, 6], "flags":4, "x":60, "y":15}, + {"matrix":[1, 7], "flags":4, "x":70, "y":15}, + {"matrix":[1, 8], "flags":4, "x":80, "y":15}, + {"matrix":[1, 9], "flags":4, "x":90, "y":15}, + {"matrix":[1, 10], "flags":4, "x":100, "y":15}, + {"matrix":[1, 11], "flags":4, "x":110, "y":15}, + {"matrix":[1, 12], "flags":4, "x":120, "y":15}, + {"matrix":[1, 13], "flags":1, "x":135, "y":15}, + {"matrix":[1, 14], "flags":1, "x":155, "y":15}, + {"matrix":[1, 15], "flags":1, "x":165, "y":15}, + {"matrix":[1, 16], "flags":1, "x":175, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 13], "flags":4, "x":143, "y":27}, + {"matrix":[2, 14], "flags":1, "x":155, "y":27}, + {"matrix":[2, 15], "flags":1, "x":165, "y":27}, + {"matrix":[2, 16], "flags":1, "x":175, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":4, "x":143, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":165, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":67, "y":64}, + {"matrix":[5, 10], "flags":1, "x":104, "y":64}, + {"matrix":[5, 11], "flags":1, "x":116, "y":64}, + {"matrix":[5, 12], "flags":4, "x":128, "y":64}, + {"matrix":[5, 13], "flags":1, "x":140, "y":64}, + {"matrix":[5, 14], "flags":1, "x":155, "y":64}, + {"matrix":[5, 15], "flags":1, "x":165, "y":64}, + {"matrix":[5, 16], "flags":1, "x":175, "y":64}, + + {"flags":1, "x":0, "y":0}, + {"flags":1, "x":0, "y":16}, + {"flags":1, "x":0, "y":28}, + {"flags":1, "x":0, "y":40}, + {"flags":1, "x":0, "y":52}, + {"flags":1, "x":0, "y":64}, + {"flags":1, "x":224, "y":0}, + {"flags":1, "x":224, "y":16}, + {"flags":1, "x":224, "y":28}, + {"flags":1, "x":224, "y":40}, + {"flags":1, "x":224, "y":52}, + {"flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/default/keymap.c b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/default/keymap.c new file mode 100644 index 000000000000..7a234e01aa2d --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/default/keymap.c @@ -0,0 +1,65 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +// clang-format off + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_TRNS, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_APP, KC_RCTL,KC_LEFT, KC_DOWN, KC_RGHT ), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SCROLL_LOCK,KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_APP, KC_RCTL,KC_LEFT, KC_DOWN, KC_RGHT ), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_MOD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/jasmine_keeb/keymap.c b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/jasmine_keeb/keymap.c new file mode 100755 index 000000000000..0fa1f2c1af98 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/jasmine_keeb/keymap.c @@ -0,0 +1,147 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +// Disable RGB effects +// #undef RGBLIGHT_ANIMATIONS +// #define RGB_DISABLE_WHEN_USB_SUSPENDED true +// #define RGBLIGHT_ENABLE false +// #define RGB_MATRIX_ENABLE false + +enum layers{ + BASE, + FN, +}; + +#define KC_TASK G(KC_TAB) +#define KC_FLXP G(KC_E) + +// Define a custom keycode for the macro +enum custom_keycodes { + EMAL_MACRO = SAFE_RANGE, + LOVE_MACRO, + HAMM_MACRO, + SLIM_MACRO +}; + +uint16_t rgb_timer = 0; + +// Handle the custom keycode in process_record_user +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case EMAL_MACRO: + if (record->event.pressed) { + // Replace this with your email address + SEND_STRING("Jasmineaizely@gmail.com"); + } + return false; + case LOVE_MACRO: + if (record->event.pressed) { + SEND_STRING("i<3u"); + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_PINK); + rgb_timer = timer_read(); + } + return false; + case HAMM_MACRO: + if (record->event.pressed) { + SEND_STRING("okay, okay, lets kill this guy with hammers"); + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_RED); + rgb_timer = timer_read(); + } + return false; + case SLIM_MACRO: + if (record->event.pressed) { + SEND_STRING("much respect for my big slime"); + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_GREEN); + rgb_timer = timer_read(); + } + return false; + case DM_REC1: + if (record->event.pressed) { + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_BLUE); + } + return true; + case DM_PLY1: + if (record->event.pressed) { + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_BLUE); + rgb_timer = timer_read(); + } + return true; + case DM_REC2: + if (record->event.pressed) { + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_YELLOW); + } + return true; + case DM_PLY2: + if (record->event.pressed) { + rgb_matrix_enable(); + rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR); + rgb_matrix_sethsv(HSV_YELLOW); + rgb_timer = timer_read(); + } + return true; + case DM_RSTP: + rgb_matrix_disable(); + return true; + default: + return true; + } +} + +void matrix_scan_user(void) { + // Turn off RGB after 500ms + if (rgb_timer && timer_elapsed(rgb_timer) > 1000) { + rgb_matrix_disable(); + rgb_timer = 0; + } +} + +// Disable RGB on keyboard init +void keyboard_post_init_user(void) { + rgb_matrix_disable(); +} + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SCROLL_LOCK,KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(FN),KC_APP, KC_RCTL,KC_LEFT, KC_DOWN, KC_RGHT ), + + [FN] = LAYOUT_tkl_ansi( + LOVE_MACRO, DM_PLY1, DM_PLY2, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_MOD, + _______, DM_REC1, DM_REC2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DM_RSTP, _______, + _______, _______, BL_DOWN, _______, _______, _______, HAMM_MACRO, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, EMAL_MACRO, _______, _______, _______, _______, _______, + SLIM_MACRO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + +}; \ No newline at end of file diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/keymap.c b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/keymap.c new file mode 100644 index 000000000000..71cee8b98a60 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/keymap.c @@ -0,0 +1,78 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN),KC_APP, KC_RCTL,KC_LEFT, KC_DOWN, KC_RGHT ), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_OSSW, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SCROLL_LOCK,KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_APP, KC_RCTL,KC_LEFT, KC_DOWN, KC_RGHT ), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_CRTA, RGB_MOD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_OSSW, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} + diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/keymap.c b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/keymap.c new file mode 100644 index 000000000000..4dc911ccea41 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/keymap.c @@ -0,0 +1,63 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_TRNS, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), + + [MAC_FN] = LAYOUT_tkl_ansi( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SCROLL_LOCK,KC_PAUSE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_MOD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + diff --git a/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/rules.mk b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/rules.mk new file mode 100644 index 000000000000..0fcfbbf020d4 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + + diff --git a/keyboards/keychron/c3_pro/ansi/rgb/rgb.c b/keyboards/keychron/c3_pro/ansi/rgb/rgb.c new file mode 100644 index 000000000000..e9a2efd26a70 --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/rgb.c @@ -0,0 +1,135 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef RGB_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, G_1, I_1, H_1}, + {0, G_3, I_3, H_3}, + {0, G_4, I_4, H_4}, + {0, G_5, I_5, H_5}, + {0, G_6, I_6, H_6}, + {0, G_7, I_7, H_7}, + {0, G_8, I_8, H_8}, + {0, G_9, I_9, H_9}, + {0, G_10, I_10, H_10}, + {0, G_11, I_11, H_11}, + {0, G_12, I_12, H_12}, + {0, G_13, I_13, H_13}, + {0, G_14, I_14, H_14}, + {0, G_15, I_15, H_15}, + {0, G_16, I_16, H_16}, + {1, G_16, I_16, H_16}, + + {0, D_1, F_1, E_1}, + {0, D_2, F_2, E_2}, + {0, D_3, F_3, E_3}, + {0, D_4, F_4, E_4}, + {0, D_5, F_5, E_5}, + {0, D_6, F_6, E_6}, + {0, D_7, F_7, E_7}, + {0, D_8, F_8, E_8}, + {0, D_9, F_9, E_9}, + {0, D_10, F_10, E_10}, + {0, D_11, F_11, E_11}, + {0, D_12, F_12, E_12}, + {0, D_13, F_13, E_13}, + {0, D_14, F_14, E_14}, + {0, D_15, F_15, E_15}, + {0, D_16, F_16, E_16}, + {1, G_13, I_13, H_13}, + + {0, A_1, C_1, B_1}, + {0, A_2, C_2, B_2}, + {0, A_3, C_3, B_3}, + {0, A_4, C_4, B_4}, + {0, A_5, C_5, B_5}, + {0, A_6, C_6, B_6}, + {0, A_7, C_7, B_7}, + {0, A_8, C_8, B_8}, + {0, A_9, C_9, B_9}, + {0, A_10, C_10, B_10}, + {0, A_11, C_11, B_11}, + {0, A_12, C_12, B_12}, + {0, A_13, C_13, B_13}, + {0, A_14, C_14, B_14}, + {0, A_15, C_15, B_15}, + {0, A_16, C_16, B_16}, + {1, G_15, I_15, H_15}, + + {1, G_1, I_1, H_1}, + {1, G_2, I_2, H_2}, + {1, G_3, I_3, H_3}, + {1, G_4, I_4, H_4}, + {1, G_5, I_5, H_5}, + {1, G_6, I_6, H_6}, + {1, G_7, I_7, H_7}, + {1, G_8, I_8, H_8}, + {1, G_9, I_9, H_9}, + {1, G_10, I_10, H_10}, + {1, G_11, I_11, H_11}, + {1, G_12, I_12, H_12}, + {1, G_14, I_14, H_14}, + + {1, A_1, C_1, B_1}, + {1, A_3, C_3, B_3}, + {1, A_4, C_4, B_4}, + {1, A_5, C_5, B_5}, + {1, A_6, C_6, B_6}, + {1, A_7, C_7, B_7}, + {1, A_8, C_8, B_8}, + {1, A_9, C_9, B_9}, + {1, A_10, C_10, B_10}, + {1, A_11, C_11, B_11}, + {1, A_12, C_12, B_12}, + {1, A_14, C_14, B_14}, + {1, A_16, C_16, B_16}, + + {1, D_1, F_1, E_1}, + {1, D_2, F_2, E_2}, + {1, D_3, F_3, E_3}, + {1, D_7, F_7, E_7}, + {1, D_11, F_11, E_11}, + {1, D_12, F_12, E_12}, + {1, D_13, F_13, E_13}, + {1, D_14, F_14, E_14}, + {1, D_15, F_15, E_15}, + {1, D_16, F_16, E_16}, + {1, A_15, C_15, B_15}, + + {0, J_1, L_1, K_1}, + {0, J_2, L_2, K_2}, + {0, J_3, L_3, K_3}, + {0, J_4, L_4, K_4}, + {0, J_5, L_5, K_5}, + {0, J_6, L_6, K_6}, + {0, J_7, L_7, K_7}, + {0, J_8, L_8, K_8}, + {0, J_9, L_9, K_9}, + {0, J_10, L_10, K_10}, + {0, J_11, L_11, K_11}, + {0, J_12, L_12, K_12}, +}; +#endif diff --git a/keyboards/keychron/c3_pro/ansi/rgb/rules.mk b/keyboards/keychron/c3_pro/ansi/rgb/rules.mk new file mode 100644 index 000000000000..7ff128fa692e --- /dev/null +++ b/keyboards/keychron/c3_pro/ansi/rgb/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank \ No newline at end of file diff --git a/keyboards/keychron/c3_pro/c3_pro.c b/keyboards/keychron/c3_pro/c3_pro.c new file mode 100755 index 000000000000..8a6eea2b6c49 --- /dev/null +++ b/keyboards/keychron/c3_pro/c3_pro.c @@ -0,0 +1,158 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "c3_pro.h" + +static uint32_t os_switch_timer_buffer = 0; +static uint8_t os_switch_indicate_count = 0; + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_MAC_OS_PIN); + setPinOutputPushPull(LED_WIN_OS_PIN); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + + layer_state_t last_layer = eeconfig_read_default_layer(); + if (last_layer) { + default_layer_set(last_layer); + } else { + default_layer_set(1U << 2); + } + + keyboard_post_init_user(); +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + eeconfig_init_user(); +} + +void housekeeping_task_kb(void) { + if (default_layer_state == (1U << 0)) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + } + if (default_layer_state == (1U << 2)) { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + } + + if (os_switch_timer_buffer && timer_elapsed32(os_switch_timer_buffer) > 300) { + if (os_switch_indicate_count++ > 5) { + os_switch_indicate_count = 0; + os_switch_timer_buffer = 0; + } else { + os_switch_timer_buffer = timer_read32(); + } + } + + housekeeping_task_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { +#ifdef LED_MATRIX_ENABLE + case BL_TOGG: + if (record->event.pressed) { + switch (led_matrix_get_flags()) { + case LED_FLAG_ALL: { + led_matrix_set_flags(LED_FLAG_NONE); + led_matrix_set_value_all(0); + } break; + default: { + led_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + if (!led_matrix_get_val()) { + led_matrix_set_flags(LED_FLAG_ALL); + led_matrix_increase_val(); + } + return false; +#endif +#ifdef RGB_MATRIX_ENABLE + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + if(!rgb_matrix_get_val()){ + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_increase_val(); + } + return false; +#endif + case KC_OSSW: + if (record->event.pressed) { + default_layer_xor(1U << 0); + default_layer_xor(1U << 2); + eeconfig_update_default_layer(default_layer_state); + os_switch_timer_buffer = timer_read32(); + } + return false; + default: + return true; + } +} + +#ifdef LED_MATRIX_ENABLE +bool led_matrix_indicators_kb(void) { + if (!led_matrix_indicators_user()) { + return false; + } + + if (os_switch_indicate_count) { + led_matrix_set_value_all(os_switch_indicate_count % 2 ? 0 : UINT8_MAX); + } + + return true; +} +#endif + +#ifdef RGB_MATRIX_ENABLE +bool rgb_matrix_indicators_kb(void){ + if(!rgb_matrix_indicators_user()){ + return false; + } + if(os_switch_indicate_count){ + rgb_matrix_set_color_all(os_switch_indicate_count % 2 ? 0 : RGB_RED); + } + return true; +} +#endif +void suspend_power_down_kb(void) { + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + suspend_power_down_user(); +} diff --git a/keyboards/keychron/c3_pro/c3_pro.h b/keyboards/keychron/c3_pro/c3_pro.h new file mode 100755 index 000000000000..39ea2a07d109 --- /dev/null +++ b/keyboards/keychron/c3_pro/c3_pro.h @@ -0,0 +1,28 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +#define KC_MICT QK_KB_0 +#define KC_LAPA QK_KB_1 + +enum my_keycodes { + KC_OS_SWITCH = QK_KB_11, +}; + +#define KC_OSSW KC_OS_SWITCH diff --git a/keyboards/keychron/c3_pro/config.h b/keyboards/keychron/c3_pro/config.h new file mode 100755 index 000000000000..f8d443a5f6dd --- /dev/null +++ b/keyboards/keychron/c3_pro/config.h @@ -0,0 +1,32 @@ +/* Copyright 2024 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* I2C driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) + diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap_user.h b/keyboards/keychron/c3_pro/halconf.h old mode 100644 new mode 100755 similarity index 82% rename from keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap_user.h rename to keyboards/keychron/c3_pro/halconf.h index 728114d556ff..093e4254c343 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap_user.h +++ b/keyboards/keychron/c3_pro/halconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Grayson Carr +/* Copyright 2024 @ Keychron (https://www.keychron.com) * * 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 @@ -16,13 +16,6 @@ #pragma once -// clang-format off +#define HAL_USE_I2C TRUE -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; - -// clang-format on +#include_next diff --git a/keyboards/keychron/c3_pro/info.json b/keyboards/keychron/c3_pro/info.json new file mode 100755 index 000000000000..9c335110ac3b --- /dev/null +++ b/keyboards/keychron/c3_pro/info.json @@ -0,0 +1,19 @@ +{ + "keyboard_name": "Keychron C3 Pro", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "Joe", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + } +} diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap_user.h b/keyboards/keychron/c3_pro/mcuconf.h old mode 100644 new mode 100755 similarity index 62% rename from keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap_user.h rename to keyboards/keychron/c3_pro/mcuconf.h index 87b1baf47f23..ebf4048e09dc --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap_user.h +++ b/keyboards/keychron/c3_pro/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Mike Killewald +/* Copyright 2024 @ Keychron (https://www.keychron.com) * * 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 @@ -16,18 +16,19 @@ #pragma once -// clang-format off +#include_next -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U -// clang-format on +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 -bool get_caps_lock_light_tab(void); -bool get_caps_lock_light_alphas(void); -bool get_fn_layer_transparent_keys_off(void); -bool get_fn_layer_color_enable(void); \ No newline at end of file +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/c3_pro/readme.md b/keyboards/keychron/c3_pro/readme.md new file mode 100755 index 000000000000..ae2deb45a734 --- /dev/null +++ b/keyboards/keychron/c3_pro/readme.md @@ -0,0 +1,28 @@ +# Keychron C3 Pro + +![Keychron C3 Pro](https://i.imgur.com/b4FTJsf.jpg) + +A customizable 87% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Keychron C3 Pro +* Hardware Availability: [Keychron](https://www.keychron.com/) + +Make example for this keyboard (after setting up your build environment): + + make keychron/c3_pro/ansi/red:default + make keychron/c3_pro/ansi/rgb:default + +Flashing example for this keyboard: + + make keychron/c3_pro/ansi/red:default:flash + make keychron/c3_pro/ansi/rgb:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_red.json b/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_red.json new file mode 100755 index 000000000000..0409658a26bd --- /dev/null +++ b/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_red.json @@ -0,0 +1,225 @@ +{ + "name": "Keychron C3 Pro ANSI Red", + "vendorId": "0x3434", + "productId": "0x0430", + "keycodes" : ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control", "title": "Mission Control in macOS", "shortName": "MCtrl"}, + {"name": "Launch Pad", "title": "Launch Pad in macOS", "shortName": "LPad"}, + {"name": "Left Option", "title": "Left Option in macOS", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option in macOS", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command in macOS", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command in macOS", "shortName": "RCmd"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in windows", "shortName": "File"}, + {"name": "Screen Shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in windows", "shortName": "Cortana"}, + {"name": "OS Switch", "title": "Switch between windows and macOS", "shortName": "OSSW"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,2", + "0,3", + "0,4", + "0,5", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,6", + "0,7", + "0,8", + "0,9", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,10", + "0,11", + "0,12", + "0,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_rgb.json b/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_rgb.json new file mode 100644 index 000000000000..1a24ab2f98ad --- /dev/null +++ b/keyboards/keychron/c3_pro/via_json/c3_pro_ansi_rgb.json @@ -0,0 +1,286 @@ +{ + "name": "Keychron C3 Pro ANSI RGB", + "vendorId": "0x3434", + "productId": "0x0433", + "keycodes" : ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["None", 0], + ["Solid Color", 1], + ["Breathing", 2], + ["Band Spiral Val", 3], + ["Cycle All", 4], + ["Cycle Left Right", 5], + ["Cycle Up Down", 6], + ["Rainbow Moving Chevron", 7], + ["Cycle Out In", 8], + ["Cycle Out In Dual", 9], + ["Cycle Pinwheel", 10], + ["Cycle Spiral", 11], + ["Dual Beacon", 12], + ["Rainbow Beacon", 13], + ["Jellybean Raindrops", 14], + ["Pixel Rain", 15], + ["Typing Heatmap", 16], + ["Digital Rain", 17], + ["Reactive Simple", 18], + ["Reactive Multiwide", 19], + ["Reactive Multinexus", 20], + ["Splash", 21], + ["Solid Splash", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0 && ( {id_qmk_rgb_matrix_effect} < 4 || {id_qmk_rgb_matrix_effect} == 18 || ({id_qmk_rgb_matrix_effect} > 17 && {id_qmk_rgb_matrix_effect} != 21) ) ", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "customKeycodes": [ + {"name": "Mission Control", "title": "Mission Control in macOS", "shortName": "MCtrl"}, + {"name": "Launch Pad", "title": "Launch Pad in macOS", "shortName": "LPad"}, + {"name": "Left Option", "title": "Left Option in macOS", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option in macOS", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command in macOS", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command in macOS", "shortName": "RCmd"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in windows", "shortName": "File"}, + {"name": "Screen Shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in windows", "shortName": "Cortana"}, + {"name": "Mac/Win", "title": "Switch between Windows and mac OS", "shortName": "Mac/Win"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,2", + "0,3", + "0,4", + "0,5", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,6", + "0,7", + "0,8", + "0,9", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,10", + "0,11", + "0,12", + "0,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#777777", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#cccccc" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/common/common.mk b/keyboards/keychron/common/common.mk new file mode 100644 index 000000000000..29264842d900 --- /dev/null +++ b/keyboards/keychron/common/common.mk @@ -0,0 +1,6 @@ +COMMON_DIR = common +SRC += \ + $(COMMON_DIR)/keychron_common.c \ + $(COMMON_DIR)/keychron_ft_common.c + +VPATH ?= $(TOP_DIR)/keyboards/keychron/$(COMMON_DIR) diff --git a/keyboards/keychron/common/keychron_common.c b/keyboards/keychron/common/keychron_common.c index 9c7fc3ace572..3f88b086970c 100644 --- a/keyboards/keychron/common/keychron_common.c +++ b/keyboards/keychron/common/keychron_common.c @@ -14,24 +14,40 @@ * along with this program. If not, see . */ +#include QMK_KEYBOARD_H + #include "keychron_common.h" -#include "sync_timer.h" +#include "raw_hid.h" +#include "version.h" + +#define PROTOCOL_VERSION 0x02 -bool is_siri_active = false; -uint32_t siri_timer = 0; +enum { + kc_get_protocol_version = 0xA0, + kc_get_firmware_version = 0xA1, + kc_get_support_feature = 0xA2, + kc_get_default_layer = 0xA3, +}; + +enum { + FEATURE_DEFAULT_LAYER = 0x01 << 0, +}; + +bool is_siri_active = false; +uint32_t siri_timer = 0; key_combination_t key_comb_list[4] = { {2, {KC_LWIN, KC_TAB}}, {2, {KC_LWIN, KC_E}}, {3, {KC_LSFT, KC_LCMD, KC_4}}, - {2, {KC_LWIN, KC_C}} + {2, {KC_LWIN, KC_C}}, }; -static uint8_t mac_keycode[4] = { KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD }; +static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD}; void housekeeping_task_keychron(void) { if (is_siri_active) { - if (sync_timer_elapsed32(siri_timer) >= 500) { + if (timer_elapsed32(siri_timer) >= 500) { unregister_code(KC_LCMD); unregister_code(KC_SPACE); is_siri_active = false; @@ -47,14 +63,14 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) { } else { unregister_code(KC_MISSION_CONTROL); } - return false; // Skip all further processing of this key + return false; // Skip all further processing of this key case QK_KB_1: if (record->event.pressed) { register_code(KC_LAUNCHPAD); } else { unregister_code(KC_LAUNCHPAD); } - return false; // Skip all further processing of this key + return false; // Skip all further processing of this key case KC_LOPTN: case KC_ROPTN: case KC_LCMMD: @@ -64,7 +80,7 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) { } else { unregister_code(mac_keycode[keycode - KC_LOPTN]); } - return false; // Skip all further processing of this key + return false; // Skip all further processing of this key case KC_SIRI: if (record->event.pressed) { if (!is_siri_active) { @@ -72,11 +88,11 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) { register_code(KC_LCMD); register_code(KC_SPACE); } - siri_timer = sync_timer_read32(); + siri_timer = timer_read32(); } else { // Do something else when release } - return false; // Skip all further processing of this key + return false; // Skip all further processing of this key case KC_TASK: case KC_FLXP: case KC_SNAP: @@ -90,8 +106,95 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) { unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]); } } - return false; // Skip all further processing of this key + return false; // Skip all further processing of this key + default: + return true; // Process all other keycodes normally + } +} + +#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS) +static void encoder_pad_cb(void *param) { + encoder_interrupt_read((uint32_t)param & 0XFF); +} + +__attribute__((weak)) void keyboard_post_init_kb(void) { + pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A; + pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B; + for (uint32_t i = 0; i < NUM_ENCODERS; i++) { + palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES); + palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES); + palSetLineCallback(encoders_pad_a[i], encoder_pad_cb, (void *)i); + palSetLineCallback(encoders_pad_b[i], encoder_pad_cb, (void *)i); + } +} +#endif + +#ifdef PROTOCOL_CHIBIOS +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} +#endif + +#ifdef RAW_ENABLE +# ifdef FACTORY_TEST_ENABLE +__attribute__((weak)) bool factory_test_rx(uint8_t *data, uint8_t length) { + return false; +} +# endif + +void get_support_feature(uint8_t *data) { + data[1] = FEATURE_DEFAULT_LAYER; +} + +bool via_command_kb(uint8_t *data, uint8_t length) { + // if (!raw_hid_receive_keychron(data, length)) + // return false; + switch (data[0]) { + case kc_get_protocol_version: + data[1] = PROTOCOL_VERSION; + raw_hid_send(data, length); + break; + + case kc_get_firmware_version: { + uint8_t i = 1; + data[i++] = 'v'; + if ((DEVICE_VER & 0xF000) != 0) itoa((DEVICE_VER >> 12), (char *)&data[i++], 16); + itoa((DEVICE_VER >> 8) & 0xF, (char *)&data[i++], 16); + data[i++] = '.'; + itoa((DEVICE_VER >> 4) & 0xF, (char *)&data[i++], 16); + data[i++] = '.'; + itoa((DEVICE_VER >> 4) & 0xF, (char *)&data[i++], 16); + data[i++] = ' '; + memcpy(&data[i], QMK_BUILDDATE, sizeof(QMK_BUILDDATE)); + i += sizeof(QMK_BUILDDATE); + raw_hid_send(data, length); + } break; + + case kc_get_support_feature: + get_support_feature(&data[1]); + raw_hid_send(data, length); + break; + + case kc_get_default_layer: + data[1] = get_highest_layer(default_layer_state); + raw_hid_send(data, length); + break; + +# ifdef FACTORY_TEST_ENABLE + case 0xAB: + factory_test_rx(data, length); + break; +# endif default: - return true; // Process all other keycodes normally + return false; } + + return true; +} + +# if !defined(VIA_ENABLE) +void raw_hid_receive(uint8_t *data, uint8_t length) { + via_command_kb(data, length); } +# endif +#endif diff --git a/keyboards/keychron/common/keychron_common.h b/keyboards/keychron/common/keychron_common.h index 648a5d3371a7..eb1d148803e3 100644 --- a/keyboards/keychron/common/keychron_common.h +++ b/keyboards/keychron/common/keychron_common.h @@ -14,16 +14,15 @@ * along with this program. If not, see . */ -#pragma once - -#include -#include -#include "action.h" +#include "quantum.h" #ifdef VIA_ENABLE # include "via.h" #endif +#define KC_MICT QK_KB_0 +#define KC_LAPA QK_KB_1 + #include "quantum_keycodes.h" enum custom_keycodes { @@ -50,3 +49,7 @@ typedef struct PACKED { void housekeeping_task_keychron(void); bool process_record_keychron(uint16_t keycode, keyrecord_t *record); + +#ifdef FACTORY_TEST_ENABLE +bool factory_test_rx(uint8_t *data, uint8_t length); +#endif diff --git a/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.c b/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.c new file mode 100644 index 000000000000..0cd168072a53 --- /dev/null +++ b/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.c @@ -0,0 +1,213 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" +#include "raw_hid.h" + +#define KEY_PRESS_FN (0x1 << 0) +#define KEY_PRESS_J (0x1 << 1) +#define KEY_PRESS_Z (0x1 << 2) +#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z) + +#ifndef NKRO +# include +# define RAW_EPSIZE 32 +#endif + +#ifndef F_RESET_KEY1 +# define F_RESET_KEY1 KC_J +#endif + +#ifndef F_RESET_KEY2 +# define F_RESET_KEY2 KC_Z +#endif + +enum { + OS_SWITCH = 0x01, +}; + +enum { + FACTORY_TEST_CMD_OS_SWITCH = 0x02, + FACTORY_TEST_CMD_JUMP_TO_BL, + FACTORY_TEST_CMD_EEPROM_CLEAR, +}; + +uint16_t key_press_status = 0; +uint32_t timer_3s_buffer = 0; +uint32_t timer_300ms_buffer = 0; +uint8_t factory_reset_count = 0; +bool factory_reset_flag = false; +bool report_os_sw_state = false; +extern matrix_row_t matrix[MATRIX_ROWS]; + +#ifdef SPLIT_KEYBOARD +# ifdef RGB_MATRIX_ENABLE +uint8_t led_state = 0; +uint8_t light_test_state = 0; +HSV hsv; +# endif +#endif + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#if defined(FN_KEY1) || defined(FN_KEY2) +# ifdef FN_KEY1 + case FN_KEY1: /* fall through */ +# endif +# ifdef FN_KEY2 + case FN_KEY2: +# endif + if (record->event.pressed) { + key_press_status |= KEY_PRESS_FN; + } else { + key_press_status &= ~KEY_PRESS_FN; + timer_3s_buffer = 0; + } + return true; +#endif + case F_RESET_KEY1: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_J; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_J; + timer_3s_buffer = 0; + } + return true; + case F_RESET_KEY2: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_Z; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_Z; + timer_3s_buffer = 0; + } + return true; + default: + return process_record_user(keycode, record); + } +} + +static void factory_reset(void) { + timer_300ms_buffer = timer_read32(); + layer_state_t default_layer = default_layer_state; + eeconfig_init(); + default_layer_set(default_layer); + factory_reset_count++; +} + +void factory_reset_task(void) { + if (timer_3s_buffer && (timer_elapsed32(timer_3s_buffer) > 3000)) { + timer_3s_buffer = 0; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + factory_reset_flag = true; + factory_reset(); + } + key_press_status = 0; + } +} + +void factory_reset_ind_task(void) { + if (timer_300ms_buffer && (timer_elapsed32(timer_300ms_buffer) > 300)) { + if (factory_reset_count++ > 7) { + timer_300ms_buffer = 0; + factory_reset_count = 0; + factory_reset_flag = false; + if (host_keyboard_led_state().caps_lock) { + writePin(LED_CAPS_LOCK_PIN, LED_OS_PIN_ON_STATE); + } + } else { + timer_300ms_buffer = timer_read32(); + if (factory_reset_count % 2 == 0) { + writePin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE); + writePin(LED_CAPS_LOCK_PIN, LED_OS_PIN_ON_STATE); + } else { + writePin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE); + writePin(LED_CAPS_LOCK_PIN, !LED_OS_PIN_ON_STATE); + } + } + } +} + +static void system_switch_state_report(uint8_t index, bool active) { + uint16_t checksum = 0; + uint8_t data[RAW_EPSIZE] = {0}; + uint8_t payload[3] = {0}; + + if (report_os_sw_state) { + payload[0] = FACTORY_TEST_CMD_OS_SWITCH; + payload[1] = OS_SWITCH; +#if defined(OS_SWITCH_REVERSE) + payload[2] = !active; +#else + payload[2] = active; +#endif + data[0] = 0xAB; + memcpy(&data[1], payload, 3); + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) { + checksum += data[i]; + } + data[RAW_EPSIZE - 2] = checksum & 0xFF; + data[RAW_EPSIZE - 1] = (checksum >> 8) & 0xFF; + raw_hid_send(data, RAW_EPSIZE); + } +} + +bool dip_switch_update_user(uint8_t index, bool active) { + /* Send default layer state to host */ + system_switch_state_report(index, active); + return true; +} + +bool factory_test_rx(uint8_t *data, uint8_t length) { + uint16_t checksum = 0; + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) { + checksum += data[i]; + } + /* Verify checksum */ + if ((checksum & 0xFF) != data[RAW_EPSIZE - 2] || checksum >> 8 != data[RAW_EPSIZE - 1]) { + return true; + } + switch (data[1]) { +#if defined(DIP_SWITCH_ENABLE) + case FACTORY_TEST_CMD_OS_SWITCH: + report_os_sw_state = data[2]; + if (report_os_sw_state) { + dip_switch_read(true); + } + break; +#endif + case FACTORY_TEST_CMD_JUMP_TO_BL: + if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) { + if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0) bootloader_jump(); + } + break; + case FACTORY_TEST_CMD_EEPROM_CLEAR: + if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) { + if (data[2]) { + factory_reset(); + } + } + break; + } + return true; +} diff --git a/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.h b/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.h new file mode 100755 index 000000000000..b446d00ac383 --- /dev/null +++ b/keyboards/keychron/common/keychron_ft_c1_pro_ansi_v2_non_light.h @@ -0,0 +1,20 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +extern bool factory_reset_flag; + +void factory_reset_task(void); +void factory_reset_ind_task(void); diff --git a/keyboards/keychron/common/keychron_ft_common.c b/keyboards/keychron/common/keychron_ft_common.c new file mode 100644 index 000000000000..9a8b2855123f --- /dev/null +++ b/keyboards/keychron/common/keychron_ft_common.c @@ -0,0 +1,378 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "keychron_ft_common.h" +#include "raw_hid.h" + +#ifndef NKRO +# include +# define RAW_EPSIZE 32 +#endif + +#ifndef BL_TEST_KEY1 +# define BL_TEST_KEY1 KC_RIGHT +#endif + +#ifndef BL_TEST_KEY2 +# define BL_TEST_KEY2 KC_HOME +#endif + +#ifndef F_RESET_KEY1 +# define F_RESET_KEY1 KC_J +#endif + +#ifndef F_RESET_KEY2 +# define F_RESET_KEY2 KC_Z +#endif + +enum { + OS_SWITCH = 0x01, +}; + +enum { + FACTORY_TEST_CMD_BACKLIGHT = 0x01, + FACTORY_TEST_CMD_OS_SWITCH, + FACTORY_TEST_CMD_JUMP_TO_BL, + FACTORY_TEST_CMD_EEPROM_CLEAR, +}; +// clang-format on + +uint16_t key_press_status = 0; +uint32_t timer_3s_buffer = 0; +uint32_t timer_300ms_buffer = 0; +uint8_t factory_reset_count = 0; +bool report_os_sw_state = false; +extern matrix_row_t matrix[MATRIX_ROWS]; + +#ifdef SPLIT_KEYBOARD +# ifdef RGB_MATRIX_ENABLE +uint8_t led_state = 0; +uint8_t light_test_state = 0; +HSV hsv; +# endif +#endif + +__attribute__((weak)) bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#if defined(FN_KEY1) || defined(FN_KEY2) +# ifdef FN_KEY1 + case FN_KEY1: /* fall through */ +# endif +# ifdef FN_KEY2 + case FN_KEY2: +# endif + if (record->event.pressed) { + key_press_status |= KEY_PRESS_FN; + } else { + key_press_status &= ~KEY_PRESS_FN; + timer_3s_buffer = 0; + } + return true; +#endif + case F_RESET_KEY1: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_J; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_J; + timer_3s_buffer = 0; + } + return true; + case F_RESET_KEY2: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_Z; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_Z; + timer_3s_buffer = 0; + } + return true; + case BL_TEST_KEY1: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_HOME; + if (led_test_mode) { + if (++led_test_mode >= LED_TEST_MODE_MAX) { + led_test_mode = LED_TEST_MODE_WHITE; + } + } else if (key_press_status == KEY_PRESS_LED_TEST) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_HOME; + timer_3s_buffer = 0; + } + return true; + case BL_TEST_KEY2: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_RIGHT; + if (led_test_mode) { + led_test_mode = LED_TEST_MODE_OFF; + } else if (key_press_status == KEY_PRESS_LED_TEST) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_RIGHT; + timer_3s_buffer = 0; + } + return true; + default: + return true; + } +} + +static void factory_reset(void) { + timer_300ms_buffer = timer_read32(); + factory_reset_count++; +#ifdef KEYBOARD_keychron_c3_pro_ansi_white + layer_state_t default_layer = 1 << 2; +#else + layer_state_t default_layer = default_layer_state; +#endif + eeconfig_init(); + default_layer_set(default_layer); + led_test_mode = LED_TEST_MODE_OFF; +#ifdef LED_MATRIX_ENABLE + if (!led_matrix_is_enabled()) { + led_matrix_enable(); + } + led_matrix_init(); +#endif +#ifdef RGB_MATRIX_ENABLE + if (!rgb_matrix_is_enabled()) { + rgb_matrix_enable(); + } + rgb_matrix_init(); +# ifdef SPLIT_KEYBOARD + led_state = rgb_matrix_get_mode(); + hsv = rgb_matrix_get_hsv(); + rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR); +# endif +#endif +} + +static void timer_3s_task(void) { + if (timer_elapsed32(timer_3s_buffer) > 3000) { + timer_3s_buffer = 0; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + factory_reset(); + } else if (key_press_status == KEY_PRESS_LED_TEST) { +#ifdef SPLIT_KEYBOARD + rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR); +#endif + led_test_mode = LED_TEST_MODE_WHITE; +#ifdef LED_MATRIX_ENABLE + if (!led_matrix_is_enabled()) { + led_matrix_enable(); + } +#endif +#ifdef RGB_MATRIX_ENABLE + if (!rgb_matrix_is_enabled()) { + rgb_matrix_enable(); + } +#endif + } + key_press_status = 0; + } +} + +static void timer_300ms_task(void) { + if (timer_elapsed32(timer_300ms_buffer) > 300) { + if (factory_reset_count++ > 6) { + timer_300ms_buffer = 0; + factory_reset_count = 0; +#ifdef SPLIT_KEYBOARD + rgb_matrix_mode_noeeprom(led_state); + rgb_matrix_sethsv_noeeprom(hsv.h, hsv.s, hsv.v); +#endif + } else { + timer_300ms_buffer = timer_read32(); + } + } +} + +#ifdef LED_MATRIX_ENABLE +bool led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (factory_reset_count) { + for (uint8_t i = led_min; i <= led_max; i++) { + led_matrix_set_value(i, factory_reset_count % 2 ? 0 : UINT8_MAX); + } + } + return true; +} +#endif + +#ifdef RGB_MATRIX_ENABLE +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (factory_reset_count) { + if (rgb_matrix_get_mode() == RGB_MATRIX_SOLID_COLOR) { + if (factory_reset_count % 2) { + rgb_matrix_sethsv_noeeprom(HSV_RED); + } else { + rgb_matrix_sethsv_noeeprom(HSV_OFF); + } + } else { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED); + } + } + return false; + } else if (led_test_mode) { + switch (led_test_mode) { + case LED_TEST_MODE_WHITE: + if (rgb_matrix_get_mode() == RGB_MATRIX_SOLID_COLOR) { + rgb_matrix_sethsv_noeeprom(HSV_WHITE); + } else { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_WHITE); + } + } + break; + case LED_TEST_MODE_RED: + if (rgb_matrix_get_mode() == RGB_MATRIX_SOLID_COLOR) { + rgb_matrix_sethsv_noeeprom(HSV_RED); + } else { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_RED); + } + } + break; + case LED_TEST_MODE_GREEN: + if (rgb_matrix_get_mode() == RGB_MATRIX_SOLID_COLOR) { + rgb_matrix_sethsv_noeeprom(HSV_GREEN); + } else { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_GREEN); + } + } + break; + case LED_TEST_MODE_BLUE: + if (rgb_matrix_get_mode() == RGB_MATRIX_SOLID_COLOR) { + rgb_matrix_sethsv_noeeprom(HSV_BLUE); + } else { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_BLUE); + } + } + break; + default: + break; + } + return false; + } + return true; +} +#endif + +void housekeeping_task_keychron_ft(void) { + if (timer_3s_buffer) { + timer_3s_task(); + } + if (timer_300ms_buffer) { + timer_300ms_task(); + } +} + +#ifdef RAW_ENABLE +static void system_switch_state_report(uint8_t index, bool active) { + uint16_t checksum = 0; + uint8_t data[RAW_EPSIZE] = {0}; + uint8_t payload[3] = {0}; + + if (report_os_sw_state) { + payload[0] = FACTORY_TEST_CMD_OS_SWITCH; + payload[1] = OS_SWITCH; +# if defined(OS_SWITCH_REVERSE) + payload[2] = !active; +# else + payload[2] = active; +# endif + data[0] = 0xAB; + memcpy(&data[1], payload, 3); + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) { + checksum += data[i]; + } + data[RAW_EPSIZE - 2] = checksum & 0xFF; + data[RAW_EPSIZE - 1] = (checksum >> 8) & 0xFF; + raw_hid_send(data, RAW_EPSIZE); + } +} + +bool dip_switch_update_user(uint8_t index, bool active) { + /* Send default layer state to host */ + system_switch_state_report(index, active); + return true; +} + +bool factory_test_rx(uint8_t *data, uint8_t length) { + uint16_t checksum = 0; + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) { + checksum += data[i]; + } + /* Verify checksum */ + if ((checksum & 0xFF) != data[RAW_EPSIZE - 2] || checksum >> 8 != data[RAW_EPSIZE - 1]) { + return true; + } + switch (data[1]) { +# if defined(RGB_MATRIX_ENABLE) + case FACTORY_TEST_CMD_BACKLIGHT: + led_test_mode = data[2]; +# if defined(SPLIT_KEYBOARD) + if (led_test_mode) { + light_test_state += 1; + if (light_test_state == 1) { + led_state = rgb_matrix_get_mode(); + hsv = rgb_matrix_get_hsv(); + } + rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR); + } else { + if (light_test_state) { + light_test_state = 0; + rgb_matrix_mode_noeeprom(led_state); + rgb_matrix_sethsv_noeeprom(hsv.h, hsv.s, hsv.v); + } + } +# endif + timer_3s_buffer = 0; + break; +# endif +# if defined(DIP_SWITCH_ENABLE) + case FACTORY_TEST_CMD_OS_SWITCH: + report_os_sw_state = data[2]; + if (report_os_sw_state) { + dip_switch_read(true); + } + break; +# endif + case FACTORY_TEST_CMD_JUMP_TO_BL: + if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) { + if (memcmp(&data[2], "JumpToBootloader", strlen("JumpToBootloader")) == 0) bootloader_jump(); + } + break; + case FACTORY_TEST_CMD_EEPROM_CLEAR: + if (matrix[0] & 0x1 && matrix[MATRIX_ROWS - 1] & (0x1 << (MATRIX_COLS - 1))) { + if (data[2]) { + factory_reset(); + } + } + break; + } + return true; +} +#endif diff --git a/keyboards/keychron/common/keychron_ft_common.h b/keyboards/keychron/common/keychron_ft_common.h new file mode 100644 index 000000000000..1d61d5d64c6c --- /dev/null +++ b/keyboards/keychron/common/keychron_ft_common.h @@ -0,0 +1,47 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#define KEY_PRESS_FN (0x1 << 0) +#define KEY_PRESS_J (0x1 << 1) +#define KEY_PRESS_Z (0x1 << 2) +#define KEY_PRESS_HOME (0x1 << 3) +#define KEY_PRESS_RIGHT (0x1 << 4) +#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z) +#define KEY_PRESS_LED_TEST (KEY_PRESS_FN | KEY_PRESS_HOME | KEY_PRESS_RIGHT) + +enum { + LED_TEST_MODE_OFF, + LED_TEST_MODE_WHITE, + LED_TEST_MODE_RED, + LED_TEST_MODE_GREEN, + LED_TEST_MODE_BLUE, + LED_TEST_MODE_MAX, +} led_test_mode; + +extern uint16_t key_press_status; +extern uint32_t timer_3s_buffer; +#ifdef SPLIT_KEYBOARD +# ifdef RGB_MATRIX_ENABLE +extern uint8_t led_state; +extern uint8_t light_test_state; +extern HSV hsv; +# endif +#endif + +void housekeeping_task_keychron_ft(void); +bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record); diff --git a/keyboards/keychron/common/keychron_ft_q0.c b/keyboards/keychron/common/keychron_ft_q0.c new file mode 100755 index 000000000000..a9fd1292fe2c --- /dev/null +++ b/keyboards/keychron/common/keychron_ft_q0.c @@ -0,0 +1,93 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "keychron_ft_common.h" + +bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#if defined(FN_KEY1) || defined(FN_KEY2) +# ifdef FN_KEY1 + case FN_KEY1: /* fall through */ +# endif +# ifdef FN_KEY2 + case FN_KEY2: +# endif + if (record->event.pressed) { + key_press_status |= KEY_PRESS_FN; + } else { + key_press_status &= ~KEY_PRESS_FN; + timer_3s_buffer = 0; + } + return true; +#endif + case RGB_SAD: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_J; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } else { + } + } else { + rgb_matrix_decrease_sat_noeeprom(); + key_press_status &= ~KEY_PRESS_J; + timer_3s_buffer = 0; + } + return false; // Skip all further processing of this key + case RGB_HUD: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_Z; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + timer_3s_buffer = timer_read32(); + } else { + } + } else { + rgb_matrix_decrease_hue_noeeprom(); + key_press_status &= ~KEY_PRESS_Z; + timer_3s_buffer = 0; + } + return false; // Skip all further processing of this key + case KC_MPLY: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_HOME; + if (led_test_mode) { + if (++led_test_mode >= LED_TEST_MODE_MAX) { + led_test_mode = LED_TEST_MODE_WHITE; + } + } else if (key_press_status == KEY_PRESS_LED_TEST) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_HOME; + timer_3s_buffer = 0; + } + return true; + case KC_DEL: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_RIGHT; + if (led_test_mode) { + led_test_mode = LED_TEST_MODE_OFF; + } else if (key_press_status == KEY_PRESS_LED_TEST) { + timer_3s_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_RIGHT; + timer_3s_buffer = 0; + } + return true; + default: + return true; + } +} diff --git a/keyboards/keychron/c2_pro/matrix.c b/keyboards/keychron/common/matrix.c similarity index 61% rename from keyboards/keychron/c2_pro/matrix.c rename to keyboards/keychron/common/matrix.c index 5065f97aa7d4..e99edbf43c38 100644 --- a/keyboards/keychron/c2_pro/matrix.c +++ b/keyboards/keychron/common/matrix.c @@ -16,49 +16,45 @@ #include "quantum.h" -#ifndef SHIFT_COL_START -# define SHIFT_COL_START 8 +#ifndef HC595_STCP +# define HC595_STCP B0 #endif -#ifndef SHIFT_COL_END -# define SHIFT_COL_END 15 +#ifndef HC595_SHCP +# define HC595_SHCP A1 +#endif +#ifndef HC595_DS +# define HC595_DS A7 +#endif + +#ifndef HC595_START_INDEX +# define HC595_START_INDEX 0 +#endif +#ifndef HC595_END_INDEX +# define HC595_END_INDEX 15 +#endif +#ifndef HC595_START_OFFSET +# define HC595_START_OFFSET -1 #endif -#if defined(SHIFT_COL_START) && defined(SHIFT_COL_END) -# if ((SHIFT_COL_END - SHIFT_COL_START + 1) > 16) +#if defined(HC595_START_INDEX) && defined(HC595_END_INDEX) +# if ((HC595_END_INDEX - HC595_START_INDEX + 1) > 16) # define SIZE_T uint32_t # define UNSELECT_ALL_COL 0xFFFFFFFF -# elif ((SHIFT_COL_END - SHIFT_COL_START + 1) > 8) +# define SELECT_ALL_COL 0x00000000 +# elif ((HC595_END_INDEX - HC595_START_INDEX + 1) > 8) # define SIZE_T uint16_t # define UNSELECT_ALL_COL 0xFFFF +# define SELECT_ALL_COL 0x0000 # else # define SIZE_T uint8_t # define UNSELECT_ALL_COL 0xFF +# define SELECT_ALL_COL 0x00 # endif #endif pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInput_high(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - static inline uint8_t readMatrixPin(pin_t pin) { if (pin != NO_PIN) { return readPin(pin); @@ -67,17 +63,27 @@ static inline uint8_t readMatrixPin(pin_t pin) { } } -static inline void HC595_delay(uint8_t n) { +static inline void setPinOutput_writeLow(pin_t pin) { + setPinOutput(pin); + writePinLow(pin); +} + +static inline void setPinOutput_writeHigh(pin_t pin) { + setPinOutput(pin); + writePinHigh(pin); +} + +static inline void HC595_delay(uint16_t n) { while (n-- > 0) { asm volatile("nop" ::: "memory"); } } -static void HC595_output(SIZE_T data, uint8_t bit) { +static void HC595_output(SIZE_T data, bool bit_flag) { uint8_t n = 1; ATOMIC_BLOCK_FORCEON { - for (uint8_t i = 0; i < (SHIFT_COL_END - SHIFT_COL_START + 1); i++) { + for (uint8_t i = 0; i < (HC595_END_INDEX - HC595_START_INDEX + 1); i++) { if (data & 0x1) { writePinHigh(HC595_DS); } else { @@ -87,7 +93,7 @@ static void HC595_output(SIZE_T data, uint8_t bit) { HC595_delay(n); writePinLow(HC595_SHCP); HC595_delay(n); - if (bit) { + if (bit_flag) { break; } else { data = data >> 1; @@ -100,59 +106,59 @@ static void HC595_output(SIZE_T data, uint8_t bit) { } } -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (col < SHIFT_COL_START || col > SHIFT_COL_END) { - setPinOutput_writeLow(pin); - return true; +static void select_col(uint8_t col) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { + setPinOutput_writeLow(col_pins[col]); } else { - if (col == SHIFT_COL_START) { - HC595_output(0x00, 1); + if (col == HC595_START_INDEX) { + HC595_output(0x00, true); + if (col <= HC595_START_OFFSET) HC595_output(0x01, true); } - return true; } - return false; } static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (col < SHIFT_COL_START || col > SHIFT_COL_END) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { #ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); + setPinOutput_writeHigh(col_pins[col]); #else - setPinInput_high(pin); + setPinInputHigh(col_pins[col]); #endif } else { - HC595_output(0x01, 1); + HC595_output(0x01, true); } } static void unselect_cols(void) { - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - if (x < SHIFT_COL_START || x > SHIFT_COL_END) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { #ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); + setPinOutput_writeHigh(col_pins[col]); #else - setPinInput_high(pin); + setPinInputHigh(col_pins[col]); #endif } else { - if (x == SHIFT_COL_START) HC595_output(UNSELECT_ALL_COL, 0); + if (col == HC595_START_INDEX) HC595_output(UNSELECT_ALL_COL, false); + break; } } } -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col +void select_all_cols(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { + setPinOutput_writeLow(col_pins[col]); + } else { + if (col == HC595_START_INDEX) HC595_output(SELECT_ALL_COL, false); + break; + } } +} - matrix_output_select_delay(); +static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { + // Select col + select_col(current_col); // select col + HC595_delay(200); // For each row... for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { @@ -160,7 +166,6 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre if (readMatrixPin(row_pins[row_index]) == 0) { // Pin LO, set col bit current_matrix[row_index] |= row_shifter; - key_pressed = true; } else { // Pin HI, clear col bit current_matrix[row_index] &= ~row_shifter; @@ -169,7 +174,7 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre // Unselect col unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH + HC595_delay(200); // wait for all Row signals to go HIGH } void matrix_init_custom(void) { @@ -179,7 +184,7 @@ void matrix_init_custom(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { if (row_pins[x] != NO_PIN) { - setPinInput_high(row_pins[x]); + setPinInputHigh(row_pins[x]); } } @@ -200,3 +205,8 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { return changed; } + +void suspend_wakeup_init_kb(void) { + // code will run on keyboard wakeup + clear_keyboard(); +} diff --git a/keyboards/keychron/common/via_indicator.c b/keyboards/keychron/common/via_indicator.c new file mode 100755 index 000000000000..256f2ff0d20b --- /dev/null +++ b/keyboards/keychron/common/via_indicator.c @@ -0,0 +1,237 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#if defined(RGB_MATRIX_ENABLE) +# if defined(CAPS_LOCK_INDEX) || defined(NUM_LOCK_INDEX) + +enum via_capslock_value { + id_capslock_brightness = 1, + id_capslock_status = 2, + id_capslock_color = 3, + id_numlock_brightness = 4, + id_numlock_status = 5, + id_numlock_color = 6, +}; + +typedef struct { + HSV hsv; + bool status; +} g_capslock_control; +typedef struct { + HSV hsv; + bool status; +} g_numlock_control; +struct { + g_capslock_control caps; + g_numlock_control num; +} g_indicator_control; + +void keyboard_post_init_user() { + eeconfig_read_user_datablock(&g_indicator_control); +} + +void eeconfig_init_kb(void) { +# if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +# endif + g_indicator_control.caps.hsv.h = 255; + g_indicator_control.caps.hsv.s = 0; + g_indicator_control.caps.hsv.v = 255; + g_indicator_control.caps.status = true; + g_indicator_control.num.hsv.h = 255; + g_indicator_control.num.hsv.s = 0; + g_indicator_control.num.hsv.v = 255; + g_indicator_control.num.status = true; + eeconfig_update_user_datablock(&g_indicator_control); + + eeconfig_init_user(); +} + +bool rgb_matrix_indicators_kb(void) { +# if defined(CAPS_LOCK_INDEX) + if (host_keyboard_led_state().caps_lock && g_indicator_control.caps.status) { + RGB rgb = hsv_to_rgb(g_indicator_control.caps.hsv); +# if defined(DIM_CAPS_LOCK) + rgb_matrix_set_color(CAPS_LOCK_INDEX, 0, 0, 0); +# else + rgb_matrix_set_color(CAPS_LOCK_INDEX, rgb.r, rgb.g, rgb.b); +# endif + } +# endif +# if defined(NUM_LOCK_INDEX) + if (host_keyboard_led_state().num_lock && g_indicator_control.num.status) { + RGB rgb = hsv_to_rgb(g_indicator_control.num.hsv); + rgb_matrix_set_color(NUM_LOCK_INDEX, rgb.r, rgb.g, rgb.b); + } +# endif + return true; +} + +void rgb_matrix_none_indicators_kb(void) { + rgb_matrix_indicators_kb(); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + + if (rgb_matrix_is_enabled() +# if defined(ENABLE_RGB_MATRIX_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS) + && (rgb_matrix_get_mode() != RGB_MATRIX_JELLYBEAN_RAINDROPS) +# endif +# if defined(ENABLE_RGB_MATRIX_PIXEL_RAIN) + && (rgb_matrix_get_mode() != RGB_MATRIX_PIXEL_RAIN) +# endif + ) { + return res; + } + + if (res) { +# if defined(CAPS_LOCK_INDEX) + if (led_state.caps_lock) { + RGB rgb = hsv_to_rgb(g_indicator_control.caps.hsv); + rgb_matrix_set_color(CAPS_LOCK_INDEX, rgb.r, rgb.g, rgb.b); + } else { + rgb_matrix_set_color(CAPS_LOCK_INDEX, 0, 0, 0); + } +# endif +# if defined(NUM_LOCK_INDEX) + if (led_state.num_lock) { + RGB rgb = hsv_to_rgb(g_indicator_control.caps.hsv); + rgb_matrix_set_color(NUM_LOCK_INDEX, rgb.r, rgb.g, rgb.b); + } else { + rgb_matrix_set_color(NUM_LOCK_INDEX, 0, 0, 0); + } +# endif + rgb_matrix_driver.flush(); + } + return res; +} + +void indicator_config_set_value(uint8_t *data) { + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_capslock_brightness: { + g_indicator_control.caps.hsv.v = *value_data; + break; + } + case id_capslock_status: { + g_indicator_control.caps.status = *value_data; + break; + } + case id_capslock_color: { + g_indicator_control.caps.hsv.h = value_data[0]; + g_indicator_control.caps.hsv.s = value_data[1]; + break; + } + case id_numlock_brightness: { + g_indicator_control.num.hsv.v = *value_data; + break; + } + case id_numlock_status: { + g_indicator_control.num.status = *value_data; + break; + } + case id_numlock_color: { + g_indicator_control.num.hsv.h = value_data[0]; + g_indicator_control.num.hsv.s = value_data[1]; + break; + } + } +} + +void indicator_config_get_value(uint8_t *data) { + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch (*value_id) { + case id_capslock_brightness: { + *value_data = g_indicator_control.caps.hsv.v; + break; + } + case id_capslock_status: { + *value_data = g_indicator_control.caps.status; + break; + } + case id_capslock_color: { + value_data[0] = g_indicator_control.caps.hsv.h; + value_data[1] = g_indicator_control.caps.hsv.s; + break; + } + case id_numlock_brightness: { + *value_data = g_indicator_control.num.hsv.v; + break; + } + case id_numlock_status: { + *value_data = g_indicator_control.num.status; + break; + } + case id_numlock_color: { + value_data[0] = g_indicator_control.num.hsv.h; + value_data[1] = g_indicator_control.num.hsv.s; + break; + } + } +} + +void indicator_config_save(void) { + eeconfig_update_user_datablock(&g_indicator_control); +} + +void via_custom_value_command_kb(uint8_t *data, uint8_t length) { + // data = [ command_id, channel_id, value_id, value_data ] + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + + if (*channel_id == id_custom_channel) { + switch (*command_id) { + case id_custom_set_value: { + indicator_config_set_value(value_id_and_data); + break; + } + case id_custom_get_value: { + indicator_config_get_value(value_id_and_data); + break; + } + case id_custom_save: { + indicator_config_save(); + break; + } + default: { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + return; + } + + // Return the unhandled state + *command_id = id_unhandled; + + // DO NOT call raw_hid_send(data,length) here, let caller do this +} + +# endif +#endif diff --git a/keyboards/keychron/q0/config.h b/keyboards/keychron/q0/config.h index c0366b1ed882..a3a8728646d2 100644 --- a/keyboards/keychron/q0/config.h +++ b/keyboards/keychron/q0/config.h @@ -16,7 +16,9 @@ #pragma once -#define CKLED2001_CURRENT_TUNE { 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70 } +/* Set LED driver current */ +#define CKLED2001_CURRENT_TUNE \ + { 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70, 0xFF, 0xFF, 0x70 } /* turn off effects when suspended */ #define RGB_DISABLE_WHEN_USB_SUSPENDED @@ -25,5 +27,12 @@ #define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects + #define RGB_MATRIX_KEYPRESSES -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS \ No newline at end of file +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/q0/halconf.h b/keyboards/keychron/q0/halconf.h index 41bddcb2799b..e490b49e005a 100644 --- a/keyboards/keychron/q0/halconf.h +++ b/keyboards/keychron/q0/halconf.h @@ -17,5 +17,6 @@ #pragma once #define HAL_USE_I2C TRUE +#define PAL_USE_CALLBACKS TRUE #include_next diff --git a/keyboards/keychron/q0/info.json b/keyboards/keychron/q0/info.json new file mode 100644 index 000000000000..5aa75a85c225 --- /dev/null +++ b/keyboards/keychron/q0/info.json @@ -0,0 +1,48 @@ +{ + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434", + "force_nkro": true + }, + "diode_direction": "ROW2COL", + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + } + } +} diff --git a/keyboards/keychron/q0/q0.c b/keyboards/keychron/q0/q0.c deleted file mode 100644 index cfe26a583a1a..000000000000 --- a/keyboards/keychron/q0/q0.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "quantum.h" - -#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { -# ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - } break; - } - } - return false; -# endif - } - 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; - } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - - if (host_keyboard_led_state().num_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // NUM_LOCK_LED_INDEX diff --git a/keyboards/keychron/q0/readme.md b/keyboards/keychron/q0/readme.md index d0180d386e0f..2ad9c29ccf8c 100644 --- a/keyboards/keychron/q0/readme.md +++ b/keyboards/keychron/q0/readme.md @@ -1,5 +1,7 @@ # Keychron Q0 +![Keychron Q0](https://i.imgur.com/cLbEiZ0.jpg) + A customizable number keypad. * Keyboard Maintainer: [Keychron](https://github.com/keychron) @@ -9,11 +11,18 @@ A customizable number keypad. Make example for this keyboard (after setting up your build environment): make keychron/q0/rev_0130:default + make keychron/q0/rev_0131:default Flashing example for this keyboard: make keychron/q0/rev_0130:default:flash + make keychron/q0/rev_0131:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button whitch is located directly below the key dot to the left side. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q0/rev_0130/config.h b/keyboards/keychron/q0/rev_0130/config.h index 12ecfe135606..8a6efc8b1091 100644 --- a/keyboards/keychron/q0/rev_0130/config.h +++ b/keyboards/keychron/q0/rev_0130/config.h @@ -21,8 +21,7 @@ #define DRIVER_ADDR_1 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 21 -#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL +#define RGB_MATRIX_LED_COUNT 21 /* Enable num-lock LED */ #define NUM_LOCK_LED_INDEX 4 diff --git a/keyboards/keychron/q0/rev_0130/info.json b/keyboards/keychron/q0/rev_0130/info.json index f6225c884a94..8ac3b96d569c 100644 --- a/keyboards/keychron/q0/rev_0130/info.json +++ b/keyboards/keychron/q0/rev_0130/info.json @@ -1,10 +1,6 @@ { "keyboard_name": "Q0", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0130", "device_version": "1.0.2", "force_nkro": true @@ -13,46 +9,7 @@ "cols": ["A5", "A6", "A7", "B0"], "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] }, - "features": { - "audio": false, - "backlight": false, - "bootmagic": true, - "command": false, - "console": false, - "extrakey": true, - "mousekey": true, - "nkro": true, - "rgb_matrix": true, - "rgblight": false - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "rgb_matrix": { - "driver": "ckled2001", - "animations": { - "band_spiral_val": true, - "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, - "jellybean_raindrops": true, - "pixel_rain": true, - "typing_heatmap": true, - "digital_rain": true, - "solid_reactive_simple": true, - "solid_reactive_multiwide": true, - "solid_reactive_multinexus": true, - "splash": true, - "solid_splash": true - }, "center_point": [56, 16], "layout": [ {"flags": 1, "matrix": [0, 0], "x": 0, "y": 0}, diff --git a/keyboards/keychron/q0/rev_0130/keymaps/keychron/keymap.c b/keyboards/keychron/q0/rev_0130/keymaps/keychron/keymap.c index 73826716fca6..4c257e909a2f 100644 --- a/keyboards/keychron/q0/rev_0130/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q0/rev_0130/keymaps/keychron/keymap.c @@ -16,6 +16,7 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 }; @@ -55,11 +56,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q0/rev_0130/keymaps/keychron/rules.mk b/keyboards/keychron/q0/rev_0130/keymaps/keychron/rules.mk index 495e8907b48c..f6b45fef46a0 100644 --- a/keyboards/keychron/q0/rev_0130/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q0/rev_0130/keymaps/keychron/rules.mk @@ -1,4 +1,5 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk +SRC += keychron_ft_q0.c + diff --git a/keyboards/keychron/q0/rev_0130/keymaps/via/keymap.c b/keyboards/keychron/q0/rev_0130/keymaps/via/keymap.c index 32fd198cf00b..cf00b3656800 100644 --- a/keyboards/keychron/q0/rev_0130/keymaps/via/keymap.c +++ b/keyboards/keychron/q0/rev_0130/keymaps/via/keymap.c @@ -16,8 +16,14 @@ #include QMK_KEYBOARD_H -enum layers { _BASE, _FN1, _RESERVED1, _RESERVED2 }; +enum layers { + _BASE, + _FN1, + _RESERVED1, + _RESERVED2, +}; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT_numpad_6x4( MO(_FN1), KC_ESC, KC_BSPC, KC_TAB, diff --git a/keyboards/keychron/q0/rev_0130/rules.mk b/keyboards/keychron/q0/rev_0130/rules.mk index f6868e88e334..6e7633bfe015 100644 --- a/keyboards/keychron/q0/rev_0130/rules.mk +++ b/keyboards/keychron/q0/rev_0130/rules.mk @@ -1,3 +1 @@ -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q0/rev_0131/config.h b/keyboards/keychron/q0/rev_0131/config.h index e4c5c2d3fc2a..982e5e1c4650 100644 --- a/keyboards/keychron/q0/rev_0131/config.h +++ b/keyboards/keychron/q0/rev_0131/config.h @@ -21,8 +21,7 @@ #define DRIVER_ADDR_1 0b1110111 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 26 -#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL +#define RGB_MATRIX_LED_COUNT 26 /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL @@ -30,5 +29,7 @@ /* Enable num-lock LED */ #define NUM_LOCK_LED_INDEX 5 -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q0/rev_0131/info.json b/keyboards/keychron/q0/rev_0131/info.json index c569e498f404..b410f8b498b8 100644 --- a/keyboards/keychron/q0/rev_0131/info.json +++ b/keyboards/keychron/q0/rev_0131/info.json @@ -1,32 +1,16 @@ { "keyboard_name": "Keychron Q0 Plus", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0131", - "device_version": "1.0.0", - "force_nkro": true + "device_version": "1.0.0" }, "matrix_pins": { "cols": ["C14", "C15", "A0", "A1", "A2"], "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] }, "features": { - "audio": false, - "backlight": false, - "bootmagic": true, - "command": false, - "console": false, - "encoder": true, - "extrakey": true, - "mousekey": true, - "nkro": true, - "rgb_matrix": true, - "rgblight": false + "encoder": true }, - "diode_direction": "ROW2COL", "encoder": { "rotary": [ {"pin_a": "A3", "pin_b": "A4"} @@ -35,33 +19,7 @@ "bootmagic": { "matrix": [0, 1] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "rgb_matrix": { - "driver": "ckled2001", - "animations": { - "band_spiral_val": true, - "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, - "jellybean_raindrops": true, - "pixel_rain": true, - "typing_heatmap": true, - "digital_rain": true, - "solid_reactive_simple": true, - "solid_reactive_multiwide": true, - "solid_reactive_multinexus": true, - "splash": true, - "solid_splash": true - }, "layout": [ {"flags": 1, "matrix": [0, 1], "x": 56, "y": 0}, {"flags": 1, "matrix": [0, 2], "x": 112, "y": 0}, diff --git a/keyboards/keychron/q0/rev_0131/keymaps/default/keymap.c b/keyboards/keychron/q0/rev_0131/keymaps/default/keymap.c index 4e281d4d7db9..e28da8828a6d 100644 --- a/keyboards/keychron/q0/rev_0131/keymaps/default/keymap.c +++ b/keyboards/keychron/q0/rev_0131/keymaps/default/keymap.c @@ -16,13 +16,12 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { BASE, - FUNC + FUNC, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_numpad_6x5( KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB, diff --git a/keyboards/keychron/q0/rev_0131/keymaps/keychron/keymap.c b/keyboards/keychron/q0/rev_0131/keymaps/keychron/keymap.c index 795c27554332..237d6b32d1fc 100644 --- a/keyboards/keychron/q0/rev_0131/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q0/rev_0131/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers { BASE, FUNC, L2, - L3 + L3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_numpad_6x5( KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB, @@ -73,11 +73,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q0/rev_0131/keymaps/keychron/rules.mk b/keyboards/keychron/q0/rev_0131/keymaps/keychron/rules.mk index 9cf1a9b56cba..75d84e5f9ba2 100644 --- a/keyboards/keychron/q0/rev_0131/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q0/rev_0131/keymaps/keychron/rules.mk @@ -1,5 +1,5 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk +SRC += keychron_ft_q0.c diff --git a/keyboards/keychron/q0/rev_0131/keymaps/via/keymap.c b/keyboards/keychron/q0/rev_0131/keymaps/via/keymap.c index 935d3edb76b1..f2678850597f 100644 --- a/keyboards/keychron/q0/rev_0131/keymaps/via/keymap.c +++ b/keyboards/keychron/q0/rev_0131/keymaps/via/keymap.c @@ -16,15 +16,14 @@ #include QMK_KEYBOARD_H - // clang-format off - enum layers { BASE, FUNC, L2, - L3 + L3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_numpad_6x5( KC_MUTE, MO(FUNC), KC_ESC, KC_BSPC, KC_TAB, @@ -61,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, - [FUNC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, - [L2] = { ENCODER_CCW_CW(_______, _______) }, - [L3] = { ENCODER_CCW_CW(_______, _______) } + [BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [FUNC] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, + [L2] = { ENCODER_CCW_CW(_______, _______) }, + [L3] = { ENCODER_CCW_CW(_______, _______) } }; #endif // ENCODER_MAP_ENABLE diff --git a/keyboards/keychron/q0/rev_0131/rules.mk b/keyboards/keychron/q0/rev_0131/rules.mk index f6868e88e334..6e7633bfe015 100644 --- a/keyboards/keychron/q0/rev_0131/rules.mk +++ b/keyboards/keychron/q0/rev_0131/rules.mk @@ -1,3 +1 @@ -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q1/ansi/info.json b/keyboards/keychron/q1/ansi/info.json deleted file mode 100644 index 8ff2075747c3..000000000000 --- a/keyboards/keychron/q1/ansi/info.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "keyboard_name": "Q1", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", - "usb": { - "vid": "0x3434", - "pid": "0x0100", - "device_version": "1.0.0", - "force_nkro": true - }, - "rgb_matrix": { - "driver": "is31fl3733" - }, - "matrix_pins": { - "cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"], - "rows": ["D3", "D2", "B3", "B2", "B1", "B0"] - }, - "diode_direction": "ROW2COL", - "processor": "atmega32u4", - "bootloader": "atmel-dfu", - "layouts": { - "LAYOUT_ansi_82": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0}, - {"matrix": [0, 2], "x": 1.25, "y": 0}, - {"matrix": [0, 3], "x": 2.25, "y": 0}, - {"matrix": [0, 4], "x": 3.25, "y": 0}, - {"matrix": [0, 5], "x": 4.25, "y": 0}, - {"matrix": [0, 6], "x": 5.5, "y": 0}, - {"matrix": [0, 7], "x": 6.5, "y": 0}, - {"matrix": [0, 8], "x": 7.5, "y": 0}, - {"matrix": [0, 9], "x": 8.5, "y": 0}, - {"matrix": [0, 10], "x": 9.75, "y": 0}, - {"matrix": [0, 11], "x": 10.75, "y": 0}, - {"matrix": [0, 12], "x": 11.75, "y": 0}, - {"matrix": [0, 13], "x": 12.75, "y": 0}, - {"matrix": [4, 14], "x": 14, "y": 0}, - {"matrix": [0, 14], "x": 15.25, "y": 0}, - - {"matrix": [1, 0], "x": 0, "y": 1}, - {"matrix": [1, 1], "x": 1, "y": 1}, - {"matrix": [1, 2], "x": 2, "y": 1}, - {"matrix": [1, 3], "x": 3, "y": 1}, - {"matrix": [1, 4], "x": 4, "y": 1}, - {"matrix": [1, 5], "x": 5, "y": 1}, - {"matrix": [1, 6], "x": 6, "y": 1}, - {"matrix": [1, 7], "x": 7, "y": 1}, - {"matrix": [1, 8], "x": 8, "y": 1}, - {"matrix": [1, 9], "x": 9, "y": 1}, - {"matrix": [1, 10], "x": 10, "y": 1}, - {"matrix": [1, 11], "x": 11, "y": 1}, - {"matrix": [1, 12], "x": 12, "y": 1}, - {"matrix": [1, 13], "x": 13, "y": 1, "w": 2}, - {"matrix": [1, 14], "x": 15.25, "y": 1}, - - {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.5}, - {"matrix": [2, 1], "x": 1.5, "y": 2}, - {"matrix": [2, 2], "x": 2.5, "y": 2}, - {"matrix": [2, 3], "x": 3.5, "y": 2}, - {"matrix": [2, 4], "x": 4.5, "y": 2}, - {"matrix": [2, 5], "x": 5.5, "y": 2}, - {"matrix": [2, 6], "x": 6.5, "y": 2}, - {"matrix": [2, 7], "x": 7.5, "y": 2}, - {"matrix": [2, 8], "x": 8.5, "y": 2}, - {"matrix": [2, 9], "x": 9.5, "y": 2}, - {"matrix": [2, 10], "x": 10.5, "y": 2}, - {"matrix": [2, 11], "x": 11.5, "y": 2}, - {"matrix": [2, 12], "x": 12.5, "y": 2}, - {"matrix": [2, 13], "x": 13.5, "y": 2, "w": 1.5}, - {"matrix": [2, 14], "x": 15.25, "y": 2}, - - {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.75}, - {"matrix": [3, 1], "x": 1.75, "y": 3}, - {"matrix": [3, 2], "x": 2.75, "y": 3}, - {"matrix": [3, 3], "x": 3.75, "y": 3}, - {"matrix": [3, 4], "x": 4.75, "y": 3}, - {"matrix": [3, 5], "x": 5.75, "y": 3}, - {"matrix": [3, 6], "x": 6.75, "y": 3}, - {"matrix": [3, 7], "x": 7.75, "y": 3}, - {"matrix": [3, 8], "x": 8.75, "y": 3}, - {"matrix": [3, 9], "x": 9.75, "y": 3}, - {"matrix": [3, 10], "x": 10.75, "y": 3}, - {"matrix": [3, 11], "x": 11.75, "y": 3}, - {"matrix": [3, 13], "x": 12.75, "y": 3, "w": 2.25}, - {"matrix": [3, 14], "x": 15.25, "y": 3}, - - {"matrix": [4, 0], "x": 0, "y": 4, "w": 2.25}, - {"matrix": [4, 2], "x": 2.25, "y": 4}, - {"matrix": [4, 3], "x": 3.25, "y": 4}, - {"matrix": [4, 4], "x": 4.25, "y": 4}, - {"matrix": [4, 5], "x": 5.25, "y": 4}, - {"matrix": [4, 6], "x": 6.25, "y": 4}, - {"matrix": [4, 7], "x": 7.25, "y": 4}, - {"matrix": [4, 8], "x": 8.25, "y": 4}, - {"matrix": [4, 9], "x": 9.25, "y": 4}, - {"matrix": [4, 10], "x": 10.25, "y": 4}, - {"matrix": [4, 11], "x": 11.25, "y": 4}, - {"matrix": [4, 13], "x": 12.25, "y": 4, "w": 1.75}, - {"matrix": [3, 12], "x": 14.25, "y": 4.25}, - - {"matrix": [5, 0], "x": 0, "y": 5, "w": 1.25}, - {"matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25}, - {"matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25}, - {"matrix": [5, 6], "x": 3.75, "y": 5, "w": 6.25}, - {"matrix": [5, 10], "x": 10, "y": 5}, - {"matrix": [5, 11], "x": 11, "y": 5}, - {"matrix": [5, 12], "x": 12, "y": 5}, - {"matrix": [5, 13], "x": 13.25, "y": 5.25}, - {"matrix": [4, 12], "x": 14.25, "y": 5.25}, - {"matrix": [5, 14], "x": 15.25, "y": 5.25} - ] - } - } -} diff --git a/keyboards/keychron/q1/ansi/keymaps/default/keymap.c b/keyboards/keychron/q1/ansi/keymaps/default/keymap.c deleted file mode 100644 index 092d446773d0..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/default/keymap.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; - -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [MAC_FN] = LAYOUT_ansi_82( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), - - [WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [WIN_FN] = LAYOUT_ansi_82( - _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) -}; diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/README.md b/keyboards/keychron/q1/ansi/keymaps/gtg465x/README.md deleted file mode 100644 index c2d5799bb8b1..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# gtg465x's Keychron Q1 keymap - -- On macOS, F3 opens Mission Control and F4 opens Launchpad without needing to configure shortcuts in System Preferences -- RGB lighting turns off when the computer sleeps -- Caps Lock and alpha keys turn red to indicate when Caps Lock is on -- When the Fn layer is active, RGB lighting turns off for keys that are not assigned - -## Changelog - -### 10/3/2021 - 1.0.3 - -- Feature: When the Fn layer is active, RGB lighting turns off for keys that are not assigned - -### 10/1/2021 - 1.0.2 - -- Added Caps Lock indicator (my implementation is different, but this was inspired by mkillewald) -- Mission Control and Launchpad custom keycodes are now defined using the VIA user keycodes range so they can be labeled properly in VIA - -### 9/28/2021 - 1.0.1 - -- Initial release diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap.c b/keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap.c deleted file mode 100644 index 8da475c3c60a..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/keymap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2021 @ Grayson Carr - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -// clang-format off - -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[MAC_FN] = LAYOUT_ansi_82( - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - -[WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[WIN_FN] = LAYOUT_ansi_82( - KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) - -}; - -// clang-format on - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.c b/keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.c deleted file mode 100644 index b7d12f9466ad..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rgb_matrix_user.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2021 @ Grayson Carr - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#ifdef CAPS_LOCK_INDICATOR_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } -#endif - break; - case MAC_FN: - case WIN_FN: -#ifdef FN_LAYER_TRANSPARENT_KEYS_OFF - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); -#endif - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { -#ifdef CAPS_LOCK_INDICATOR_LIGHT_ALPHAS - return (KC_A <= keycode && keycode <= KC_Z) || keycode == KC_CAPS; -#else - return keycode == KC_CAPS; -#endif -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rules.mk b/keyboards/keychron/q1/ansi/keymaps/gtg465x/rules.mk deleted file mode 100644 index 42ba38028d26..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -VIA_ENABLE = yes -MOUSEKEY_ENABLE = no - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif diff --git a/keyboards/keychron/q1/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q1/ansi/keymaps/keychron/rules.mk deleted file mode 100644 index 495e8907b48c..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/config.h b/keyboards/keychron/q1/ansi/keymaps/mkillewald/config.h deleted file mode 100644 index bc9fe405c35c..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/config.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#ifdef RGB_MATRIX_ENABLE -# define RGB_DISABLE_WHEN_USB_SUSPENDED -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define FN_LAYER_COLOR RGB_ORANGE -#endif \ No newline at end of file diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap.c b/keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap.c deleted file mode 100644 index 4fc8ad58e546..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/keymap.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -// clang-format off - -typedef union { - uint32_t raw; - struct { - bool caps_lock_light_tab :1; - bool caps_lock_light_alphas :1; - bool fn_layer_transparent_keys_off :1; - bool fn_layer_color_enable :1; - }; -} user_config_t; - -user_config_t user_config; - -enum custom_keycodes { - KC_LIGHT_TAB_TOGGLE = QK_KB_2, // TECH DEBT: Starts at QK_KB_2 to maintain ordering with VIA definitions. See #19884. Revert to QK_KB_0 when VIA catches up with QMK. - KC_LIGHT_ALPHAS_TOGGLE, - KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE, - KC_FN_LAYER_COLOR_TOGGLE -}; - -#define KC_LTTOG KC_LIGHT_TAB_TOGGLE -#define KC_LATOG KC_LIGHT_ALPHAS_TOGGLE -#define KC_TKTOG KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE -#define KC_FCTOG KC_FN_LAYER_COLOR_TOGGLE -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[MAC_FN] = LAYOUT_ansi_82( - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_LTTOG, KC_LATOG, KC_TKTOG, KC_FCTOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - -[WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[WIN_FN] = LAYOUT_ansi_82( - KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_LTTOG, KC_LATOG, KC_TKTOG, KC_FCTOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) - -}; - -// clang-format on - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} - -void keyboard_post_init_user(void) { - user_config.raw = eeconfig_read_user(); -} - -void eeconfig_init_user(void) { - user_config.raw = 0; - user_config.caps_lock_light_tab = false; - user_config.caps_lock_light_alphas = false; - user_config.fn_layer_transparent_keys_off = true; - user_config.fn_layer_color_enable = false; - eeconfig_update_user(user_config.raw); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case KC_LIGHT_TAB_TOGGLE: - if (record->event.pressed) { - user_config.caps_lock_light_tab ^= 1; // bitwise xor to toggle status bit - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_LIGHT_ALPHAS_TOGGLE: - if (record->event.pressed) { - user_config.caps_lock_light_alphas ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE: - if (record->event.pressed) { - user_config.fn_layer_transparent_keys_off ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_FN_LAYER_COLOR_TOGGLE: - if (record->event.pressed) { - user_config.fn_layer_color_enable ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - default: - return true; // Process all other keycodes normally - } -} - -bool get_caps_lock_light_tab(void) { - return user_config.caps_lock_light_tab; -} - -bool get_caps_lock_light_alphas(void) { - return user_config.caps_lock_light_alphas; -} - -bool get_fn_layer_transparent_keys_off(void) { - return user_config.fn_layer_transparent_keys_off; -} - -bool get_fn_layer_color_enable(void) { - return user_config.fn_layer_color_enable; -} diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/readme.md b/keyboards/keychron/q1/ansi/keymaps/mkillewald/readme.md deleted file mode 100644 index 8ff2dbcc2cb9..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/readme.md +++ /dev/null @@ -1,54 +0,0 @@ -## mkillewald's Keychron Q1 keymap (ANSI rev_0100) v1.0.4 - -This keymap builds on the keymap by Grayson Carr (gtg465x) but adds a couple options. - -## Features: -- On macOS, F3 opens Mission Control and F4 opens Launchpad without needing to configure shortcuts in System Preferences -- RGB lighting turns off when the computer sleeps -- Caps Lock RGB indicator - - the Caps Lock key will light when Caps Lock is enabled with the following options: - - #define CAPS_LOCK_INDICATOR_COLOR [color] in config.h to set the backlight color used for the indicator when Caps Lock is enabled (default: red) - - Fn+Z will toggle lighting the TAB key when Caps Lock is enabled. This is useful with non backlit keycaps/legends. (default: off) - - Fn+X will toggle lighting all the alpha keys when Caps Lock is enabled. (default: off) - -- Dynamic Fn layer RGB indicator - - When the Fn key is held down, any keys defined on the Fn layer in this firmware or in VIA will be highlighted with the following options: - - #define FN_LAYER_COLOR [color] in config.h to set a static color for defined keys (default: orange) - - Fn+C will toggle turning off RGB for keys with no definition (default: RGB off) - - Fn+V will toggle lighting the defined Fn layer keys with the static color set with FN_LAYER_COLOR (default: static color off) - -- All custom keycodes can be moved to different keys in VIA by using the ANY key with the following keycodes: - - USER(0) (default: F3) macOS Mission Control - - USER(1) (default: F4) macOS Launchpad - - USER(2) (default: Fn+Z) Caps Lock light Tab toggle - - USER(3) (default: Fn+X) Caps Lock light alphas toggle - - USER(4) (default: Fn+C) Fn layer non-defined keys RGB toggle - - USER(5) (default: Fn+V) Fn layer defined keys static color toggle - -RGB must be toggled on for all indicators to function. If you do not want an RGB mode active but still want the indicators, toggle RGB on and turn the brightness all the way off. The indicators will remain at full brightness. - -Please make sure to save any customizations you have made in VIA to a .json file before flashing the firmware. Sometimes it has been necessary to re-apply those changes in VIA after flashing the firmware. If that is the case, you will most likely need to manually add the USER(0) through USER(5) custom keycodes after loading your customizations from the saved .json file. Then re-save a new .json file which will have your previous customizations and the custom keycodes for future use as needed. - -#### USE AT YOUR OWN RISK - -## Changelog: - -v1.0.4 October 9, 2021 -- Caps Lock and Fn layer toggles are now stored in eeprom so settings will remain when Q1 is unplugged - -v1.0.3 October 8, 2021 -- now using keycode toggles instead of preprocessor directive to set the various Caps Lock and Fn Layer RGB lighting options. This allows for setting the options from user space without having to recompile. - -v1.0.2 October 7, 2021 -- adapted Grayson Carr's (gtg465x) Caps Lock alphas and dynamic Fn layer RGB routines -- added CAPS_LOCK_INDICATOR_LIGHT_TAB config option to enable/disable lighting Tab with Caps Lock indicator -- added FN_LAYER_COLOR config option to set FN layer static color - -v1.0.1 October 7, 2021 -- Mission Control and Launchpad custom keycodes are now defined using the VIA user keycodes range so thay can be labeled properly in VIA (adopted change from gtg465x) - -v1.0.0 September 30, 2021 -- Initial release built upon keymap by Grayson Carr (gtg465x) -- defined Mission Control (F3) and Launchpad (F4) keycodes for macOs -- RGB backlight turns off when computer sleeps -- added Caps Lock indicator lighting both the Caps Lock and Tab LEDs for better effect on non-backlit keycaps diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.c b/keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.c deleted file mode 100644 index c6fa5f1f155a..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#ifdef CAPS_LOCK_INDICATOR_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } -#endif - break; - case MAC_FN: - case WIN_FN: -#ifdef FN_LAYER_COLOR - if (get_fn_layer_color_enable()) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_not_transparent, FN_LAYER_COLOR); - } -#endif - if (get_fn_layer_transparent_keys_off()) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); - } - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { - bool indicator = keycode == KC_CAPS; - - if (get_caps_lock_light_tab()) { - indicator = keycode == KC_TAB || keycode == KC_CAPS; - } - - if (get_caps_lock_light_alphas()) { - return (KC_A <= keycode && keycode <= KC_Z) || indicator; - } else { - return indicator; - } -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } -bool is_not_transparent(uint16_t keycode) { return keycode != KC_TRNS; } diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rules.mk b/keyboards/keychron/q1/ansi/keymaps/mkillewald/rules.mk deleted file mode 100644 index af720e37ee7b..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -VIA_ENABLE = yes -MOUSEKEY_ENABLE = no - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif \ No newline at end of file diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/keymap.c b/keyboards/keychron/q1/ansi/keymaps/teimor/keymap.c deleted file mode 100644 index 77af30c5b6a3..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/keymap.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -// clang-format off - -#define TG_NKRO MAGIC_TOGGLE_NKRO - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_END, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, - KC_LGMAC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_MACFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [MAC_FN] = LAYOUT_ansi_82( - _______, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MACPS, KC_INS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, - KC_CAPS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, KC_LMAC, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), - - [WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_END, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, - KC_LGWIN, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_WINFN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [WIN_FN] = LAYOUT_ansi_82( - _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_INS, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, - KC_CAPS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) -}; - -// clang-format on - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/readme.md b/keyboards/keychron/q1/ansi/keymaps/teimor/readme.md deleted file mode 100644 index 9aa16f9a8939..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -# teimor's Keychron Q1 keymap - -- Via Enabled. -- Tap dance enabled. -- On macOS, F3 opens Mission Control and F4 opens Launchpad without needing to configure shortcuts in System Preferences. -- RGB lighting turns off when the computer sleeps. -- The RGB lighting for keys that are not assigned turns off when the Fn layer is active -- 60% layout turns red to indicate when Caps Lock is on. -- Windows and macOS: A single tap will quickly change the language, and holding will trigger Caps Lock. (Using Tap Dance) -- RGB Matrix based on layout - macOS base layout will turn on cyan color, Windows base layout will turn on green color. -- `fn + N` will toggle NKRO, useful when using the keyboard on freebsd. -- `fn + L` on macOS will lock the system. -- `fn + del` will trigger screenshot on macOS and Windows. diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.c b/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.c deleted file mode 100644 index fbc37fb5bfbe..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state | default_layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#if defined CAPS_LOCK_INDICATOR_COLOR && defined MAC_LAYER_DEFAULT_COLOR && defined WIN_LAYER_DEFAULT_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } else if (current_layer == MAC_BASE) - rgb_matrix_set_color_all(MAC_LAYER_DEFAULT_COLOR); - else if (current_layer == WIN_BASE) - rgb_matrix_set_color_all(WIN_LAYER_DEFAULT_COLOR); -#endif - break; - case MAC_FN: - case WIN_FN: -#if defined MAC_LAYER_DEFAULT_COLOR && defined WIN_LAYER_DEFAULT_COLOR - if (current_layer == MAC_FN) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_not_transparent, MAC_LAYER_DEFAULT_COLOR); - } else if (current_layer == WIN_FN) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_not_transparent, WIN_LAYER_DEFAULT_COLOR); - } -#endif -#ifdef FN_LAYER_TRANSPARENT_KEYS_OFF - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); -#endif - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } -#if defined MAC_LAYER_DEFAULT_COLOR && defined WIN_LAYER_DEFAULT_COLOR - else { - if (layer == MAC_BASE) - rgb_matrix_set_color(i, MAC_LAYER_DEFAULT_COLOR); - else if (layer == WIN_BASE) - rgb_matrix_set_color(i, WIN_LAYER_DEFAULT_COLOR); - } -#endif - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { - bool indicator = keycode == KC_CAPS || keycode == KC_LGMAC || keycode == KC_LGWIN; -#ifdef CAPS_LOCK_INDICATOR_LIGHT_60 - return (KC_A <= keycode && keycode <= KC_CAPS) || (KC_LEFT_CTRL <= keycode && keycode <= KC_RIGHT_GUI) || keycode == KC_MACFN || keycode == KC_WINFN || indicator; -#else - return indicator; -#endif -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } -bool is_not_transparent(uint16_t keycode) { return keycode != KC_TRNS; } diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.h b/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.h deleted file mode 100644 index 5b53b5b8ec1f..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/rgb_matrix_user.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -void rgb_matrix_init_user(void); - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); - -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); -bool is_not_transparent(uint16_t keycode); diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/rules.mk b/keyboards/keychron/q1/ansi/keymaps/teimor/rules.mk deleted file mode 100644 index bafb40484bfc..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/rules.mk +++ /dev/null @@ -1,14 +0,0 @@ -VIA_ENABLE = yes -MOUSEKEY_ENABLE = no -TAP_DANCE_ENABLE = yes - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif - -ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) - SRC += tap_dance_user.c - SRC += tap_dance_setup.c - SRC += tap_dance_mac_caps.c - SRC += tap_dance_win_caps.c -endif diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.c b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.c deleted file mode 100644 index dfb0346ff16b..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2021 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* macOS CapsLock language change */ -#include "tap_dance_mac_caps.h" - -static td_tap_t mac_caps_language_tap_state = {.is_press_action = true, .state = TD_NONE}; - -void mac_caps_language_finished(tap_dance_state_t *state, void *user_data) { - mac_caps_language_tap_state.state = current_dance(state); - switch (mac_caps_language_tap_state.state) { - case TD_SINGLE_TAP: - register_code(KC_LCTL); - register_code(KC_SPACE); - break; - case TD_SINGLE_HOLD: - register_code(KC_CAPS_LOCK); - break; - default: - break; - } -} - -void mac_caps_language_reset(tap_dance_state_t *state, void *user_data) { - switch (mac_caps_language_tap_state.state) { - case TD_SINGLE_TAP: - unregister_code(KC_SPACE); - unregister_code(KC_LCTL); - break; - case TD_SINGLE_HOLD: - unregister_code(KC_CAPS_LOCK); - break; - default: - break; - } - mac_caps_language_tap_state.state = TD_NONE; -} diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.h b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.h deleted file mode 100644 index ef552a2c2c94..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_mac_caps.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2021 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* macOS CapsLock language change */ -#pragma once - -#include "tap_dance_setup.h" - -void mac_caps_language_finished(tap_dance_state_t *state, void *user_data); -void mac_caps_language_reset(tap_dance_state_t *state, void *user_data); diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.c b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.c deleted file mode 100644 index 07257e556a1a..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include "tap_dance_setup.h" - -td_state_t current_dance(tap_dance_state_t *state) { - if (state->count == 1) { - if (state->interrupted || !state->pressed) return TD_SINGLE_TAP; - /* Key has not been interrupted, but the key is still held. Means you w ant to send a 'HOLD'. */ - else - return TD_SINGLE_HOLD; - } else if (state->count == 2) { - /* TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap - action when hitting 'pp'. Suggested use case for this return value is when you want to send two - keystrokes of the key, and not the 'double tap' action/macro. */ - if (state->interrupted) - return TD_DOUBLE_SINGLE_TAP; - else if (state->pressed) - return TD_DOUBLE_HOLD; - else - return TD_DOUBLE_TAP; - } - - /* Assumes no one is trying to type the same letter three times (at least not quickly). - If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add - an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP' */ - if (state->count == 3) { - if (state->interrupted) - return TD_TRIPLE_SINGLE_TAP; - else if (state->pressed) - return TD_TRIPLE_HOLD; - else - return TD_TRIPLE_TAP; - - } else - return TD_UNKNOWN; -} diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.h b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.h deleted file mode 100644 index 5d2f4acd577f..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_setup.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#pragma once - -#include QMK_KEYBOARD_H - -typedef enum { - TD_NONE, - TD_UNKNOWN, - TD_SINGLE_TAP, - TD_SINGLE_HOLD, - TD_DOUBLE_TAP, - TD_DOUBLE_HOLD, - TD_DOUBLE_SINGLE_TAP, // Send two single taps - TD_TRIPLE_TAP, - TD_TRIPLE_HOLD, - TD_TRIPLE_SINGLE_TAP // Send three single tap -} td_state_t; - -typedef struct { - bool is_press_action; - td_state_t state; -} td_tap_t; - -td_state_t current_dance(tap_dance_state_t *state); diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_user.c b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_user.c deleted file mode 100644 index ed8120572eea..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_user.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "keymap_user.h" -#include "tap_dance_mac_caps.h" -#include "tap_dance_win_caps.h" - -// clang-format off - -tap_dance_action_t tap_dance_actions[] = { - [MAC_CAPS_LANGUAGE_CHANGE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, mac_caps_language_finished, mac_caps_language_reset), - [WIN_CAPS_LANGUAGE_CHANGE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, win_caps_language_finished, win_caps_language_reset) -}; - -// clang-format on diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.c b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.c deleted file mode 100644 index 1c7c438d2e50..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* Windows CapsLock language change */ -#include "tap_dance_win_caps.h" - -static td_tap_t win_caps_language_tap_state = {.is_press_action = true, .state = TD_NONE}; - -void win_caps_language_finished(tap_dance_state_t *state, void *user_data) { - win_caps_language_tap_state.state = current_dance(state); - switch (win_caps_language_tap_state.state) { - case TD_SINGLE_TAP: - register_code(KC_LGUI); - register_code(KC_SPACE); - break; - case TD_SINGLE_HOLD: - register_code(KC_CAPS_LOCK); - break; - default: - break; - } -} - -void win_caps_language_reset(tap_dance_state_t *state, void *user_data) { - switch (win_caps_language_tap_state.state) { - case TD_SINGLE_TAP: - unregister_code(KC_SPACE); - unregister_code(KC_LGUI); - break; - case TD_SINGLE_HOLD: - unregister_code(KC_CAPS_LOCK); - break; - default: - break; - } - win_caps_language_tap_state.state = TD_NONE; -} diff --git a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.h b/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.h deleted file mode 100644 index 2289cce32694..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/teimor/tap_dance_win_caps.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2022 @ Teimor Epstein - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* Windows CapsLock language change */ -#pragma once - -#include "tap_dance_setup.h" - -void win_caps_language_finished(tap_dance_state_t *state, void *user_data); -void win_caps_language_reset(tap_dance_state_t *state, void *user_data); diff --git a/keyboards/keychron/q1/ansi/keymaps/via/keymap.c b/keyboards/keychron/q1/ansi/keymaps/via/keymap.c deleted file mode 100644 index 6cbf71baf566..000000000000 --- a/keyboards/keychron/q1/ansi/keymaps/via/keymap.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; - -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [MAC_FN] = LAYOUT_ansi_82( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), - - [WIN_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - - [WIN_FN] = LAYOUT_ansi_82( - _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) -}; diff --git a/keyboards/keychron/q1/ansi/readme.md b/keyboards/keychron/q1/ansi/readme.md deleted file mode 100644 index 5cf488f04867..000000000000 --- a/keyboards/keychron/q1/ansi/readme.md +++ /dev/null @@ -1 +0,0 @@ -# The ANSI variant of the Keychron Q1 \ No newline at end of file diff --git a/keyboards/keychron/q1/ansi/rules.mk b/keyboards/keychron/q1/ansi/rules.mk deleted file mode 100644 index 0379fdb94c47..000000000000 --- a/keyboards/keychron/q1/ansi/rules.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes diff --git a/keyboards/keychron/q1/ansi_encoder/info.json b/keyboards/keychron/q1/ansi_encoder/info.json deleted file mode 100644 index ef361257f054..000000000000 --- a/keyboards/keychron/q1/ansi_encoder/info.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "keyboard_name": "Q1", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", - "usb": { - "vid": "0x3434", - "pid": "0x0101", - "device_version": "1.0.0", - "force_nkro": true - }, - "rgb_matrix": { - "driver": "is31fl3733" - }, - "matrix_pins": { - "cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"], - "rows": ["D3", "D2", "B3", "B2", "B1", "B0"] - }, - "diode_direction": "ROW2COL", - "encoder": { - "rotary": [ - {"pin_a": "E6", "pin_b": "B7"} - ] - }, - "processor": "atmega32u4", - "bootloader": "atmel-dfu", - "layouts": { - "LAYOUT_ansi_82": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0}, - {"matrix": [0, 2], "x": 1.25, "y": 0}, - {"matrix": [0, 3], "x": 2.25, "y": 0}, - {"matrix": [0, 4], "x": 3.25, "y": 0}, - {"matrix": [0, 5], "x": 4.25, "y": 0}, - {"matrix": [0, 6], "x": 5.5, "y": 0}, - {"matrix": [0, 7], "x": 6.5, "y": 0}, - {"matrix": [0, 8], "x": 7.5, "y": 0}, - {"matrix": [0, 9], "x": 8.5, "y": 0}, - {"matrix": [0, 10], "x": 9.75, "y": 0}, - {"matrix": [0, 11], "x": 10.75, "y": 0}, - {"matrix": [0, 12], "x": 11.75, "y": 0}, - {"matrix": [0, 13], "x": 12.75, "y": 0}, - {"matrix": [4, 14], "x": 14, "y": 0}, - {"matrix": [0, 14], "x": 15.25, "y": 0}, - - {"matrix": [1, 0], "x": 0, "y": 1}, - {"matrix": [1, 1], "x": 1, "y": 1}, - {"matrix": [1, 2], "x": 2, "y": 1}, - {"matrix": [1, 3], "x": 3, "y": 1}, - {"matrix": [1, 4], "x": 4, "y": 1}, - {"matrix": [1, 5], "x": 5, "y": 1}, - {"matrix": [1, 6], "x": 6, "y": 1}, - {"matrix": [1, 7], "x": 7, "y": 1}, - {"matrix": [1, 8], "x": 8, "y": 1}, - {"matrix": [1, 9], "x": 9, "y": 1}, - {"matrix": [1, 10], "x": 10, "y": 1}, - {"matrix": [1, 11], "x": 11, "y": 1}, - {"matrix": [1, 12], "x": 12, "y": 1}, - {"matrix": [1, 13], "x": 13, "y": 1, "w": 2}, - {"matrix": [1, 14], "x": 15.25, "y": 1}, - - {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.5}, - {"matrix": [2, 1], "x": 1.5, "y": 2}, - {"matrix": [2, 2], "x": 2.5, "y": 2}, - {"matrix": [2, 3], "x": 3.5, "y": 2}, - {"matrix": [2, 4], "x": 4.5, "y": 2}, - {"matrix": [2, 5], "x": 5.5, "y": 2}, - {"matrix": [2, 6], "x": 6.5, "y": 2}, - {"matrix": [2, 7], "x": 7.5, "y": 2}, - {"matrix": [2, 8], "x": 8.5, "y": 2}, - {"matrix": [2, 9], "x": 9.5, "y": 2}, - {"matrix": [2, 10], "x": 10.5, "y": 2}, - {"matrix": [2, 11], "x": 11.5, "y": 2}, - {"matrix": [2, 12], "x": 12.5, "y": 2}, - {"matrix": [2, 13], "x": 13.5, "y": 2, "w": 1.5}, - {"matrix": [2, 14], "x": 15.25, "y": 2}, - - {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.75}, - {"matrix": [3, 1], "x": 1.75, "y": 3}, - {"matrix": [3, 2], "x": 2.75, "y": 3}, - {"matrix": [3, 3], "x": 3.75, "y": 3}, - {"matrix": [3, 4], "x": 4.75, "y": 3}, - {"matrix": [3, 5], "x": 5.75, "y": 3}, - {"matrix": [3, 6], "x": 6.75, "y": 3}, - {"matrix": [3, 7], "x": 7.75, "y": 3}, - {"matrix": [3, 8], "x": 8.75, "y": 3}, - {"matrix": [3, 9], "x": 9.75, "y": 3}, - {"matrix": [3, 10], "x": 10.75, "y": 3}, - {"matrix": [3, 11], "x": 11.75, "y": 3}, - {"matrix": [3, 13], "x": 12.75, "y": 3, "w": 2.25}, - {"matrix": [3, 14], "x": 15.25, "y": 3}, - - {"matrix": [4, 0], "x": 0, "y": 4, "w": 2.25}, - {"matrix": [4, 2], "x": 2.25, "y": 4}, - {"matrix": [4, 3], "x": 3.25, "y": 4}, - {"matrix": [4, 4], "x": 4.25, "y": 4}, - {"matrix": [4, 5], "x": 5.25, "y": 4}, - {"matrix": [4, 6], "x": 6.25, "y": 4}, - {"matrix": [4, 7], "x": 7.25, "y": 4}, - {"matrix": [4, 8], "x": 8.25, "y": 4}, - {"matrix": [4, 9], "x": 9.25, "y": 4}, - {"matrix": [4, 10], "x": 10.25, "y": 4}, - {"matrix": [4, 11], "x": 11.25, "y": 4}, - {"matrix": [4, 13], "x": 12.25, "y": 4, "w": 1.75}, - {"matrix": [3, 12], "x": 14.25, "y": 4.25}, - - {"matrix": [5, 0], "x": 0, "y": 5, "w": 1.25}, - {"matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25}, - {"matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25}, - {"matrix": [5, 6], "x": 3.75, "y": 5, "w": 6.25}, - {"matrix": [5, 10], "x": 10, "y": 5}, - {"matrix": [5, 11], "x": 11, "y": 5}, - {"matrix": [5, 12], "x": 12, "y": 5}, - {"matrix": [5, 13], "x": 13.25, "y": 5.25}, - {"matrix": [4, 12], "x": 14.25, "y": 5.25}, - {"matrix": [5, 14], "x": 15.25, "y": 5.25} - ] - } - } -} diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1/ansi_encoder/keymaps/keychron/rules.mk deleted file mode 100644 index 9cf1a9b56cba..000000000000 --- a/keyboards/keychron/q1/ansi_encoder/keymaps/keychron/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -VIA_ENABLE = yes -ENCODER_MAP_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/q1/ansi_encoder/readme.md b/keyboards/keychron/q1/ansi_encoder/readme.md deleted file mode 100644 index b89c9ad7ad66..000000000000 --- a/keyboards/keychron/q1/ansi_encoder/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -# The ANSI variant of the Keychron Q1 -- Enable EC11 rotary encoder -- Turn clockwise to increase volume and turn anti-clockwise to decrease volume -- Press top right key pushbutton to mute diff --git a/keyboards/keychron/q1/ansi_encoder/rules.mk b/keyboards/keychron/q1/ansi_encoder/rules.mk deleted file mode 100644 index d60167579e24..000000000000 --- a/keyboards/keychron/q1/ansi_encoder/rules.mk +++ /dev/null @@ -1,16 +0,0 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h deleted file mode 100644 index c78453dc5fbc..000000000000 --- a/keyboards/keychron/q1/config.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2021 @ Keychron(https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -/* RGB Matrix Driver Configuration */ -#define DRIVER_COUNT 2 -#define DRIVER_ADDR_1 0b1010000 -#define DRIVER_ADDR_2 0b1011111 - -/* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { {0,1} } - -/* Disable DIP switch in matrix data */ -#define MATRIX_MASKED - -/* Disable RGB lighting when PC is in suspend */ -#define RGB_DISABLE_WHEN_USB_SUSPENDED - -// 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH diff --git a/keyboards/keychron/q1/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q1/iso/keymaps/keychron/rules.mk deleted file mode 100644 index 495e8907b48c..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/README.md b/keyboards/keychron/q1/iso/keymaps/kubahorak/README.md deleted file mode 100644 index 3cfae17543bf..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# kubahorak's Keychron Q1 keymap - -This ISO layout got heavily inspired by gtg465x's ANSI keymap (rev_0100). - -Features: -- The rightest key column is: Ins, Home, PgUp, PgDn, which differs from the default. -- RGB lighting turns off when the computer sleeps -- Caps Lock and alpha keys turn red to indicate when Caps Lock is on -- When the Fn layer is active, RGB lighting turns off for keys that are not assigned - -## Changelog - -### 2021-10-17 - 1.0.0 - -- Initial release - diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/keymap.c b/keyboards/keychron/q1/iso/keymaps/kubahorak/keymap.c deleted file mode 100644 index 479988dfa9f4..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/keymap.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2021 Jakub Horak (@kubahorak) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -// clang-format off - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGUP, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGDN, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT - ), - [1] = LAYOUT_iso_83( - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PENT, KC_PPLS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), - [2] = LAYOUT_iso_83( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGUP, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGDN, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(3), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT - ), - [3] = LAYOUT_iso_83( - KC_TRNS, KC_BRID, KC_BRIU, LGUI(KC_TAB), LGUI(KC_E), RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PENT, KC_PPLS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ) -}; - -// clang-format on - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.c b/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.c deleted file mode 100644 index 638aa77eb0ab..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2021 @ Grayson Carr - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#ifdef CAPS_LOCK_INDICATOR_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } -#endif - break; - case MAC_FN: - case WIN_FN: -#ifdef FN_LAYER_TRANSPARENT_KEYS_OFF - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); -#endif - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { - switch (keycode) { -#ifdef CAPS_LOCK_INDICATOR_LIGHT_ALPHAS - case KC_A ... KC_Z: -#endif - case KC_CAPS: - return true; - default: - return false; - } -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.h b/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.h deleted file mode 100644 index dead4541676d..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/rgb_matrix_user.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2021 @ Grayson Carr - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -void rgb_matrix_init_user(void); - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); - -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/rules.mk b/keyboards/keychron/q1/iso/keymaps/kubahorak/rules.mk deleted file mode 100644 index af720e37ee7b..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -VIA_ENABLE = yes -MOUSEKEY_ENABLE = no - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif \ No newline at end of file diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/config.h b/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/config.h deleted file mode 100644 index bc9fe405c35c..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/config.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#ifdef RGB_MATRIX_ENABLE -# define RGB_DISABLE_WHEN_USB_SUSPENDED -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define FN_LAYER_COLOR RGB_ORANGE -#endif \ No newline at end of file diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap.c b/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap.c deleted file mode 100644 index f86a84e468dd..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/keymap.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -// clang-format off - -typedef union { - uint32_t raw; - struct { - bool caps_lock_light_tab :1; - bool caps_lock_light_alphas :1; - bool fn_layer_transparent_keys_off :1; - bool fn_layer_color_enable :1; - }; -} user_config_t; - -user_config_t user_config; - -enum custom_keycodes { - KC_LIGHT_TAB_TOGGLE = QK_KB_2, // TECH DEBT: Starts at QK_KB_2 to maintain ordering with VIA definitions. See #19884. Revert to QK_KB_0 when VIA catches up with QMK. - KC_LIGHT_ALPHAS_TOGGLE, - KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE, - KC_FN_LAYER_COLOR_TOGGLE -}; - -#define KC_LTTOG KC_LIGHT_TAB_TOGGLE -#define KC_LATOG KC_LIGHT_ALPHAS_TOGGLE -#define KC_TKTOG KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE -#define KC_FCTOG KC_FN_LAYER_COLOR_TOGGLE -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[MAC_FN] = LAYOUT_iso_83( - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_LTTOG, KC_LATOG, KC_TKTOG, KC_FCTOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - -[WIN_BASE] = LAYOUT_iso_83( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[WIN_FN] = LAYOUT_iso_83( - KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_LTTOG, KC_LATOG, KC_TKTOG, KC_FCTOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) - -}; - -// clang-format on - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} - -void keyboard_post_init_user(void) { - user_config.raw = eeconfig_read_user(); -} - -void eeconfig_init_user(void) { - user_config.raw = 0; - user_config.caps_lock_light_tab = false; - user_config.caps_lock_light_alphas = false; - user_config.fn_layer_transparent_keys_off = true; - user_config.fn_layer_color_enable = false; - eeconfig_update_user(user_config.raw); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case KC_LIGHT_TAB_TOGGLE: - if (record->event.pressed) { - user_config.caps_lock_light_tab ^= 1; // bitwise xor to toggle status bit - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_LIGHT_ALPHAS_TOGGLE: - if (record->event.pressed) { - user_config.caps_lock_light_alphas ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_FN_LAYER_TRANSPARENT_KEYS_TOGGLE: - if (record->event.pressed) { - user_config.fn_layer_transparent_keys_off ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - case KC_FN_LAYER_COLOR_TOGGLE: - if (record->event.pressed) { - user_config.fn_layer_color_enable ^= 1; - eeconfig_update_user(user_config.raw); - } - return false; // Skip all further processing of this key - default: - return true; // Process all other keycodes normally - } -} - -bool get_caps_lock_light_tab(void) { - return user_config.caps_lock_light_tab; -} - -bool get_caps_lock_light_alphas(void) { - return user_config.caps_lock_light_alphas; -} - -bool get_fn_layer_transparent_keys_off(void) { - return user_config.fn_layer_transparent_keys_off; -} - -bool get_fn_layer_color_enable(void) { - return user_config.fn_layer_color_enable; -} diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/readme.md b/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/readme.md deleted file mode 100644 index 25d835b1c021..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/readme.md +++ /dev/null @@ -1,54 +0,0 @@ -## mkillewald's Keychron Q1 keymap (ISO rev_0102) v1.0.4 - -This keymap builds on the keymap by Grayson Carr (gtg465x) but adds a couple options. - -## Features: -- On macOS, F3 opens Mission Control and F4 opens Launchpad without needing to configure shortcuts in System Preferences -- RGB lighting turns off when the computer sleeps -- Caps Lock RGB indicator - - the Caps Lock key will light when Caps Lock is enabled with the following options: - - #define CAPS_LOCK_INDICATOR_COLOR [color] in config.h to set the backlight color used for the indicator when Caps Lock is enabled (default: red) - - Fn+Z will toggle lighting the TAB key when Caps Lock is enabled. This is useful with non backlit keycaps/legends. (default: off) - - Fn+X will toggle lighting all the alpha keys when Caps Lock is enabled. (default: off) - -- Dynamic Fn layer RGB indicator - - When the Fn key is held down, any keys defined on the Fn layer in this firmware or in VIA will be highlighted with the following options: - - #define FN_LAYER_COLOR [color] in config.h to set a static color for defined keys (default: orange) - - Fn+C will toggle turning off RGB for keys with no definition (default: RGB off) - - Fn+V will toggle lighting the defined Fn layer keys with the static color set with FN_LAYER_COLOR (default: static color off) - -- All custom keycodes can be moved to different keys in VIA by using the ANY key with the following keycodes: - - USER(0) (default: F3) macOS Mission Control - - USER(1) (default: F4) macOS Launchpad - - USER(2) (default: Fn+Z) Caps Lock light Tab toggle - - USER(3) (default: Fn+X) Caps Lock light alphas toggle - - USER(4) (default: Fn+C) Fn layer non-defined keys RGB toggle - - USER(5) (default: Fn+V) Fn layer defined keys static color toggle - -RGB must be toggled on for all indicators to function. If you do not want an RGB mode active but still want the indicators, toggle RGB on and turn the brightness all the way off. The indicators will remain at full brightness. - -Please make sure to save any customizations you have made in VIA to a .json file before flashing the firmware. Sometimes it has been necessary to re-apply those changes in VIA after flashing the firmware. If that is the case, you will most likely need to manually add the USER(0) through USER(5) custom keycodes after loading your customizations from the saved .json file. Then re-save a new .json file which will have your previous customizations and the custom keycodes for future use as needed. - -#### USE AT YOUR OWN RISK - -## Changelog: - -v1.0.4 October 9, 2021 -- Caps Lock and Fn layer toggles are now stored in eeprom so settings will remain when Q1 is unplugged - -v1.0.3 October 8, 2021 -- now using keycode toggles instead of preprocessor directives to set the various Caps Lock and Fn Layer RGB lighting options. This allows for setting the options from user space without having to recompile. - -v1.0.2 October 7, 2021 -- adapted Grayson Carr's (gtg465x) Caps Lock alphas and dynamic Fn layer RGB routines -- added CAPS_LOCK_INDICATOR_LIGHT_TAB config option to enable/disable lighting Tab with Caps Lock indicator -- added FN_LAYER_COLOR config option to set FN layer static color - -v1.0.1 October 7, 2021 -- Mission Control and Launchpad custom keycodes are now defined using the VIA user keycodes range so thay can be labeled properly in VIA (adopted change from gtg465x) - -v1.0.0 September 30, 2021 -- Initial release built upon keymap by Grayson Carr (gtg465x) -- defined Mission Control (F3) and Launchpad (F4) keycodes for macOs -- RGB backlight turns off when computer sleeps -- added Caps Lock indicator lighting both the Caps Lock and Tab LEDs for better effect on non-backlit keycaps diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.c b/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.c deleted file mode 100644 index c6fa5f1f155a..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rgb_matrix_user.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2021 @ Mike Killewald - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#ifdef CAPS_LOCK_INDICATOR_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } -#endif - break; - case MAC_FN: - case WIN_FN: -#ifdef FN_LAYER_COLOR - if (get_fn_layer_color_enable()) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_not_transparent, FN_LAYER_COLOR); - } -#endif - if (get_fn_layer_transparent_keys_off()) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); - } - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { - bool indicator = keycode == KC_CAPS; - - if (get_caps_lock_light_tab()) { - indicator = keycode == KC_TAB || keycode == KC_CAPS; - } - - if (get_caps_lock_light_alphas()) { - return (KC_A <= keycode && keycode <= KC_Z) || indicator; - } else { - return indicator; - } -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } -bool is_not_transparent(uint16_t keycode) { return keycode != KC_TRNS; } diff --git a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rules.mk b/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rules.mk deleted file mode 100644 index af720e37ee7b..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/mkillewald_iso/rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -VIA_ENABLE = yes -MOUSEKEY_ENABLE = no - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif \ No newline at end of file diff --git a/keyboards/keychron/q1/iso/keymaps/victorsavu3/config.h b/keyboards/keychron/q1/iso/keymaps/victorsavu3/config.h deleted file mode 100644 index 02f08db4a7ff..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/victorsavu3/config.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2021 @ Victor-Gabriel Savu - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -// disable all default effects -#undef ENABLE_RGB_MATRIX_BREATHING -#undef ENABLE_RGB_MATRIX_CYCLE_ALL -#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -#undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN -#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL -#undef ENABLE_RGB_MATRIX_DUAL_BEACON -#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON -#undef ENABLE_RGB_MATRIX_RAINDROPS -#undef ENABLE_RGB_MATRIX_TYPING_HEATMAP -#undef ENABLE_RGB_MATRIX_DIGITAL_RAIN -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#undef ENABLE_RGB_MATRIX_SPLASH -#undef ENABLE_RGB_MATRIX_MULTISPLASH -#undef ENABLE_RGB_MATRIX_SOLID_SPLASH -#undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -// Allow fancy RGB -#define RGB_MATRIX_KEYPRESSES -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS - -// Simple RGB -#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT - -// Reactive RGB -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS - -#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_TYPING_HEATMAP - -#define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 - -// Unicode for Linux -#define UNICODE_SELECTED_MODES UNICODE_MODE_LINUX -#define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) - -// Leader config -#define LEADER_PER_KEY_TIMING -#define LEADER_TIMEOUT 500 diff --git a/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c b/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c deleted file mode 100644 index 5256c97dca7b..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/victorsavu3/keymap.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright 2021 @ Victor-Gabriel Savu - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; - -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -enum unicode_names { - GRIN, - SAD, -}; - -const uint32_t unicode_map[] PROGMEM = { - [GRIN] = 0x1F600, // 😀 - [SAD] = 0x1F61E, // 😞 -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_F3, KC_F4, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[MAC_FN] = LAYOUT_iso_83( - KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - -[WIN_BASE] = LAYOUT_iso_83( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, UM(SAD), - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, UM(GRIN), - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGUP, - QK_LEAD, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGDN, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - -[WIN_FN] = LAYOUT_iso_83( - KC_TRNS, KC_BRID, KC_BRIU, KC_CALC, KC_FLXP, RGB_VAD, RGB_VAI, KC_TRNS, KC_PSCR, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_CAPS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END) - -}; - -static bool wiggle_mouse; -static uint16_t wiggle_timer; -static uint16_t next_wiggle; - -void leader_end_user(void) { - if (leader_sequence_one_key(QK_LEAD)) { - tap_code(KC_CAPS); - } - - if (leader_sequence_four_keys(KC_I, KC_D, KC_L, KC_E)) { - wiggle_mouse = !wiggle_mouse; - wiggle_timer = timer_read(); - } - - if (leader_sequence_two_keys(KC_O, KC_K)) { - send_unicode_string("👍"); - } - - if (leader_sequence_three_keys(KC_S, KC_A, KC_D)) { - send_unicode_string("😞"); - } - - if (leader_sequence_five_keys(KC_C, KC_H, KC_E, KC_C, KC_K)) { - send_unicode_string("✅"); - } - - if (leader_sequence_five_keys(KC_C, KC_R, KC_O, KC_S, KC_S)) { - send_unicode_string("❎"); - } - - if (leader_sequence_five_keys(KC_T, KC_H, KC_A, KC_N, KC_K)) { - send_unicode_string("🙏"); - } - - if (leader_sequence_five_keys(KC_S, KC_M, KC_I, KC_L, KC_E)) { - send_unicode_string("😊"); - } - - if (leader_sequence_five_keys(KC_P, KC_A, KC_R, KC_T, KC_Y)) { - send_unicode_string("🎉"); - } - - if (leader_sequence_four_keys(KC_E, KC_Y, KC_E, KC_S)) { - send_unicode_string("(ಠ_ಠ)"); - } - - if (leader_sequence_five_keys(KC_M, KC_A, KC_G, KC_I, KC_C)) { - send_unicode_string("(ಠ_ಠ) 🪄 ⠁⭒*.✫.*⭒⠁"); - } - - if (leader_sequence_five_keys(KC_T, KC_A, KC_B, KC_L, KC_E)) { - send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); - } - - if (leader_sequence_five_keys(KC_S, KC_H, KC_R, KC_U, KC_G)) { - send_unicode_string("¯\\_(ツ)_/¯"); - } -} - -void matrix_scan_user(void) { - if (wiggle_mouse && timer_elapsed(wiggle_timer) > next_wiggle) { - wiggle_timer = timer_read(); - - uint8_t rval = TCNT0 + TCNT1 + TCNT3 + TCNT4; - next_wiggle = rval % 1000; - - if (rval & 1) tap_code(KC_MS_UP); - if (rval & 2) tap_code(KC_MS_DOWN); - if (rval & 4) tap_code(KC_MS_LEFT); - if (rval & 8) tap_code(KC_MS_RIGHT); - } -} diff --git a/keyboards/keychron/q1/iso/keymaps/victorsavu3/readme.md b/keyboards/keychron/q1/iso/keymaps/victorsavu3/readme.md deleted file mode 100644 index c96130816e91..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/victorsavu3/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -# victorsavu3's Keychron Q1 keymap (ISO) - -Very similar to the default layout. Enables reactive and framebuffer RGB, but disables most effects enabled by keychron. -Uses Caps Lock as a leader key for emojis and to enable a random mouse wiggler to prevent the system from going to sleep. diff --git a/keyboards/keychron/q1/iso/keymaps/victorsavu3/rules.mk b/keyboards/keychron/q1/iso/keymaps/victorsavu3/rules.mk deleted file mode 100644 index 853c414ec7e3..000000000000 --- a/keyboards/keychron/q1/iso/keymaps/victorsavu3/rules.mk +++ /dev/null @@ -1,3 +0,0 @@ -MOUSEKEY_ENABLE = yes -UNICODEMAP_ENABLE = yes -LEADER_ENABLE = yes diff --git a/keyboards/keychron/q1/iso/readme.md b/keyboards/keychron/q1/iso/readme.md deleted file mode 100644 index 777ce0477349..000000000000 --- a/keyboards/keychron/q1/iso/readme.md +++ /dev/null @@ -1 +0,0 @@ -# The ISO variant of the Keychron Q1 \ No newline at end of file diff --git a/keyboards/keychron/q1/iso/rules.mk b/keyboards/keychron/q1/iso/rules.mk deleted file mode 100644 index 0379fdb94c47..000000000000 --- a/keyboards/keychron/q1/iso/rules.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1/iso_encoder/keymaps/keychron/rules.mk deleted file mode 100644 index 2d17902f9817..000000000000 --- a/keyboards/keychron/q1/iso_encoder/keymaps/keychron/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -VIA_ENABLE = yes -ENCODER_MAP_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c \ No newline at end of file diff --git a/keyboards/keychron/q1/iso_encoder/readme.md b/keyboards/keychron/q1/iso_encoder/readme.md deleted file mode 100644 index 66db24a1975f..000000000000 --- a/keyboards/keychron/q1/iso_encoder/readme.md +++ /dev/null @@ -1,5 +0,0 @@ -# The ISO variant of the Keychron Q1 - -- Enables EC11 rotary encoder. -- Turn clockwise to increase volume and turn counter-clockwise to decrease volume. -- Press top right button to mute. diff --git a/keyboards/keychron/q1/iso_encoder/rules.mk b/keyboards/keychron/q1/iso_encoder/rules.mk deleted file mode 100644 index d994ac1fad70..000000000000 --- a/keyboards/keychron/q1/iso_encoder/rules.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -RAW_ENABLE = yes -LTO_ENABLE = yes - diff --git a/keyboards/keychron/q11/halconf.h b/keyboards/keychron/q11/halconf.h index 028285a1f3e1..9a36206a1686 100755 --- a/keyboards/keychron/q11/halconf.h +++ b/keyboards/keychron/q11/halconf.h @@ -19,5 +19,7 @@ #define HAL_USE_I2C TRUE #define HAL_USE_SERIAL TRUE #define HAL_USE_ADC TRUE - +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q1/ansi/ansi.c b/keyboards/keychron/q1v1/ansi/ansi.c similarity index 64% rename from keyboards/keychron/q1/ansi/ansi.c rename to keyboards/keychron/q1v1/ansi/ansi.c index ee586fef93ce..3644f8c9bc78 100644 --- a/keyboards/keychron/q1/ansi/ansi.c +++ b/keyboards/keychron/q1v1/ansi/ansi.c @@ -111,40 +111,6 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { {1, F_13, D_13, E_13}, {1, F_14, D_14, E_14}, {1, F_15, D_15, E_15}, - {1, F_16, D_16, E_16} - + {1, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, - { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, - { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } - }, - { - // LED Index to Physical Position - {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, - {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, - {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, - {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, - {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52}, - {2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q1/ansi/config.h b/keyboards/keychron/q1v1/ansi/config.h similarity index 81% rename from keyboards/keychron/q1/ansi/config.h rename to keyboards/keychron/q1v1/ansi/config.h index c6d4e44c8777..130eb0217cf1 100644 --- a/keyboards/keychron/q1/ansi/config.h +++ b/keyboards/keychron/q1v1/ansi/config.h @@ -17,6 +17,8 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 59 -#define DRIVER_2_LED_TOTAL 23 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) \ No newline at end of file +#define RGB_MATRIX_LED_COUNT 82 + +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 45 +// #define CAPS_LOCK_LED_INDEX 45 // Disable caps-lock LED to reduce code size diff --git a/keyboards/keychron/q1v1/ansi/info.json b/keyboards/keychron/q1v1/ansi/info.json new file mode 100644 index 000000000000..17ed94557704 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/info.json @@ -0,0 +1,190 @@ +{ + "usb": { + "pid": "0x0100", + "device_version": "1.0.0" + }, + "layouts": { + "LAYOUT_ansi_82": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 1.25, "y": 0}, + {"matrix": [0, 3], "x": 2.25, "y": 0}, + {"matrix": [0, 4], "x": 3.25, "y": 0}, + {"matrix": [0, 5], "x": 4.25, "y": 0}, + {"matrix": [0, 6], "x": 5.5, "y": 0}, + {"matrix": [0, 7], "x": 6.5, "y": 0}, + {"matrix": [0, 8], "x": 7.5, "y": 0}, + {"matrix": [0, 9], "x": 8.5, "y": 0}, + {"matrix": [0, 10], "x": 9.75, "y": 0}, + {"matrix": [0, 11], "x": 10.75, "y": 0}, + {"matrix": [0, 12], "x": 11.75, "y": 0}, + {"matrix": [0, 13], "x": 12.75, "y": 0}, + {"matrix": [4, 14], "x": 14, "y": 0}, + {"matrix": [0, 14], "x": 15.25, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + {"matrix": [1, 5], "x": 5, "y": 1}, + {"matrix": [1, 6], "x": 6, "y": 1}, + {"matrix": [1, 7], "x": 7, "y": 1}, + {"matrix": [1, 8], "x": 8, "y": 1}, + {"matrix": [1, 9], "x": 9, "y": 1}, + {"matrix": [1, 10], "x": 10, "y": 1}, + {"matrix": [1, 11], "x": 11, "y": 1}, + {"matrix": [1, 12], "x": 12, "y": 1}, + {"matrix": [1, 13], "x": 13, "y": 1, "w": 2}, + {"matrix": [1, 14], "x": 15.25, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.5}, + {"matrix": [2, 1], "x": 1.5, "y": 2}, + {"matrix": [2, 2], "x": 2.5, "y": 2}, + {"matrix": [2, 3], "x": 3.5, "y": 2}, + {"matrix": [2, 4], "x": 4.5, "y": 2}, + {"matrix": [2, 5], "x": 5.5, "y": 2}, + {"matrix": [2, 6], "x": 6.5, "y": 2}, + {"matrix": [2, 7], "x": 7.5, "y": 2}, + {"matrix": [2, 8], "x": 8.5, "y": 2}, + {"matrix": [2, 9], "x": 9.5, "y": 2}, + {"matrix": [2, 10], "x": 10.5, "y": 2}, + {"matrix": [2, 11], "x": 11.5, "y": 2}, + {"matrix": [2, 12], "x": 12.5, "y": 2}, + {"matrix": [2, 13], "x": 13.5, "y": 2, "w": 1.5}, + {"matrix": [2, 14], "x": 15.25, "y": 2}, + + {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.75}, + {"matrix": [3, 1], "x": 1.75, "y": 3}, + {"matrix": [3, 2], "x": 2.75, "y": 3}, + {"matrix": [3, 3], "x": 3.75, "y": 3}, + {"matrix": [3, 4], "x": 4.75, "y": 3}, + {"matrix": [3, 5], "x": 5.75, "y": 3}, + {"matrix": [3, 6], "x": 6.75, "y": 3}, + {"matrix": [3, 7], "x": 7.75, "y": 3}, + {"matrix": [3, 8], "x": 8.75, "y": 3}, + {"matrix": [3, 9], "x": 9.75, "y": 3}, + {"matrix": [3, 10], "x": 10.75, "y": 3}, + {"matrix": [3, 11], "x": 11.75, "y": 3}, + {"matrix": [3, 13], "x": 12.75, "y": 3, "w": 2.25}, + {"matrix": [3, 14], "x": 15.25, "y": 3}, + + {"matrix": [4, 0], "x": 0, "y": 4, "w": 2.25}, + {"matrix": [4, 2], "x": 2.25, "y": 4}, + {"matrix": [4, 3], "x": 3.25, "y": 4}, + {"matrix": [4, 4], "x": 4.25, "y": 4}, + {"matrix": [4, 5], "x": 5.25, "y": 4}, + {"matrix": [4, 6], "x": 6.25, "y": 4}, + {"matrix": [4, 7], "x": 7.25, "y": 4}, + {"matrix": [4, 8], "x": 8.25, "y": 4}, + {"matrix": [4, 9], "x": 9.25, "y": 4}, + {"matrix": [4, 10], "x": 10.25, "y": 4}, + {"matrix": [4, 11], "x": 11.25, "y": 4}, + {"matrix": [4, 13], "x": 12.25, "y": 4, "w": 1.75}, + {"matrix": [3, 12], "x": 14.25, "y": 4.25}, + + {"matrix": [5, 0], "x": 0, "y": 5, "w": 1.25}, + {"matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25}, + {"matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25}, + {"matrix": [5, 6], "x": 3.75, "y": 5, "w": 6.25}, + {"matrix": [5, 10], "x": 10, "y": 5}, + {"matrix": [5, 11], "x": 11, "y": 5}, + {"matrix": [5, 12], "x": 12, "y": 5}, + {"matrix": [5, 13], "x": 13.25, "y": 5.25}, + {"matrix": [4, 12], "x": 14.25, "y": 5.25}, + {"matrix": [5, 14], "x": 15.25, "y": 5.25} + ] + } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":18, "y":0}, + {"matrix":[0, 3], "flags":1, "x":33, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":62, "y":0}, + {"matrix":[0, 6], "flags":1, "x":81, "y":0}, + {"matrix":[0, 7], "flags":1, "x":95, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":125, "y":0}, + {"matrix":[0, 10], "flags":1, "x":143, "y":0}, + {"matrix":[0, 11], "flags":1, "x":158, "y":0}, + {"matrix":[0, 12], "flags":1, "x":173, "y":0}, + {"matrix":[0, 13], "flags":1, "x":187, "y":0}, + {"matrix":[4, 14], "flags":1, "x":206, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 13], "flags":4, "x":202, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 13], "flags":1, "x":196, "y":38}, + {"matrix":[3, 14], "flags":1, "x":224, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":9, "y":49}, + {"matrix":[4, 2], "flags":4, "x":33, "y":49}, + {"matrix":[4, 3], "flags":4, "x":48, "y":49}, + {"matrix":[4, 4], "flags":4, "x":62, "y":49}, + {"matrix":[4, 5], "flags":4, "x":77, "y":49}, + {"matrix":[4, 6], "flags":4, "x":92, "y":49}, + {"matrix":[4, 7], "flags":4, "x":106, "y":49}, + {"matrix":[4, 8], "flags":4, "x":121, "y":49}, + {"matrix":[4, 9], "flags":4, "x":136, "y":49}, + {"matrix":[4, 10], "flags":4, "x":151, "y":49}, + {"matrix":[4, 11], "flags":4, "x":165, "y":49}, + {"matrix":[4, 13], "flags":1, "x":185, "y":49}, + {"matrix":[3, 12], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 6], "flags":4, "x":94, "y":61}, + {"matrix":[5, 10], "flags":1, "x":147, "y":61}, + {"matrix":[5, 11], "flags":1, "x":162, "y":61}, + {"matrix":[5, 12], "flags":1, "x":176, "y":61}, + {"matrix":[5, 13], "flags":1, "x":195, "y":64}, + {"matrix":[4, 12], "flags":1, "x":209, "y":64}, + {"matrix":[5, 14], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/q1v1/ansi/keymaps/default/keymap.c b/keyboards/keychron/q1v1/ansi/keymaps/default/keymap.c new file mode 100644 index 000000000000..ec4e05ca97ee --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_ansi_82( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_82( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; diff --git a/keyboards/keychron/q1/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q1v1/ansi/keymaps/keychron/keymap.c similarity index 90% rename from keyboards/keychron/q1/ansi/keymaps/keychron/keymap.c rename to keyboards/keychron/q1v1/ansi/keymaps/keychron/keymap.c index e7c9fddcdcaa..6cd08f3533db 100644 --- a/keyboards/keychron/q1/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v1/ansi/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, @@ -58,10 +60,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q1v1/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q1v1/ansi/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v1/ansi/keymaps/via/keymap.c b/keyboards/keychron/q1v1/ansi/keymaps/via/keymap.c new file mode 100644 index 000000000000..c7bcb8c2e798 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/keymaps/via/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_ansi_82( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_82( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) +}; diff --git a/keyboards/keychron/q1v1/ansi/keymaps/via/rules.mk b/keyboards/keychron/q1v1/ansi/keymaps/via/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/q1v1/ansi/rules.mk b/keyboards/keychron/q1v1/ansi/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q1/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q1v1/ansi_encoder/ansi_encoder.c similarity index 65% rename from keyboards/keychron/q1/ansi_encoder/ansi_encoder.c rename to keyboards/keychron/q1v1/ansi_encoder/ansi_encoder.c index bc559b354166..9c45ae33552a 100644 --- a/keyboards/keychron/q1/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q1v1/ansi_encoder/ansi_encoder.c @@ -112,37 +112,4 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }, - { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 71, 57, 58 }, - { 59, __, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 70, 13 }, - { 72, 73, 74, __, __, __, 75, __, __, __, 76, 77, 78, 79, 81 } - }, - { - // LED Index to Physical Position - {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, - {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, - {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {202,26}, {224,26}, - {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {196,38}, {224,38}, - {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52}, - {2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q1/iso/config.h b/keyboards/keychron/q1v1/ansi_encoder/config.h similarity index 76% rename from keyboards/keychron/q1/iso/config.h rename to keyboards/keychron/q1v1/ansi_encoder/config.h index cb7b05560ae3..7330e52bbd14 100644 --- a/keyboards/keychron/q1/iso/config.h +++ b/keyboards/keychron/q1v1/ansi_encoder/config.h @@ -17,6 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 59 -#define DRIVER_2_LED_TOTAL 24 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) \ No newline at end of file +#define RGB_MATRIX_LED_COUNT 82 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif + +/* Enable caps-lock LED */ +// #define CAPS_LOCK_LED_INDEX 45 // Disable caps-lock LED to reduce code size diff --git a/keyboards/keychron/q1v1/ansi_encoder/info.json b/keyboards/keychron/q1v1/ansi_encoder/info.json new file mode 100644 index 000000000000..ce4f1acdbb73 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi_encoder/info.json @@ -0,0 +1,198 @@ +{ + "usb": { + "pid": "0x0101", + "device_version": "1.0.0" + }, + "features": { + "encoder": true + }, + "encoder": { + "rotary": [ + {"pin_a": "E6", "pin_b": "B7"} + ] + }, + "layouts": { + "LAYOUT_ansi_82": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 1.25, "y": 0}, + {"matrix": [0, 3], "x": 2.25, "y": 0}, + {"matrix": [0, 4], "x": 3.25, "y": 0}, + {"matrix": [0, 5], "x": 4.25, "y": 0}, + {"matrix": [0, 6], "x": 5.5, "y": 0}, + {"matrix": [0, 7], "x": 6.5, "y": 0}, + {"matrix": [0, 8], "x": 7.5, "y": 0}, + {"matrix": [0, 9], "x": 8.5, "y": 0}, + {"matrix": [0, 10], "x": 9.75, "y": 0}, + {"matrix": [0, 11], "x": 10.75, "y": 0}, + {"matrix": [0, 12], "x": 11.75, "y": 0}, + {"matrix": [0, 13], "x": 12.75, "y": 0}, + {"matrix": [4, 14], "x": 14, "y": 0}, + {"matrix": [0, 14], "x": 15.25, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + {"matrix": [1, 5], "x": 5, "y": 1}, + {"matrix": [1, 6], "x": 6, "y": 1}, + {"matrix": [1, 7], "x": 7, "y": 1}, + {"matrix": [1, 8], "x": 8, "y": 1}, + {"matrix": [1, 9], "x": 9, "y": 1}, + {"matrix": [1, 10], "x": 10, "y": 1}, + {"matrix": [1, 11], "x": 11, "y": 1}, + {"matrix": [1, 12], "x": 12, "y": 1}, + {"matrix": [1, 13], "x": 13, "y": 1, "w": 2}, + {"matrix": [1, 14], "x": 15.25, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.5}, + {"matrix": [2, 1], "x": 1.5, "y": 2}, + {"matrix": [2, 2], "x": 2.5, "y": 2}, + {"matrix": [2, 3], "x": 3.5, "y": 2}, + {"matrix": [2, 4], "x": 4.5, "y": 2}, + {"matrix": [2, 5], "x": 5.5, "y": 2}, + {"matrix": [2, 6], "x": 6.5, "y": 2}, + {"matrix": [2, 7], "x": 7.5, "y": 2}, + {"matrix": [2, 8], "x": 8.5, "y": 2}, + {"matrix": [2, 9], "x": 9.5, "y": 2}, + {"matrix": [2, 10], "x": 10.5, "y": 2}, + {"matrix": [2, 11], "x": 11.5, "y": 2}, + {"matrix": [2, 12], "x": 12.5, "y": 2}, + {"matrix": [2, 13], "x": 13.5, "y": 2, "w": 1.5}, + {"matrix": [2, 14], "x": 15.25, "y": 2}, + + {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.75}, + {"matrix": [3, 1], "x": 1.75, "y": 3}, + {"matrix": [3, 2], "x": 2.75, "y": 3}, + {"matrix": [3, 3], "x": 3.75, "y": 3}, + {"matrix": [3, 4], "x": 4.75, "y": 3}, + {"matrix": [3, 5], "x": 5.75, "y": 3}, + {"matrix": [3, 6], "x": 6.75, "y": 3}, + {"matrix": [3, 7], "x": 7.75, "y": 3}, + {"matrix": [3, 8], "x": 8.75, "y": 3}, + {"matrix": [3, 9], "x": 9.75, "y": 3}, + {"matrix": [3, 10], "x": 10.75, "y": 3}, + {"matrix": [3, 11], "x": 11.75, "y": 3}, + {"matrix": [3, 13], "x": 12.75, "y": 3, "w": 2.25}, + {"matrix": [3, 14], "x": 15.25, "y": 3}, + + {"matrix": [4, 0], "x": 0, "y": 4, "w": 2.25}, + {"matrix": [4, 2], "x": 2.25, "y": 4}, + {"matrix": [4, 3], "x": 3.25, "y": 4}, + {"matrix": [4, 4], "x": 4.25, "y": 4}, + {"matrix": [4, 5], "x": 5.25, "y": 4}, + {"matrix": [4, 6], "x": 6.25, "y": 4}, + {"matrix": [4, 7], "x": 7.25, "y": 4}, + {"matrix": [4, 8], "x": 8.25, "y": 4}, + {"matrix": [4, 9], "x": 9.25, "y": 4}, + {"matrix": [4, 10], "x": 10.25, "y": 4}, + {"matrix": [4, 11], "x": 11.25, "y": 4}, + {"matrix": [4, 13], "x": 12.25, "y": 4, "w": 1.75}, + {"matrix": [3, 12], "x": 14.25, "y": 4.25}, + + {"matrix": [5, 0], "x": 0, "y": 5, "w": 1.25}, + {"matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25}, + {"matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25}, + {"matrix": [5, 6], "x": 3.75, "y": 5, "w": 6.25}, + {"matrix": [5, 10], "x": 10, "y": 5}, + {"matrix": [5, 11], "x": 11, "y": 5}, + {"matrix": [5, 12], "x": 12, "y": 5}, + {"matrix": [5, 13], "x": 13.25, "y": 5.25}, + {"matrix": [4, 12], "x": 14.25, "y": 5.25}, + {"matrix": [5, 14], "x": 15.25, "y": 5.25} + ] + } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":18, "y":0}, + {"matrix":[0, 3], "flags":1, "x":33, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":62, "y":0}, + {"matrix":[0, 6], "flags":1, "x":81, "y":0}, + {"matrix":[0, 7], "flags":1, "x":95, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":125, "y":0}, + {"matrix":[0, 10], "flags":1, "x":143, "y":0}, + {"matrix":[0, 11], "flags":1, "x":158, "y":0}, + {"matrix":[0, 12], "flags":1, "x":173, "y":0}, + {"matrix":[0, 13], "flags":1, "x":187, "y":0}, + {"matrix":[4, 14], "flags":1, "x":206, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 13], "flags":4, "x":202, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 13], "flags":1, "x":196, "y":38}, + {"matrix":[3, 14], "flags":1, "x":224, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":9, "y":49}, + {"matrix":[4, 2], "flags":4, "x":33, "y":49}, + {"matrix":[4, 3], "flags":4, "x":48, "y":49}, + {"matrix":[4, 4], "flags":4, "x":62, "y":49}, + {"matrix":[4, 5], "flags":4, "x":77, "y":49}, + {"matrix":[4, 6], "flags":4, "x":92, "y":49}, + {"matrix":[4, 7], "flags":4, "x":106, "y":49}, + {"matrix":[4, 8], "flags":4, "x":121, "y":49}, + {"matrix":[4, 9], "flags":4, "x":136, "y":49}, + {"matrix":[4, 10], "flags":4, "x":151, "y":49}, + {"matrix":[4, 11], "flags":4, "x":165, "y":49}, + {"matrix":[4, 13], "flags":1, "x":185, "y":49}, + {"matrix":[3, 12], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 6], "flags":4, "x":94, "y":61}, + {"matrix":[5, 10], "flags":1, "x":147, "y":61}, + {"matrix":[5, 11], "flags":1, "x":162, "y":61}, + {"matrix":[5, 12], "flags":1, "x":176, "y":61}, + {"matrix":[5, 13], "flags":1, "x":195, "y":64}, + {"matrix":[4, 12], "flags":1, "x":209, "y":64}, + {"matrix":[5, 14], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q1v1/ansi_encoder/keymaps/default/keymap.c similarity index 96% rename from keyboards/keychron/q1/ansi_encoder/keymaps/default/keymap.c rename to keyboards/keychron/q1v1/ansi_encoder/keymaps/default/keymap.c index a4febc93c75a..2f41d68b5582 100644 --- a/keyboards/keychron/q1/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v1/ansi_encoder/keymaps/default/keymap.c @@ -16,16 +16,17 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/default/rules.mk b/keyboards/keychron/q1v1/ansi_encoder/keymaps/default/rules.mk similarity index 100% rename from keyboards/keychron/q1/ansi_encoder/keymaps/default/rules.mk rename to keyboards/keychron/q1v1/ansi_encoder/keymaps/default/rules.mk diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/keymap.c similarity index 93% rename from keyboards/keychron/q1/ansi_encoder/keymaps/keychron/keymap.c rename to keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/keymap.c index 88d0b49efd2a..bf202ea5eefc 100644 --- a/keyboards/keychron/q1/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, @@ -67,10 +69,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..936769ddc6e2 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi_encoder/keymaps/keychron/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q1v1/ansi_encoder/keymaps/via/keymap.c similarity index 96% rename from keyboards/keychron/q1/ansi_encoder/keymaps/via/keymap.c rename to keyboards/keychron/q1v1/ansi_encoder/keymaps/via/keymap.c index 9372a1d8144c..18ae53420147 100644 --- a/keyboards/keychron/q1/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v1/ansi_encoder/keymaps/via/keymap.c @@ -16,16 +16,17 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, diff --git a/keyboards/keychron/q1/ansi_encoder/keymaps/via/rules.mk b/keyboards/keychron/q1v1/ansi_encoder/keymaps/via/rules.mk similarity index 100% rename from keyboards/keychron/q1/ansi_encoder/keymaps/via/rules.mk rename to keyboards/keychron/q1v1/ansi_encoder/keymaps/via/rules.mk diff --git a/keyboards/keychron/q1v1/ansi_encoder/rules.mk b/keyboards/keychron/q1v1/ansi_encoder/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q1v1/ansi_encoder/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q1/iso_encoder/config.h b/keyboards/keychron/q1v1/config.h similarity index 63% rename from keyboards/keychron/q1/iso_encoder/config.h rename to keyboards/keychron/q1v1/config.h index c1e84e44d351..639a1e463405 100644 --- a/keyboards/keychron/q1/iso_encoder/config.h +++ b/keyboards/keychron/q1v1/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2021 @ Keychron(https://www.keychron.com) * * 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 @@ -16,18 +16,27 @@ #pragma once -/* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { {0,1} } - /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1010000 #define DRIVER_ADDR_2 0b1011111 -/* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 59 -#define DRIVER_2_LED_TOTAL 24 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +/* DIP switch */ +#define DIP_SWITCH_MATRIX_GRID { {0,1} } + +/* Disable DIP switch in matrix data */ +#define MATRIX_MASKED + +/* Disable RGB lighting when PC is in suspend */ +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects + +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYRELEASES -/* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 44 +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q1v1/info.json b/keyboards/keychron/q1v1/info.json new file mode 100644 index 000000000000..4735fc308400 --- /dev/null +++ b/keyboards/keychron/q1v1/info.json @@ -0,0 +1,54 @@ +{ + "keyboard_name": "Q1", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "atmega32u4", + "bootloader": "atmel-dfu", + "usb": { + "vid": "0x3434", + "force_nkro": true + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true, + "lto": true + }, + "rgb_matrix": { + "driver": "is31fl3733", + "animations": { + "band_spiral_val": true, + "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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + } + }, + "matrix_pins": { + "cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"], + "rows": ["D3", "D2", "B3", "B2", "B1", "B0"] + }, + "diode_direction": "ROW2COL" +} diff --git a/keyboards/keychron/q1/ansi_encoder/config.h b/keyboards/keychron/q1v1/iso/config.h similarity index 84% rename from keyboards/keychron/q1/ansi_encoder/config.h rename to keyboards/keychron/q1v1/iso/config.h index 28bbea908788..ae3c43ff7124 100644 --- a/keyboards/keychron/q1/ansi_encoder/config.h +++ b/keyboards/keychron/q1v1/iso/config.h @@ -17,6 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 59 -#define DRIVER_2_LED_TOTAL 23 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 83 + +/* Enable caps-lock LED */ +// #define CAPS_LOCK_LED_INDEX 44 // Disable caps-lock LED to reduce code size diff --git a/keyboards/keychron/q1v1/iso/info.json b/keyboards/keychron/q1v1/iso/info.json new file mode 100644 index 000000000000..4b66d1fbeb1c --- /dev/null +++ b/keyboards/keychron/q1v1/iso/info.json @@ -0,0 +1,192 @@ +{ + "usb": { + "pid": "0x0102", + "device_version": "1.0.0" + }, + "layouts": { + "LAYOUT_iso_83": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 1.25, "y": 0}, + {"matrix": [0, 3], "x": 2.25, "y": 0}, + {"matrix": [0, 4], "x": 3.25, "y": 0}, + {"matrix": [0, 5], "x": 4.25, "y": 0}, + {"matrix": [0, 6], "x": 5.5, "y": 0}, + {"matrix": [0, 7], "x": 6.5, "y": 0}, + {"matrix": [0, 8], "x": 7.5, "y": 0}, + {"matrix": [0, 9], "x": 8.5, "y": 0}, + {"matrix": [0, 10], "x": 9.75, "y": 0}, + {"matrix": [0, 11], "x": 10.75, "y": 0}, + {"matrix": [0, 12], "x": 11.75, "y": 0}, + {"matrix": [0, 13], "x": 12.75, "y": 0}, + {"matrix": [4, 14], "x": 14, "y": 0}, + {"matrix": [0, 14], "x": 15.25, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1.25}, + {"matrix": [1, 1], "x": 1, "y": 1.25}, + {"matrix": [1, 2], "x": 2, "y": 1.25}, + {"matrix": [1, 3], "x": 3, "y": 1.25}, + {"matrix": [1, 4], "x": 4, "y": 1.25}, + {"matrix": [1, 5], "x": 5, "y": 1.25}, + {"matrix": [1, 6], "x": 6, "y": 1.25}, + {"matrix": [1, 7], "x": 7, "y": 1.25}, + {"matrix": [1, 8], "x": 8, "y": 1.25}, + {"matrix": [1, 9], "x": 9, "y": 1.25}, + {"matrix": [1, 10], "x": 10, "y": 1.25}, + {"matrix": [1, 11], "x": 11, "y": 1.25}, + {"matrix": [1, 12], "x": 12, "y": 1.25}, + {"matrix": [1, 13], "x": 13, "y": 1.25, "w": 2}, + {"matrix": [1, 14], "x": 15.25, "y": 1.25}, + + {"matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, + {"matrix": [2, 1], "x": 1.5, "y": 2.25}, + {"matrix": [2, 2], "x": 2.5, "y": 2.25}, + {"matrix": [2, 3], "x": 3.5, "y": 2.25}, + {"matrix": [2, 4], "x": 4.5, "y": 2.25}, + {"matrix": [2, 5], "x": 5.5, "y": 2.25}, + {"matrix": [2, 6], "x": 6.5, "y": 2.25}, + {"matrix": [2, 7], "x": 7.5, "y": 2.25}, + {"matrix": [2, 8], "x": 8.5, "y": 2.25}, + {"matrix": [2, 9], "x": 9.5, "y": 2.25}, + {"matrix": [2, 10], "x": 10.5, "y": 2.25}, + {"matrix": [2, 11], "x": 11.5, "y": 2.25}, + {"matrix": [2, 12], "x": 12.5, "y": 2.25}, + {"matrix": [2, 14], "x": 15.25, "y": 2.25}, + + {"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, + {"matrix": [3, 1], "x": 1.75, "y": 3.25}, + {"matrix": [3, 2], "x": 2.75, "y": 3.25}, + {"matrix": [3, 3], "x": 3.75, "y": 3.25}, + {"matrix": [3, 4], "x": 4.75, "y": 3.25}, + {"matrix": [3, 5], "x": 5.75, "y": 3.25}, + {"matrix": [3, 6], "x": 6.75, "y": 3.25}, + {"matrix": [3, 7], "x": 7.75, "y": 3.25}, + {"matrix": [3, 8], "x": 8.75, "y": 3.25}, + {"matrix": [3, 9], "x": 9.75, "y": 3.25}, + {"matrix": [3, 10], "x": 10.75, "y": 3.25}, + {"matrix": [3, 11], "x": 11.75, "y": 3.25}, + {"matrix": [3, 13], "x": 12.75, "y": 3.25}, + {"matrix": [2, 13], "x": 13.75, "y": 2.25, "w": 1.25, "h": 2}, + {"matrix": [3, 14], "x": 15.25, "y": 3.25}, + + {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 1.25}, + {"matrix": [4, 1], "x": 1.25, "y": 4.25}, + {"matrix": [4, 2], "x": 2.25, "y": 4.25}, + {"matrix": [4, 3], "x": 3.25, "y": 4.25}, + {"matrix": [4, 4], "x": 4.25, "y": 4.25}, + {"matrix": [4, 5], "x": 5.25, "y": 4.25}, + {"matrix": [4, 6], "x": 6.25, "y": 4.25}, + {"matrix": [4, 7], "x": 7.25, "y": 4.25}, + {"matrix": [4, 8], "x": 8.25, "y": 4.25}, + {"matrix": [4, 9], "x": 9.25, "y": 4.25}, + {"matrix": [4, 10], "x": 10.25, "y": 4.25}, + {"matrix": [4, 11], "x": 11.25, "y": 4.25}, + {"matrix": [4, 13], "x": 12.25, "y": 4.25, "w": 1.75}, + {"matrix": [3, 12], "x": 14.25, "y": 4.5}, + + {"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, + {"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, + {"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, + {"matrix": [5, 6], "x": 3.75, "y": 5.25, "w": 6.25}, + {"matrix": [5, 10], "x": 10, "y": 5.25}, + {"matrix": [5, 11], "x": 11, "y": 5.25}, + {"matrix": [5, 12], "x": 12, "y": 5.25}, + {"matrix": [5, 13], "x": 13.25, "y": 5.5}, + {"matrix": [4, 12], "x": 14.25, "y": 5.5}, + {"matrix": [5, 14], "x": 15.25, "y": 5.5} + ] + } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":18, "y":0}, + {"matrix":[0, 3], "flags":1, "x":33, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":62, "y":0}, + {"matrix":[0, 6], "flags":1, "x":81, "y":0}, + {"matrix":[0, 7], "flags":1, "x":95, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":125, "y":0}, + {"matrix":[0, 10], "flags":1, "x":143, "y":0}, + {"matrix":[0, 11], "flags":1, "x":158, "y":0}, + {"matrix":[0, 12], "flags":1, "x":173, "y":0}, + {"matrix":[0, 13], "flags":1, "x":187, "y":0}, + {"matrix":[4, 14], "flags":1, "x":206, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 13], "flags":1, "x":187, "y":38}, + {"matrix":[2, 13], "flags":1, "x":203, "y":32}, + {"matrix":[3, 14], "flags":1, "x":209, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":49}, + {"matrix":[4, 1], "flags":1, "x":18, "y":49}, + {"matrix":[4, 2], "flags":4, "x":33, "y":49}, + {"matrix":[4, 3], "flags":4, "x":48, "y":49}, + {"matrix":[4, 4], "flags":4, "x":62, "y":49}, + {"matrix":[4, 5], "flags":4, "x":77, "y":49}, + {"matrix":[4, 6], "flags":4, "x":92, "y":49}, + {"matrix":[4, 7], "flags":4, "x":106, "y":49}, + {"matrix":[4, 8], "flags":4, "x":121, "y":49}, + {"matrix":[4, 9], "flags":4, "x":136, "y":49}, + {"matrix":[4, 10], "flags":4, "x":151, "y":49}, + {"matrix":[4, 11], "flags":4, "x":165, "y":49}, + {"matrix":[4, 13], "flags":1, "x":185, "y":49}, + {"matrix":[3, 12], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 6], "flags":4, "x":94, "y":61}, + {"matrix":[5, 10], "flags":1, "x":147, "y":61}, + {"matrix":[5, 11], "flags":1, "x":162, "y":61}, + {"matrix":[5, 12], "flags":1, "x":176, "y":61}, + {"matrix":[5, 13], "flags":1, "x":195, "y":64}, + {"matrix":[4, 12], "flags":1, "x":209, "y":64}, + {"matrix":[5, 14], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/q1/iso/iso.c b/keyboards/keychron/q1v1/iso/iso.c similarity index 65% rename from keyboards/keychron/q1/iso/iso.c rename to keyboards/keychron/q1v1/iso/iso.c index 619d89dffc93..aa90584dea5c 100644 --- a/keyboards/keychron/q1/iso/iso.c +++ b/keyboards/keychron/q1v1/iso/iso.c @@ -113,37 +113,4 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 57, 43 }, - { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 72, 56, 58 }, - { 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 81, 71, 13 }, - { 73, 74, 75, __, __, __, 76, __, __, __, 77, 78, 79, 80, 82 } - }, - { - // LED Index to Physical Position - {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, - {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, - {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {224,26}, - {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {187,38}, {203,32}, {224,38}, - {2,49}, {18,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52}, - {2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q1/iso/keymaps/default/keymap.c b/keyboards/keychron/q1v1/iso/keymaps/default/keymap.c similarity index 95% rename from keyboards/keychron/q1/iso/keymaps/default/keymap.c rename to keyboards/keychron/q1v1/iso/keymaps/default/keymap.c index 080e2839c83f..9b17ca737d28 100644 --- a/keyboards/keychron/q1/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v1/iso/keymaps/default/keymap.c @@ -16,19 +16,20 @@ #include QMK_KEYBOARD_H -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, diff --git a/keyboards/keychron/q1/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q1v1/iso/keymaps/keychron/keymap.c similarity index 91% rename from keyboards/keychron/q1/iso/keymaps/keychron/keymap.c rename to keyboards/keychron/q1v1/iso/keymaps/keychron/keymap.c index d641f62c3f17..bf486149a7c4 100644 --- a/keyboards/keychron/q1/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v1/iso/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, @@ -58,10 +60,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v1/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q1v1/iso/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/q1v1/iso/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1/iso/keymaps/via/keymap.c b/keyboards/keychron/q1v1/iso/keymaps/via/keymap.c similarity index 95% rename from keyboards/keychron/q1/iso/keymaps/via/keymap.c rename to keyboards/keychron/q1v1/iso/keymaps/via/keymap.c index 4d9f158e1ef7..2b5ae78879e3 100644 --- a/keyboards/keychron/q1/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v1/iso/keymaps/via/keymap.c @@ -16,19 +16,20 @@ #include QMK_KEYBOARD_H -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, diff --git a/keyboards/keychron/q1v1/iso/keymaps/via/rules.mk b/keyboards/keychron/q1v1/iso/keymaps/via/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/q1v1/iso/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/q1v1/iso/rules.mk b/keyboards/keychron/q1v1/iso/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q1v1/iso/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q1/ansi/keymaps/gtg465x/config.h b/keyboards/keychron/q1v1/iso_encoder/config.h similarity index 71% rename from keyboards/keychron/q1/ansi/keymaps/gtg465x/config.h rename to keyboards/keychron/q1v1/iso_encoder/config.h index 5ac05d04c12f..e802a7422193 100644 --- a/keyboards/keychron/q1/ansi/keymaps/gtg465x/config.h +++ b/keyboards/keychron/q1v1/iso_encoder/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Grayson Carr +/* Copyright 2021 @ Keychron (https://www.keychron.com) * * 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 @@ -17,9 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#ifdef RGB_MATRIX_ENABLE -# define RGB_DISABLE_WHEN_USB_SUSPENDED -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define CAPS_LOCK_INDICATOR_LIGHT_ALPHAS -# define FN_LAYER_TRANSPARENT_KEYS_OFF +#define RGB_MATRIX_LED_COUNT 83 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 #endif + +/* Enable caps-lock LED */ +// #define CAPS_LOCK_LED_INDEX 44 // Disable caps-lock LED to reduce code size diff --git a/keyboards/keychron/q1/iso_encoder/info.json b/keyboards/keychron/q1v1/iso_encoder/info.json similarity index 50% rename from keyboards/keychron/q1/iso_encoder/info.json rename to keyboards/keychron/q1v1/iso_encoder/info.json index 250cd1ffb436..03baa7f1aafc 100644 --- a/keyboards/keychron/q1/iso_encoder/info.json +++ b/keyboards/keychron/q1v1/iso_encoder/info.json @@ -1,29 +1,16 @@ { - "keyboard_name": "Keychron Q1", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0103", - "device_version": "1.0.2", - "force_nkro": true + "device_version": "1.0.2" }, - "rgb_matrix": { - "driver": "is31fl3733" - }, - "matrix_pins": { - "cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"], - "rows": ["D3", "D2", "B3", "B2", "B1", "B0"] + "features": { + "encoder": true }, - "diode_direction": "ROW2COL", "encoder": { "rotary": [ {"pin_a": "E6", "pin_b": "B7"} ] }, - "processor": "atmega32u4", - "bootloader": "atmel-dfu", "layouts": { "LAYOUT_iso_83": { "layout": [ @@ -117,5 +104,97 @@ {"matrix": [5, 14], "x": 15.25, "y": 5.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":18, "y":0}, + {"matrix":[0, 3], "flags":1, "x":33, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":62, "y":0}, + {"matrix":[0, 6], "flags":1, "x":81, "y":0}, + {"matrix":[0, 7], "flags":1, "x":95, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":125, "y":0}, + {"matrix":[0, 10], "flags":1, "x":143, "y":0}, + {"matrix":[0, 11], "flags":1, "x":158, "y":0}, + {"matrix":[0, 12], "flags":1, "x":173, "y":0}, + {"matrix":[0, 13], "flags":1, "x":187, "y":0}, + {"matrix":[4, 14], "flags":1, "x":206, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 13], "flags":1, "x":187, "y":38}, + {"matrix":[2, 13], "flags":1, "x":203, "y":32}, + {"matrix":[3, 14], "flags":1, "x":209, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":49}, + {"matrix":[4, 1], "flags":1, "x":18, "y":49}, + {"matrix":[4, 2], "flags":4, "x":33, "y":49}, + {"matrix":[4, 3], "flags":4, "x":48, "y":49}, + {"matrix":[4, 4], "flags":4, "x":62, "y":49}, + {"matrix":[4, 5], "flags":4, "x":77, "y":49}, + {"matrix":[4, 6], "flags":4, "x":92, "y":49}, + {"matrix":[4, 7], "flags":4, "x":106, "y":49}, + {"matrix":[4, 8], "flags":4, "x":121, "y":49}, + {"matrix":[4, 9], "flags":4, "x":136, "y":49}, + {"matrix":[4, 10], "flags":4, "x":151, "y":49}, + {"matrix":[4, 11], "flags":4, "x":165, "y":49}, + {"matrix":[4, 13], "flags":1, "x":185, "y":49}, + {"matrix":[3, 12], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 6], "flags":4, "x":94, "y":61}, + {"matrix":[5, 10], "flags":1, "x":147, "y":61}, + {"matrix":[5, 11], "flags":1, "x":162, "y":61}, + {"matrix":[5, 12], "flags":1, "x":176, "y":61}, + {"matrix":[5, 13], "flags":1, "x":195, "y":64}, + {"matrix":[4, 12], "flags":1, "x":209, "y":64}, + {"matrix":[5, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q1/iso_encoder/iso_encoder.c b/keyboards/keychron/q1v1/iso_encoder/iso_encoder.c similarity index 64% rename from keyboards/keychron/q1/iso_encoder/iso_encoder.c rename to keyboards/keychron/q1v1/iso_encoder/iso_encoder.c index c6b091fff173..aa152002e947 100644 --- a/keyboards/keychron/q1/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q1v1/iso_encoder/iso_encoder.c @@ -112,39 +112,6 @@ const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = { {1, F_13, D_13, E_13}, {1, F_14, D_14, E_14}, {1, F_15, D_15, E_15}, - {1, F_16, D_16, E_16} + {1, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 57, 43 }, - { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 72, 56, 58 }, - { 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 81, 71, 13 }, - { 73, 74, 75, __, __, __, 76, __, __, __, 77, 78, 79, 80, 82 } - }, - { - // LED Index to Physical Position - {0,0}, {18,0}, {33,0}, {48,0}, {62,0}, {81,0}, {95,0}, {110,0}, {125,0}, {143,0}, {158,0}, {173,0}, {187,0}, {206,0}, {224,0}, - {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {118,15}, {132,15}, {147,15}, {162,15}, {176,15}, {198,15}, {224,15}, - {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {140,26}, {154,26}, {169,26}, {184,26}, {224,26}, - {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {129,38}, {143,38}, {158,38}, {173,38}, {187,38}, {203,32}, {224,38}, - {2,49}, {18,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {151,49}, {165,49}, {185,49}, {209,52}, - {2,61}, {20,61}, {39,61}, {94,61}, {147,61}, {162,61}, {176,61}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q1v1/iso_encoder/keymaps/default/keymap.c similarity index 96% rename from keyboards/keychron/q1/iso_encoder/keymaps/default/keymap.c rename to keyboards/keychron/q1v1/iso_encoder/keymaps/default/keymap.c index 237d9a3f1e5d..6463ef085d1e 100644 --- a/keyboards/keychron/q1/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v1/iso_encoder/keymaps/default/keymap.c @@ -16,17 +16,17 @@ #include QMK_KEYBOARD_H - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, @@ -65,4 +65,4 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, [WIN_FN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, }; -#endif \ No newline at end of file +#endif diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/default/rules.mk b/keyboards/keychron/q1v1/iso_encoder/keymaps/default/rules.mk similarity index 100% rename from keyboards/keychron/q1/iso_encoder/keymaps/default/rules.mk rename to keyboards/keychron/q1v1/iso_encoder/keymaps/default/rules.mk diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/keymap.c similarity index 93% rename from keyboards/keychron/q1/iso_encoder/keymaps/keychron/keymap.c rename to keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/keymap.c index b007e56fbae0..4746d9e46eff 100644 --- a/keyboards/keychron/q1/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, @@ -69,10 +69,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; -} \ No newline at end of file +} diff --git a/keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..936769ddc6e2 --- /dev/null +++ b/keyboards/keychron/q1v1/iso_encoder/keymaps/keychron/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q1v1/iso_encoder/keymaps/via/keymap.c similarity index 97% rename from keyboards/keychron/q1/iso_encoder/keymaps/via/keymap.c rename to keyboards/keychron/q1v1/iso_encoder/keymaps/via/keymap.c index 47f04d8a29d4..7fbf6195119a 100644 --- a/keyboards/keychron/q1/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v1/iso_encoder/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, @@ -66,4 +65,4 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, [WIN_FN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, }; -#endif \ No newline at end of file +#endif diff --git a/keyboards/keychron/q1/iso_encoder/keymaps/via/rules.mk b/keyboards/keychron/q1v1/iso_encoder/keymaps/via/rules.mk similarity index 100% rename from keyboards/keychron/q1/iso_encoder/keymaps/via/rules.mk rename to keyboards/keychron/q1v1/iso_encoder/keymaps/via/rules.mk diff --git a/keyboards/keychron/q1v1/iso_encoder/rules.mk b/keyboards/keychron/q1v1/iso_encoder/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q1v1/iso_encoder/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q1/q1.c b/keyboards/keychron/q1v1/q1v1.c similarity index 100% rename from keyboards/keychron/q1/q1.c rename to keyboards/keychron/q1v1/q1v1.c diff --git a/keyboards/keychron/q1v1/readme.md b/keyboards/keychron/q1v1/readme.md new file mode 100644 index 000000000000..9cdd06a7aa4d --- /dev/null +++ b/keyboards/keychron/q1v1/readme.md @@ -0,0 +1,32 @@ +# Keychron Q1 + +![Keychron Q1](https://i.imgur.com/BbJNGLY.jpg) + +A customizable 75% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Keychron Q1 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/q1/ansi:default + make keychron/q1/ansi_encoder:default + make keychron/q1/iso:default + make keychron/q1/iso_encoder:default + +Flashing example for this keyboard: + + make keychron/q1/ansi:default:flash + make keychron/q1/ansi_encoder:default:flash + make keychron/q1/iso:default:flash + make keychron/q1/iso_encoder:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q1v2/ansi/ansi.c b/keyboards/keychron/q1v2/ansi/ansi.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi/config.h b/keyboards/keychron/q1v2/ansi/config.h old mode 100644 new mode 100755 index 05ace3177834..5246136e3c65 --- a/keyboards/keychron/q1v2/ansi/config.h +++ b/keyboards/keychron/q1v2/ansi/config.h @@ -17,9 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 45 -#define DRIVER_2_LED_TOTAL 37 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 82 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 45 diff --git a/keyboards/keychron/q1v2/ansi/info.json b/keyboards/keychron/q1v2/ansi/info.json old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi/keymaps/default/keymap.c b/keyboards/keychron/q1v2/ansi/keymaps/default/keymap.c old mode 100644 new mode 100755 index 383a43cdb2a5..46f43b8bfa0e --- a/keyboards/keychron/q1v2/ansi/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/ansi/keymaps/default/keymap.c @@ -16,9 +16,7 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, @@ -28,6 +26,7 @@ enum layers{ #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, diff --git a/keyboards/keychron/q1v2/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/ansi/keymaps/keychron/keymap.c old mode 100644 new mode 100755 index 3a6676196f8a..7569346144eb --- a/keyboards/keychron/q1v2/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/ansi/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, @@ -64,11 +64,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/ansi/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 495e8907b48c..3c9fcc5c98c2 --- a/keyboards/keychron/q1v2/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/ansi/keymaps/via/keymap.c b/keyboards/keychron/q1v2/ansi/keymaps/via/keymap.c old mode 100644 new mode 100755 index ad35cfb78e3f..46f43b8bfa0e --- a/keyboards/keychron/q1v2/ansi/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/ansi/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, diff --git a/keyboards/keychron/q1v2/ansi/keymaps/via/rules.mk b/keyboards/keychron/q1v2/ansi/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi/rules.mk b/keyboards/keychron/q1v2/ansi/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/ansi/rules.mk +++ b/keyboards/keychron/q1v2/ansi/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q1v2/ansi_encoder/ansi_encoder.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi_encoder/config.h b/keyboards/keychron/q1v2/ansi_encoder/config.h old mode 100644 new mode 100755 index 0dce301c3cef..cb15be0babaa --- a/keyboards/keychron/q1v2/ansi_encoder/config.h +++ b/keyboards/keychron/q1v2/ansi_encoder/config.h @@ -17,12 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 45 -#define DRIVER_2_LED_TOTAL 37 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +#define RGB_MATRIX_LED_COUNT 82 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 45 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q1v2/ansi_encoder/info.json b/keyboards/keychron/q1v2/ansi_encoder/info.json old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/keymap.c old mode 100644 new mode 100755 index d4424125249e..a7a54d0892b6 --- a/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/rules.mk b/keyboards/keychron/q1v2/ansi_encoder/keymaps/default/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/keymap.c old mode 100644 new mode 100755 index 9de2b88de986..5bbb0c1404f5 --- a/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, @@ -73,11 +73,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 9cf1a9b56cba..936769ddc6e2 --- a/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/keymap.c old mode 100644 new mode 100755 index e299e1c96bee..5f589baa194e --- a/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, diff --git a/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/rules.mk b/keyboards/keychron/q1v2/ansi_encoder/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/ansi_encoder/rules.mk b/keyboards/keychron/q1v2/ansi_encoder/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/ansi_encoder/rules.mk +++ b/keyboards/keychron/q1v2/ansi_encoder/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/config.h b/keyboards/keychron/q1v2/config.h old mode 100644 new mode 100755 index e2d331c1ac19..4f020ed30651 --- a/keyboards/keychron/q1v2/config.h +++ b/keyboards/keychron/q1v2/config.h @@ -29,10 +29,7 @@ #define I2C1_TIMINGR_SCLL 51U /* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID \ - { \ - { 5, 4 } \ - } +#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } } /* Disable DIP switch in matrix data */ #define MATRIX_MASKED @@ -56,4 +53,13 @@ #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES -#define HOLD_ON_OTHER_KEY_PRESS // Old default behavior of mod-taps +/* HC595 Driver Configuration */ +#define HC595_STCP B0 +#define HC595_SHCP B1 +#define HC595_DS A7 +#define HC595_START_INDEX 8 +#define HC595_END_INDEX 15 + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q1v2/halconf.h b/keyboards/keychron/q1v2/halconf.h old mode 100644 new mode 100755 index 41bddcb2799b..463d177eabc7 --- a/keyboards/keychron/q1v2/halconf.h +++ b/keyboards/keychron/q1v2/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q1v2/info.json b/keyboards/keychron/q1v2/info.json old mode 100644 new mode 100755 index c4a75f0283ab..6cd122874868 --- a/keyboards/keychron/q1v2/info.json +++ b/keyboards/keychron/q1v2/info.json @@ -12,11 +12,11 @@ "bootmagic": true, "command": false, "console": false, + "dip_switch": true, "extrakey": true, "mousekey": true, "nkro": true, - "rgb_matrix": true, - "dip_switch": true + "rgb_matrix": true }, "matrix_pins": { "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null], diff --git a/keyboards/keychron/q1v2/iso/config.h b/keyboards/keychron/q1v2/iso/config.h old mode 100644 new mode 100755 index d9e596e2c571..0708cdb1bc7b --- a/keyboards/keychron/q1v2/iso/config.h +++ b/keyboards/keychron/q1v2/iso/config.h @@ -17,9 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 45 -#define DRIVER_2_LED_TOTAL 38 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 83 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 44 diff --git a/keyboards/keychron/q1v2/iso/info.json b/keyboards/keychron/q1v2/iso/info.json old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso/iso.c b/keyboards/keychron/q1v2/iso/iso.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso/keymaps/default/keymap.c b/keyboards/keychron/q1v2/iso/keymaps/default/keymap.c old mode 100644 new mode 100755 index f97a595ea62f..4d6312d2944c --- a/keyboards/keychron/q1v2/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/iso/keymaps/default/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, diff --git a/keyboards/keychron/q1v2/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/iso/keymaps/keychron/keymap.c old mode 100644 new mode 100755 index 30e1ef18bb48..55058651d5d2 --- a/keyboards/keychron/q1v2/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/iso/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, @@ -64,11 +64,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/iso/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 495e8907b48c..3c9fcc5c98c2 --- a/keyboards/keychron/q1v2/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/iso/keymaps/via/keymap.c b/keyboards/keychron/q1v2/iso/keymaps/via/keymap.c old mode 100644 new mode 100755 index f97a595ea62f..4d6312d2944c --- a/keyboards/keychron/q1v2/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/iso/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, diff --git a/keyboards/keychron/q1v2/iso/keymaps/via/rules.mk b/keyboards/keychron/q1v2/iso/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso/rules.mk b/keyboards/keychron/q1v2/iso/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/iso/rules.mk +++ b/keyboards/keychron/q1v2/iso/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/iso_encoder/config.h b/keyboards/keychron/q1v2/iso_encoder/config.h old mode 100644 new mode 100755 index ab9be499d98a..ae39290a2995 --- a/keyboards/keychron/q1v2/iso_encoder/config.h +++ b/keyboards/keychron/q1v2/iso_encoder/config.h @@ -17,12 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 45 -#define DRIVER_2_LED_TOTAL 38 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +#define RGB_MATRIX_LED_COUNT 83 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 44 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q1v2/iso_encoder/info.json b/keyboards/keychron/q1v2/iso_encoder/info.json old mode 100644 new mode 100755 index 38e34176b89d..bc30de4c4d60 --- a/keyboards/keychron/q1v2/iso_encoder/info.json +++ b/keyboards/keychron/q1v2/iso_encoder/info.json @@ -7,7 +7,6 @@ "encoder": true }, "encoder": { - "enabled": true, "rotary": [ {"pin_a": "A10", "pin_b": "A8", "resolution": 4} ] diff --git a/keyboards/keychron/q1v2/iso_encoder/iso_encoder.c b/keyboards/keychron/q1v2/iso_encoder/iso_encoder.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q1v2/iso_encoder/keymaps/default/keymap.c old mode 100644 new mode 100755 index 74aa487f95ed..30efe449d022 --- a/keyboards/keychron/q1v2/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/iso_encoder/keymaps/default/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/default/rules.mk b/keyboards/keychron/q1v2/iso_encoder/keymaps/default/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/keymap.c old mode 100644 new mode 100755 index 3b1e8b68ece1..700cda345bbf --- a/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, @@ -60,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, @@ -75,11 +73,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 9cf1a9b56cba..936769ddc6e2 --- a/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q1v2/iso_encoder/keymaps/via/keymap.c old mode 100644 new mode 100755 index 74aa487f95ed..30efe449d022 --- a/keyboards/keychron/q1v2/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/iso_encoder/keymaps/via/keymap.c @@ -16,18 +16,17 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, diff --git a/keyboards/keychron/q1v2/iso_encoder/keymaps/via/rules.mk b/keyboards/keychron/q1v2/iso_encoder/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/iso_encoder/rules.mk b/keyboards/keychron/q1v2/iso_encoder/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/iso_encoder/rules.mk +++ b/keyboards/keychron/q1v2/iso_encoder/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/jis/config.h b/keyboards/keychron/q1v2/jis/config.h old mode 100644 new mode 100755 index 2e3db213b0c5..0fe9fd0d6d84 --- a/keyboards/keychron/q1v2/jis/config.h +++ b/keyboards/keychron/q1v2/jis/config.h @@ -17,9 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 46 -#define DRIVER_2_LED_TOTAL 40 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 86 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 45 diff --git a/keyboards/keychron/q1v2/jis/info.json b/keyboards/keychron/q1v2/jis/info.json old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis/jis.c b/keyboards/keychron/q1v2/jis/jis.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis/keymaps/default/keymap.c b/keyboards/keychron/q1v2/jis/keymaps/default/keymap.c index 14af11a77cb5..8dc254b3febb 100644 --- a/keyboards/keychron/q1v2/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/jis/keymaps/default/keymap.c @@ -16,24 +16,23 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/q1v2/jis/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/jis/keymaps/keychron/keymap.c index b783b9307809..0a9bad03015e 100644 --- a/keyboards/keychron/q1v2/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/jis/keymaps/keychron/keymap.c @@ -16,22 +16,22 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -64,11 +64,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/jis/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/jis/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 495e8907b48c..3c9fcc5c98c2 --- a/keyboards/keychron/q1v2/jis/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/jis/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/jis/keymaps/via/keymap.c b/keyboards/keychron/q1v2/jis/keymaps/via/keymap.c index 14af11a77cb5..8dc254b3febb 100644 --- a/keyboards/keychron/q1v2/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/jis/keymaps/via/keymap.c @@ -16,24 +16,23 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/q1v2/jis/keymaps/via/rules.mk b/keyboards/keychron/q1v2/jis/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis/rules.mk b/keyboards/keychron/q1v2/jis/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/jis/rules.mk +++ b/keyboards/keychron/q1v2/jis/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/jis_encoder/config.h b/keyboards/keychron/q1v2/jis_encoder/config.h old mode 100644 new mode 100755 index c80c4238f57d..39364286c3f8 --- a/keyboards/keychron/q1v2/jis_encoder/config.h +++ b/keyboards/keychron/q1v2/jis_encoder/config.h @@ -17,12 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 46 -#define DRIVER_2_LED_TOTAL 40 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +#define RGB_MATRIX_LED_COUNT 86 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 45 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q1v2/jis_encoder/info.json b/keyboards/keychron/q1v2/jis_encoder/info.json old mode 100644 new mode 100755 index 544958f24fd6..02f90b5e7183 --- a/keyboards/keychron/q1v2/jis_encoder/info.json +++ b/keyboards/keychron/q1v2/jis_encoder/info.json @@ -7,7 +7,6 @@ "encoder": true }, "encoder": { - "enabled": true, "rotary": [ {"pin_a": "A10", "pin_b": "A8", "resolution": 4} ] diff --git a/keyboards/keychron/q1v2/jis_encoder/jis_encoder.c b/keyboards/keychron/q1v2/jis_encoder/jis_encoder.c old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/q1v2/jis_encoder/keymaps/default/keymap.c old mode 100644 new mode 100755 index def0cba27f4e..866614494c43 --- a/keyboards/keychron/q1v2/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q1v2/jis_encoder/keymaps/default/keymap.c @@ -16,24 +16,23 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/default/rules.mk b/keyboards/keychron/q1v2/jis_encoder/keymaps/default/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/keymap.c old mode 100644 new mode 100755 index 5aa1ab9471f6..fb249ca6517f --- a/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/keymap.c @@ -16,22 +16,22 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -73,11 +73,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/rules.mk old mode 100644 new mode 100755 index 9cf1a9b56cba..936769ddc6e2 --- a/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q1v2/jis_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/q1v2/jis_encoder/keymaps/via/keymap.c old mode 100644 new mode 100755 index def0cba27f4e..866614494c43 --- a/keyboards/keychron/q1v2/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q1v2/jis_encoder/keymaps/via/keymap.c @@ -16,24 +16,23 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/q1v2/jis_encoder/keymaps/via/rules.mk b/keyboards/keychron/q1v2/jis_encoder/keymaps/via/rules.mk old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/jis_encoder/rules.mk b/keyboards/keychron/q1v2/jis_encoder/rules.mk old mode 100644 new mode 100755 index 36ee49ccb093..6e7633bfe015 --- a/keyboards/keychron/q1v2/jis_encoder/rules.mk +++ b/keyboards/keychron/q1v2/jis_encoder/rules.mk @@ -1 +1 @@ -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q1v2/matrix.c b/keyboards/keychron/q1v2/matrix.c deleted file mode 100644 index d008a7938414..000000000000 --- a/keyboards/keychron/q1v2/matrix.c +++ /dev/null @@ -1,205 +0,0 @@ -/* Copyright 2023 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "quantum.h" - -// Pin connected to DS of 74HC595 -#define DATA_PIN A7 -// Pin connected to SH_CP of 74HC595 -#define CLOCK_PIN B1 -// Pin connected to ST_CP of 74HC595 -#define LATCH_PIN B0 - -#ifdef MATRIX_ROW_PINS -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -#endif // MATRIX_ROW_PINS -#ifdef MATRIX_COL_PINS -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif // MATRIX_COL_PINS - -#define ROWS_PER_HAND (MATRIX_ROWS) - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - -static inline uint8_t readMatrixPin(pin_t pin) { - if (pin != NO_PIN) { - return readPin(pin); - } else { - return 1; - } -} - -static void shiftOut(uint8_t dataOut) { - for (uint8_t i = 0; i < 8; i++) { - if (dataOut & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - dataOut = dataOut >> 1; - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - } - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static void shiftout_single(uint8_t data) { - if (data & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { - setPinOutput_writeLow(pin); - return true; - } else { - if (col == 8) { - shiftout_single(0x00); - } else { - shiftout_single(0x01); - } - return true; - } - return false; -} - -static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - if (col == (MATRIX_COLS - 1)) shiftout_single(0x01); - } -} - -static void unselect_cols(void) { - // unselect column pins - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } - if (x == (MATRIX_COLS - 1)) - // unselect Shift Register - shiftOut(0xFF); - } -} - -static void matrix_init_pins(void) { - unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); - } - } -} - -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col - } - - if (current_col < 8) { - matrix_output_select_delay(); - } else { - for (int8_t cycle = 4; cycle > 0; cycle--) { - matrix_output_select_delay(); // 0.25us - matrix_output_select_delay(); - matrix_output_select_delay(); - matrix_output_select_delay(); - } - } - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_matrix[row_index] |= row_shifter; - key_pressed = true; - } else { - // Pin HI, clear col bit - current_matrix[row_index] &= ~row_shifter; - } - } - - // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH -} - -void matrix_init_custom(void) { - // initialize key pins - matrix_init_pins(); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; - - // Set col, read rows - matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); - } - - bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); - - return changed; -} diff --git a/keyboards/keychron/q1v2/mcuconf.h b/keyboards/keychron/q1v2/mcuconf.h old mode 100644 new mode 100755 diff --git a/keyboards/keychron/q1v2/q1v2.c b/keyboards/keychron/q1v2/q1v2.c old mode 100644 new mode 100755 index 4f83a760d385..6d3508d53596 --- a/keyboards/keychron/q1v2/q1v2.c +++ b/keyboards/keychron/q1v2/q1v2.c @@ -36,51 +36,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { return true; } #endif - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { -# ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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 - } - 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; - } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif diff --git a/keyboards/keychron/q1v2/readme.md b/keyboards/keychron/q1v2/readme.md old mode 100644 new mode 100755 index 8efb51e60ff5..aa3559c6e12a --- a/keyboards/keychron/q1v2/readme.md +++ b/keyboards/keychron/q1v2/readme.md @@ -26,6 +26,11 @@ Flashing example for this keyboard: make keychron/q1v2/jis:default:flash make keychron/q1v2/jis_encoder:default:flash -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q1v2/rules.mk b/keyboards/keychron/q1v2/rules.mk new file mode 100755 index 000000000000..a515de570cd8 --- /dev/null +++ b/keyboards/keychron/q1v2/rules.mk @@ -0,0 +1,2 @@ +VPATH += $(TOP_DIR)/keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/q2/ansi/ansi.c b/keyboards/keychron/q2/ansi/ansi.c index 28f91269c444..6741e1c92a78 100644 --- a/keyboards/keychron/q2/ansi/ansi.c +++ b/keyboards/keychron/q2/ansi/ansi.c @@ -96,34 +96,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 65, 42, 43 }, - { 44, __, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, __, 55, 56 }, - { 57, 58, 59, __, __, __, 60, __, __, __, 61, 62, 63, 64, 66 } - }, - { - // LED Index to Physical Position - {0,0}, {15,0}, {29,0}, {44,0}, {59,0}, {73,0}, {88,0}, {103,0}, {118,0}, {132,0}, {147,0}, {162,0}, {176,0}, {198,0}, {224,0}, - {4,15}, {22,15}, {37,15}, {51,15}, {66,15}, {81,15}, {95,15}, {110,15}, {125,15}, {140,15}, {154,15}, {169,15}, {184,15}, {202,15}, {224,15}, - {6,30}, {26,30}, {40,30}, {55,30}, {70,30}, {84,30}, {99,30}, {114,30}, {129,30}, {143,30}, {158,30}, {173,30}, {196,30}, {224,30}, - {9,45}, {33,45}, {48,45}, {62,45}, {77,45}, {92,45}, {106,45}, {121,45}, {136,45}, {151,45}, {165,45}, {185,45}, {209,49}, - {2,60}, {20,60}, {39,60}, {94,60}, {147,60}, {162,60}, {176,60}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/ansi/config.h b/keyboards/keychron/q2/ansi/config.h index 6c39432b74f4..d94a0a6b0a93 100644 --- a/keyboards/keychron/q2/ansi/config.h +++ b/keyboards/keychron/q2/ansi/config.h @@ -17,6 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 34 -#define DRIVER_2_LED_TOTAL 33 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 67 + +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 30 diff --git a/keyboards/keychron/q2/ansi/info.json b/keyboards/keychron/q2/ansi/info.json index 8ed601fe8f4a..a80a9ae270bd 100644 --- a/keyboards/keychron/q2/ansi/info.json +++ b/keyboards/keychron/q2/ansi/info.json @@ -1,23 +1,8 @@ { - "keyboard_name": "Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0110", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_67": { "layout": [ @@ -94,5 +79,80 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":4, "x":15, "y":0}, + {"matrix":[0, 2], "flags":4, "x":29, "y":0}, + {"matrix":[0, 3], "flags":4, "x":44, "y":0}, + {"matrix":[0, 4], "flags":4, "x":59, "y":0}, + {"matrix":[0, 5], "flags":4, "x":73, "y":0}, + {"matrix":[0, 6], "flags":4, "x":88, "y":0}, + {"matrix":[0, 7], "flags":4, "x":103, "y":0}, + {"matrix":[0, 8], "flags":4, "x":118, "y":0}, + {"matrix":[0, 9], "flags":4, "x":132, "y":0}, + {"matrix":[0, 10], "flags":4, "x":147, "y":0}, + {"matrix":[0, 11], "flags":4, "x":162, "y":0}, + {"matrix":[0, 12], "flags":4, "x":176, "y":0}, + {"matrix":[0, 13], "flags":1, "x":198, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":15}, + {"matrix":[1, 1], "flags":4, "x":22, "y":15}, + {"matrix":[1, 2], "flags":4, "x":37, "y":15}, + {"matrix":[1, 3], "flags":4, "x":51, "y":15}, + {"matrix":[1, 4], "flags":4, "x":66, "y":15}, + {"matrix":[1, 5], "flags":4, "x":81, "y":15}, + {"matrix":[1, 6], "flags":4, "x":95, "y":15}, + {"matrix":[1, 7], "flags":4, "x":110, "y":15}, + {"matrix":[1, 8], "flags":4, "x":125, "y":15}, + {"matrix":[1, 9], "flags":4, "x":140, "y":15}, + {"matrix":[1, 10], "flags":4, "x":154, "y":15}, + {"matrix":[1, 11], "flags":4, "x":169, "y":15}, + {"matrix":[1, 12], "flags":4, "x":184, "y":15}, + {"matrix":[1, 13], "flags":1, "x":202, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":30}, + {"matrix":[2, 1], "flags":4, "x":26, "y":30}, + {"matrix":[2, 2], "flags":4, "x":40, "y":30}, + {"matrix":[2, 3], "flags":4, "x":55, "y":30}, + {"matrix":[2, 4], "flags":4, "x":70, "y":30}, + {"matrix":[2, 5], "flags":4, "x":84, "y":30}, + {"matrix":[2, 6], "flags":4, "x":99, "y":30}, + {"matrix":[2, 7], "flags":4, "x":114, "y":30}, + {"matrix":[2, 8], "flags":4, "x":129, "y":30}, + {"matrix":[2, 9], "flags":4, "x":143, "y":30}, + {"matrix":[2, 10], "flags":4, "x":158, "y":30}, + {"matrix":[2, 11], "flags":4, "x":173, "y":30}, + {"matrix":[2, 13], "flags":1, "x":196, "y":30}, + {"matrix":[2, 14], "flags":1, "x":224, "y":30}, + + {"matrix":[3, 0], "flags":1, "x":9, "y":45}, + {"matrix":[3, 2], "flags":4, "x":33, "y":45}, + {"matrix":[3, 3], "flags":4, "x":48, "y":45}, + {"matrix":[3, 4], "flags":4, "x":62, "y":45}, + {"matrix":[3, 5], "flags":4, "x":77, "y":45}, + {"matrix":[3, 6], "flags":4, "x":92, "y":45}, + {"matrix":[3, 7], "flags":4, "x":106, "y":45}, + {"matrix":[3, 8], "flags":4, "x":121, "y":45}, + {"matrix":[3, 9], "flags":4, "x":136, "y":45}, + {"matrix":[3, 10], "flags":4, "x":151, "y":45}, + {"matrix":[3, 11], "flags":4, "x":165, "y":45}, + {"matrix":[3, 13], "flags":1, "x":185, "y":45}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":60}, + {"matrix":[4, 1], "flags":1, "x":20, "y":60}, + {"matrix":[4, 2], "flags":1, "x":39, "y":60}, + {"matrix":[4, 6], "flags":4, "x":94, "y":60}, + {"matrix":[4, 10], "flags":1, "x":147, "y":60}, + {"matrix":[4, 11], "flags":1, "x":162, "y":60}, + {"matrix":[4, 12], "flags":1, "x":176, "y":60}, + {"matrix":[4, 13], "flags":1, "x":195, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/ansi/keymaps/default/keymap.c b/keyboards/keychron/q2/ansi/keymaps/default/keymap.c index ea386157bcb2..e421f70d1302 100644 --- a/keyboards/keychron/q2/ansi/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/ansi/keymaps/default/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c index 5581f9340610..f3ac27c1275a 100644 --- a/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/ansi/keymaps/keychron/keymap.c @@ -16,15 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -41,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, @@ -62,10 +64,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/keymap.c b/keyboards/keychron/q2/ansi/keymaps/ladduro/keymap.c deleted file mode 100644 index 55ee7a9732ce..000000000000 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/keymap.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2022 @ Ionut Micu - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keymap_user.h" -#ifdef RGB_MATRIX_ENABLE -# include "rgb_matrix_user.h" -#endif - -#define KC_WAVE S(KC_GRV) -#define KC_TASK LGUI(KC_TAB) -#define KC_FLXP LGUI(KC_E) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_67( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), - - [WIN_BASE] = LAYOUT_ansi_67( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), - - [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - - [_FN2] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - - [_FN3] = LAYOUT_ansi_67( - KC_WAVE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) -}; - -void matrix_init_user(void) { -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init_user(); -#endif -} diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/readme.md b/keyboards/keychron/q2/ansi/keymaps/ladduro/readme.md deleted file mode 100644 index 42ca81a1a1ef..000000000000 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/readme.md +++ /dev/null @@ -1,29 +0,0 @@ -# Ladduro keymap for Keychron Q2 (ANSI rev_0110) v1.01 - -This keymap ports Q1 logic (by gtg465x) for RGB caps lock indicator and layer RBG assigned key. - -## Features: -- On macOS, F3 opens Mission Control and F4 opens Launchpad without needing to configure shortcuts in System Preferences -- RGB lighting turns off when the computer sleeps -- Caps Lock and alpha keys turn red to indicate when Caps Lock is on -- When the Fn layer is active, RGB lighting turns off for keys that are not assigned - -Make example for this keyboard (after setting up your build environment): - - make keychron/q2/rev_0110:ladduro - -Flashing example for this keyboard: - - make keychron/q2/rev_0110:ladduro:flash - -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). - -## Changelog - -### 14/03/2021 - 1. - -- Initial release - -### 02/04/2021 - 1.01 - -- Remove via enable from rules.mk as it breaks the layout for some reason diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.c b/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.c deleted file mode 100644 index 604f54a7050a..000000000000 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2022 @ Ionut Micu - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "rgb_matrix_user.h" -#include "keymap_user.h" - -keypos_t led_index_key_position[RGB_MATRIX_LED_COUNT]; - -void rgb_matrix_init_user(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - uint8_t led_index = g_led_config.matrix_co[row][col]; - if (led_index != NO_LED) { - led_index_key_position[led_index] = (keypos_t){.row = row, .col = col}; - } - } - } -} - -bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - uint8_t current_layer = get_highest_layer(layer_state); - switch (current_layer) { - case MAC_BASE: - case WIN_BASE: -#ifdef CAPS_LOCK_INDICATOR_COLOR - if (host_keyboard_led_state().caps_lock) { - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_caps_lock_indicator, CAPS_LOCK_INDICATOR_COLOR); - } -#endif - break; - case _FN1: - case _FN2: - case _FN3: -#ifdef FN_LAYER_TRANSPARENT_KEYS_OFF - rgb_matrix_set_color_by_keycode(led_min, led_max, current_layer, is_transparent, RGB_OFF); -#endif - break; - } - return false; -} - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue) { - for (uint8_t i = led_min; i < led_max; i++) { - uint16_t keycode = keymap_key_to_keycode(layer, led_index_key_position[i]); - if ((*is_keycode)(keycode)) { - rgb_matrix_set_color(i, red, green, blue); - } - } -} - -bool is_caps_lock_indicator(uint16_t keycode) { -#ifdef CAPS_LOCK_INDICATOR_LIGHT_ALPHAS - return (KC_A <= keycode && keycode <= KC_Z) || keycode == KC_CAPS; -#else - return keycode == KC_CAPS; -#endif -} - -bool is_transparent(uint16_t keycode) { return keycode == KC_TRNS; } diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.h b/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.h deleted file mode 100644 index 4d33f483aeee..000000000000 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/rgb_matrix_user.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* Copyright 2022 @ Ionut Micu - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -void rgb_matrix_init_user(void); - -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); - -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); \ No newline at end of file diff --git a/keyboards/keychron/q2/ansi/keymaps/ladduro/rules.mk b/keyboards/keychron/q2/ansi/keymaps/ladduro/rules.mk deleted file mode 100644 index c0ee640cd242..000000000000 --- a/keyboards/keychron/q2/ansi/keymaps/ladduro/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -MOUSEKEY_ENABLE = no - -ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) - SRC += rgb_matrix_user.c -endif diff --git a/keyboards/keychron/q2/ansi/keymaps/via/keymap.c b/keyboards/keychron/q2/ansi/keymaps/via/keymap.c index ea386157bcb2..e421f70d1302 100644 --- a/keyboards/keychron/q2/ansi/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/ansi/keymaps/via/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/ansi/rules.mk b/keyboards/keychron/q2/ansi/rules.mk index ede7d6fab23a..6e7633bfe015 100644 --- a/keyboards/keychron/q2/ansi/rules.mk +++ b/keyboards/keychron/q2/ansi/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = no # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c index 28f91269c444..6741e1c92a78 100644 --- a/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q2/ansi_encoder/ansi_encoder.c @@ -96,34 +96,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 65, 42, 43 }, - { 44, __, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, __, 55, 56 }, - { 57, 58, 59, __, __, __, 60, __, __, __, 61, 62, 63, 64, 66 } - }, - { - // LED Index to Physical Position - {0,0}, {15,0}, {29,0}, {44,0}, {59,0}, {73,0}, {88,0}, {103,0}, {118,0}, {132,0}, {147,0}, {162,0}, {176,0}, {198,0}, {224,0}, - {4,15}, {22,15}, {37,15}, {51,15}, {66,15}, {81,15}, {95,15}, {110,15}, {125,15}, {140,15}, {154,15}, {169,15}, {184,15}, {202,15}, {224,15}, - {6,30}, {26,30}, {40,30}, {55,30}, {70,30}, {84,30}, {99,30}, {114,30}, {129,30}, {143,30}, {158,30}, {173,30}, {196,30}, {224,30}, - {9,45}, {33,45}, {48,45}, {62,45}, {77,45}, {92,45}, {106,45}, {121,45}, {136,45}, {151,45}, {165,45}, {185,45}, {209,49}, - {2,60}, {20,60}, {39,60}, {94,60}, {147,60}, {162,60}, {176,60}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/ansi_encoder/config.h b/keyboards/keychron/q2/ansi_encoder/config.h index b7e4b1e7f871..f1b6a9b7c0b8 100644 --- a/keyboards/keychron/q2/ansi_encoder/config.h +++ b/keyboards/keychron/q2/ansi_encoder/config.h @@ -17,9 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 34 -#define DRIVER_2_LED_TOTAL 33 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 67 -/* Encoder used pins */ -#define ENCODER_DEFAULT_POS 0x3 +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 30 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q2/ansi_encoder/info.json b/keyboards/keychron/q2/ansi_encoder/info.json index c9587d20ea0a..0f62e42b21d5 100644 --- a/keyboards/keychron/q2/ansi_encoder/info.json +++ b/keyboards/keychron/q2/ansi_encoder/info.json @@ -1,28 +1,16 @@ { - "keyboard_name": "Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0111", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] + "features": { + "encoder": true }, - "diode_direction": "ROW2COL", "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_67": { "layout": [ @@ -99,5 +87,80 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":4, "x":15, "y":0}, + {"matrix":[0, 2], "flags":4, "x":29, "y":0}, + {"matrix":[0, 3], "flags":4, "x":44, "y":0}, + {"matrix":[0, 4], "flags":4, "x":59, "y":0}, + {"matrix":[0, 5], "flags":4, "x":73, "y":0}, + {"matrix":[0, 6], "flags":4, "x":88, "y":0}, + {"matrix":[0, 7], "flags":4, "x":103, "y":0}, + {"matrix":[0, 8], "flags":4, "x":118, "y":0}, + {"matrix":[0, 9], "flags":4, "x":132, "y":0}, + {"matrix":[0, 10], "flags":4, "x":147, "y":0}, + {"matrix":[0, 11], "flags":4, "x":162, "y":0}, + {"matrix":[0, 12], "flags":4, "x":176, "y":0}, + {"matrix":[0, 13], "flags":1, "x":198, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":15}, + {"matrix":[1, 1], "flags":4, "x":22, "y":15}, + {"matrix":[1, 2], "flags":4, "x":37, "y":15}, + {"matrix":[1, 3], "flags":4, "x":51, "y":15}, + {"matrix":[1, 4], "flags":4, "x":66, "y":15}, + {"matrix":[1, 5], "flags":4, "x":81, "y":15}, + {"matrix":[1, 6], "flags":4, "x":95, "y":15}, + {"matrix":[1, 7], "flags":4, "x":110, "y":15}, + {"matrix":[1, 8], "flags":4, "x":125, "y":15}, + {"matrix":[1, 9], "flags":4, "x":140, "y":15}, + {"matrix":[1, 10], "flags":4, "x":154, "y":15}, + {"matrix":[1, 11], "flags":4, "x":169, "y":15}, + {"matrix":[1, 12], "flags":4, "x":184, "y":15}, + {"matrix":[1, 13], "flags":1, "x":202, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":30}, + {"matrix":[2, 1], "flags":4, "x":26, "y":30}, + {"matrix":[2, 2], "flags":4, "x":40, "y":30}, + {"matrix":[2, 3], "flags":4, "x":55, "y":30}, + {"matrix":[2, 4], "flags":4, "x":70, "y":30}, + {"matrix":[2, 5], "flags":4, "x":84, "y":30}, + {"matrix":[2, 6], "flags":4, "x":99, "y":30}, + {"matrix":[2, 7], "flags":4, "x":114, "y":30}, + {"matrix":[2, 8], "flags":4, "x":129, "y":30}, + {"matrix":[2, 9], "flags":4, "x":143, "y":30}, + {"matrix":[2, 10], "flags":4, "x":158, "y":30}, + {"matrix":[2, 11], "flags":4, "x":173, "y":30}, + {"matrix":[2, 13], "flags":1, "x":196, "y":30}, + {"matrix":[2, 14], "flags":1, "x":224, "y":30}, + + {"matrix":[3, 0], "flags":1, "x":9, "y":45}, + {"matrix":[3, 2], "flags":4, "x":33, "y":45}, + {"matrix":[3, 3], "flags":4, "x":48, "y":45}, + {"matrix":[3, 4], "flags":4, "x":62, "y":45}, + {"matrix":[3, 5], "flags":4, "x":77, "y":45}, + {"matrix":[3, 6], "flags":4, "x":92, "y":45}, + {"matrix":[3, 7], "flags":4, "x":106, "y":45}, + {"matrix":[3, 8], "flags":4, "x":121, "y":45}, + {"matrix":[3, 9], "flags":4, "x":136, "y":45}, + {"matrix":[3, 10], "flags":4, "x":151, "y":45}, + {"matrix":[3, 11], "flags":4, "x":165, "y":45}, + {"matrix":[3, 13], "flags":1, "x":185, "y":45}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":60}, + {"matrix":[4, 1], "flags":1, "x":20, "y":60}, + {"matrix":[4, 2], "flags":1, "x":39, "y":60}, + {"matrix":[4, 6], "flags":4, "x":94, "y":60}, + {"matrix":[4, 10], "flags":1, "x":147, "y":60}, + {"matrix":[4, 11], "flags":1, "x":162, "y":60}, + {"matrix":[4, 12], "flags":1, "x":176, "y":60}, + {"matrix":[4, 13], "flags":1, "x":195, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q2/ansi_encoder/keymaps/default/keymap.c index 5c20bda03108..778b1a47c3c6 100644 --- a/keyboards/keychron/q2/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/default/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c index db560b8ea37f..9012fb1b14ef 100644 --- a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/keymap.c @@ -16,15 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -41,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, @@ -72,10 +74,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q2/ansi_encoder/keymaps/via/keymap.c index f4ae8c1cc064..30944a33ce45 100644 --- a/keyboards/keychron/q2/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/via/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_67( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_ansi_67( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/ansi_encoder/rules.mk b/keyboards/keychron/q2/ansi_encoder/rules.mk index b294cf950e01..6e7633bfe015 100644 --- a/keyboards/keychron/q2/ansi_encoder/rules.mk +++ b/keyboards/keychron/q2/ansi_encoder/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/config.h b/keyboards/keychron/q2/config.h index 63e31cd01de6..a748a1b5a44d 100644 --- a/keyboards/keychron/q2/config.h +++ b/keyboards/keychron/q2/config.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) +/* Copyright 2022 @ Keychron (https://www.keychron.com) * * 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 @@ -16,27 +16,35 @@ #pragma once -#define MATRIX_UNSELECT_DRIVE_HIGH - -/* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { {4, 4} } +/* If PH3 used with a stronger pull resistor then the following definition needs be included */ +// #define MATRIX_UNSELECT_DRIVE_HIGH /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 #define DRIVER_ADDR_2 0b1110100 +/* Increase I2C speed to 1000 KHz */ +#define I2C1_TIMINGR_PRESC 0U +#define I2C1_TIMINGR_SCLDEL 3U +#define I2C1_TIMINGR_SDADEL 0U +#define I2C1_TIMINGR_SCLH 15U +#define I2C1_TIMINGR_SCLL 51U + /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL +/* Set LED driver current */ +#define CKLED2001_CURRENT_TUNE \ + { 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60 } /* Disable DIP switch in matrix data */ #define MATRIX_MASKED -/* turn off effects when suspended */ -#define RGB_DISABLE_WHEN_USB_SUSPENDED +/* DIP switch */ +#define DIP_SWITCH_MATRIX_GRID { { 4, 4 } } -/* Use 5 dynamic keymap layers */ -#define DYNAMIC_KEYMAP_LAYER_COUNT 5 +/* Turn off effects when suspended */ +#define RGB_DISABLE_WHEN_USB_SUSPENDED /* EEPROM Driver Configuration */ #define WEAR_LEVELING_LOGICAL_SIZE 2048 @@ -45,51 +53,10 @@ // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -#define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYRELEASES + +/* Factory test keys */ +#define FN_KEY1 MO(2) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q2/halconf.h b/keyboards/keychron/q2/halconf.h index 41bddcb2799b..463d177eabc7 100644 --- a/keyboards/keychron/q2/halconf.h +++ b/keyboards/keychron/q2/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q2/info.json b/keyboards/keychron/q2/info.json new file mode 100644 index 000000000000..6a4a5260fa91 --- /dev/null +++ b/keyboards/keychron/q2/info.json @@ -0,0 +1,55 @@ +{ + "keyboard_name": "Q2", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + } + }, + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], + "rows": ["B4", "B3", "A15", "A14", "A13"] + }, + "diode_direction": "ROW2COL", + "dynamic_keymap": { + "layer_count": 5 + } +} diff --git a/keyboards/keychron/q2/iso/config.h b/keyboards/keychron/q2/iso/config.h index 35a86d5839f5..5e6ddbf8ea1c 100644 --- a/keyboards/keychron/q2/iso/config.h +++ b/keyboards/keychron/q2/iso/config.h @@ -17,6 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 34 -#define DRIVER_2_LED_TOTAL 34 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 68 + +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 29 diff --git a/keyboards/keychron/q2/iso/info.json b/keyboards/keychron/q2/iso/info.json index e3cad79b14be..04c9b9bc2b1b 100644 --- a/keyboards/keychron/q2/iso/info.json +++ b/keyboards/keychron/q2/iso/info.json @@ -1,23 +1,8 @@ { - "keyboard_name": "Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0112", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_68": { "layout": [ @@ -95,5 +80,81 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":4, "x":15, "y":0}, + {"matrix":[0, 2], "flags":4, "x":29, "y":0}, + {"matrix":[0, 3], "flags":4, "x":44, "y":0}, + {"matrix":[0, 4], "flags":4, "x":59, "y":0}, + {"matrix":[0, 5], "flags":4, "x":73, "y":0}, + {"matrix":[0, 6], "flags":4, "x":88, "y":0}, + {"matrix":[0, 7], "flags":4, "x":103, "y":0}, + {"matrix":[0, 8], "flags":4, "x":118, "y":0}, + {"matrix":[0, 9], "flags":4, "x":132, "y":0}, + {"matrix":[0, 10], "flags":4, "x":147, "y":0}, + {"matrix":[0, 11], "flags":4, "x":162, "y":0}, + {"matrix":[0, 12], "flags":4, "x":176, "y":0}, + {"matrix":[0, 13], "flags":1, "x":198, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":15}, + {"matrix":[1, 1], "flags":4, "x":22, "y":15}, + {"matrix":[1, 2], "flags":4, "x":37, "y":15}, + {"matrix":[1, 3], "flags":4, "x":51, "y":15}, + {"matrix":[1, 4], "flags":4, "x":66, "y":15}, + {"matrix":[1, 5], "flags":4, "x":81, "y":15}, + {"matrix":[1, 6], "flags":4, "x":95, "y":15}, + {"matrix":[1, 7], "flags":4, "x":110, "y":15}, + {"matrix":[1, 8], "flags":4, "x":125, "y":15}, + {"matrix":[1, 9], "flags":4, "x":140, "y":15}, + {"matrix":[1, 10], "flags":4, "x":154, "y":15}, + {"matrix":[1, 11], "flags":4, "x":169, "y":15}, + {"matrix":[1, 12], "flags":4, "x":184, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":30}, + {"matrix":[2, 1], "flags":4, "x":26, "y":30}, + {"matrix":[2, 2], "flags":4, "x":40, "y":30}, + {"matrix":[2, 3], "flags":4, "x":55, "y":30}, + {"matrix":[2, 4], "flags":4, "x":70, "y":30}, + {"matrix":[2, 5], "flags":4, "x":84, "y":30}, + {"matrix":[2, 6], "flags":4, "x":99, "y":30}, + {"matrix":[2, 7], "flags":4, "x":114, "y":30}, + {"matrix":[2, 8], "flags":4, "x":129, "y":30}, + {"matrix":[2, 9], "flags":4, "x":143, "y":30}, + {"matrix":[2, 10], "flags":4, "x":158, "y":30}, + {"matrix":[2, 11], "flags":4, "x":173, "y":30}, + {"matrix":[2, 13], "flags":1, "x":187, "y":30}, + {"matrix":[1, 13], "flags":1, "x":204, "y":23}, + {"matrix":[2, 14], "flags":1, "x":224, "y":30}, + + {"matrix":[3, 0], "flags":1, "x":2, "y":45}, + {"matrix":[3, 1], "flags":1, "x":18, "y":45}, + {"matrix":[3, 2], "flags":4, "x":33, "y":45}, + {"matrix":[3, 3], "flags":4, "x":48, "y":45}, + {"matrix":[3, 4], "flags":4, "x":62, "y":45}, + {"matrix":[3, 5], "flags":4, "x":77, "y":45}, + {"matrix":[3, 6], "flags":4, "x":92, "y":45}, + {"matrix":[3, 7], "flags":4, "x":106, "y":45}, + {"matrix":[3, 8], "flags":4, "x":121, "y":45}, + {"matrix":[3, 9], "flags":4, "x":136, "y":45}, + {"matrix":[3, 10], "flags":4, "x":151, "y":45}, + {"matrix":[3, 11], "flags":4, "x":165, "y":45}, + {"matrix":[3, 13], "flags":1, "x":185, "y":45}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":60}, + {"matrix":[4, 1], "flags":1, "x":20, "y":60}, + {"matrix":[4, 2], "flags":1, "x":39, "y":60}, + {"matrix":[4, 6], "flags":4, "x":94, "y":60}, + {"matrix":[4, 10], "flags":1, "x":147, "y":60}, + {"matrix":[4, 11], "flags":1, "x":162, "y":60}, + {"matrix":[4, 12], "flags":1, "x":176, "y":60}, + {"matrix":[4, 13], "flags":1, "x":195, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/iso/iso.c b/keyboards/keychron/q2/iso/iso.c index 1f2c76468e8f..e1a8d32d3d4a 100644 --- a/keyboards/keychron/q2/iso/iso.c +++ b/keyboards/keychron/q2/iso/iso.c @@ -97,34 +97,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 42, 28 }, - { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 66, 41, 43 }, - { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, __, 56, 57 }, - { 58, 59, 60, __, __, __, 61, __, __, __, 62, 63, 64, 65, 67 } - }, - { - // LED Index to Physical Position - {0,0}, {15,0}, {29,0}, {44,0}, {59,0}, {73,0}, {88,0}, {103,0}, {118,0}, {132,0}, {147,0}, {162,0}, {176,0}, {198,0}, {224,0}, - {4,15}, {22,15}, {37,15}, {51,15}, {66,15}, {81,15}, {95,15}, {110,15}, {125,15}, {140,15}, {154,15}, {169,15}, {184,15}, {224,15}, - {6,30}, {26,30}, {40,30}, {55,30}, {70,30}, {84,30}, {99,30}, {114,30}, {129,30}, {143,30}, {158,30}, {173,30}, {187,30}, {204,23}, {224,30}, - {2,45}, {18,45}, {33,45}, {48,45}, {62,45}, {77,45}, {92,45}, {106,45}, {121,45}, {136,45}, {151,45}, {165,45}, {185,45}, {209,49}, - {2,60}, {20,60}, {39,60}, {94,60}, {147,60}, {162,60}, {176,60}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/iso/keymaps/default/keymap.c b/keyboards/keychron/q2/iso/keymaps/default/keymap.c index 3f2952f0b22b..ecd958a2c4a8 100644 --- a/keyboards/keychron/q2/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/iso/keymaps/default/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c index 989f74929d12..bee6767578f1 100644 --- a/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/iso/keymaps/keychron/keymap.c @@ -16,15 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -41,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, @@ -62,10 +64,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/iso/keymaps/via/keymap.c b/keyboards/keychron/q2/iso/keymaps/via/keymap.c index 3f2952f0b22b..ecd958a2c4a8 100644 --- a/keyboards/keychron/q2/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/iso/keymaps/via/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/iso/rules.mk b/keyboards/keychron/q2/iso/rules.mk index b3de9622913e..6e7633bfe015 100644 --- a/keyboards/keychron/q2/iso/rules.mk +++ b/keyboards/keychron/q2/iso/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = no # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/iso_encoder/config.h b/keyboards/keychron/q2/iso_encoder/config.h index 376b92b6fa11..692d995a0ce2 100644 --- a/keyboards/keychron/q2/iso_encoder/config.h +++ b/keyboards/keychron/q2/iso_encoder/config.h @@ -17,9 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 34 -#define DRIVER_2_LED_TOTAL 34 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 68 -/* Encoder used pins */ -#define ENCODER_DEFAULT_POS 0x3 +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 29 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q2/iso_encoder/info.json b/keyboards/keychron/q2/iso_encoder/info.json index 5030e6be4262..c8559ddfb521 100644 --- a/keyboards/keychron/q2/iso_encoder/info.json +++ b/keyboards/keychron/q2/iso_encoder/info.json @@ -1,28 +1,16 @@ { - "keyboard_name": "Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0113", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] + "features": { + "encoder": true }, - "diode_direction": "ROW2COL", "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_68": { "layout": [ @@ -100,5 +88,81 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.5} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":4, "x":15, "y":0}, + {"matrix":[0, 2], "flags":4, "x":29, "y":0}, + {"matrix":[0, 3], "flags":4, "x":44, "y":0}, + {"matrix":[0, 4], "flags":4, "x":59, "y":0}, + {"matrix":[0, 5], "flags":4, "x":73, "y":0}, + {"matrix":[0, 6], "flags":4, "x":88, "y":0}, + {"matrix":[0, 7], "flags":4, "x":103, "y":0}, + {"matrix":[0, 8], "flags":4, "x":118, "y":0}, + {"matrix":[0, 9], "flags":4, "x":132, "y":0}, + {"matrix":[0, 10], "flags":4, "x":147, "y":0}, + {"matrix":[0, 11], "flags":4, "x":162, "y":0}, + {"matrix":[0, 12], "flags":4, "x":176, "y":0}, + {"matrix":[0, 13], "flags":1, "x":198, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":15}, + {"matrix":[1, 1], "flags":4, "x":22, "y":15}, + {"matrix":[1, 2], "flags":4, "x":37, "y":15}, + {"matrix":[1, 3], "flags":4, "x":51, "y":15}, + {"matrix":[1, 4], "flags":4, "x":66, "y":15}, + {"matrix":[1, 5], "flags":4, "x":81, "y":15}, + {"matrix":[1, 6], "flags":4, "x":95, "y":15}, + {"matrix":[1, 7], "flags":4, "x":110, "y":15}, + {"matrix":[1, 8], "flags":4, "x":125, "y":15}, + {"matrix":[1, 9], "flags":4, "x":140, "y":15}, + {"matrix":[1, 10], "flags":4, "x":154, "y":15}, + {"matrix":[1, 11], "flags":4, "x":169, "y":15}, + {"matrix":[1, 12], "flags":4, "x":184, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":30}, + {"matrix":[2, 1], "flags":4, "x":26, "y":30}, + {"matrix":[2, 2], "flags":4, "x":40, "y":30}, + {"matrix":[2, 3], "flags":4, "x":55, "y":30}, + {"matrix":[2, 4], "flags":4, "x":70, "y":30}, + {"matrix":[2, 5], "flags":4, "x":84, "y":30}, + {"matrix":[2, 6], "flags":4, "x":99, "y":30}, + {"matrix":[2, 7], "flags":4, "x":114, "y":30}, + {"matrix":[2, 8], "flags":4, "x":129, "y":30}, + {"matrix":[2, 9], "flags":4, "x":143, "y":30}, + {"matrix":[2, 10], "flags":4, "x":158, "y":30}, + {"matrix":[2, 11], "flags":4, "x":173, "y":30}, + {"matrix":[2, 13], "flags":1, "x":187, "y":30}, + {"matrix":[1, 13], "flags":1, "x":204, "y":23}, + {"matrix":[2, 14], "flags":1, "x":224, "y":30}, + + {"matrix":[3, 0], "flags":1, "x":2, "y":45}, + {"matrix":[3, 1], "flags":1, "x":18, "y":45}, + {"matrix":[3, 2], "flags":4, "x":33, "y":45}, + {"matrix":[3, 3], "flags":4, "x":48, "y":45}, + {"matrix":[3, 4], "flags":4, "x":62, "y":45}, + {"matrix":[3, 5], "flags":4, "x":77, "y":45}, + {"matrix":[3, 6], "flags":4, "x":92, "y":45}, + {"matrix":[3, 7], "flags":4, "x":106, "y":45}, + {"matrix":[3, 8], "flags":4, "x":121, "y":45}, + {"matrix":[3, 9], "flags":4, "x":136, "y":45}, + {"matrix":[3, 10], "flags":4, "x":151, "y":45}, + {"matrix":[3, 11], "flags":4, "x":165, "y":45}, + {"matrix":[3, 13], "flags":1, "x":185, "y":45}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":60}, + {"matrix":[4, 1], "flags":1, "x":20, "y":60}, + {"matrix":[4, 2], "flags":1, "x":39, "y":60}, + {"matrix":[4, 6], "flags":4, "x":94, "y":60}, + {"matrix":[4, 10], "flags":1, "x":147, "y":60}, + {"matrix":[4, 11], "flags":1, "x":162, "y":60}, + {"matrix":[4, 12], "flags":1, "x":176, "y":60}, + {"matrix":[4, 13], "flags":1, "x":195, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/iso_encoder/iso_encoder.c b/keyboards/keychron/q2/iso_encoder/iso_encoder.c index 1f2c76468e8f..e1a8d32d3d4a 100644 --- a/keyboards/keychron/q2/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q2/iso_encoder/iso_encoder.c @@ -97,34 +97,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_15, D_15, E_15}, {1, F_16, D_16, E_16} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, - { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 42, 28 }, - { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 66, 41, 43 }, - { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, __, 56, 57 }, - { 58, 59, 60, __, __, __, 61, __, __, __, 62, 63, 64, 65, 67 } - }, - { - // LED Index to Physical Position - {0,0}, {15,0}, {29,0}, {44,0}, {59,0}, {73,0}, {88,0}, {103,0}, {118,0}, {132,0}, {147,0}, {162,0}, {176,0}, {198,0}, {224,0}, - {4,15}, {22,15}, {37,15}, {51,15}, {66,15}, {81,15}, {95,15}, {110,15}, {125,15}, {140,15}, {154,15}, {169,15}, {184,15}, {224,15}, - {6,30}, {26,30}, {40,30}, {55,30}, {70,30}, {84,30}, {99,30}, {114,30}, {129,30}, {143,30}, {158,30}, {173,30}, {187,30}, {204,23}, {224,30}, - {2,45}, {18,45}, {33,45}, {48,45}, {62,45}, {77,45}, {92,45}, {106,45}, {121,45}, {136,45}, {151,45}, {165,45}, {185,45}, {209,49}, - {2,60}, {20,60}, {39,60}, {94,60}, {147,60}, {162,60}, {176,60}, {195,64}, {209,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q2/iso_encoder/keymaps/default/keymap.c index 5cbe605de40b..f40af24ce034 100644 --- a/keyboards/keychron/q2/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/iso_encoder/keymaps/default/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/keymap.c b/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/keymap.c deleted file mode 100644 index 0d4f7e6a2212..000000000000 --- a/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/keymap.c +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Dan Hertz (@dhertz) -// SPDX-License-Identifier: GPL-3.0 - -#include QMK_KEYBOARD_H -#include "dhertz.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Layer 0: Default Layer - * ,---------------------------------------------------------------. - * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backsp|( )| - * |---------------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Enter|Del| - * |------------------------------------------------------` |---| - * |SrCtl | A| S| D| F| G| H| J| K| L| ;| '| \| |Hom| - * |---------------------------------------------------------------| - * |Shif| #| Z| X| C| V| B| N| M| ,| .| /|Shift |Up | | - * |---------------------------------------------------------------| - * |NcCtl| Alt| CTab| LyrSpc |CGv|Alt|CSL|Lef|Dow|Rig| - * `---------------------------------------------------------------' - */ - [0] = LAYOUT_iso_68( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, - KC_LSFT, HSH_TLD, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, - NC_CTL, KC_LALT, CMD_TAB_CMD, LYR_SPC, CMD_GRV_CMD, KC_RALT, CMD_SFT_ALT_A, KC_LEFT, KC_DOWN, KC_RIGHT - ), - /* Layer 1: Special - * ,---------------------------------------------------------------. - * | §| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |( )| - * |---------------------------------------------------------------| - * | | | | | | | | | | | | | | | | - * |------------------------------------------------------` |---| - * | | | | | | | | | |CSL| | | `| | | - * |---------------------------------------------------------------| - * | | `| | |CAC| | | | | | | | |PgU| | - * |---------------------------------------------------------------| - * | | | | | | | |Hom|PgD|End| - * `---------------------------------------------------------------' - */ - [1] = LAYOUT_iso_68( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F10, KC_F11, KC_TRNS, CMD_SFT_A, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, CMD_SFT_L, KC_TRNS, KC_TRNS, KC_NUBS, KC_TRNS, KC_END, - KC_TRNS, KC_NUBS, KC_TRNS, KC_TRNS, CMD_ALT_C, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END - ), -}; - -void keyboard_post_init_user(void) { - rgb_matrix_mode(RGB_MATRIX_NONE); - rgb_matrix_set_color_all(RGB_BLACK); -} - -uint32_t cancel_cmd(uint32_t trigger_time, void *cb_arg) { - if (get_highest_layer(layer_state|default_layer_state) > 0) { - return 20; - } - unregister_code(KC_LCMD); - return 0; -} - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (get_highest_layer(layer_state|default_layer_state) == 0) { - if (clockwise) { - tap_code_delay(KC_VOLU, 10); - } else { - tap_code_delay(KC_VOLD, 10); - } - } else { - if ((get_mods() & MOD_BIT(KC_LCMD)) != MOD_BIT(KC_LCMD)) { - register_code(KC_LCMD); - defer_exec(20, cancel_cmd, NULL); - } - if (clockwise) { - tap_code(KC_TAB); - } else { - tap_code16(S(KC_TAB)); - } - } - return false; -} - -bool rgb_matrix_indicators_user(void) { - switch(get_highest_layer(layer_state|default_layer_state)) { - case 1: - rgb_matrix_set_color_all(RGB_BLACK); - rgb_matrix_set_color_all(25, 25, 112); - break; - default: - rgb_matrix_set_color_all(RGB_BLACK); - break; - } - return false; -} diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/rules.mk b/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/rules.mk deleted file mode 100644 index 199bad85f3c8..000000000000 --- a/keyboards/keychron/q2/iso_encoder/keymaps/dhertz/rules.mk +++ /dev/null @@ -1 +0,0 @@ -DEFERRED_EXEC_ENABLE = yes diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c index eb485917b3f6..d0c8fccb0196 100644 --- a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/keymap.c @@ -16,15 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -41,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, @@ -72,10 +74,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q2/iso_encoder/keymaps/via/keymap.c index 244eb8b4826f..707ee5aa5a39 100644 --- a/keyboards/keychron/q2/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/iso_encoder/keymaps/via/keymap.c @@ -21,12 +21,13 @@ enum layers{ WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_68( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MUTE, @@ -43,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_iso_68( - KC_GRV, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/iso_encoder/rules.mk b/keyboards/keychron/q2/iso_encoder/rules.mk index aba76c09442f..6e7633bfe015 100644 --- a/keyboards/keychron/q2/iso_encoder/rules.mk +++ b/keyboards/keychron/q2/iso_encoder/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/jis/config.h b/keyboards/keychron/q2/jis/config.h index 2d83933f9a6a..f428589bb2a2 100644 --- a/keyboards/keychron/q2/jis/config.h +++ b/keyboards/keychron/q2/jis/config.h @@ -17,11 +17,7 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 35 -#define DRIVER_2_LED_TOTAL 36 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE { 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D } +#define RGB_MATRIX_LED_COUNT 71 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 30 diff --git a/keyboards/keychron/q2/jis/info.json b/keyboards/keychron/q2/jis/info.json index d0af24b29daa..eb24b69d2b4b 100644 --- a/keyboards/keychron/q2/jis/info.json +++ b/keyboards/keychron/q2/jis/info.json @@ -1,23 +1,8 @@ { - "keyboard_name": "Keychron Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0114", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_jis_71": { "layout": [ @@ -98,5 +83,84 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":4}, + {"matrix":[0, 1], "flags":4, "x":15, "y":4}, + {"matrix":[0, 2], "flags":4, "x":29, "y":4}, + {"matrix":[0, 3], "flags":4, "x":44, "y":4}, + {"matrix":[0, 4], "flags":4, "x":59, "y":4}, + {"matrix":[0, 5], "flags":4, "x":73, "y":4}, + {"matrix":[0, 6], "flags":4, "x":88, "y":4}, + {"matrix":[0, 7], "flags":4, "x":103, "y":4}, + {"matrix":[0, 8], "flags":4, "x":117, "y":4}, + {"matrix":[0, 9], "flags":4, "x":132, "y":4}, + {"matrix":[0, 10], "flags":4, "x":146, "y":4}, + {"matrix":[0, 11], "flags":4, "x":161, "y":4}, + {"matrix":[0, 12], "flags":4, "x":176, "y":4}, + {"matrix":[0, 13], "flags":1, "x":190, "y":4}, + {"matrix":[3, 1], "flags":1, "x":205, "y":4}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":19}, + {"matrix":[1, 1], "flags":4, "x":22, "y":19}, + {"matrix":[1, 2], "flags":4, "x":37, "y":19}, + {"matrix":[1, 3], "flags":4, "x":51, "y":19}, + {"matrix":[1, 4], "flags":4, "x":66, "y":19}, + {"matrix":[1, 5], "flags":4, "x":81, "y":19}, + {"matrix":[1, 6], "flags":4, "x":95, "y":19}, + {"matrix":[1, 7], "flags":4, "x":110, "y":19}, + {"matrix":[1, 8], "flags":4, "x":125, "y":19}, + {"matrix":[1, 9], "flags":4, "x":140, "y":19}, + {"matrix":[1, 10], "flags":4, "x":154, "y":19}, + {"matrix":[1, 11], "flags":4, "x":168, "y":19}, + {"matrix":[1, 12], "flags":4, "x":183, "y":19}, + {"matrix":[1, 14], "flags":1, "x":224, "y":19}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":34}, + {"matrix":[2, 1], "flags":4, "x":26, "y":34}, + {"matrix":[2, 2], "flags":4, "x":40, "y":34}, + {"matrix":[2, 3], "flags":4, "x":55, "y":34}, + {"matrix":[2, 4], "flags":4, "x":70, "y":34}, + {"matrix":[2, 5], "flags":4, "x":84, "y":34}, + {"matrix":[2, 6], "flags":4, "x":99, "y":34}, + {"matrix":[2, 7], "flags":4, "x":114, "y":34}, + {"matrix":[2, 8], "flags":4, "x":128, "y":34}, + {"matrix":[2, 9], "flags":4, "x":143, "y":34}, + {"matrix":[2, 10], "flags":4, "x":158, "y":34}, + {"matrix":[2, 11], "flags":4, "x":172, "y":34}, + {"matrix":[2, 13], "flags":1, "x":187, "y":34}, + {"matrix":[1, 13], "flags":1, "x":207, "y":29}, + {"matrix":[2, 14], "flags":1, "x":224, "y":34}, + + {"matrix":[3, 0], "flags":1, "x":9, "y":49}, + {"matrix":[3, 2], "flags":4, "x":33, "y":49}, + {"matrix":[3, 3], "flags":4, "x":48, "y":49}, + {"matrix":[3, 4], "flags":4, "x":62, "y":49}, + {"matrix":[3, 5], "flags":4, "x":77, "y":49}, + {"matrix":[3, 6], "flags":4, "x":92, "y":49}, + {"matrix":[3, 7], "flags":4, "x":106, "y":49}, + {"matrix":[3, 8], "flags":4, "x":121, "y":49}, + {"matrix":[3, 9], "flags":4, "x":136, "y":49}, + {"matrix":[3, 10], "flags":4, "x":150, "y":49}, + {"matrix":[3, 11], "flags":4, "x":165, "y":49}, + {"matrix":[3, 12], "flags":4, "x":179, "y":49}, + {"matrix":[3, 13], "flags":1, "x":194, "y":49}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":64}, + {"matrix":[4, 1], "flags":1, "x":18, "y":64}, + {"matrix":[4, 2], "flags":1, "x":35, "y":64}, + {"matrix":[4, 3], "flags":1, "x":51, "y":64}, + {"matrix":[4, 6], "flags":4, "x":92, "y":64}, + {"matrix":[4, 9], "flags":1, "x":134, "y":64}, + {"matrix":[4, 10], "flags":1, "x":150, "y":64}, + {"matrix":[4, 11], "flags":1, "x":165, "y":64}, + {"matrix":[4, 12], "flags":1, "x":179, "y":64}, + {"matrix":[4, 13], "flags":1, "x":194, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/jis/jis.c b/keyboards/keychron/q2/jis/jis.c index 31ed1edc58a3..9d8f439d6ff3 100644 --- a/keyboards/keychron/q2/jis/jis.c +++ b/keyboards/keychron/q2/jis/jis.c @@ -102,33 +102,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16} }; -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 43, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 69, 42, 44 }, - { 45, 14, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 }, - { 59, 60, 61, 62, __, __, 63, __, __, 64, 65, 66, 67, 68, 70 } - }, - { - // LED Index to Physical Position - {0,4}, {15,4}, {29,4}, {44,4}, {59,4}, {73,4}, {88,4}, {103,4}, {117,4}, {132,4}, {146,4}, {161,4}, {176,4}, {190,4}, {205,4}, {224,0}, - {4,19}, {22,19}, {37,19}, {51,19}, {66,19}, {81,19}, {95,19}, {110,19}, {125,19}, {139,19}, {154,19}, {168,19}, {183,19}, {224,19}, - {6,34}, {26,34}, {40,34}, {55,34}, {70,34}, {84,34}, {99,34}, {114,34}, {128,34}, {143,34}, {158,34}, {172,34}, {187,34}, {207,29}, {224,34}, - {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {150,49}, {165,49}, {179,49}, {194,49}, {209,49}, - {2,64}, {18,64}, {35,64}, {51,64}, {92,64}, {134,64}, {150,64}, {165,64}, {179,64}, {194,64}, {209,64}, {223,64}, - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/jis/keymaps/default/keymap.c b/keyboards/keychron/q2/jis/keymaps/default/keymap.c index e11a31cda511..bd5928e3bece 100644 --- a/keyboards/keychron/q2/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/jis/keymaps/default/keymap.c @@ -16,36 +16,35 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c b/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c index 930f4614665a..e37342c037bd 100644 --- a/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/jis/keymaps/keychron/keymap.c @@ -16,34 +16,34 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, @@ -66,9 +66,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk b/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/jis/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/jis/keymaps/via/keymap.c b/keyboards/keychron/q2/jis/keymaps/via/keymap.c index e11a31cda511..38a18376cc91 100644 --- a/keyboards/keychron/q2/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/jis/keymaps/via/keymap.c @@ -16,16 +16,15 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) @@ -33,19 +32,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q2/jis/rules.mk b/keyboards/keychron/q2/jis/rules.mk index c37beecb9ec1..6e7633bfe015 100644 --- a/keyboards/keychron/q2/jis/rules.mk +++ b/keyboards/keychron/q2/jis/rules.mk @@ -1,17 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/jis_encoder/config.h b/keyboards/keychron/q2/jis_encoder/config.h index 5e7ab551437f..dabeac526510 100644 --- a/keyboards/keychron/q2/jis_encoder/config.h +++ b/keyboards/keychron/q2/jis_encoder/config.h @@ -17,14 +17,12 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 35 -#define DRIVER_2_LED_TOTAL 36 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE { 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D, 0xC0, 0xC0, 0x5D } - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +#define RGB_MATRIX_LED_COUNT 71 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 30 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif diff --git a/keyboards/keychron/q2/jis_encoder/info.json b/keyboards/keychron/q2/jis_encoder/info.json index e409fb63a67e..cf43e4ca0554 100644 --- a/keyboards/keychron/q2/jis_encoder/info.json +++ b/keyboards/keychron/q2/jis_encoder/info.json @@ -1,28 +1,13 @@ { - "keyboard_name": "Keychron Q2", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0115", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "B5"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_jis_71": { "layout": [ @@ -103,5 +88,84 @@ {"matrix": [4, 14], "x": 15.25, "y": 4.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":4}, + {"matrix":[0, 1], "flags":4, "x":15, "y":4}, + {"matrix":[0, 2], "flags":4, "x":29, "y":4}, + {"matrix":[0, 3], "flags":4, "x":44, "y":4}, + {"matrix":[0, 4], "flags":4, "x":59, "y":4}, + {"matrix":[0, 5], "flags":4, "x":73, "y":4}, + {"matrix":[0, 6], "flags":4, "x":88, "y":4}, + {"matrix":[0, 7], "flags":4, "x":103, "y":4}, + {"matrix":[0, 8], "flags":4, "x":117, "y":4}, + {"matrix":[0, 9], "flags":4, "x":132, "y":4}, + {"matrix":[0, 10], "flags":4, "x":146, "y":4}, + {"matrix":[0, 11], "flags":4, "x":161, "y":4}, + {"matrix":[0, 12], "flags":4, "x":176, "y":4}, + {"matrix":[0, 13], "flags":1, "x":190, "y":4}, + {"matrix":[3, 1], "flags":1, "x":205, "y":4}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":4, "y":19}, + {"matrix":[1, 1], "flags":4, "x":22, "y":19}, + {"matrix":[1, 2], "flags":4, "x":37, "y":19}, + {"matrix":[1, 3], "flags":4, "x":51, "y":19}, + {"matrix":[1, 4], "flags":4, "x":66, "y":19}, + {"matrix":[1, 5], "flags":4, "x":81, "y":19}, + {"matrix":[1, 6], "flags":4, "x":95, "y":19}, + {"matrix":[1, 7], "flags":4, "x":110, "y":19}, + {"matrix":[1, 8], "flags":4, "x":125, "y":19}, + {"matrix":[1, 9], "flags":4, "x":140, "y":19}, + {"matrix":[1, 10], "flags":4, "x":154, "y":19}, + {"matrix":[1, 11], "flags":4, "x":168, "y":19}, + {"matrix":[1, 12], "flags":4, "x":183, "y":19}, + {"matrix":[1, 14], "flags":1, "x":224, "y":19}, + + {"matrix":[2, 0], "flags":8, "x":6, "y":34}, + {"matrix":[2, 1], "flags":4, "x":26, "y":34}, + {"matrix":[2, 2], "flags":4, "x":40, "y":34}, + {"matrix":[2, 3], "flags":4, "x":55, "y":34}, + {"matrix":[2, 4], "flags":4, "x":70, "y":34}, + {"matrix":[2, 5], "flags":4, "x":84, "y":34}, + {"matrix":[2, 6], "flags":4, "x":99, "y":34}, + {"matrix":[2, 7], "flags":4, "x":114, "y":34}, + {"matrix":[2, 8], "flags":4, "x":128, "y":34}, + {"matrix":[2, 9], "flags":4, "x":143, "y":34}, + {"matrix":[2, 10], "flags":4, "x":158, "y":34}, + {"matrix":[2, 11], "flags":4, "x":172, "y":34}, + {"matrix":[2, 13], "flags":1, "x":187, "y":34}, + {"matrix":[1, 13], "flags":1, "x":207, "y":29}, + {"matrix":[2, 14], "flags":1, "x":224, "y":34}, + + {"matrix":[3, 0], "flags":1, "x":9, "y":49}, + {"matrix":[3, 2], "flags":4, "x":33, "y":49}, + {"matrix":[3, 3], "flags":4, "x":48, "y":49}, + {"matrix":[3, 4], "flags":4, "x":62, "y":49}, + {"matrix":[3, 5], "flags":4, "x":77, "y":49}, + {"matrix":[3, 6], "flags":4, "x":92, "y":49}, + {"matrix":[3, 7], "flags":4, "x":106, "y":49}, + {"matrix":[3, 8], "flags":4, "x":121, "y":49}, + {"matrix":[3, 9], "flags":4, "x":136, "y":49}, + {"matrix":[3, 10], "flags":4, "x":150, "y":49}, + {"matrix":[3, 11], "flags":4, "x":165, "y":49}, + {"matrix":[3, 12], "flags":4, "x":179, "y":49}, + {"matrix":[3, 13], "flags":1, "x":194, "y":49}, + {"matrix":[3, 14], "flags":1, "x":209, "y":49}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":64}, + {"matrix":[4, 1], "flags":1, "x":18, "y":64}, + {"matrix":[4, 2], "flags":1, "x":35, "y":64}, + {"matrix":[4, 3], "flags":1, "x":51, "y":64}, + {"matrix":[4, 6], "flags":4, "x":92, "y":64}, + {"matrix":[4, 9], "flags":1, "x":134, "y":64}, + {"matrix":[4, 10], "flags":1, "x":150, "y":64}, + {"matrix":[4, 11], "flags":1, "x":165, "y":64}, + {"matrix":[4, 12], "flags":1, "x":179, "y":64}, + {"matrix":[4, 13], "flags":1, "x":194, "y":64}, + {"matrix":[2, 12], "flags":1, "x":209, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q2/jis_encoder/jis_encoder.c b/keyboards/keychron/q2/jis_encoder/jis_encoder.c index de20255e0b56..9d8f439d6ff3 100644 --- a/keyboards/keychron/q2/jis_encoder/jis_encoder.c +++ b/keyboards/keychron/q2/jis_encoder/jis_encoder.c @@ -102,33 +102,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16} }; -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 43, 29 }, - { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 69, 42, 44 }, - { 45, 14, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 }, - { 59, 60, 61, 62, __, __, 63, __, __, 64, 65, 66, 67, 68, 70 }, - }, - { - // LED Index to Physical Position - {0,4}, {15,4}, {29,4}, {44,4}, {59,4}, {73,4}, {88,4}, {103,4}, {117,4}, {132,4}, {146,4}, {161,4}, {176,4}, {190,4}, {205,4}, {224,0}, - {4,19}, {22,19}, {37,19}, {51,19}, {66,19}, {81,19}, {95,19}, {110,19}, {125,19}, {139,19}, {154,19}, {168,19}, {183,19}, {224,19}, - {6,34}, {26,34}, {40,34}, {55,34}, {70,34}, {84,34}, {99,34}, {114,34}, {128,34}, {143,34}, {158,34}, {172,34}, {187,34}, {207,29}, {224,34}, - {9,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {150,49}, {165,49}, {179,49}, {194,49}, {209,49}, - {2,64}, {18,64}, {35,64}, {51,64}, {92,64}, {134,64}, {150,64}, {165,64}, {179,64}, {194,64}, {209,64}, {223,64}, - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/q2/jis_encoder/keymaps/default/keymap.c index 33b36986162f..a99ae7317983 100644 --- a/keyboards/keychron/q2/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q2/jis_encoder/keymaps/default/keymap.c @@ -16,36 +16,35 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, @@ -70,8 +69,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN3] = { ENCODER_CCW_CW(_______, _______)} + [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [_FN3] = { ENCODER_CCW_CW(_______, _______)} }; #endif // ENCODER_MAP_ENABLE diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c index a1c155e6e600..5ba2cd1e671c 100644 --- a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/keymap.c @@ -16,34 +16,34 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, @@ -64,21 +64,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN3] = { ENCODER_CCW_CW(_______, _______)} + [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, + [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI) }, + [_FN3] = { ENCODER_CCW_CW(_______, _______) }, }; -#endif // ENCODER_MAP_ENABLE +#endif + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q2/jis_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q2/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/q2/jis_encoder/keymaps/via/keymap.c index 33b36986162f..513fb5d14116 100644 --- a/keyboards/keychron/q2/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q2/jis_encoder/keymaps/via/keymap.c @@ -16,16 +16,15 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ +enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off #define KC_TASK LGUI(KC_TAB) #define KC_FLXP LGUI(KC_E) @@ -33,19 +32,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [_FN1] = LAYOUT_jis_71( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, @@ -70,8 +69,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, - [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, - [_FN3] = { ENCODER_CCW_CW(_______, _______)} + [_FN1] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [_FN2] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [_FN3] = { ENCODER_CCW_CW(_______, _______)} }; #endif // ENCODER_MAP_ENABLE diff --git a/keyboards/keychron/q2/jis_encoder/rules.mk b/keyboards/keychron/q2/jis_encoder/rules.mk index 5091fe94148b..6e7633bfe015 100644 --- a/keyboards/keychron/q2/jis_encoder/rules.mk +++ b/keyboards/keychron/q2/jis_encoder/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q2/q2.c b/keyboards/keychron/q2/q2.c index 7ff85556def5..e522c20f868b 100644 --- a/keyboards/keychron/q2/q2.c +++ b/keyboards/keychron/q2/q2.c @@ -35,45 +35,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - switch (keycode) { - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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; - } - 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; } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // CAPS_LOCK_LED_INDEX diff --git a/keyboards/keychron/q2/readme.md b/keyboards/keychron/q2/readme.md index 60144a1079e6..b79b0ade0765 100644 --- a/keyboards/keychron/q2/readme.md +++ b/keyboards/keychron/q2/readme.md @@ -1,5 +1,7 @@ # Keychron Q2 +![Keychron Q2](https://i.imgur.com/sRf98x5.jpg) + A customizable 65% keyboard. * Keyboard Maintainer: [Keychron](https://github.com/keychron) @@ -9,11 +11,26 @@ A customizable 65% keyboard. Make example for this keyboard (after setting up your build environment): make keychron/q2/ansi:default + make keychron/q2/ansi_encoder:default + make keychron/q2/iso:default + make keychron/q2/iso_encoder:default + make keychron/q2/jis:default + make keychron/q2/jis_encoder:default Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid)) make keychron/q2/ansi:default:flash + make keychron/q2/ansi_encoder:default:flash + make keychron/q2/iso:default:flash + make keychron/q2/iso_encoder:default:flash + make keychron/q2/jis:default:flash + make keychron/q2/jis_encoder:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q3/ansi/ansi.c b/keyboards/keychron/q3/ansi/ansi.c index 432a914058c8..7cd7422da89c 100644 --- a/keyboards/keychron/q3/ansi/ansi.c +++ b/keyboards/keychron/q3/ansi/ansi.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -118,37 +117,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, {1, C_15, A_15, B_15}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, - { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 }, - { 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 49, 62, 15, 32 }, - { 63, __, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, __, 74, 86, 75 }, - { 76, 77, 78, __, __, __, 79, __, __, __, 80, 81, 82, 83, 84, 85 }, - }, - { - // LED Index to Physical Position - {0,0}, {26,0}, {39,0}, {52,0}, {65,0}, {85,0}, {98,0}, {111,0}, {124,0}, {143,0}, {156,0}, {169,0}, {182,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {176,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {20,28}, {33,28}, {46,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {179,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {174,40}, - {8,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {171,52}, {211,52}, - {2,64}, {18,64}, {34,64}, {83,64}, {131,64}, {148,64}, {164,64}, {180,64}, {198,64}, {211,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/ansi/config.h b/keyboards/keychron/q3/ansi/config.h index f7c1c16931e2..3f940adf43cf 100644 --- a/keyboards/keychron/q3/ansi/config.h +++ b/keyboards/keychron/q3/ansi/config.h @@ -16,21 +16,11 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, A10, H3 } - /* We uses a pin with a stronger pull resistor than the internal MCU pins */ // #define MATRIX_UNSELECT_DRIVE_HIGH /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 48 -#define DRIVER_2_LED_TOTAL 39 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +#define RGB_MATRIX_LED_COUNT 87 /* Enable CapsLcok LED */ #define CAPS_LOCK_LED_INDEX 50 - diff --git a/keyboards/keychron/q3/ansi/info.json b/keyboards/keychron/q3/ansi/info.json index 124ac1bdcc9c..9b6393e313f2 100644 --- a/keyboards/keychron/q3/ansi/info.json +++ b/keyboards/keychron/q3/ansi/info.json @@ -1,18 +1,12 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0120", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_tkl_ansi": { "layout": [ @@ -110,5 +104,101 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":20, "y":28}, + {"matrix":[2, 2], "flags":4, "x":33, "y":28}, + {"matrix":[2, 3], "flags":4, "x":46, "y":28}, + {"matrix":[2, 4], "flags":4, "x":59, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 13], "flags":1, "x":179, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":153, "y":40}, + {"matrix":[3, 13], "flags":1, "x":174, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":131, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":164, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/ansi/keymaps/default/keymap.c b/keyboards/keychron/q3/ansi/keymaps/default/keymap.c index 3837a59fad70..905ceb16dce2 100644 --- a/keyboards/keychron/q3/ansi/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/ansi/keymaps/default/keymap.c @@ -16,16 +16,20 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -49,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_ansi( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q3/ansi/keymaps/keychron/keymap.c index 32a9d010ea7b..91e588fe6271 100644 --- a/keyboards/keychron/q3/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/ansi/keymaps/keychron/keymap.c @@ -16,17 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -60,12 +62,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q3/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q3/ansi/keymaps/keychron/rules.mk index b29114f76ae1..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q3/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ -VPATH += keyboards/keychron/common -SRC += keychron_common.c - VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/ansi/keymaps/via/keymap.c b/keyboards/keychron/q3/ansi/keymaps/via/keymap.c index 3837a59fad70..af0721dfb8d3 100644 --- a/keyboards/keychron/q3/ansi/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/ansi/keymaps/via/keymap.c @@ -20,12 +20,16 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -49,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_ansi( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/ansi/rules.mk b/keyboards/keychron/q3/ansi/rules.mk index 58bbb89a7226..6e7633bfe015 100644 --- a/keyboards/keychron/q3/ansi/rules.mk +++ b/keyboards/keychron/q3/ansi/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q3/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q3/ansi_encoder/ansi_encoder.c index f873f77d12ec..9d72f640281f 100644 --- a/keyboards/keychron/q3/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q3/ansi_encoder/ansi_encoder.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -118,37 +117,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, {1, C_15, A_15, B_15}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, - { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 }, - { 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 49, 62, 15, 32 }, - { 63, __, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, __, 74, 86, 75 }, - { 76, 77, 78, __, __, __, 79, __, __, __, 80, 81, 82, 83, 84, 85 }, - }, - { - // LED Index to Physical Position - {0,0}, {16,0}, {29,0}, {42,0}, {55,0}, {71,0}, {84,0}, {97,0}, {110,0}, {126,0}, {139,0}, {152,0}, {165,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {176,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {19,28}, {32,28}, {45,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {179,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {174,40}, - {8,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {171,52}, {211,52}, - {2,64}, {18,64}, {34,64}, {83,64}, {131,64}, {148,64}, {164,64}, {180,64}, {198,64}, {211,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/ansi_encoder/config.h b/keyboards/keychron/q3/ansi_encoder/config.h index 201288841a6b..fa2c936c8ab4 100644 --- a/keyboards/keychron/q3/ansi_encoder/config.h +++ b/keyboards/keychron/q3/ansi_encoder/config.h @@ -16,20 +16,20 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 48 -#define DRIVER_2_LED_TOTAL 39 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 - -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +#define RGB_MATRIX_LED_COUNT 87 /* Enable CapsLcok LED */ #define CAPS_LOCK_LED_INDEX 50 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif + +/* HC595 Driver Configuration */ +#define HC595_STCP B0 +#define HC595_SHCP B1 +#define HC595_DS A7 +#define HC595_START_INDEX 8 +#define HC595_END_INDEX 15 diff --git a/keyboards/keychron/q3/ansi_encoder/info.json b/keyboards/keychron/q3/ansi_encoder/info.json index 2dd2f18bf9f5..2215e77fe4c2 100644 --- a/keyboards/keychron/q3/ansi_encoder/info.json +++ b/keyboards/keychron/q3/ansi_encoder/info.json @@ -1,23 +1,22 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0121", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "A8"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, "layouts": { "LAYOUT_tkl_f13_ansi": { "layout": [ @@ -116,5 +115,101 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":20, "y":28}, + {"matrix":[2, 2], "flags":4, "x":33, "y":28}, + {"matrix":[2, 3], "flags":4, "x":46, "y":28}, + {"matrix":[2, 4], "flags":4, "x":59, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 13], "flags":1, "x":179, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":153, "y":40}, + {"matrix":[3, 13], "flags":1, "x":174, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":131, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":164, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q3/ansi_encoder/keymaps/default/keymap.c index 832234c99741..95e24673f17b 100644 --- a/keyboards/keychron/q3/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/ansi_encoder/keymaps/default/keymap.c @@ -16,16 +16,20 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, diff --git a/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/keymap.c index 7a6944ff422c..5e2008271d6f 100644 --- a/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -69,12 +70,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q3/ansi_encoder/keymaps/via/keymap.c index 80230dae4bf0..67f98b2ce1ec 100644 --- a/keyboards/keychron/q3/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/ansi_encoder/keymaps/via/keymap.c @@ -20,12 +20,16 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_ansi( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, @@ -49,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_f13_ansi( - _______, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/ansi_encoder/rules.mk b/keyboards/keychron/q3/ansi_encoder/rules.mk index 77b90f246666..a515de570cd8 100644 --- a/keyboards/keychron/q3/ansi_encoder/rules.mk +++ b/keyboards/keychron/q3/ansi_encoder/rules.mk @@ -1,23 +1,2 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - +VPATH += $(TOP_DIR)/keyboards/keychron/common SRC += matrix.c diff --git a/keyboards/keychron/q3/config.h b/keyboards/keychron/q3/config.h index 79f07d039054..225bf60f568e 100644 --- a/keyboards/keychron/q3/config.h +++ b/keyboards/keychron/q3/config.h @@ -16,13 +16,6 @@ #pragma once -/* key matrix size */ -#define MATRIX_ROWS 6 -#define MATRIX_COLS 16 - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION ROW2COL - /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 @@ -38,8 +31,12 @@ /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL +/* Set LED driver current */ +#define CKLED2001_CURRENT_TUNE \ + { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } + /* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { {5, 4} } +#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } } /* Disable DIP switch in matrix data */ #define MATRIX_MASKED @@ -54,51 +51,10 @@ // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -#define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYRELEASES + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q3/halconf.h b/keyboards/keychron/q3/halconf.h index 41bddcb2799b..463d177eabc7 100644 --- a/keyboards/keychron/q3/halconf.h +++ b/keyboards/keychron/q3/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q3/info.json b/keyboards/keychron/q3/info.json new file mode 100644 index 000000000000..cdb126c70e86 --- /dev/null +++ b/keyboards/keychron/q3/info.json @@ -0,0 +1,48 @@ +{ + "keyboard_name": "Keychron Q3", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + } + }, + "diode_direction": "ROW2COL" +} diff --git a/keyboards/keychron/q3/iso/config.h b/keyboards/keychron/q3/iso/config.h index c6992eb52bfb..b12f12ad2149 100644 --- a/keyboards/keychron/q3/iso/config.h +++ b/keyboards/keychron/q3/iso/config.h @@ -16,20 +16,11 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, A10, H3 } - /* We uses a pin with a stronger pull resistor than the internal MCU pins */ // #define MATRIX_UNSELECT_DRIVE_HIGH /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 48 -#define DRIVER_2_LED_TOTAL 40 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +#define RGB_MATRIX_LED_COUNT 88 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 49 diff --git a/keyboards/keychron/q3/iso/info.json b/keyboards/keychron/q3/iso/info.json index c9618c5b47fe..87666ad5f0bd 100644 --- a/keyboards/keychron/q3/iso/info.json +++ b/keyboards/keychron/q3/iso/info.json @@ -1,18 +1,12 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0122", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_tkl_iso": { "layout": [ @@ -111,5 +105,102 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":20, "y":28}, + {"matrix":[2, 2], "flags":4, "x":33, "y":28}, + {"matrix":[2, 3], "flags":4, "x":46, "y":28}, + {"matrix":[2, 4], "flags":4, "x":59, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":150, "y":40}, + {"matrix":[3, 13], "flags":1, "x":166, "y":40}, + {"matrix":[2, 13], "flags":1, "x":183, "y":36}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":52}, + {"matrix":[4, 1], "flags":1, "x":16, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":131, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":164, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/iso/iso.c b/keyboards/keychron/q3/iso/iso.c index d747d5511545..6aa831802d43 100644 --- a/keyboards/keychron/q3/iso/iso.c +++ b/keyboards/keychron/q3/iso/iso.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -119,37 +118,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, {1, C_15, A_15, B_15}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, - { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 62, 46, 47 }, - { 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 48, 61, 15, 32 }, - { 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, __, 75, 87, 76 }, - { 77, 78, 79, __, __, __, 80, __, __, __, 81, 82, 83, 84, 85, 86 }, - }, - { - // LED Index to Physical Position - {0,0}, {26,0}, {39,0}, {52,0}, {65,0}, {84,0}, {97,0}, {111,0}, {124,0}, {143,0}, {156,0}, {169,0}, {182,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {176,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {19,28}, {32,28}, {45,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {166,40}, {183,36}, - {2,52}, {16,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {171,52}, {211,52}, - {2,64}, {18,64}, {34,64}, {83,64}, {131,64}, {148,64}, {164,64}, {180,64}, {198,64}, {211,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/iso/keymaps/default/keymap.c b/keyboards/keychron/q3/iso/keymaps/default/keymap.c index e8a98f32db5d..6d7f0c976ff3 100644 --- a/keyboards/keychron/q3/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/iso/keymaps/default/keymap.c @@ -20,12 +20,15 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -49,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_iso( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q3/iso/keymaps/keychron/keymap.c index cff222e885a8..3a87da0f4389 100644 --- a/keyboards/keychron/q3/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/iso/keymaps/keychron/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -60,12 +61,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q3/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q3/iso/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q3/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/iso/keymaps/via/keymap.c b/keyboards/keychron/q3/iso/keymaps/via/keymap.c index e8a98f32db5d..7c41bbc17793 100644 --- a/keyboards/keychron/q3/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/iso/keymaps/via/keymap.c @@ -16,16 +16,19 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -49,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_iso( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/iso/rules.mk b/keyboards/keychron/q3/iso/rules.mk index 58bbb89a7226..6e7633bfe015 100644 --- a/keyboards/keychron/q3/iso/rules.mk +++ b/keyboards/keychron/q3/iso/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q3/iso_encoder/config.h b/keyboards/keychron/q3/iso_encoder/config.h index 2ee93a4faeac..d2b3bf19fbf4 100644 --- a/keyboards/keychron/q3/iso_encoder/config.h +++ b/keyboards/keychron/q3/iso_encoder/config.h @@ -16,20 +16,20 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 48 -#define DRIVER_2_LED_TOTAL 40 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 - -#define CKLED2001_CURRENT_TUNE \ - { 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44, 0x9D, 0x9D, 0x44 } +#define RGB_MATRIX_LED_COUNT 88 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 49 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif + +/* HC595 Driver Configuration */ +#define HC595_STCP B0 +#define HC595_SHCP B1 +#define HC595_DS A7 +#define HC595_START_INDEX 8 +#define HC595_END_INDEX 15 diff --git a/keyboards/keychron/q3/iso_encoder/info.json b/keyboards/keychron/q3/iso_encoder/info.json index 85714450876c..ed26580db79c 100644 --- a/keyboards/keychron/q3/iso_encoder/info.json +++ b/keyboards/keychron/q3/iso_encoder/info.json @@ -1,23 +1,22 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0123", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "A8"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, "layouts": { "LAYOUT_tkl_f13_iso": { "layout": [ @@ -117,5 +116,102 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":20, "y":28}, + {"matrix":[2, 2], "flags":4, "x":33, "y":28}, + {"matrix":[2, 3], "flags":4, "x":46, "y":28}, + {"matrix":[2, 4], "flags":4, "x":59, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":150, "y":40}, + {"matrix":[3, 13], "flags":1, "x":166, "y":40}, + {"matrix":[2, 13], "flags":1, "x":183, "y":36}, + + {"matrix":[4, 0], "flags":1, "x":2, "y":52}, + {"matrix":[4, 1], "flags":1, "x":16, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":131, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":164, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/iso_encoder/iso_encoder.c b/keyboards/keychron/q3/iso_encoder/iso_encoder.c index d2bb169aacc0..6aa831802d43 100644 --- a/keyboards/keychron/q3/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q3/iso_encoder/iso_encoder.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -119,37 +118,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, {1, C_15, A_15, B_15}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, - { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 62, 46, 47 }, - { 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 48, 61, 15, 32 }, - { 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, __, 75, 87, 76 }, - { 77, 78, 79, __, __, __, 80, __, __, __, 81, 82, 83, 84, 85, 86 }, - }, - { - // LED Index to Physical Position - {0,0}, {16,0}, {29,0}, {42,0}, {55,0}, {71,0}, {84,0}, {97,0}, {110,0}, {126,0}, {139,0}, {152,0}, {165,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {176,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {19,28}, {32,28}, {45,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {166,40}, {183,36}, - {2,52}, {16,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {171,52}, {211,52}, - {2,64}, {18,64}, {34,64}, {83,64}, {131,64}, {148,64}, {164,64}, {180,64}, {198,64}, {211,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q3/iso_encoder/keymaps/default/keymap.c index caf29839191c..ba50c77b4b5b 100644 --- a/keyboards/keychron/q3/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/iso_encoder/keymaps/default/keymap.c @@ -16,16 +16,19 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -49,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_f13_iso( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q3/iso_encoder/keymaps/keychron/keymap.c index 336842a28f7d..968566f7132b 100644 --- a/keyboards/keychron/q3/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/iso_encoder/keymaps/keychron/keymap.c @@ -16,17 +16,18 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -69,12 +70,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q3/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q3/iso_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q3/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q3/iso_encoder/keymaps/via/keymap.c index caf29839191c..ba50c77b4b5b 100644 --- a/keyboards/keychron/q3/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/iso_encoder/keymaps/via/keymap.c @@ -16,16 +16,19 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_tkl_f13_iso( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, @@ -49,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_tkl_f13_iso( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/iso_encoder/rules.mk b/keyboards/keychron/q3/iso_encoder/rules.mk index 77b90f246666..a515de570cd8 100644 --- a/keyboards/keychron/q3/iso_encoder/rules.mk +++ b/keyboards/keychron/q3/iso_encoder/rules.mk @@ -1,23 +1,2 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - +VPATH += $(TOP_DIR)/keyboards/keychron/common SRC += matrix.c diff --git a/keyboards/keychron/q3/jis/config.h b/keyboards/keychron/q3/jis/config.h index 856dd14df4d5..34c10ad712ae 100644 --- a/keyboards/keychron/q3/jis/config.h +++ b/keyboards/keychron/q3/jis/config.h @@ -16,23 +16,11 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { C14, C15, A0, A1, A2, A3, A4, A5, A6, A7, B0, B1, A8, A9, A10, H3 } - /* If PH3 used with a stronger pull resistor then the following definition needs be included */ // #define MATRIX_UNSELECT_DRIVE_HIGH /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 48 -#define DRIVER_2_LED_TOTAL 43 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE \ - { 0x94, 0x94, 0x44, 0x94, 0x94, 0x44, 0x94, 0x94, 0x44, 0x94, 0x94, 0x44 } +#define RGB_MATRIX_LED_COUNT 91 /* Enable CapsLcok LED */ #define CAPS_LOCK_LED_INDEX 50 - diff --git a/keyboards/keychron/q3/jis/info.json b/keyboards/keychron/q3/jis/info.json index 6f17a7cf9d71..6a6f96519df5 100644 --- a/keyboards/keychron/q3/jis/info.json +++ b/keyboards/keychron/q3/jis/info.json @@ -1,18 +1,12 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0124", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_jis_91": { "layout": [ @@ -114,5 +108,105 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":16, "y":0}, + {"matrix":[0, 2], "flags":1, "x":29, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":55, "y":0}, + {"matrix":[0, 5], "flags":1, "x":84, "y":0}, + {"matrix":[0, 6], "flags":1, "x":97, "y":0}, + {"matrix":[0, 7], "flags":1, "x":110, "y":0}, + {"matrix":[0, 8], "flags":1, "x":126, "y":0}, + {"matrix":[0, 9], "flags":1, "x":139, "y":0}, + {"matrix":[0, 10], "flags":1, "x":152, "y":0}, + {"matrix":[0, 11], "flags":1, "x":165, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":169, "y":15}, + {"matrix":[0, 13], "flags":1, "x":182, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":19, "y":28}, + {"matrix":[2, 2], "flags":4, "x":32, "y":28}, + {"matrix":[2, 3], "flags":4, "x":45, "y":28}, + {"matrix":[2, 4], "flags":4, "x":58, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":150, "y":40}, + {"matrix":[3, 13], "flags":1, "x":166, "y":40}, + {"matrix":[2, 13], "flags":1, "x":183, "y":36}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 12], "flags":4, "x":159, "y":52}, + {"matrix":[4, 13], "flags":1, "x":177, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":16, "y":64}, + {"matrix":[5, 2], "flags":1, "x":31, "y":64}, + {"matrix":[5, 3], "flags":1, "x":45, "y":64}, + {"matrix":[5, 6], "flags":4, "x":81, "y":64}, + {"matrix":[5, 9], "flags":1, "x":119, "y":64}, + {"matrix":[5, 10], "flags":1, "x":135, "y":64}, + {"matrix":[5, 11], "flags":1, "x":151, "y":64}, + {"matrix":[5, 12], "flags":1, "x":166, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/jis/jis.c b/keyboards/keychron/q3/jis/jis.c index f262d3c7d89b..245b3974fa8e 100644 --- a/keyboards/keychron/q3/jis/jis.c +++ b/keyboards/keychron/q3/jis/jis.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -122,37 +121,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, // Down {1, C_15, A_15, B_15}, // Right }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 30, 13, 14 }, - { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32 }, - { 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 63, 47, 48 }, - { 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 49, 62, 15, 33 }, - { 64, __, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 90, 77 }, - { 78, 79, 80, 81, __, __, 82, __, __, 83, 84, 85, 86, 87, 88, 89 }, - }, - { - // LED Index to Physical Position - {0,0}, {26,0}, {39,0}, {52,0}, {65,0}, {84,0}, {97,0}, {111,0}, {124,0}, {143,0}, {156,0}, {169,0}, {182,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {169,15}, {182,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {19,28}, {32,28}, {45,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {166,40}, {183,36}, - {8,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {159,52}, {177,52}, {211,52}, - {2,64}, {16,64}, {31,64}, {45,64}, {81,64}, {119,64}, {135,64}, {151,64}, {166,64}, {180,64}, {198,64}, {211,64}, {224,64} - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // GB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/jis/keymaps/default/keymap.c b/keyboards/keychron/q3/jis/keymaps/default/keymap.c index bd764ecdf353..d11edd8dfcae 100644 --- a/keyboards/keychron/q3/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/jis/keymaps/default/keymap.c @@ -16,20 +16,23 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_91( KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_91( @@ -44,12 +47,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_91( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/jis/keymaps/keychron/keymap.c b/keyboards/keychron/q3/jis/keymaps/keychron/keymap.c index b65d92ae62a7..9e998a677363 100644 --- a/keyboards/keychron/q3/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/jis/keymaps/keychron/keymap.c @@ -16,6 +16,7 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, @@ -29,8 +30,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_91( @@ -45,8 +46,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_91( @@ -60,12 +61,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q3/jis/keymaps/keychron/rules.mk b/keyboards/keychron/q3/jis/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q3/jis/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/jis/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/jis/keymaps/via/keymap.c b/keyboards/keychron/q3/jis/keymaps/via/keymap.c index bd764ecdf353..77d0f4e9e9c9 100644 --- a/keyboards/keychron/q3/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/jis/keymaps/via/keymap.c @@ -16,20 +16,23 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_91( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_91( @@ -44,12 +47,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_91( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q3/jis/rules.mk b/keyboards/keychron/q3/jis/rules.mk index 58bbb89a7226..6e7633bfe015 100644 --- a/keyboards/keychron/q3/jis/rules.mk +++ b/keyboards/keychron/q3/jis/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q3/jis_encoder/config.h b/keyboards/keychron/q3/jis_encoder/config.h index 9fca0cfc73ce..a794d9bf7a9e 100644 --- a/keyboards/keychron/q3/jis_encoder/config.h +++ b/keyboards/keychron/q3/jis_encoder/config.h @@ -16,22 +16,20 @@ #pragma once -/* key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { C14, C15, A0, A1, A2, A3, A4, A5, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 49 -#define DRIVER_2_LED_TOTAL 43 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) - -#define CKLED2001_CURRENT_TUNE \ - { 0x94, 0x94, 0x44, 0x94, 0x94, 0x44, 0x94, 0x94, 0x44, 0x94, 0x94, 0x44 } - -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +#define RGB_MATRIX_LED_COUNT 92 /* Enable CapsLcok LED */ #define CAPS_LOCK_LED_INDEX 51 + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif + +/* HC595 Driver Configuration */ +#define HC595_STCP B0 +#define HC595_SHCP B1 +#define HC595_DS A7 +#define HC595_START_INDEX 8 +#define HC595_END_INDEX 15 diff --git a/keyboards/keychron/q3/jis_encoder/info.json b/keyboards/keychron/q3/jis_encoder/info.json index fd1f361f5724..61d3e267c87c 100644 --- a/keyboards/keychron/q3/jis_encoder/info.json +++ b/keyboards/keychron/q3/jis_encoder/info.json @@ -1,23 +1,22 @@ { - "keyboard_name": "Keychron Q3", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0125", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "A10", "pin_b": "A8"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, "layouts": { "LAYOUT_jis_92": { "layout": [ @@ -120,5 +119,106 @@ {"matrix": [4, 14], "x": 17.25, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":16, "y":0}, + {"matrix":[0, 2], "flags":1, "x":29, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":55, "y":0}, + {"matrix":[0, 5], "flags":1, "x":71, "y":0}, + {"matrix":[0, 6], "flags":1, "x":84, "y":0}, + {"matrix":[0, 7], "flags":1, "x":97, "y":0}, + {"matrix":[0, 8], "flags":1, "x":110, "y":0}, + {"matrix":[0, 9], "flags":1, "x":126, "y":0}, + {"matrix":[0, 10], "flags":1, "x":139, "y":0}, + {"matrix":[0, 11], "flags":1, "x":152, "y":0}, + {"matrix":[0, 12], "flags":1, "x":165, "y":0}, + {"matrix":[0, 13], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[3, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":13, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":169, "y":15}, + {"matrix":[5, 5], "flags":1, "x":182, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[3, 15], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":28}, + {"matrix":[2, 1], "flags":4, "x":19, "y":28}, + {"matrix":[2, 2], "flags":4, "x":32, "y":28}, + {"matrix":[2, 3], "flags":4, "x":45, "y":28}, + {"matrix":[2, 4], "flags":4, "x":59, "y":28}, + {"matrix":[2, 5], "flags":4, "x":72, "y":28}, + {"matrix":[2, 6], "flags":4, "x":85, "y":28}, + {"matrix":[2, 7], "flags":4, "x":98, "y":28}, + {"matrix":[2, 8], "flags":4, "x":111, "y":28}, + {"matrix":[2, 9], "flags":4, "x":124, "y":28}, + {"matrix":[2, 10], "flags":4, "x":137, "y":28}, + {"matrix":[2, 11], "flags":4, "x":150, "y":28}, + {"matrix":[2, 12], "flags":4, "x":163, "y":28}, + {"matrix":[2, 14], "flags":1, "x":198, "y":28}, + {"matrix":[2, 15], "flags":1, "x":211, "y":28}, + {"matrix":[3, 12], "flags":1, "x":224, "y":28}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":40}, + {"matrix":[3, 1], "flags":4, "x":23, "y":40}, + {"matrix":[3, 2], "flags":4, "x":36, "y":40}, + {"matrix":[3, 3], "flags":4, "x":49, "y":40}, + {"matrix":[3, 4], "flags":4, "x":62, "y":40}, + {"matrix":[3, 5], "flags":4, "x":75, "y":40}, + {"matrix":[3, 6], "flags":4, "x":88, "y":40}, + {"matrix":[3, 7], "flags":4, "x":101, "y":40}, + {"matrix":[3, 8], "flags":4, "x":114, "y":40}, + {"matrix":[3, 9], "flags":4, "x":127, "y":40}, + {"matrix":[3, 10], "flags":4, "x":140, "y":40}, + {"matrix":[3, 11], "flags":4, "x":150, "y":40}, + {"matrix":[3, 13], "flags":1, "x":166, "y":40}, + {"matrix":[2, 13], "flags":1, "x":183, "y":36}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":81, "y":52}, + {"matrix":[4, 7], "flags":4, "x":94, "y":52}, + {"matrix":[4, 8], "flags":4, "x":107, "y":52}, + {"matrix":[4, 9], "flags":4, "x":120, "y":52}, + {"matrix":[4, 10], "flags":4, "x":133, "y":52}, + {"matrix":[4, 11], "flags":4, "x":146, "y":52}, + {"matrix":[4, 12], "flags":1, "x":159, "y":52}, + {"matrix":[4, 13], "flags":1, "x":177, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":16, "y":64}, + {"matrix":[5, 2], "flags":1, "x":31, "y":64}, + {"matrix":[5, 3], "flags":1, "x":45, "y":64}, + {"matrix":[5, 6], "flags":4, "x":81, "y":64}, + {"matrix":[5, 9], "flags":1, "x":119, "y":64}, + {"matrix":[5, 10], "flags":1, "x":135, "y":64}, + {"matrix":[5, 11], "flags":1, "x":151, "y":64}, + {"matrix":[5, 12], "flags":1, "x":166, "y":64}, + {"matrix":[5, 13], "flags":1, "x":180, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[4, 14], "flags":1, "x":224, "y":64} + ] } } diff --git a/keyboards/keychron/q3/jis_encoder/jis_encoder.c b/keyboards/keychron/q3/jis_encoder/jis_encoder.c index 0a97c5ca6857..1b50100f0fc3 100644 --- a/keyboards/keychron/q3/jis_encoder/jis_encoder.c +++ b/keyboards/keychron/q3/jis_encoder/jis_encoder.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -123,37 +122,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_16, D_16, E_16}, // Down {1, C_15, A_15, B_15}, // Right }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33 }, - { 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 64, 48, 49 }, - { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 50, 63, 16, 34 }, - { 65, __, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 91, 78 }, - { 79, 80, 81, 82, __, 31, 83, __, __, 84, 85, 86, 87, 88, 89, 90 }, - }, - { - // LED Index to Physical Position - {0,0}, {16,0}, {29,0}, {42,0}, {55,0}, {71,0}, {84,0}, {97,0}, {110,0}, {126,0}, {139,0}, {152,0}, {165,0}, {182,0}, {198,0}, {211,0}, {224,0}, - {0,15}, {13,15}, {26,15}, {39,15}, {52,15}, {65,15}, {78,15}, {91,15}, {104,15}, {117,15}, {130,15}, {143,15}, {156,15}, {169,15}, {182,15}, {198,15}, {211,15}, {224,15}, - {3,28}, {19,28}, {32,28}, {45,28}, {59,28}, {72,28}, {85,28}, {98,28}, {111,28}, {124,28}, {137,28}, {150,28}, {163,28}, {198,28}, {211,28}, {224,28}, - {5,40}, {23,40}, {36,40}, {49,40}, {62,40}, {75,40}, {88,40}, {101,40}, {114,40}, {127,40}, {140,40}, {153,40}, {166,40}, {183,36}, - {8,52}, {29,52}, {42,52}, {55,52}, {68,52}, {81,52}, {94,52}, {107,52}, {120,52}, {133,52}, {146,52}, {159,52}, {177,52}, {211,52}, - {2,64}, {16,64}, {31,64}, {45,64}, {81,64}, {119,64}, {135,64}, {151,64}, {166,64}, {180,64}, {198,64}, {211,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q3/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/q3/jis_encoder/keymaps/default/keymap.c index 30e85d79df7b..8eaaaa01adca 100644 --- a/keyboards/keychron/q3/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q3/jis_encoder/keymaps/default/keymap.c @@ -20,16 +20,19 @@ enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_92( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_92( @@ -44,12 +47,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_92( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, @@ -57,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, diff --git a/keyboards/keychron/q3/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q3/jis_encoder/keymaps/keychron/keymap.c index 3a7e06abd62c..5b4584d43214 100644 --- a/keyboards/keychron/q3/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q3/jis_encoder/keymaps/keychron/keymap.c @@ -16,21 +16,22 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_92( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_92( @@ -45,8 +46,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_CRTA, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_92( @@ -58,8 +59,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, @@ -71,12 +70,15 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q3/jis_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q3/jis_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q3/jis_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q3/jis_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q3/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/q3/jis_encoder/keymaps/via/keymap.c index 63618ce05af7..8cbe34173a7c 100644 --- a/keyboards/keychron/q3/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q3/jis_encoder/keymaps/via/keymap.c @@ -16,20 +16,23 @@ #include QMK_KEYBOARD_H -enum layers{ +enum layers { MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_92( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [MAC_FN] = LAYOUT_jis_92( @@ -44,12 +47,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), [WIN_FN] = LAYOUT_jis_92( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, @@ -57,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, diff --git a/keyboards/keychron/q3/jis_encoder/rules.mk b/keyboards/keychron/q3/jis_encoder/rules.mk index 77b90f246666..a515de570cd8 100644 --- a/keyboards/keychron/q3/jis_encoder/rules.mk +++ b/keyboards/keychron/q3/jis_encoder/rules.mk @@ -1,23 +1,2 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - +VPATH += $(TOP_DIR)/keyboards/keychron/common SRC += matrix.c diff --git a/keyboards/keychron/q3/matrix.c b/keyboards/keychron/q3/matrix.c deleted file mode 100644 index 26830780ffe4..000000000000 --- a/keyboards/keychron/q3/matrix.c +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright 2021 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "matrix.h" -#include "quantum.h" - -// Pin connected to DS of 74HC595 -#define DATA_PIN A7 -// Pin connected to SH_CP of 74HC595 -#define CLOCK_PIN B1 -// Pin connected to ST_CP of 74HC595 -#define LATCH_PIN B0 - -#ifdef MATRIX_ROW_PINS -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -#endif // MATRIX_ROW_PINS -#ifdef MATRIX_COL_PINS -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif // MATRIX_COL_PINS - -#define ROWS_PER_HAND (MATRIX_ROWS) - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - -static inline uint8_t readMatrixPin(pin_t pin) { - if (pin != NO_PIN) { - return readPin(pin); - } else { - return 1; - } -} - -static void shiftOut(uint8_t dataOut) { - for (uint8_t i = 0; i < 8; i++) { - if (dataOut & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - dataOut = dataOut >> 1; - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - } - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static void shiftout_single(uint8_t data) { - if (data & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { - setPinOutput_writeLow(pin); - return true; - } else { - if (col == 8) { - shiftout_single(0x00); - } else { - shiftout_single(0x01); - } - return true; - } - return false; -} - -static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - if (col == (MATRIX_COLS - 1)) - shiftout_single(0x01); - } -} - -static void unselect_cols(void) { - // unselect column pins - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } - if (x == (MATRIX_COLS - 1)) - // unselect Shift Register - shiftOut(0xFF); - } -} - -static void matrix_init_pins(void) { - unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); - } - } -} - -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col - } - matrix_output_select_delay(); - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_matrix[row_index] |= row_shifter; - key_pressed = true; - } else { - // Pin HI, clear col bit - current_matrix[row_index] &= ~row_shifter; - } - } - - // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH -} - -void matrix_init_custom(void) { - // initialize key pins - matrix_init_pins(); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; - - // Set col, read rows - matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); - } - - bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); - - return changed; -} diff --git a/keyboards/keychron/q3/q3.c b/keyboards/keychron/q3/q3.c index 2bf8bf08a0b1..11786b4c27db 100644 --- a/keyboards/keychron/q3/q3.c +++ b/keyboards/keychron/q3/q3.c @@ -15,7 +15,6 @@ */ #include "quantum.h" -#include "rgb_matrix.h" // clang-format off @@ -43,47 +42,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - switch (keycode) { -#ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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 - } - 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; } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // CAPS_LOCK_LED_INDEX diff --git a/keyboards/keychron/q3/readme.md b/keyboards/keychron/q3/readme.md index 8e25a1b33224..14733dbf2db5 100644 --- a/keyboards/keychron/q3/readme.md +++ b/keyboards/keychron/q3/readme.md @@ -1,5 +1,7 @@ # Keychron Q3 +![Keychron Q3](https://i.imgur.com/KjP4nqd.jpg) + A customizable 80% keyboard. * Keyboard Maintainer: [Keychron](https://github.com/keychron) @@ -8,16 +10,27 @@ A customizable 80% keyboard. Make example for this keyboard (after setting up your build environment): -``` - make keychron/q3/ansi:default -``` + make keychron/q3/ansi:default + make keychron/q3/ansi_encoder:default + make keychron/q3/iso:default + make keychron/q3/iso_encoder:default + make keychron/q3/jis:default + make keychron/q3/jis_encoder:default Flashing example for this keyboard: -``` - make keychron/q3/ansi:default:flash -``` + make keychron/q3/ansi:default:flash + make keychron/q3/ansi_encoder:default:flash + make keychron/q3/iso:default:flash + make keychron/q3/iso_encoder:default:flash + make keychron/q3/jis:default:flash + make keychron/q3/jis_encoder:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q4/ansi/config.h b/keyboards/keychron/q4/ansi/config.h new file mode 100644 index 000000000000..c05e8f73a065 --- /dev/null +++ b/keyboards/keychron/q4/ansi/config.h @@ -0,0 +1,20 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* Enable CapsLcok LED*/ +#define CAPS_LOCK_LED_INDEX 28 diff --git a/keyboards/keychron/q4/ansi/info.json b/keyboards/keychron/q4/ansi/info.json new file mode 100644 index 000000000000..23f40e3de31e --- /dev/null +++ b/keyboards/keychron/q4/ansi/info.json @@ -0,0 +1,147 @@ +{ + "usb": { + "pid": "0x0140", + "device_version": "1.0.0" + }, + "layouts": { + "LAYOUT_ansi_61": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0}, + {"matrix": [0, 5], "x": 5, "y": 0}, + {"matrix": [0, 6], "x": 6, "y": 0}, + {"matrix": [0, 7], "x": 7, "y": 0}, + {"matrix": [0, 8], "x": 8, "y": 0}, + {"matrix": [0, 9], "x": 9, "y": 0}, + {"matrix": [0, 10], "x": 10, "y": 0}, + {"matrix": [0, 11], "x": 11, "y": 0}, + {"matrix": [0, 12], "x": 12, "y": 0}, + {"matrix": [0, 13], "x": 13, "y": 0, "w": 2}, + + {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5}, + {"matrix": [1, 1], "x": 1.5, "y": 1}, + {"matrix": [1, 2], "x": 2.5, "y": 1}, + {"matrix": [1, 3], "x": 3.5, "y": 1}, + {"matrix": [1, 4], "x": 4.5, "y": 1}, + {"matrix": [1, 5], "x": 5.5, "y": 1}, + {"matrix": [1, 6], "x": 6.5, "y": 1}, + {"matrix": [1, 7], "x": 7.5, "y": 1}, + {"matrix": [1, 8], "x": 8.5, "y": 1}, + {"matrix": [1, 9], "x": 9.5, "y": 1}, + {"matrix": [1, 10], "x": 10.5, "y": 1}, + {"matrix": [1, 11], "x": 11.5, "y": 1}, + {"matrix": [1, 12], "x": 12.5, "y": 1}, + {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, + + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75}, + {"matrix": [2, 1], "x": 1.75, "y": 2}, + {"matrix": [2, 2], "x": 2.75, "y": 2}, + {"matrix": [2, 3], "x": 3.75, "y": 2}, + {"matrix": [2, 4], "x": 4.75, "y": 2}, + {"matrix": [2, 5], "x": 5.75, "y": 2}, + {"matrix": [2, 6], "x": 6.75, "y": 2}, + {"matrix": [2, 7], "x": 7.75, "y": 2}, + {"matrix": [2, 8], "x": 8.75, "y": 2}, + {"matrix": [2, 9], "x": 9.75, "y": 2}, + {"matrix": [2, 10], "x": 10.75, "y": 2}, + {"matrix": [2, 11], "x": 11.75, "y": 2}, + {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, + + {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, + {"matrix": [3, 2], "x": 2.25, "y": 3}, + {"matrix": [3, 3], "x": 3.25, "y": 3}, + {"matrix": [3, 4], "x": 4.25, "y": 3}, + {"matrix": [3, 5], "x": 5.25, "y": 3}, + {"matrix": [3, 6], "x": 6.25, "y": 3}, + {"matrix": [3, 7], "x": 7.25, "y": 3}, + {"matrix": [3, 8], "x": 8.25, "y": 3}, + {"matrix": [3, 9], "x": 9.25, "y": 3}, + {"matrix": [3, 10], "x": 10.25, "y": 3}, + {"matrix": [3, 11], "x": 11.25, "y": 3}, + {"matrix": [3, 13], "x": 12.25, "y": 3, "w": 2.75}, + + {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25}, + {"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25}, + {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25}, + {"matrix": [4, 6], "x": 3.75, "y": 4, "w": 6.25}, + {"matrix": [4, 10], "x": 10, "y": 4, "w": 1.25}, + {"matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25}, + {"matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25}, + {"matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25} + ] + } + }, + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 16, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 32, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 48, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 64, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 81, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 97, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 113, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 129, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 145, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 161, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 177, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 193, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 218, "y": 0, "flags": 1}, + + {"matrix": [1, 0], "x": 4,"y": 16, "flags": 1}, + {"matrix": [1, 1], "x": 24,"y": 16, "flags": 4}, + {"matrix": [1, 2], "x": 40,"y": 16, "flags": 4}, + {"matrix": [1, 3], "x": 56,"y": 16, "flags": 4}, + {"matrix": [1, 4], "x": 73,"y": 16, "flags": 4}, + {"matrix": [1, 5], "x": 89,"y": 16, "flags": 4}, + {"matrix": [1, 6], "x": 105,"y": 16, "flags": 4}, + {"matrix": [1, 7], "x": 121,"y": 16, "flags": 4}, + {"matrix": [1, 8], "x": 137,"y": 16, "flags": 4}, + {"matrix": [1, 9], "x": 153,"y": 16, "flags": 4}, + {"matrix": [1, 10], "x": 169,"y": 16, "flags": 4}, + {"matrix": [1, 11], "x": 185,"y": 16, "flags": 4}, + {"matrix": [1, 12], "x": 202,"y": 16, "flags": 4}, + {"matrix": [1, 13], "x": 222,"y": 16, "flags": 4}, + + {"matrix": [2, 0], "x": 6, "y": 32, "flags": 8}, + {"matrix": [2, 1], "x": 28, "y": 32, "flags": 4}, + {"matrix": [2, 2], "x": 44, "y": 32, "flags": 4}, + {"matrix": [2, 3], "x": 60, "y": 32, "flags": 4}, + {"matrix": [2, 4], "x": 77, "y": 32, "flags": 4}, + {"matrix": [2, 5], "x": 93, "y": 32, "flags": 4}, + {"matrix": [2, 6], "x": 109, "y": 32, "flags": 4}, + {"matrix": [2, 7], "x": 125, "y": 32, "flags": 4}, + {"matrix": [2, 8], "x": 141, "y": 32, "flags": 4}, + {"matrix": [2, 9], "x": 157, "y": 32, "flags": 4}, + {"matrix": [2, 10], "x": 173, "y": 32, "flags": 4}, + {"matrix": [2, 11], "x": 189, "y": 32, "flags": 4}, + {"matrix": [2, 13], "x": 216, "y": 32, "flags": 1}, + + {"matrix": [3, 0], "x": 10, "y": 48, "flags": 1}, + {"matrix": [3, 2], "x": 36, "y": 48, "flags": 4}, + {"matrix": [3, 3], "x": 52, "y": 48, "flags": 4}, + {"matrix": [3, 4], "x": 69, "y": 48, "flags": 4}, + {"matrix": [3, 5], "x": 85, "y": 48, "flags": 4}, + {"matrix": [3, 6], "x": 101, "y": 48, "flags": 4}, + {"matrix": [3, 7], "x": 117, "y": 48, "flags": 4}, + {"matrix": [3, 8], "x": 133, "y": 48, "flags": 4}, + {"matrix": [3, 9], "x": 149, "y": 48, "flags": 4}, + {"matrix": [3, 10], "x": 165, "y": 48, "flags": 4}, + {"matrix": [3, 11], "x": 181, "y": 48, "flags": 4}, + {"matrix": [3, 13], "x": 212, "y": 48, "flags": 1}, + + {"matrix": [4, 0], "x": 2, "y": 64, "flags": 1}, + {"matrix": [4, 1], "x": 22, "y": 64, "flags": 1}, + {"matrix": [4, 2], "x": 42, "y": 64, "flags": 1}, + {"matrix": [4, 6], "x": 103, "y": 64, "flags": 4}, + {"matrix": [4, 10], "x": 164, "y": 64, "flags": 1}, + {"matrix": [4, 11], "x": 184, "y": 64, "flags": 1}, + {"matrix": [4, 12], "x": 204, "y": 64, "flags": 1}, + {"matrix": [4, 13], "x": 224, "y": 64, "flags": 1} + + ] + } +} diff --git a/keyboards/keychron/q4/ansi_v2/keymaps/default/keymap.c b/keyboards/keychron/q4/ansi/keymaps/default/keymap.c similarity index 95% rename from keyboards/keychron/q4/ansi_v2/keymaps/default/keymap.c rename to keyboards/keychron/q4/ansi/keymaps/default/keymap.c index dd8669c3fba4..67bc10435eaa 100644 --- a/keyboards/keychron/q4/ansi_v2/keymaps/default/keymap.c +++ b/keyboards/keychron/q4/ansi/keymaps/default/keymap.c @@ -16,16 +16,18 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_61( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -42,14 +44,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, _______), [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -62,5 +64,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; - -// clang-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v2/keymaps/keychron/keymap.c b/keyboards/keychron/q4/ansi/keymaps/keychron/keymap.c similarity index 92% rename from keyboards/keychron/q4/ansi_v2/keymaps/keychron/keymap.c rename to keyboards/keychron/q4/ansi/keymaps/keychron/keymap.c index d58af0f24410..333e006d317c 100644 --- a/keyboards/keychron/q4/ansi_v2/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q4/ansi/keymaps/keychron/keymap.c @@ -16,17 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_61( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -43,14 +43,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, _______), [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -66,10 +66,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; -} \ No newline at end of file +} diff --git a/keyboards/keychron/q4/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q4/ansi/keymaps/keychron/rules.mk new file mode 100644 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/q4/ansi/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q4/ansi_v1/keymaps/via/keymap.c b/keyboards/keychron/q4/ansi/keymaps/via/keymap.c similarity index 95% rename from keyboards/keychron/q4/ansi_v1/keymaps/via/keymap.c rename to keyboards/keychron/q4/ansi/keymaps/via/keymap.c index dd8669c3fba4..97895d0745ea 100644 --- a/keyboards/keychron/q4/ansi_v1/keymaps/via/keymap.c +++ b/keyboards/keychron/q4/ansi/keymaps/via/keymap.c @@ -16,16 +16,19 @@ #include QMK_KEYBOARD_H -// clang-format off enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_61( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -42,14 +45,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, _______), [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -62,5 +65,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; - -// clang-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v1/keymaps/via/rules.mk b/keyboards/keychron/q4/ansi/keymaps/via/rules.mk similarity index 100% rename from keyboards/keychron/q4/ansi_v1/keymaps/via/rules.mk rename to keyboards/keychron/q4/ansi/keymaps/via/rules.mk diff --git a/keyboards/keychron/q4/ansi_v1/readme.md b/keyboards/keychron/q4/ansi/readme.md similarity index 100% rename from keyboards/keychron/q4/ansi_v1/readme.md rename to keyboards/keychron/q4/ansi/readme.md diff --git a/keyboards/keychron/q4/ansi_v1/config.h b/keyboards/keychron/q4/ansi/v1/config.h similarity index 90% rename from keyboards/keychron/q4/ansi_v1/config.h rename to keyboards/keychron/q4/ansi/v1/config.h index e11ab12b93bf..ef0a97909358 100644 --- a/keyboards/keychron/q4/ansi_v1/config.h +++ b/keyboards/keychron/q4/ansi/v1/config.h @@ -22,9 +22,7 @@ #define DRIVER_ADDR_2 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 31 -#define DRIVER_2_LED_TOTAL 30 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 61 /* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ #define PHASE_CHANNEL MSKPHASE_9CHANNEL diff --git a/keyboards/keychron/q4/ansi/v1/rules.mk b/keyboards/keychron/q4/ansi/v1/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q4/ansi/v1/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q4/ansi_v1/ansi_v1.c b/keyboards/keychron/q4/ansi/v1/v1.c similarity index 65% rename from keyboards/keychron/q4/ansi_v1/ansi_v1.c rename to keyboards/keychron/q4/ansi/v1/v1.c index 88599103ef84..d593569d7321 100644 --- a/keyboards/keychron/q4/ansi_v1/ansi_v1.c +++ b/keyboards/keychron/q4/ansi/v1/v1.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to CKLED manual for these locations * driver @@ -91,34 +90,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_13, D_13, E_13}, {1, F_14, D_14, E_14}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, - { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }, - { 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, __, 40 }, - { 41, __, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, __, 52 }, - { 53, 54, 55, __, __, __, 56, __, __, __, 57, 58, 59, 60 }, - }, - { - // LED Index to Physical Position - {0,0}, {16,0}, {32,0}, {48,0}, {64,0}, {81,0}, {97,0}, {113,0}, {129,0}, {145,0}, {161,0}, {177,0}, {193,0}, {218,0}, - {4,16}, {24,16}, {40,16}, {56,16}, {73,16}, {89,16}, {105,16}, {121,16}, {137,16}, {153,16}, {169,16}, {185,16}, {202,16}, {222,16}, - {6,32}, {28,32}, {44,32}, {60,32}, {77,32}, {93,32}, {109,32}, {125,32}, {141,32}, {157,32}, {173,32}, {189,32}, {216,32}, - {10,48}, {36,48}, {52,48}, {69,48}, {85,48}, {101,48}, {117,48}, {133,48}, {149,48}, {165,48}, {181,48}, {212,48}, - {2,64}, {22,64}, {42,64}, {103,64}, {164,64}, {184,64}, {204,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 1, 1, 4, 1, 1, 1, 1, - } -}; - #endif diff --git a/keyboards/keychron/q4/ansi_v2/config.h b/keyboards/keychron/q4/ansi/v2/config.h similarity index 87% rename from keyboards/keychron/q4/ansi_v2/config.h rename to keyboards/keychron/q4/ansi/v2/config.h index cc906fed03d9..6630902b5478 100644 --- a/keyboards/keychron/q4/ansi_v2/config.h +++ b/keyboards/keychron/q4/ansi/v2/config.h @@ -21,11 +21,7 @@ #define DRIVER_ADDR_1 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 61 -#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL +#define RGB_MATRIX_LED_COUNT 61 #define CKLED2001_CURRENT_TUNE \ { 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60 } - -/* Enable CapsLcok LED*/ -#define CAPS_LOCK_LED_INDEX 28 diff --git a/keyboards/keychron/q4/ansi/v2/rules.mk b/keyboards/keychron/q4/ansi/v2/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/q4/ansi/v2/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/q4/ansi_v2/ansi_v2.c b/keyboards/keychron/q4/ansi/v2/v2.c similarity index 65% rename from keyboards/keychron/q4/ansi_v2/ansi_v2.c rename to keyboards/keychron/q4/ansi/v2/v2.c index d454a796fa03..0d044979a025 100644 --- a/keyboards/keychron/q4/ansi_v2/ansi_v2.c +++ b/keyboards/keychron/q4/ansi/v2/v2.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to CKLED manual for these locations * driver @@ -91,34 +90,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {0, F_15, D_15, E_15}, {0, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, - { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }, - { 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, __, 40 }, - { 41, __, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, __, 52 }, - { 53, 54, 55, __, __, __, 56, __, __, __, 57, 58, 59, 60 }, - }, - { - // LED Index to Physical Position - {0,0}, {16,0}, {32,0}, {48,0}, {64,0}, {81,0}, {97,0}, {113,0}, {129,0}, {145,0}, {161,0}, {177,0}, {193,0}, {218,0}, - {4,16}, {24,16}, {40,16}, {56,16}, {73,16}, {89,16}, {105,16}, {121,16}, {137,16}, {153,16}, {169,16}, {185,16}, {202,16}, {222,16}, - {6,32}, {28,32}, {44,32}, {60,32}, {77,32}, {93,32}, {109,32}, {125,32}, {141,32}, {157,32}, {173,32}, {189,32}, {216,32}, - {10,48}, {36,48}, {52,48}, {69,48}, {85,48}, {101,48}, {117,48}, {133,48}, {149,48}, {165,48}, {181,48}, {212,48}, - {2,64}, {22,64}, {42,64}, {103,64}, {164,64}, {184,64}, {204,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 1, 1, 4, 1, 1, 1, 1, - } -}; - #endif diff --git a/keyboards/keychron/q4/ansi_v1/info.json b/keyboards/keychron/q4/ansi_v1/info.json deleted file mode 100644 index 8ee286c48190..000000000000 --- a/keyboards/keychron/q4/ansi_v1/info.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "keyboard_name": "Keychron Q4", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", - "usb": { - "vid": "0x3434", - "pid": "0x0140", - "device_version": "1.0.0" - }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", - "layouts": { - "LAYOUT_ansi_61": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0}, - {"matrix": [0, 1], "x": 1, "y": 0}, - {"matrix": [0, 2], "x": 2, "y": 0}, - {"matrix": [0, 3], "x": 3, "y": 0}, - {"matrix": [0, 4], "x": 4, "y": 0}, - {"matrix": [0, 5], "x": 5, "y": 0}, - {"matrix": [0, 6], "x": 6, "y": 0}, - {"matrix": [0, 7], "x": 7, "y": 0}, - {"matrix": [0, 8], "x": 8, "y": 0}, - {"matrix": [0, 9], "x": 9, "y": 0}, - {"matrix": [0, 10], "x": 10, "y": 0}, - {"matrix": [0, 11], "x": 11, "y": 0}, - {"matrix": [0, 12], "x": 12, "y": 0}, - {"matrix": [0, 13], "x": 13, "y": 0, "w": 2}, - - {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5}, - {"matrix": [1, 1], "x": 1.5, "y": 1}, - {"matrix": [1, 2], "x": 2.5, "y": 1}, - {"matrix": [1, 3], "x": 3.5, "y": 1}, - {"matrix": [1, 4], "x": 4.5, "y": 1}, - {"matrix": [1, 5], "x": 5.5, "y": 1}, - {"matrix": [1, 6], "x": 6.5, "y": 1}, - {"matrix": [1, 7], "x": 7.5, "y": 1}, - {"matrix": [1, 8], "x": 8.5, "y": 1}, - {"matrix": [1, 9], "x": 9.5, "y": 1}, - {"matrix": [1, 10], "x": 10.5, "y": 1}, - {"matrix": [1, 11], "x": 11.5, "y": 1}, - {"matrix": [1, 12], "x": 12.5, "y": 1}, - {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, - - {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75}, - {"matrix": [2, 1], "x": 1.75, "y": 2}, - {"matrix": [2, 2], "x": 2.75, "y": 2}, - {"matrix": [2, 3], "x": 3.75, "y": 2}, - {"matrix": [2, 4], "x": 4.75, "y": 2}, - {"matrix": [2, 5], "x": 5.75, "y": 2}, - {"matrix": [2, 6], "x": 6.75, "y": 2}, - {"matrix": [2, 7], "x": 7.75, "y": 2}, - {"matrix": [2, 8], "x": 8.75, "y": 2}, - {"matrix": [2, 9], "x": 9.75, "y": 2}, - {"matrix": [2, 10], "x": 10.75, "y": 2}, - {"matrix": [2, 11], "x": 11.75, "y": 2}, - {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, - - {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, - {"matrix": [3, 2], "x": 2.25, "y": 3}, - {"matrix": [3, 3], "x": 3.25, "y": 3}, - {"matrix": [3, 4], "x": 4.25, "y": 3}, - {"matrix": [3, 5], "x": 5.25, "y": 3}, - {"matrix": [3, 6], "x": 6.25, "y": 3}, - {"matrix": [3, 7], "x": 7.25, "y": 3}, - {"matrix": [3, 8], "x": 8.25, "y": 3}, - {"matrix": [3, 9], "x": 9.25, "y": 3}, - {"matrix": [3, 10], "x": 10.25, "y": 3}, - {"matrix": [3, 11], "x": 11.25, "y": 3}, - {"matrix": [3, 13], "x": 12.25, "y": 3, "w": 2.75}, - - {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25}, - {"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25}, - {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25}, - {"matrix": [4, 6], "x": 3.75, "y": 4, "w": 6.25}, - {"matrix": [4, 10], "x": 10, "y": 4, "w": 1.25}, - {"matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25}, - {"matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25}, - {"matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25} - ] - } - } -} diff --git a/keyboards/keychron/q4/ansi_v1/keymaps/default/keymap.c b/keyboards/keychron/q4/ansi_v1/keymaps/default/keymap.c deleted file mode 100644 index dd8669c3fba4..000000000000 --- a/keyboards/keychron/q4/ansi_v1/keymaps/default/keymap.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H - -// clang-format off - -enum layers { - MAC_BASE, - WIN_BASE, - _FN1, - _FN2, - _FN3 -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(_FN1), MO(_FN3), KC_RCTL), - - [WIN_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), - - [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN3] = LAYOUT_ansi_61( - KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______) -}; - -// clang-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v1/keymaps/keychron/keymap.c b/keyboards/keychron/q4/ansi_v1/keymaps/keychron/keymap.c deleted file mode 100644 index d58af0f24410..000000000000 --- a/keyboards/keychron/q4/ansi_v1/keymaps/keychron/keymap.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H -#include "keychron_common.h" - -// clang-format off - -enum layers { - MAC_BASE, - WIN_BASE, - _FN1, - _FN2, - _FN3 -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(_FN1), MO(_FN3), KC_RCTL), - - [WIN_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), - - [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN3] = LAYOUT_ansi_61( - KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______) -}; - -// clang-format on - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (!process_record_keychron(keycode, record)) { - return false; - } - - return true; -} \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v1/keymaps/keychron/rules.mk b/keyboards/keychron/q4/ansi_v1/keymaps/keychron/rules.mk deleted file mode 100644 index 1f273de34046..000000000000 --- a/keyboards/keychron/q4/ansi_v1/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v1/rules.mk b/keyboards/keychron/q4/ansi_v1/rules.mk deleted file mode 100644 index cad488b009c9..000000000000 --- a/keyboards/keychron/q4/ansi_v1/rules.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Build Options -# change yes to no to disable. -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = no -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - diff --git a/keyboards/keychron/q4/ansi_v2/info.json b/keyboards/keychron/q4/ansi_v2/info.json deleted file mode 100644 index 8ee286c48190..000000000000 --- a/keyboards/keychron/q4/ansi_v2/info.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "keyboard_name": "Keychron Q4", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", - "usb": { - "vid": "0x3434", - "pid": "0x0140", - "device_version": "1.0.0" - }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", - "layouts": { - "LAYOUT_ansi_61": { - "layout": [ - {"matrix": [0, 0], "x": 0, "y": 0}, - {"matrix": [0, 1], "x": 1, "y": 0}, - {"matrix": [0, 2], "x": 2, "y": 0}, - {"matrix": [0, 3], "x": 3, "y": 0}, - {"matrix": [0, 4], "x": 4, "y": 0}, - {"matrix": [0, 5], "x": 5, "y": 0}, - {"matrix": [0, 6], "x": 6, "y": 0}, - {"matrix": [0, 7], "x": 7, "y": 0}, - {"matrix": [0, 8], "x": 8, "y": 0}, - {"matrix": [0, 9], "x": 9, "y": 0}, - {"matrix": [0, 10], "x": 10, "y": 0}, - {"matrix": [0, 11], "x": 11, "y": 0}, - {"matrix": [0, 12], "x": 12, "y": 0}, - {"matrix": [0, 13], "x": 13, "y": 0, "w": 2}, - - {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5}, - {"matrix": [1, 1], "x": 1.5, "y": 1}, - {"matrix": [1, 2], "x": 2.5, "y": 1}, - {"matrix": [1, 3], "x": 3.5, "y": 1}, - {"matrix": [1, 4], "x": 4.5, "y": 1}, - {"matrix": [1, 5], "x": 5.5, "y": 1}, - {"matrix": [1, 6], "x": 6.5, "y": 1}, - {"matrix": [1, 7], "x": 7.5, "y": 1}, - {"matrix": [1, 8], "x": 8.5, "y": 1}, - {"matrix": [1, 9], "x": 9.5, "y": 1}, - {"matrix": [1, 10], "x": 10.5, "y": 1}, - {"matrix": [1, 11], "x": 11.5, "y": 1}, - {"matrix": [1, 12], "x": 12.5, "y": 1}, - {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, - - {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75}, - {"matrix": [2, 1], "x": 1.75, "y": 2}, - {"matrix": [2, 2], "x": 2.75, "y": 2}, - {"matrix": [2, 3], "x": 3.75, "y": 2}, - {"matrix": [2, 4], "x": 4.75, "y": 2}, - {"matrix": [2, 5], "x": 5.75, "y": 2}, - {"matrix": [2, 6], "x": 6.75, "y": 2}, - {"matrix": [2, 7], "x": 7.75, "y": 2}, - {"matrix": [2, 8], "x": 8.75, "y": 2}, - {"matrix": [2, 9], "x": 9.75, "y": 2}, - {"matrix": [2, 10], "x": 10.75, "y": 2}, - {"matrix": [2, 11], "x": 11.75, "y": 2}, - {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, - - {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, - {"matrix": [3, 2], "x": 2.25, "y": 3}, - {"matrix": [3, 3], "x": 3.25, "y": 3}, - {"matrix": [3, 4], "x": 4.25, "y": 3}, - {"matrix": [3, 5], "x": 5.25, "y": 3}, - {"matrix": [3, 6], "x": 6.25, "y": 3}, - {"matrix": [3, 7], "x": 7.25, "y": 3}, - {"matrix": [3, 8], "x": 8.25, "y": 3}, - {"matrix": [3, 9], "x": 9.25, "y": 3}, - {"matrix": [3, 10], "x": 10.25, "y": 3}, - {"matrix": [3, 11], "x": 11.25, "y": 3}, - {"matrix": [3, 13], "x": 12.25, "y": 3, "w": 2.75}, - - {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25}, - {"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25}, - {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25}, - {"matrix": [4, 6], "x": 3.75, "y": 4, "w": 6.25}, - {"matrix": [4, 10], "x": 10, "y": 4, "w": 1.25}, - {"matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25}, - {"matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25}, - {"matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25} - ] - } - } -} diff --git a/keyboards/keychron/q4/ansi_v2/keymaps/keychron/rules.mk b/keyboards/keychron/q4/ansi_v2/keymaps/keychron/rules.mk deleted file mode 100644 index 1f273de34046..000000000000 --- a/keyboards/keychron/q4/ansi_v2/keymaps/keychron/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v2/keymaps/via/keymap.c b/keyboards/keychron/q4/ansi_v2/keymaps/via/keymap.c deleted file mode 100644 index dd8669c3fba4..000000000000 --- a/keyboards/keychron/q4/ansi_v2/keymaps/via/keymap.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include QMK_KEYBOARD_H - -// clang-format off - -enum layers { - MAC_BASE, - WIN_BASE, - _FN1, - _FN2, - _FN3 -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [MAC_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LOPT, KC_LCMD, KC_SPC, KC_RCMD, MO(_FN1), MO(_FN3), KC_RCTL), - - [WIN_BASE] = LAYOUT_ansi_61( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), - - [_FN1] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN2] = LAYOUT_ansi_61( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______), - - [_FN3] = LAYOUT_ansi_61( - KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______) -}; - -// clang-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v2/keymaps/via/rules.mk b/keyboards/keychron/q4/ansi_v2/keymaps/via/rules.mk deleted file mode 100644 index 036bd6d1c3ec..000000000000 --- a/keyboards/keychron/q4/ansi_v2/keymaps/via/rules.mk +++ /dev/null @@ -1 +0,0 @@ -VIA_ENABLE = yes \ No newline at end of file diff --git a/keyboards/keychron/q4/ansi_v2/readme.md b/keyboards/keychron/q4/ansi_v2/readme.md deleted file mode 100644 index bd2f3fd8a81f..000000000000 --- a/keyboards/keychron/q4/ansi_v2/readme.md +++ /dev/null @@ -1 +0,0 @@ -# The ANSI variant of the Keychron Q4 diff --git a/keyboards/keychron/q4/ansi_v2/rules.mk b/keyboards/keychron/q4/ansi_v2/rules.mk deleted file mode 100644 index cad488b009c9..000000000000 --- a/keyboards/keychron/q4/ansi_v2/rules.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Build Options -# change yes to no to disable. -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = no -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - diff --git a/keyboards/keychron/q4/config.h b/keyboards/keychron/q4/config.h index 940ee44e77b8..09d6cbf07ca7 100644 --- a/keyboards/keychron/q4/config.h +++ b/keyboards/keychron/q4/config.h @@ -25,8 +25,6 @@ /* turn off effects when suspended */ #define RGB_DISABLE_WHEN_USB_SUSPENDED -#define DYNAMIC_KEYMAP_LAYER_COUNT 5 - /* EEPROM Driver Configuration */ #define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) @@ -34,51 +32,10 @@ // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #define RGB_MATRIX_KEYPRESSES -#define RGB_MATRIX_FRAMEBUFFER_EFFECTS \ No newline at end of file +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS + +/* Factory test keys */ +#define FN_KEY1 MO(2) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q4/info.json b/keyboards/keychron/q4/info.json new file mode 100644 index 000000000000..de4d1fed44c4 --- /dev/null +++ b/keyboards/keychron/q4/info.json @@ -0,0 +1,55 @@ +{ + "keyboard_name": "Keychron Q4", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "matrix_pins": { + "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9"], + "rows": ["B4", "B3", "A15", "A14", "A13"] + }, + "diode_direction": "ROW2COL", + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + } + }, + "dynamic_keymap": { + "layer_count": 5 + } +} diff --git a/keyboards/keychron/q4/iso/config.h b/keyboards/keychron/q4/iso/config.h index 9e4a1fc3e504..51f3ca054ad3 100644 --- a/keyboards/keychron/q4/iso/config.h +++ b/keyboards/keychron/q4/iso/config.h @@ -21,8 +21,7 @@ #define DRIVER_ADDR_1 0b1110100 /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 62 -#define RGB_MATRIX_LED_COUNT DRIVER_1_LED_TOTAL +#define RGB_MATRIX_LED_COUNT 62 #define CKLED2001_CURRENT_TUNE \ { 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60, 0xCA, 0xCA, 0x60 } diff --git a/keyboards/keychron/q4/iso/info.json b/keyboards/keychron/q4/iso/info.json index f8945cda6198..3a173cdccc6b 100644 --- a/keyboards/keychron/q4/iso/info.json +++ b/keyboards/keychron/q4/iso/info.json @@ -1,23 +1,8 @@ { - "keyboard_name": "Keychron Q4", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0142", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "matrix_pins": { - "cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9"], - "rows": ["B4", "B3", "A15", "A14", "A13"] - }, - "diode_direction": "ROW2COL", - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_62": { "layout": [ @@ -89,5 +74,75 @@ {"matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, + {"matrix": [0, 1], "x": 16, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 32, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 48, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 64, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 81, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 97, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 113, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 129, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 145, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 161, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 177, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 193, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 218, "y": 0, "flags": 1}, + + {"matrix": [1, 0], "x": 4, "y": 16, "flags": 1}, + {"matrix": [1, 1], "x": 24, "y": 16, "flags": 4}, + {"matrix": [1, 2], "x": 40, "y": 16, "flags": 4}, + {"matrix": [1, 3], "x": 56, "y": 16, "flags": 4}, + {"matrix": [1, 4], "x": 73, "y": 16, "flags": 4}, + {"matrix": [1, 5], "x": 89, "y": 16, "flags": 4}, + {"matrix": [1, 6], "x": 105, "y": 16, "flags": 4}, + {"matrix": [1, 7], "x": 121, "y": 16, "flags": 4}, + {"matrix": [1, 8], "x": 137, "y": 16, "flags": 4}, + {"matrix": [1, 9], "x": 153, "y": 16, "flags": 4}, + {"matrix": [1, 10], "x": 169, "y": 16, "flags": 4}, + {"matrix": [1, 11], "x": 185, "y": 16, "flags": 4}, + {"matrix": [1, 12], "x": 202, "y": 16, "flags": 4}, + + {"matrix": [2, 0], "x": 6, "y": 32, "flags": 8}, + {"matrix": [2, 1], "x": 28, "y": 32, "flags": 4}, + {"matrix": [2, 2], "x": 44, "y": 32, "flags": 4}, + {"matrix": [2, 3], "x": 60, "y": 32, "flags": 4}, + {"matrix": [2, 4], "x": 77, "y": 32, "flags": 4}, + {"matrix": [2, 5], "x": 93, "y": 32, "flags": 4}, + {"matrix": [2, 6], "x": 109, "y": 32, "flags": 4}, + {"matrix": [2, 7], "x": 125, "y": 32, "flags": 4}, + {"matrix": [2, 8], "x": 141, "y": 32, "flags": 4}, + {"matrix": [2, 9], "x": 157, "y": 32, "flags": 4}, + {"matrix": [2, 10], "x": 173, "y": 32, "flags": 4}, + {"matrix": [2, 11], "x": 189, "y": 32, "flags": 4}, + {"matrix": [2, 13], "x": 206, "y": 32, "flags": 4}, + {"matrix": [1, 13], "x": 224, "y": 24, "flags": 1}, + + {"matrix": [3, 0], "x": 2, "y": 48, "flags": 1}, + {"matrix": [3, 1], "x": 20, "y": 48, "flags": 4}, + {"matrix": [3, 2], "x": 36, "y": 48, "flags": 4}, + {"matrix": [3, 3], "x": 52, "y": 48, "flags": 4}, + {"matrix": [3, 4], "x": 69, "y": 48, "flags": 4}, + {"matrix": [3, 5], "x": 85, "y": 48, "flags": 4}, + {"matrix": [3, 6], "x": 101, "y": 48, "flags": 4}, + {"matrix": [3, 7], "x": 117, "y": 48, "flags": 4}, + {"matrix": [3, 8], "x": 133, "y": 48, "flags": 4}, + {"matrix": [3, 9], "x": 149, "y": 48, "flags": 4}, + {"matrix": [3, 10], "x": 165, "y": 48, "flags": 4}, + {"matrix": [3, 11], "x": 181, "y": 48, "flags": 4}, + {"matrix": [3, 13], "x": 212, "y": 48, "flags": 1}, + + {"matrix": [4, 0], "x": 2, "y": 64, "flags": 1}, + {"matrix": [4, 1], "x": 22, "y": 64, "flags": 1}, + {"matrix": [4, 2], "x": 42, "y": 64, "flags": 1}, + {"matrix": [4, 6], "x": 103, "y": 64, "flags": 4}, + {"matrix": [4, 10], "x": 164, "y": 64, "flags": 1}, + {"matrix": [4, 11], "x": 184, "y": 64, "flags": 1}, + {"matrix": [4, 12], "x": 204, "y": 64, "flags": 1}, + {"matrix": [4, 13], "x": 224, "y": 64, "flags": 1} + ] } } diff --git a/keyboards/keychron/q4/iso/iso.c b/keyboards/keychron/q4/iso/iso.c index 24cbcfd74552..190037000cd5 100644 --- a/keyboards/keychron/q4/iso/iso.c +++ b/keyboards/keychron/q4/iso/iso.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to CKLED manual for these locations * driver @@ -92,34 +91,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {0, F_15, D_15, E_15}, {0, F_16, D_16, E_16}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, - { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 40 }, - { 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, __, 39 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, __, 53 }, - { 54, 55, 56, __, __, __, 57, __, __, __, 58, 59, 60, 61 }, - }, - { - // LED Index to Physical Position - {0, 0}, {16, 0}, {32, 0}, {48, 0}, {64, 0}, {81, 0}, { 97, 0}, {113, 0}, {129, 0}, {145, 0}, {161, 0}, {177, 0}, {193, 0}, {218, 0}, - {4,16}, {24,16}, {40,16}, {56,16}, {73,16}, {89,16}, {105,16}, {121,16}, {137,16}, {153,16}, {169,16}, {185,16}, {202,16}, - {6,32}, {28,32}, {44,32}, {60,32}, {77,32}, {93,32}, {109,32}, {125,32}, {141,32}, {157,32}, {173,32}, {189,32}, {206,32}, {224,24}, - {2,48}, {20,48}, {36,48}, {52,48}, {69,48}, {85,48}, {101,48}, {117,48}, {133,48}, {149,48}, {165,48}, {181,48}, {212,48}, - {2,64}, {22,64}, {42,64}, {103,64}, {164,64}, {184,64}, {204,64}, {224,64}, - }, - { - // RGB LED Index to Flag - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, - 1, 1, 1, 4, 1, 1, 1, 1, - } -}; - #endif diff --git a/keyboards/keychron/q4/iso/keymaps/default/keymap.c b/keyboards/keychron/q4/iso/keymaps/default/keymap.c index e7c9edb412cf..d3aa858bcfe4 100644 --- a/keyboards/keychron/q4/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q4/iso/keymaps/default/keymap.c @@ -16,16 +16,18 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_62( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -42,14 +44,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_iso_62( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, _______), [_FN2] = LAYOUT_iso_62( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -62,5 +64,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; - -// clnag-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q4/iso/keymaps/keychron/keymap.c index 1176f5949b72..b5f37968c0ea 100644 --- a/keyboards/keychron/q4/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q4/iso/keymaps/keychron/keymap.c @@ -16,17 +16,17 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_62( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_iso_62( - KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_SNAP, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -64,12 +64,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______) }; -// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; -} \ No newline at end of file +} diff --git a/keyboards/keychron/q4/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q4/iso/keymaps/keychron/rules.mk index 1f273de34046..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q4/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q4/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c \ No newline at end of file +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q4/iso/keymaps/via/keymap.c b/keyboards/keychron/q4/iso/keymaps/via/keymap.c index e7c9edb412cf..d3aa858bcfe4 100644 --- a/keyboards/keychron/q4/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q4/iso/keymaps/via/keymap.c @@ -16,16 +16,18 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers { MAC_BASE, WIN_BASE, _FN1, _FN2, - _FN3 + _FN3, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_62( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, @@ -42,14 +44,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN2), MO(_FN3), KC_RCTL), [_FN1] = LAYOUT_iso_62( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, KC_INS, KC_PGUP, KC_HOME, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_NO, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, _______, _______, _______, _______, _______, _______, _______, _______), [_FN2] = LAYOUT_iso_62( - KC_GRV, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, + KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_MOD, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, KC_APP, KC_SCRL, KC_INS, KC_PGUP, KC_HOME, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, KC_UP, KC_PSCR, KC_PGDN, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL, _______, @@ -62,5 +64,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; - -// clnag-format on \ No newline at end of file diff --git a/keyboards/keychron/q4/iso/rules.mk b/keyboards/keychron/q4/iso/rules.mk index cad488b009c9..6e7633bfe015 100644 --- a/keyboards/keychron/q4/iso/rules.mk +++ b/keyboards/keychron/q4/iso/rules.mk @@ -1,18 +1 @@ -# Build Options -# change yes to no to disable. -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = no -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - +# This file intentionally left blank diff --git a/keyboards/keychron/q4/q4.c b/keyboards/keychron/q4/q4.c index c3cb67bcc2ec..d97f72fb8ea1 100644 --- a/keyboards/keychron/q4/q4.c +++ b/keyboards/keychron/q4/q4.c @@ -35,47 +35,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - switch (keycode) { -#ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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 - } - 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; - } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // CAPS_LOCK_LED_INDEX diff --git a/keyboards/keychron/q4/readme.md b/keyboards/keychron/q4/readme.md index 2c3d9c85727c..ec05e28ef3f1 100644 --- a/keyboards/keychron/q4/readme.md +++ b/keyboards/keychron/q4/readme.md @@ -1,19 +1,29 @@ # Keychron Q4 +![Keychron Q4](https://i.imgur.com/daIVjVG.jpg) + A customizable 60% keyboard. +Q4 Version 1 uses only 2 ICs for CKLED2001 and Q4 Version 2 uses only one IC. * Keyboard Maintainer: [Keychron](https://github.com/keychron) * Hardware Supported: Keychron Q4 -* Hardware Availability: [Keychron](https://www.keychron.com) +* Hardware Availability: [Keychron Q4 QMK Custom Mechanical Keyboard](https://www.keychron.com/products/keychron-q4-qmk-via-custom-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): - make keychron/q4/ansi_v2:default + make keychron/q4/ansi/v1:default + make keychron/q4/ansi/v2:default + make keychron/q4/iso:default Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid)) make keychron/q4/ansi_v2:default:flash -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q5/ansi/ansi.c b/keyboards/keychron/q5/ansi/ansi.c index dda563cd798e..ee877a05702e 100644 --- a/keyboards/keychron/q5/ansi/ansi.c +++ b/keyboards/keychron/q5/ansi/ansi.c @@ -17,7 +17,6 @@ #include "quantum.h" #ifdef RGB_MATRIX_ENABLE - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -131,37 +130,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_2, J_2, K_2}, {1, L_7, J_7, K_7} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, - { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, __, 33, 34, 35 }, - { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 70, 51, 52, 53 }, - { 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 18, 66, 36, 67, 68, 69 }, - { 71, __, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, __, 82, 83, 84, 85, 86 }, - { 87, 88, 89, __, __, 99, 90, __, __, __, 91, 92, 93, 94, 95, 96, 97, 98 } - }, - { - // LED Index to Physical Position - {0,0}, {12,0}, {24,0}, {36,0}, {48,0}, {60,0}, {72,0}, {84,0}, {97,0}, {109,0}, {121,0}, {133,0}, {145,0}, {157,0}, {169,0}, {188,0}, {200,0}, {212,0}, {224,0}, - {0,15}, {12,15}, {24,15}, {36,15}, {48,15}, {60,15}, {72,15}, {84,15}, {97,15}, {109,15}, {121,15}, {133,15}, {145,15}, {163,15}, {188,15}, {200,15}, {212,15}, {224,15}, - {3,26}, {18,26}, {30,26}, {42,26}, {54,26}, {66,26}, {78,26}, {91,26}, {103,26}, {115,26}, {127,26}, {139,26}, {151,26}, {166,26}, {188,26}, {200,26}, {212,26}, - {5,38}, {21,38}, {33,38}, {45,38}, {57,38}, {69,38}, {81,38}, {94,38}, {106,38}, {118,38}, {130,38}, {142,38}, {161,38}, {188,38}, {200,38}, {212,38}, {224,32}, - {8,49}, {27,49}, {39,49}, {51,49}, {63,49}, {75,49}, {88,49}, {100,49}, {112,49}, {124,49}, {136,49}, {152,49}, {172,52}, {188,49}, {200,49}, {212,49}, - {1,61}, {17,61}, {32,61}, {77,61}, {121,61}, {133,61}, {145,61}, {160,64}, {172,64}, {184,64}, {200,61}, {212,61}, {224,55}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q5/ansi/config.h b/keyboards/keychron/q5/ansi/config.h index 9ed58dd52275..4b324b206749 100644 --- a/keyboards/keychron/q5/ansi/config.h +++ b/keyboards/keychron/q5/ansi/config.h @@ -17,12 +17,10 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 55 -#define DRIVER_2_LED_TOTAL 45 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 100 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 54 /* Enable num-lock LED */ -// #define NUM_LOCK_LED_INDEX 33 +#define NUM_LOCK_LED_INDEX 33 diff --git a/keyboards/keychron/q5/ansi/info.json b/keyboards/keychron/q5/ansi/info.json index 55d7ae0165c6..069e0a54ebb9 100644 --- a/keyboards/keychron/q5/ansi/info.json +++ b/keyboards/keychron/q5/ansi/info.json @@ -1,18 +1,8 @@ { - "keyboard_name": "Keychron Q5", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0150", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_100": { "layout": [ @@ -123,5 +113,114 @@ {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":12, "y":0}, + {"matrix":[0, 2], "flags":1, "x":24, "y":0}, + {"matrix":[0, 3], "flags":1, "x":36, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":60, "y":0}, + {"matrix":[0, 6], "flags":1, "x":72, "y":0}, + {"matrix":[0, 7], "flags":1, "x":84, "y":0}, + {"matrix":[0, 8], "flags":1, "x":97, "y":0}, + {"matrix":[0, 9], "flags":1, "x":109, "y":0}, + {"matrix":[0, 10], "flags":1, "x":121, "y":0}, + {"matrix":[0, 11], "flags":1, "x":133, "y":0}, + {"matrix":[0, 12], "flags":1, "x":145, "y":0}, + {"matrix":[0, 13], "flags":1, "x":157, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":188, "y":0}, + {"matrix":[0, 16], "flags":1, "x":200, "y":0}, + {"matrix":[0, 17], "flags":1, "x":212, "y":0}, + {"matrix":[3, 12], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":12, "y":15}, + {"matrix":[1, 2], "flags":4, "x":24, "y":15}, + {"matrix":[1, 3], "flags":4, "x":36, "y":15}, + {"matrix":[1, 4], "flags":4, "x":48, "y":15}, + {"matrix":[1, 5], "flags":4, "x":60, "y":15}, + {"matrix":[1, 6], "flags":4, "x":72, "y":15}, + {"matrix":[1, 7], "flags":4, "x":84, "y":15}, + {"matrix":[1, 8], "flags":4, "x":97, "y":15}, + {"matrix":[1, 9], "flags":4, "x":109, "y":15}, + {"matrix":[1, 10], "flags":4, "x":121, "y":15}, + {"matrix":[1, 11], "flags":4, "x":133, "y":15}, + {"matrix":[1, 12], "flags":4, "x":145, "y":15}, + {"matrix":[1, 13], "flags":1, "x":163, "y":15}, + {"matrix":[1, 15], "flags":8, "x":188, "y":15}, + {"matrix":[1, 16], "flags":4, "x":200, "y":15}, + {"matrix":[1, 17], "flags":4, "x":212, "y":15}, + {"matrix":[3, 14], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":26}, + {"matrix":[2, 1], "flags":4, "x":18, "y":26}, + {"matrix":[2, 2], "flags":4, "x":30, "y":26}, + {"matrix":[2, 3], "flags":4, "x":42, "y":26}, + {"matrix":[2, 4], "flags":4, "x":54, "y":26}, + {"matrix":[2, 5], "flags":4, "x":66, "y":26}, + {"matrix":[2, 6], "flags":4, "x":78, "y":26}, + {"matrix":[2, 7], "flags":4, "x":91, "y":26}, + {"matrix":[2, 8], "flags":4, "x":103, "y":26}, + {"matrix":[2, 9], "flags":4, "x":115, "y":26}, + {"matrix":[2, 10], "flags":4, "x":127, "y":26}, + {"matrix":[2, 11], "flags":4, "x":139, "y":26}, + {"matrix":[2, 12], "flags":4, "x":151, "y":26}, + {"matrix":[2, 13], "flags":1, "x":166, "y":26}, + {"matrix":[2, 15], "flags":4, "x":188, "y":26}, + {"matrix":[2, 16], "flags":4, "x":200, "y":26}, + {"matrix":[2, 17], "flags":4, "x":212, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":38}, + {"matrix":[3, 1], "flags":4, "x":21, "y":38}, + {"matrix":[3, 2], "flags":4, "x":33, "y":38}, + {"matrix":[3, 3], "flags":4, "x":45, "y":38}, + {"matrix":[3, 4], "flags":4, "x":57, "y":38}, + {"matrix":[3, 5], "flags":4, "x":69, "y":38}, + {"matrix":[3, 6], "flags":4, "x":81, "y":38}, + {"matrix":[3, 7], "flags":4, "x":94, "y":38}, + {"matrix":[3, 8], "flags":4, "x":106, "y":38}, + {"matrix":[3, 9], "flags":4, "x":118, "y":38}, + {"matrix":[3, 10], "flags":4, "x":130, "y":38}, + {"matrix":[3, 11], "flags":4, "x":142, "y":38}, + {"matrix":[3, 13], "flags":1, "x":161, "y":38}, + {"matrix":[3, 15], "flags":4, "x":188, "y":38}, + {"matrix":[3, 16], "flags":4, "x":200, "y":38}, + {"matrix":[3, 17], "flags":4, "x":212, "y":38}, + {"matrix":[2, 14], "flags":4, "x":224, "y":32}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":49}, + {"matrix":[4, 2], "flags":4, "x":27, "y":49}, + {"matrix":[4, 3], "flags":4, "x":39, "y":49}, + {"matrix":[4, 4], "flags":4, "x":51, "y":49}, + {"matrix":[4, 5], "flags":4, "x":63, "y":49}, + {"matrix":[4, 6], "flags":4, "x":75, "y":49}, + {"matrix":[4, 7], "flags":4, "x":88, "y":49}, + {"matrix":[4, 8], "flags":4, "x":100, "y":49}, + {"matrix":[4, 9], "flags":4, "x":112, "y":49}, + {"matrix":[4, 10], "flags":4, "x":124, "y":49}, + {"matrix":[4, 11], "flags":4, "x":136, "y":49}, + {"matrix":[4, 13], "flags":1, "x":152, "y":49}, + {"matrix":[4, 14], "flags":1, "x":172, "y":52}, + {"matrix":[4, 15], "flags":4, "x":188, "y":49}, + {"matrix":[4, 16], "flags":4, "x":200, "y":49}, + {"matrix":[4, 17], "flags":4, "x":212, "y":49}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":61}, + {"matrix":[5, 1], "flags":1, "x":17, "y":61}, + {"matrix":[5, 2], "flags":1, "x":32, "y":61}, + {"matrix":[5, 6], "flags":4, "x":77, "y":61}, + {"matrix":[5, 10], "flags":1, "x":121, "y":61}, + {"matrix":[5, 11], "flags":1, "x":133, "y":61}, + {"matrix":[5, 12], "flags":1, "x":145, "y":61}, + {"matrix":[5, 13], "flags":1, "x":160, "y":64}, + {"matrix":[5, 14], "flags":1, "x":172, "y":64}, + {"matrix":[5, 15], "flags":1, "x":184, "y":64}, + {"matrix":[5, 16], "flags":4, "x":200, "y":61}, + {"matrix":[5, 17], "flags":4, "x":212, "y":61}, + {"matrix":[5, 5], "flags":4, "x":224, "y":55} + ] } } diff --git a/keyboards/keychron/q5/ansi/keymaps/default/keymap.c b/keyboards/keychron/q5/ansi/keymaps/default/keymap.c index c747bf4ae150..4dc56ade450c 100644 --- a/keyboards/keychron/q5/ansi/keymaps/default/keymap.c +++ b/keyboards/keychron/q5/ansi/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_100( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_100( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q5/ansi/keymaps/keychron/keymap.c index 82cc9bda12c5..bcab9f89f086 100644 --- a/keyboards/keychron/q5/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q5/ansi/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_100( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -57,12 +57,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q5/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q5/ansi/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q5/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q5/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q5/ansi/keymaps/via/keymap.c b/keyboards/keychron/q5/ansi/keymaps/via/keymap.c index c747bf4ae150..4dc56ade450c 100644 --- a/keyboards/keychron/q5/ansi/keymaps/via/keymap.c +++ b/keyboards/keychron/q5/ansi/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_100( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_100( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/ansi/rules.mk b/keyboards/keychron/q5/ansi/rules.mk index e859eb9c34c6..6e7633bfe015 100644 --- a/keyboards/keychron/q5/ansi/rules.mk +++ b/keyboards/keychron/q5/ansi/rules.mk @@ -1,21 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q5/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q5/ansi_encoder/ansi_encoder.c index 4d3cc0f036ca..d61c73eb9697 100644 --- a/keyboards/keychron/q5/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q5/ansi_encoder/ansi_encoder.c @@ -16,10 +16,9 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -133,37 +132,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_2, J_2, K_2}, {1, L_7, J_7, K_7} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, __, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, __, 31, 32, 33 }, - { 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 68, 49, 50, 51 }, - { 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 16, 64, 34, 65, 66, 67 }, - { 69, __, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, __, 80, 81, 82, 83, 84 }, - { 85, 86, 87, __, __, 97, 88, __, __, __, 89, 90, 91, 92, 93, 94, 95, 96 } - }, - { - // LED Index to Physical Position - {0,0}, {24,0}, {36,0}, {48,0}, {60,0}, {78,0}, {90,0}, {103,0}, {115,0}, {133,0}, {145,0}, {157,0}, {169,0}, {184,0}, {196,0}, {208,0}, {224,0}, - {0,15}, {12,15}, {24,15}, {36,15}, {48,15}, {60,15}, {72,15}, {85,15}, {97,15}, {109,15}, {121,15}, {133,15}, {145,15}, {163,15}, {188,15}, {200,15}, {212,15}, {224,15}, - {3,26}, {18,26}, {30,26}, {42,26}, {54,26}, {66,26}, {78,26}, {91,26}, {103,26}, {115,26}, {127,26}, {139,26}, {151,26}, {166,26}, {188,26}, {200,26}, {212,26}, - {5,38}, {21,38}, {33,38}, {45,38}, {57,38}, {69,38}, {81,38}, {94,38}, {106,38}, {118,38}, {130,38}, {142,38}, {161,38}, {188,38}, {200,38}, {212,38}, {224,32}, - {8,49}, {27,49}, {39,49}, {51,49}, {63,49}, {75,49}, {88,49}, {100,49}, {112,49}, {124,49}, {136,49}, {152,49}, {172,52}, {188,49}, {200,49}, {212,49}, - {1,61}, {17,61}, {32,61}, {77,61}, {121,61}, {133,61}, {145,61}, {160,64}, {172,64}, {184,64}, {200,61}, {212,61}, {224,55}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 4, 4, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q5/ansi_encoder/config.h b/keyboards/keychron/q5/ansi_encoder/config.h index 3986c11a027e..e1055525c3dd 100644 --- a/keyboards/keychron/q5/ansi_encoder/config.h +++ b/keyboards/keychron/q5/ansi_encoder/config.h @@ -17,15 +17,15 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 53 -#define DRIVER_2_LED_TOTAL 45 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 98 -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 52 /* Enable num-lock LED */ -// #define NUM_LOCK_LED_INDEX 31 +#define NUM_LOCK_LED_INDEX 31 diff --git a/keyboards/keychron/q5/ansi_encoder/info.json b/keyboards/keychron/q5/ansi_encoder/info.json index 468261b1e9ad..9bb7b142c42f 100644 --- a/keyboards/keychron/q5/ansi_encoder/info.json +++ b/keyboards/keychron/q5/ansi_encoder/info.json @@ -1,23 +1,16 @@ { - "keyboard_name": "Keychron Q5", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0151", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "C14", "pin_b": "A2"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_98": { "layout": [ @@ -126,5 +119,112 @@ {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":24, "y":0}, + {"matrix":[0, 3], "flags":1, "x":36, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":60, "y":0}, + {"matrix":[0, 7], "flags":1, "x":78, "y":0}, + {"matrix":[0, 8], "flags":1, "x":90, "y":0}, + {"matrix":[0, 9], "flags":1, "x":103, "y":0}, + {"matrix":[0, 10], "flags":1, "x":115, "y":0}, + {"matrix":[0, 11], "flags":1, "x":133, "y":0}, + {"matrix":[0, 12], "flags":1, "x":145, "y":0}, + {"matrix":[0, 13], "flags":1, "x":157, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":184, "y":0}, + {"matrix":[0, 16], "flags":1, "x":196, "y":0}, + {"matrix":[0, 17], "flags":1, "x":208, "y":0}, + {"matrix":[3, 12], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":12, "y":15}, + {"matrix":[1, 2], "flags":4, "x":24, "y":15}, + {"matrix":[1, 3], "flags":4, "x":36, "y":15}, + {"matrix":[1, 4], "flags":4, "x":48, "y":15}, + {"matrix":[1, 5], "flags":4, "x":60, "y":15}, + {"matrix":[1, 6], "flags":4, "x":72, "y":15}, + {"matrix":[1, 7], "flags":4, "x":84, "y":15}, + {"matrix":[1, 8], "flags":4, "x":97, "y":15}, + {"matrix":[1, 9], "flags":4, "x":109, "y":15}, + {"matrix":[1, 10], "flags":4, "x":121, "y":15}, + {"matrix":[1, 11], "flags":4, "x":133, "y":15}, + {"matrix":[1, 12], "flags":4, "x":145, "y":15}, + {"matrix":[1, 13], "flags":1, "x":163, "y":15}, + {"matrix":[1, 15], "flags":8, "x":188, "y":15}, + {"matrix":[1, 16], "flags":4, "x":200, "y":15}, + {"matrix":[1, 17], "flags":4, "x":212, "y":15}, + {"matrix":[3, 14], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":26}, + {"matrix":[2, 1], "flags":4, "x":18, "y":26}, + {"matrix":[2, 2], "flags":4, "x":30, "y":26}, + {"matrix":[2, 3], "flags":4, "x":42, "y":26}, + {"matrix":[2, 4], "flags":4, "x":54, "y":26}, + {"matrix":[2, 5], "flags":4, "x":66, "y":26}, + {"matrix":[2, 6], "flags":4, "x":78, "y":26}, + {"matrix":[2, 7], "flags":4, "x":91, "y":26}, + {"matrix":[2, 8], "flags":4, "x":103, "y":26}, + {"matrix":[2, 9], "flags":4, "x":115, "y":26}, + {"matrix":[2, 10], "flags":4, "x":127, "y":26}, + {"matrix":[2, 11], "flags":4, "x":139, "y":26}, + {"matrix":[2, 12], "flags":4, "x":151, "y":26}, + {"matrix":[2, 13], "flags":1, "x":166, "y":26}, + {"matrix":[2, 15], "flags":4, "x":188, "y":26}, + {"matrix":[2, 16], "flags":4, "x":200, "y":26}, + {"matrix":[2, 17], "flags":4, "x":212, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":38}, + {"matrix":[3, 1], "flags":4, "x":21, "y":38}, + {"matrix":[3, 2], "flags":4, "x":33, "y":38}, + {"matrix":[3, 3], "flags":4, "x":45, "y":38}, + {"matrix":[3, 4], "flags":4, "x":57, "y":38}, + {"matrix":[3, 5], "flags":4, "x":69, "y":38}, + {"matrix":[3, 6], "flags":4, "x":81, "y":38}, + {"matrix":[3, 7], "flags":4, "x":94, "y":38}, + {"matrix":[3, 8], "flags":4, "x":106, "y":38}, + {"matrix":[3, 9], "flags":4, "x":118, "y":38}, + {"matrix":[3, 10], "flags":4, "x":130, "y":38}, + {"matrix":[3, 11], "flags":4, "x":142, "y":38}, + {"matrix":[3, 13], "flags":1, "x":161, "y":38}, + {"matrix":[3, 15], "flags":4, "x":188, "y":38}, + {"matrix":[3, 16], "flags":4, "x":200, "y":38}, + {"matrix":[3, 17], "flags":4, "x":212, "y":38}, + {"matrix":[2, 14], "flags":4, "x":224, "y":32}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":49}, + {"matrix":[4, 2], "flags":4, "x":27, "y":49}, + {"matrix":[4, 3], "flags":4, "x":39, "y":49}, + {"matrix":[4, 4], "flags":4, "x":51, "y":49}, + {"matrix":[4, 5], "flags":4, "x":63, "y":49}, + {"matrix":[4, 6], "flags":4, "x":75, "y":49}, + {"matrix":[4, 7], "flags":4, "x":88, "y":49}, + {"matrix":[4, 8], "flags":4, "x":100, "y":49}, + {"matrix":[4, 9], "flags":4, "x":112, "y":49}, + {"matrix":[4, 10], "flags":4, "x":124, "y":49}, + {"matrix":[4, 11], "flags":4, "x":136, "y":49}, + {"matrix":[4, 13], "flags":1, "x":152, "y":49}, + {"matrix":[4, 14], "flags":1, "x":172, "y":52}, + {"matrix":[4, 15], "flags":4, "x":188, "y":49}, + {"matrix":[4, 16], "flags":4, "x":200, "y":49}, + {"matrix":[4, 17], "flags":4, "x":212, "y":49}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":61}, + {"matrix":[5, 1], "flags":1, "x":17, "y":61}, + {"matrix":[5, 2], "flags":1, "x":32, "y":61}, + {"matrix":[5, 6], "flags":4, "x":77, "y":61}, + {"matrix":[5, 10], "flags":1, "x":121, "y":61}, + {"matrix":[5, 11], "flags":1, "x":133, "y":61}, + {"matrix":[5, 12], "flags":1, "x":145, "y":61}, + {"matrix":[5, 13], "flags":1, "x":160, "y":64}, + {"matrix":[5, 14], "flags":1, "x":172, "y":64}, + {"matrix":[5, 15], "flags":1, "x":184, "y":64}, + {"matrix":[5, 16], "flags":4, "x":200, "y":61}, + {"matrix":[5, 17], "flags":4, "x":212, "y":61}, + {"matrix":[5, 5], "flags":4, "x":224, "y":55} + ] } } diff --git a/keyboards/keychron/q5/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q5/ansi_encoder/keymaps/default/keymap.c index c9079b53fff5..be64346b7d5e 100644 --- a/keyboards/keychron/q5/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q5/ansi_encoder/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_98( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_98( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/keymap.c index 62446674fe00..f67d16cd82ac 100644 --- a/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_98( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -66,12 +66,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q5/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q5/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q5/ansi_encoder/keymaps/via/keymap.c index c9079b53fff5..be64346b7d5e 100644 --- a/keyboards/keychron/q5/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q5/ansi_encoder/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_98( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_98( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/ansi_encoder/rules.mk b/keyboards/keychron/q5/ansi_encoder/rules.mk index 7da353fbd162..6e7633bfe015 100644 --- a/keyboards/keychron/q5/ansi_encoder/rules.mk +++ b/keyboards/keychron/q5/ansi_encoder/rules.mk @@ -1,22 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q5/config.h b/keyboards/keychron/q5/config.h index bf25cb7441f7..ade361dd9e91 100644 --- a/keyboards/keychron/q5/config.h +++ b/keyboards/keychron/q5/config.h @@ -16,24 +16,12 @@ #pragma once -/* Key matrix size */ -#define MATRIX_ROWS 6 -#define MATRIX_COLS 18 - -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION ROW2COL - /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 #define DRIVER_ADDR_2 0b1110100 +/* Set LED driver current */ #define CKLED2001_CURRENT_TUNE \ { 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56 } @@ -53,51 +41,17 @@ // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES + +/* HC595 Driver Configuration */ +#define HC595_STCP A0 +#define HC595_SHCP A1 +#define HC595_DS C15 +#define HC595_START_INDEX 10 +#define HC595_END_INDEX 17 + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q5/halconf.h b/keyboards/keychron/q5/halconf.h index 41bddcb2799b..463d177eabc7 100644 --- a/keyboards/keychron/q5/halconf.h +++ b/keyboards/keychron/q5/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q5/info.json b/keyboards/keychron/q5/info.json new file mode 100644 index 000000000000..dc238bdc5188 --- /dev/null +++ b/keyboards/keychron/q5/info.json @@ -0,0 +1,53 @@ +{ + "keyboard_name": "Keychron Q5", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + } + } +} diff --git a/keyboards/keychron/q5/iso/config.h b/keyboards/keychron/q5/iso/config.h index df775f11f1f8..f307c70f32c3 100644 --- a/keyboards/keychron/q5/iso/config.h +++ b/keyboards/keychron/q5/iso/config.h @@ -17,12 +17,10 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 55 -#define DRIVER_2_LED_TOTAL 46 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 101 /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 53 /* Enable num-lock LED */ -// #define NUM_LOCK_LED_INDEX 33 +#define NUM_LOCK_LED_INDEX 33 diff --git a/keyboards/keychron/q5/iso/info.json b/keyboards/keychron/q5/iso/info.json index 3b0b2ea1a069..85c61e29da87 100644 --- a/keyboards/keychron/q5/iso/info.json +++ b/keyboards/keychron/q5/iso/info.json @@ -1,18 +1,8 @@ { - "keyboard_name": "Keychron Q5", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0152", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_101": { "layout": [ @@ -124,5 +114,115 @@ {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":12, "y":0}, + {"matrix":[0, 2], "flags":1, "x":24, "y":0}, + {"matrix":[0, 3], "flags":1, "x":36, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":60, "y":0}, + {"matrix":[0, 6], "flags":1, "x":72, "y":0}, + {"matrix":[0, 7], "flags":1, "x":85, "y":0}, + {"matrix":[0, 8], "flags":1, "x":97, "y":0}, + {"matrix":[0, 9], "flags":1, "x":109, "y":0}, + {"matrix":[0, 10], "flags":1, "x":121, "y":0}, + {"matrix":[0, 11], "flags":1, "x":133, "y":0}, + {"matrix":[0, 12], "flags":1, "x":145, "y":0}, + {"matrix":[0, 13], "flags":1, "x":157, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":188, "y":0}, + {"matrix":[0, 16], "flags":1, "x":200, "y":0}, + {"matrix":[0, 17], "flags":1, "x":212, "y":0}, + {"matrix":[3, 12], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":12, "y":15}, + {"matrix":[1, 2], "flags":4, "x":24, "y":15}, + {"matrix":[1, 3], "flags":4, "x":36, "y":15}, + {"matrix":[1, 4], "flags":4, "x":48, "y":15}, + {"matrix":[1, 5], "flags":4, "x":60, "y":15}, + {"matrix":[1, 6], "flags":4, "x":72, "y":15}, + {"matrix":[1, 7], "flags":4, "x":84, "y":15}, + {"matrix":[1, 8], "flags":4, "x":97, "y":15}, + {"matrix":[1, 9], "flags":4, "x":109, "y":15}, + {"matrix":[1, 10], "flags":4, "x":121, "y":15}, + {"matrix":[1, 11], "flags":4, "x":133, "y":15}, + {"matrix":[1, 12], "flags":4, "x":145, "y":15}, + {"matrix":[1, 13], "flags":1, "x":163, "y":15}, + {"matrix":[1, 15], "flags":8, "x":188, "y":15}, + {"matrix":[1, 16], "flags":4, "x":200, "y":15}, + {"matrix":[1, 17], "flags":4, "x":212, "y":15}, + {"matrix":[3, 14], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":26}, + {"matrix":[2, 1], "flags":4, "x":18, "y":26}, + {"matrix":[2, 2], "flags":4, "x":30, "y":26}, + {"matrix":[2, 3], "flags":4, "x":42, "y":26}, + {"matrix":[2, 4], "flags":4, "x":54, "y":26}, + {"matrix":[2, 5], "flags":4, "x":66, "y":26}, + {"matrix":[2, 6], "flags":4, "x":78, "y":26}, + {"matrix":[2, 7], "flags":4, "x":91, "y":26}, + {"matrix":[2, 8], "flags":4, "x":103, "y":26}, + {"matrix":[2, 9], "flags":4, "x":115, "y":26}, + {"matrix":[2, 10], "flags":4, "x":127, "y":26}, + {"matrix":[2, 11], "flags":4, "x":139, "y":26}, + {"matrix":[2, 12], "flags":4, "x":151, "y":26}, + {"matrix":[2, 15], "flags":4, "x":188, "y":26}, + {"matrix":[2, 16], "flags":4, "x":200, "y":26}, + {"matrix":[2, 17], "flags":4, "x":212, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":38}, + {"matrix":[3, 1], "flags":4, "x":21, "y":38}, + {"matrix":[3, 2], "flags":4, "x":33, "y":38}, + {"matrix":[3, 3], "flags":4, "x":45, "y":38}, + {"matrix":[3, 4], "flags":4, "x":57, "y":38}, + {"matrix":[3, 5], "flags":4, "x":69, "y":38}, + {"matrix":[3, 6], "flags":4, "x":81, "y":38}, + {"matrix":[3, 7], "flags":4, "x":94, "y":38}, + {"matrix":[3, 8], "flags":4, "x":106, "y":38}, + {"matrix":[3, 9], "flags":4, "x":118, "y":38}, + {"matrix":[3, 10], "flags":4, "x":130, "y":38}, + {"matrix":[3, 11], "flags":4, "x":142, "y":38}, + {"matrix":[3, 13], "flags":1, "x":154, "y":38}, + {"matrix":[2, 13], "flags":1, "x":170, "y":34}, + {"matrix":[3, 15], "flags":4, "x":188, "y":38}, + {"matrix":[3, 16], "flags":4, "x":200, "y":38}, + {"matrix":[3, 17], "flags":4, "x":212, "y":38}, + {"matrix":[2, 14], "flags":4, "x":224, "y":32}, + + {"matrix":[4, 0], "flags":1, "x":3, "y":49}, + {"matrix":[4, 1], "flags":1, "x":15, "y":49}, + {"matrix":[4, 2], "flags":4, "x":27, "y":49}, + {"matrix":[4, 3], "flags":4, "x":39, "y":49}, + {"matrix":[4, 4], "flags":4, "x":51, "y":49}, + {"matrix":[4, 5], "flags":4, "x":63, "y":49}, + {"matrix":[4, 6], "flags":4, "x":75, "y":49}, + {"matrix":[4, 7], "flags":4, "x":88, "y":49}, + {"matrix":[4, 8], "flags":4, "x":100, "y":49}, + {"matrix":[4, 9], "flags":4, "x":112, "y":49}, + {"matrix":[4, 10], "flags":4, "x":124, "y":49}, + {"matrix":[4, 11], "flags":4, "x":136, "y":49}, + {"matrix":[4, 13], "flags":1, "x":152, "y":49}, + {"matrix":[4, 14], "flags":1, "x":172, "y":52}, + {"matrix":[4, 15], "flags":4, "x":188, "y":49}, + {"matrix":[4, 16], "flags":4, "x":200, "y":49}, + {"matrix":[4, 17], "flags":4, "x":212, "y":49}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":61}, + {"matrix":[5, 1], "flags":1, "x":17, "y":61}, + {"matrix":[5, 2], "flags":1, "x":32, "y":61}, + {"matrix":[5, 6], "flags":4, "x":77, "y":61}, + {"matrix":[5, 10], "flags":1, "x":121, "y":61}, + {"matrix":[5, 11], "flags":1, "x":133, "y":61}, + {"matrix":[5, 12], "flags":1, "x":145, "y":61}, + {"matrix":[5, 13], "flags":1, "x":160, "y":64}, + {"matrix":[5, 14], "flags":1, "x":172, "y":64}, + {"matrix":[5, 15], "flags":1, "x":184, "y":64}, + {"matrix":[5, 16], "flags":4, "x":200, "y":61}, + {"matrix":[5, 17], "flags":4, "x":212, "y":61}, + {"matrix":[5, 5], "flags":4, "x":224, "y":55} + ] } } diff --git a/keyboards/keychron/q5/iso/iso.c b/keyboards/keychron/q5/iso/iso.c index 65924abd76ec..e25db33bd5fc 100644 --- a/keyboards/keychron/q5/iso/iso.c +++ b/keyboards/keychron/q5/iso/iso.c @@ -16,10 +16,9 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -134,37 +133,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_2, J_2, K_2}, {1, L_7, J_7, K_7} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, - { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, __, 33, 34, 35 }, - { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 66, 70, 50, 51, 52 }, - { 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 18, 65, 36, 67, 68, 69 }, - { 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, __, 83, 84, 85, 86, 87 }, - { 88, 89, 90, __, __, 100, 91, __, __, __, 92, 93, 94, 95, 96, 97, 98, 99 }, - }, - { - // LED Index to Physical Position - {0,0}, {12,0}, {24,0}, {36,0}, {48,0}, {60,0}, {72,0}, {85,0}, {97,0}, {109,0}, {121,0}, {133,0}, {145,0}, {157,0}, {169,0}, {188,0}, {200,0}, {212,0}, {224,0}, - {0,15}, {12,15}, {24,15}, {36,15}, {48,15}, {60,15}, {72,15}, {85,15}, {97,15}, {109,15}, {121,15}, {133,15}, {145,15}, {163,15}, {188,15}, {200,15}, {212,15}, {224,15}, - {3,26}, {18,26}, {30,26}, {42,26}, {54,26}, {66,26}, {78,26}, {91,26}, {103,26}, {115,26}, {127,26}, {139,26}, {151,26}, {188,26}, {200,26}, {212,26}, - {5,38}, {21,38}, {33,38}, {45,38}, {57,38}, {69,38}, {81,38}, {94,38}, {106,38}, {118,38}, {130,38}, {142,38}, {154,38}, {170,34}, {188,38}, {200,38}, {212,38}, {224,32}, - {3,49}, {15,49}, {27,49}, {39,49}, {51,49}, {63,49}, {75,49}, {88,49}, {100,49}, {112,49}, {124,49}, {136,49}, {152,49}, {172,52}, {188,49}, {200,49}, {212,49}, - {1,61}, {17,61}, {32,61}, {77,61}, {121,61}, {133,61}, {145,61}, {160,64}, {172,64}, {184,64}, {200,61}, {212,61}, {224,55}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 4, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q5/iso/keymaps/default/keymap.c b/keyboards/keychron/q5/iso/keymaps/default/keymap.c index 6b0214d4d692..ffaa90721eab 100644 --- a/keyboards/keychron/q5/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q5/iso/keymaps/default/keymap.c @@ -16,18 +16,21 @@ #include QMK_KEYBOARD_H -// clang-format off -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_101( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,12 +51,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_101( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; - -// clang-format on diff --git a/keyboards/keychron/q5/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q5/iso/keymaps/keychron/keymap.c index a96063512fdd..b48bbff4e419 100644 --- a/keyboards/keychron/q5/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q5/iso/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_101( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -57,12 +57,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q5/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q5/iso/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q5/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q5/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q5/iso/keymaps/via/keymap.c b/keyboards/keychron/q5/iso/keymaps/via/keymap.c index ae1d483cf747..ffaa90721eab 100644 --- a/keyboards/keychron/q5/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q5/iso/keymaps/via/keymap.c @@ -16,18 +16,21 @@ #include QMK_KEYBOARD_H -// clang-format off -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_101( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_101( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/iso/rules.mk b/keyboards/keychron/q5/iso/rules.mk index e859eb9c34c6..6e7633bfe015 100644 --- a/keyboards/keychron/q5/iso/rules.mk +++ b/keyboards/keychron/q5/iso/rules.mk @@ -1,21 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q5/iso_encoder/config.h b/keyboards/keychron/q5/iso_encoder/config.h index 3a786cbb39be..ac5f39545b9b 100644 --- a/keyboards/keychron/q5/iso_encoder/config.h +++ b/keyboards/keychron/q5/iso_encoder/config.h @@ -17,15 +17,15 @@ #pragma once /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 53 -#define DRIVER_2_LED_TOTAL 46 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 89 -/* Encoder Configuration */ -#define ENCODER_DEFAULT_POS 0x3 +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +#endif /* Enable caps-lock LED */ #define CAPS_LOCK_LED_INDEX 51 /* Enable num-lock LED */ -// #define NUM_LOCK_LED_INDEX 31 +#define NUM_LOCK_LED_INDEX 31 diff --git a/keyboards/keychron/q5/iso_encoder/info.json b/keyboards/keychron/q5/iso_encoder/info.json index eefa6dc69306..8d55b060e583 100644 --- a/keyboards/keychron/q5/iso_encoder/info.json +++ b/keyboards/keychron/q5/iso_encoder/info.json @@ -1,23 +1,16 @@ { - "keyboard_name": "Keychron Q5", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0153", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "C14", "pin_b": "A2"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_99": { "layout": [ @@ -127,5 +120,113 @@ {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 2], "flags":1, "x":24, "y":0}, + {"matrix":[0, 3], "flags":1, "x":36, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":60, "y":0}, + {"matrix":[0, 7], "flags":1, "x":78, "y":0}, + {"matrix":[0, 8], "flags":1, "x":90, "y":0}, + {"matrix":[0, 9], "flags":1, "x":103, "y":0}, + {"matrix":[0, 10], "flags":1, "x":115, "y":0}, + {"matrix":[0, 11], "flags":1, "x":133, "y":0}, + {"matrix":[0, 12], "flags":1, "x":145, "y":0}, + {"matrix":[0, 13], "flags":1, "x":157, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":184, "y":0}, + {"matrix":[0, 16], "flags":1, "x":196, "y":0}, + {"matrix":[0, 17], "flags":1, "x":208, "y":0}, + {"matrix":[3, 12], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":12, "y":15}, + {"matrix":[1, 2], "flags":4, "x":24, "y":15}, + {"matrix":[1, 3], "flags":4, "x":36, "y":15}, + {"matrix":[1, 4], "flags":4, "x":48, "y":15}, + {"matrix":[1, 5], "flags":4, "x":60, "y":15}, + {"matrix":[1, 6], "flags":4, "x":72, "y":15}, + {"matrix":[1, 7], "flags":4, "x":84, "y":15}, + {"matrix":[1, 8], "flags":4, "x":97, "y":15}, + {"matrix":[1, 9], "flags":4, "x":109, "y":15}, + {"matrix":[1, 10], "flags":4, "x":121, "y":15}, + {"matrix":[1, 11], "flags":4, "x":133, "y":15}, + {"matrix":[1, 12], "flags":4, "x":145, "y":15}, + {"matrix":[1, 13], "flags":1, "x":163, "y":15}, + {"matrix":[1, 15], "flags":8, "x":188, "y":15}, + {"matrix":[1, 16], "flags":4, "x":200, "y":15}, + {"matrix":[1, 17], "flags":4, "x":212, "y":15}, + {"matrix":[3, 14], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":26}, + {"matrix":[2, 1], "flags":4, "x":18, "y":26}, + {"matrix":[2, 2], "flags":4, "x":30, "y":26}, + {"matrix":[2, 3], "flags":4, "x":42, "y":26}, + {"matrix":[2, 4], "flags":4, "x":54, "y":26}, + {"matrix":[2, 5], "flags":4, "x":66, "y":26}, + {"matrix":[2, 6], "flags":4, "x":78, "y":26}, + {"matrix":[2, 7], "flags":4, "x":91, "y":26}, + {"matrix":[2, 8], "flags":4, "x":103, "y":26}, + {"matrix":[2, 9], "flags":4, "x":115, "y":26}, + {"matrix":[2, 10], "flags":4, "x":127, "y":26}, + {"matrix":[2, 11], "flags":4, "x":139, "y":26}, + {"matrix":[2, 12], "flags":4, "x":151, "y":26}, + {"matrix":[2, 15], "flags":4, "x":188, "y":26}, + {"matrix":[2, 16], "flags":4, "x":200, "y":26}, + {"matrix":[2, 17], "flags":4, "x":212, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":38}, + {"matrix":[3, 1], "flags":4, "x":21, "y":38}, + {"matrix":[3, 2], "flags":4, "x":33, "y":38}, + {"matrix":[3, 3], "flags":4, "x":45, "y":38}, + {"matrix":[3, 4], "flags":4, "x":57, "y":38}, + {"matrix":[3, 5], "flags":4, "x":69, "y":38}, + {"matrix":[3, 6], "flags":4, "x":81, "y":38}, + {"matrix":[3, 7], "flags":4, "x":94, "y":38}, + {"matrix":[3, 8], "flags":4, "x":106, "y":38}, + {"matrix":[3, 9], "flags":4, "x":118, "y":38}, + {"matrix":[3, 10], "flags":4, "x":130, "y":38}, + {"matrix":[3, 11], "flags":4, "x":142, "y":38}, + {"matrix":[3, 13], "flags":1, "x":154, "y":38}, + {"matrix":[2, 13], "flags":1, "x":170, "y":34}, + {"matrix":[3, 15], "flags":4, "x":188, "y":38}, + {"matrix":[3, 16], "flags":4, "x":200, "y":38}, + {"matrix":[3, 17], "flags":4, "x":212, "y":38}, + {"matrix":[2, 14], "flags":4, "x":224, "y":32}, + + {"matrix":[4, 0], "flags":1, "x":3, "y":49}, + {"matrix":[4, 1], "flags":1, "x":15, "y":49}, + {"matrix":[4, 2], "flags":4, "x":27, "y":49}, + {"matrix":[4, 3], "flags":4, "x":39, "y":49}, + {"matrix":[4, 4], "flags":4, "x":51, "y":49}, + {"matrix":[4, 5], "flags":4, "x":63, "y":49}, + {"matrix":[4, 6], "flags":4, "x":75, "y":49}, + {"matrix":[4, 7], "flags":4, "x":88, "y":49}, + {"matrix":[4, 8], "flags":4, "x":100, "y":49}, + {"matrix":[4, 9], "flags":4, "x":112, "y":49}, + {"matrix":[4, 10], "flags":4, "x":124, "y":49}, + {"matrix":[4, 11], "flags":4, "x":136, "y":49}, + {"matrix":[4, 13], "flags":1, "x":152, "y":49}, + {"matrix":[4, 14], "flags":1, "x":172, "y":52}, + {"matrix":[4, 15], "flags":4, "x":188, "y":49}, + {"matrix":[4, 16], "flags":4, "x":200, "y":49}, + {"matrix":[4, 17], "flags":4, "x":212, "y":49}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":61}, + {"matrix":[5, 1], "flags":1, "x":17, "y":61}, + {"matrix":[5, 2], "flags":1, "x":32, "y":61}, + {"matrix":[5, 6], "flags":4, "x":77, "y":61}, + {"matrix":[5, 10], "flags":1, "x":121, "y":61}, + {"matrix":[5, 11], "flags":1, "x":133, "y":61}, + {"matrix":[5, 12], "flags":1, "x":145, "y":61}, + {"matrix":[5, 13], "flags":1, "x":160, "y":64}, + {"matrix":[5, 14], "flags":1, "x":172, "y":64}, + {"matrix":[5, 15], "flags":1, "x":184, "y":64}, + {"matrix":[5, 16], "flags":4, "x":200, "y":61}, + {"matrix":[5, 17], "flags":4, "x":212, "y":61}, + {"matrix":[5, 5], "flags":4, "x":224, "y":55} + ] } } diff --git a/keyboards/keychron/q5/iso_encoder/iso_encoder.c b/keyboards/keychron/q5/iso_encoder/iso_encoder.c index 22ba9e2d4ee7..b6978757d9fb 100644 --- a/keyboards/keychron/q5/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q5/iso_encoder/iso_encoder.c @@ -16,10 +16,9 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -132,37 +131,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_2, J_2, K_2}, {1, L_7, J_7, K_7} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, __, 1, 2, 3, 4, __, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, - { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, __, 31, 32, 33 }, - { 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 64, 68, 48, 49, 50 }, - { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 16, 63, 34, 65, 66, 67 }, - { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, __, 81, 82, 83, 84, 85 }, - { 86, 87, 88, __, __, 98, 89, __, __, __, 90, 91, 92, 93, 94, 95, 96, 97 }, - }, - { - // LED Index to Physical Position - {0,0}, {24,0}, {36,0}, {48,0}, {60,0}, {78,0}, {90,0}, {103,0}, {115,0}, {133,0}, {145,0}, {157,0}, {169,0}, {184,0}, {196,0}, {208,0}, {224,0}, - {0,15}, {12,15}, {24,15}, {36,15}, {48,15}, {60,15}, {72,15}, {85,15}, {97,15}, {109,15}, {121,15}, {133,15}, {145,15}, {163,15}, {188,15}, {200,15}, {212,15}, {224,15}, - {3,26}, {18,26}, {30,26}, {42,26}, {54,26}, {66,26}, {78,26}, {91,26}, {103,26}, {115,26}, {127,26}, {139,26}, {151,26}, {188,26}, {200,26}, {212,26}, - {5,38}, {21,38}, {33,38}, {45,38}, {57,38}, {69,38}, {81,38}, {94,38}, {106,38}, {118,38}, {130,38}, {142,38}, {154,38}, {170,34}, {188,38}, {200,38}, {212,38}, {224,32}, - {3,49}, {15,49}, {27,49}, {39,49}, {51,49}, {63,49}, {75,49}, {88,49}, {100,49}, {112,49}, {124,49}, {136,49}, {152,49}, {172,52}, {188,49}, {200,49}, {212,49}, - {1,61}, {17,61}, {32,61}, {77,61}, {121,61}, {133,61}, {145,61}, {160,64}, {172,64}, {184,64}, {200,61}, {212,61}, {224,55}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 4, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q5/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q5/iso_encoder/keymaps/default/keymap.c index e1f3d93212ec..c16a4459f7d1 100644 --- a/keyboards/keychron/q5/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q5/iso_encoder/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_99( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_99( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q5/iso_encoder/keymaps/keychron/keymap.c index 95dbb282c243..0ba707a685c7 100644 --- a/keyboards/keychron/q5/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q5/iso_encoder/keymaps/keychron/keymap.c @@ -16,19 +16,20 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_99( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -66,12 +67,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -// clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } - + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/q5/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q5/iso_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q5/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q5/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q5/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q5/iso_encoder/keymaps/via/keymap.c index 9446d048397a..d7ea6600af7a 100644 --- a/keyboards/keychron/q5/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q5/iso_encoder/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_99( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_99( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q5/iso_encoder/rules.mk b/keyboards/keychron/q5/iso_encoder/rules.mk index 7da353fbd162..6e7633bfe015 100644 --- a/keyboards/keychron/q5/iso_encoder/rules.mk +++ b/keyboards/keychron/q5/iso_encoder/rules.mk @@ -1,22 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q5/matrix.c b/keyboards/keychron/q5/matrix.c deleted file mode 100644 index 28ef877504a8..000000000000 --- a/keyboards/keychron/q5/matrix.c +++ /dev/null @@ -1,209 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "matrix.h" -#include "quantum.h" - -// Pin connected to DS of 74HC595 -#define DATA_PIN C15 -// Pin connected to SH_CP of 74HC595 -#define CLOCK_PIN A1 -// Pin connected to ST_CP of 74HC595 -#define LATCH_PIN A0 - -#ifdef MATRIX_ROW_PINS -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -#endif // MATRIX_ROW_PINS -#ifdef MATRIX_COL_PINS -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif // MATRIX_COL_PINS - -#define ROWS_PER_HAND (MATRIX_ROWS) - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - -static inline uint8_t readMatrixPin(pin_t pin) { - if (pin != NO_PIN) { - return readPin(pin); - } else { - return 1; - } -} - -static void shiftOut(uint8_t dataOut) { - for (uint8_t i = 0; i < 8; i++) { - if (dataOut & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - dataOut = dataOut >> 1; - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - } - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static void shiftout_single(uint8_t data) { - if (data & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { - setPinOutput_writeLow(pin); - return true; - } else { - if (col == 10) { - shiftout_single(0x00); - } else { - shiftout_single(0x01); - } - return true; - } - return false; -} - -static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - if (col == (MATRIX_COLS - 1)) - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); - } -} - -static void unselect_cols(void) { - // unselect column pins - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } - if (x == (MATRIX_COLS - 1)) - // unselect shift Register - shiftOut(0xFF); - } -} - -static void matrix_init_pins(void) { - unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); - } - } -} - -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col - } - - if (current_col < 10) { - matrix_output_select_delay(); - } else { - for (int8_t cycle = 4; cycle > 0; cycle--) { - matrix_output_select_delay(); // 0.25us - matrix_output_select_delay(); - matrix_output_select_delay(); - matrix_output_select_delay(); - } - } - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_matrix[row_index] |= row_shifter; - key_pressed = true; - } else { - // Pin HI, clear col bit - current_matrix[row_index] &= ~row_shifter; - } - - } - - // // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH -} - -void matrix_init_custom(void) { - // initialize key pins - matrix_init_pins(); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; - - // Set col, read rows - matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); - } - - bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); - - return changed; -} diff --git a/keyboards/keychron/q5/q5.c b/keyboards/keychron/q5/q5.c index 7a1cabcd1a5b..9e8a093d9a2b 100644 --- a/keyboards/keychron/q5/q5.c +++ b/keyboards/keychron/q5/q5.c @@ -38,59 +38,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && (defined(CAPS_LOCK_LED_INDEX) || defined(NUM_LOCK_LED_INDEX)) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { -# ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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 - } - 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; } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); -# if defined(CAPS_LOCK_LED_INDEX) - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } -# endif // CAPS_LOCK_LED_INDEX -# if defined(NUM_LOCK_LED_INDEX) - if (host_keyboard_led_state().num_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 0, 0, 0); - } - } -# endif // NUM_LOCK_LED_INDEX - return true; -} - -#endif // RGB_MATRIX_ENABLE... diff --git a/keyboards/keychron/q5/readme.md b/keyboards/keychron/q5/readme.md index ac598392589d..839338a7a406 100644 --- a/keyboards/keychron/q5/readme.md +++ b/keyboards/keychron/q5/readme.md @@ -1,19 +1,32 @@ # Keychron Q5 +![Keychron Q5](https://i.imgur.com/hgBjdtT.jpg) + A customizable 96% keyboard. * Keyboard Maintainer: [Keychron](https://github.com/keychron) * Hardware Supported: Keychron Q5 -* Hardware Availability: [Keychron](https://www.keychron.com) +* Hardware Availability: [Keychron Q5 QMK Custom Mechanical Keyboard](https://www.keychron.com/products/keychron-q5-qmk-custom-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): make keychron/q5/ansi:default + make keychron/q5/ansi_encoder:default + make keychron/q5/iso:default + make keychron/q5/iso_encoder:default Flashing example for this keyboard: make keychron/q5/ansi:default:flash + make keychron/q5/ansi_encoder:default:flash + make keychron/q5/iso:default:flash + make keychron/q5/iso_encoder:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q5/rules.mk b/keyboards/keychron/q5/rules.mk new file mode 100755 index 000000000000..a515de570cd8 --- /dev/null +++ b/keyboards/keychron/q5/rules.mk @@ -0,0 +1,2 @@ +VPATH += $(TOP_DIR)/keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/q6/ansi/ansi.c b/keyboards/keychron/q6/ansi/ansi.c index a81d5f9e9fb5..5c698cba1e79 100644 --- a/keyboards/keychron/q6/ansi/ansi.c +++ b/keyboards/keychron/q6/ansi/ansi.c @@ -16,10 +16,8 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off - +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -141,37 +139,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_12, J_12, K_12}, {1, L_9, J_9, K_9}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14, 15, 39, 40, 16 }, - { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 17 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 18 }, - { 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, __, 73, 60, 77, 76, 74, 75, 19 }, - { 78, __, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, __, 89, 93, 90, 107, 91, 92, __ }, - { 94, 95, 96, __, __, __, 97, __, __, __, 98, 99, 100, 101, 102, 103, 104, 105, 106, __ }, - }, - { - // LED Index to Physical Position - {0,0}, {21,0}, {31,0}, {42,0}, {52,0}, {68,0}, {78,0}, {89,0}, {99,0}, {115,0}, {125,0}, {136,0}, {146,0}, {159,0}, {169,0}, {180,0}, {193,0}, {203,0}, {214,0}, {224,0}, - {0,15}, {10,15}, {21,15}, {31,15}, {42,15}, {52,15}, {63,15}, {73,15}, {83,15}, {94,15}, {104,15}, {115,15}, {125,15}, {141,15}, {159,15}, {169,15}, {180,15}, {193,15}, {203,15}, {214,15}, {224,15}, - {3,27}, {16,27}, {26,27}, {36,27}, {47,27}, {57,27}, {68,27}, {78,27}, {89,27}, {99,27}, {109,27}, {120,27}, {130,27}, {143,27}, {159,27}, {169,27}, {180,27}, {193,27}, {203,27}, {214,27}, - {4,40}, {18,40}, {29,40}, {39,40}, {50,40}, {60,40}, {70,40}, {81,40}, {91,40}, {102,40}, {112,40}, {123,40}, {139,40}, {193,40}, {203,40}, {214,40}, {224,34}, - {7,52}, {23,52}, {34,52}, {44,52}, {55,52}, {65,52}, {76,52}, {86,52}, {96,52}, {107,52}, {117,52}, {137,52}, {169,52}, {193,52}, {203,52}, {214,52}, - {1,64}, {14,64}, {27,64}, {66,64}, {105,64}, {118,64}, {131,64}, {145,64}, {159,64}, {169,64}, {180,64}, {198,64}, {214,64}, {224,58}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q6/ansi/config.h b/keyboards/keychron/q6/ansi/config.h index 703da35636f1..a149902333e3 100644 --- a/keyboards/keychron/q6/ansi/config.h +++ b/keyboards/keychron/q6/ansi/config.h @@ -16,21 +16,15 @@ #pragma once -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, A2, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, C14 } -#define NO_PIN_START 11 -#define NO_PIN_OFFSET 1 - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 60 -#define DRIVER_2_LED_TOTAL 48 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 108 /* Enable caps-lock LED*/ #define CAPS_LOCK_LED_INDEX 61 /* Enable NUM_LOCK_LED_INDEX */ -// #define NUM_LOCK_LED_INDEX 37 +#define NUM_LOCK_LED_INDEX 37 + +/* HC595 Driver Configuration */ +#define HC595_START_INDEX 11 +#define HC595_END_INDEX 18 diff --git a/keyboards/keychron/q6/ansi/info.json b/keyboards/keychron/q6/ansi/info.json index fdec220e80c3..061974269842 100644 --- a/keyboards/keychron/q6/ansi/info.json +++ b/keyboards/keychron/q6/ansi/info.json @@ -1,18 +1,14 @@ { - "keyboard_name": "Keychron Q6", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0160", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", null, null, null, null, null, null, null, null, "C14"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_108": { "layout": [ @@ -131,5 +127,122 @@ {"matrix": [4, 16], "x": 21.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":159, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + {"matrix":[0, 19], "flags":1, "x":193, "y":0}, + {"matrix":[1, 19], "flags":1, "x":203, "y":0}, + {"matrix":[2, 19], "flags":1, "x":214, "y":0}, + {"matrix":[3, 19], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":8, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[0, 17], "flags":4, "x":214, "y":15}, + {"matrix":[0, 18], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 13], "flags":1, "x":143, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[3, 14], "flags":4, "x":214, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":139, "y":40}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 16], "flags":4, "x":214, "y":40}, + {"matrix":[3, 15], "flags":4, "x":224, "y":34}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 14], "flags":4, "x":214, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64}, + {"matrix":[4, 16], "flags":4, "x":224, "y":58} + ] } } diff --git a/keyboards/keychron/q6/ansi/keymaps/default/keymap.c b/keyboards/keychron/q6/ansi/keymaps/default/keymap.c index 19bab1ee378b..e65076d9aa1d 100644 --- a/keyboards/keychron/q6/ansi/keymaps/default/keymap.c +++ b/keyboards/keychron/q6/ansi/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_108( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_108( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/q6/ansi/keymaps/keychron/keymap.c index 2ae53ecb632f..9ea98681a419 100644 --- a/keyboards/keychron/q6/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q6/ansi/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_108( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -57,16 +57,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q6/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/q6/ansi/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q6/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q6/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q6/ansi/keymaps/via/keymap.c b/keyboards/keychron/q6/ansi/keymaps/via/keymap.c index 19bab1ee378b..3457f8ef1342 100644 --- a/keyboards/keychron/q6/ansi/keymaps/via/keymap.c +++ b/keyboards/keychron/q6/ansi/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_108( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_108( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/ansi/rules.mk b/keyboards/keychron/q6/ansi/rules.mk index ec47b77d0f64..6e7633bfe015 100644 --- a/keyboards/keychron/q6/ansi/rules.mk +++ b/keyboards/keychron/q6/ansi/rules.mk @@ -1,22 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q6/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q6/ansi_encoder/ansi_encoder.c index 6fbece3678a1..5c698cba1e79 100644 --- a/keyboards/keychron/q6/ansi_encoder/ansi_encoder.c +++ b/keyboards/keychron/q6/ansi_encoder/ansi_encoder.c @@ -16,10 +16,8 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off - +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -141,37 +139,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_12, J_12, K_12}, {1, L_9, J_9, K_9}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14, 15, 39, 40, 16 }, - { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 17 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 18 }, - { 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, __, 73, 60, 77, 76, 74, 75, 19 }, - { 78, __, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, __, 89, 93, 90, 107, 91, 92, __ }, - { 94, 95, 96, __, __, __, 97, __, __, __, 98, 99, 100, 101, 102, 103, 104, 105, 106, __ }, - }, - { - // LED Index to Physical Position - {0,0}, {13,0}, {24,0}, {34,0}, {45,0}, {57,0}, {68,0}, {78,0}, {89,0}, {102,0}, {112,0}, {123,0}, {133,0}, {159,0}, {169,0}, {180,0}, {193,0}, {203,0}, {214,0}, {224,0}, - {0,15}, {10,15}, {21,15}, {31,15}, {42,15}, {52,15}, {63,15}, {73,15}, {83,15}, {94,15}, {104,15}, {115,15}, {125,15}, {141,15}, {159,15}, {169,15}, {180,15}, {193,15}, {203,15}, {214,15}, {224,15}, - {3,27}, {16,27}, {26,27}, {36,27}, {47,27}, {57,27}, {68,27}, {78,27}, {89,27}, {99,27}, {109,27}, {120,27}, {130,27}, {143,27}, {159,27}, {169,27}, {180,27}, {193,27}, {203,27}, {214,27}, - {4,40}, {18,40}, {29,40}, {39,40}, {50,40}, {60,40}, {70,40}, {81,40}, {91,40}, {102,40}, {112,40}, {123,40}, {139,40}, {193,40}, {203,40}, {214,40}, {224,34}, - {7,52}, {23,52}, {34,52}, {44,52}, {55,52}, {65,52}, {76,52}, {86,52}, {96,52}, {107,52}, {117,52}, {137,52}, {169,52}, {193,52}, {203,52}, {214,52}, - {1,64}, {14,64}, {27,64}, {66,64}, {105,64}, {118,64}, {131,64}, {145,64}, {159,64}, {169,64}, {180,64}, {198,64}, {214,64}, {224,58}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q6/ansi_encoder/config.h b/keyboards/keychron/q6/ansi_encoder/config.h index 573fa614a321..a0f1a04406a9 100644 --- a/keyboards/keychron/q6/ansi_encoder/config.h +++ b/keyboards/keychron/q6/ansi_encoder/config.h @@ -16,19 +16,8 @@ #pragma once -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } -#define NO_PIN_START 10 -#define NO_PIN_NUM 10 -#define CLR_REG_VAL 0x3FF - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 60 -#define DRIVER_2_LED_TOTAL 48 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 108 /* Encoder Configuration */ #define ENCODER_DEFAULT_POS 0x3 @@ -37,4 +26,8 @@ #define CAPS_LOCK_LED_INDEX 61 /* Enable NUM_LOCK_LED_INDEX */ -// #define NUM_LOCK_LED_INDEX 37 +#define NUM_LOCK_LED_INDEX 37 + +/* HC595 Driver Configuration */ +#define HC595_START_INDEX 10 +#define HC595_END_INDEX 19 diff --git a/keyboards/keychron/q6/ansi_encoder/info.json b/keyboards/keychron/q6/ansi_encoder/info.json index df3902f44abf..3badb39473da 100644 --- a/keyboards/keychron/q6/ansi_encoder/info.json +++ b/keyboards/keychron/q6/ansi_encoder/info.json @@ -1,23 +1,22 @@ { - "keyboard_name": "Keychron Q6", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0161", - "device_version": "1.0.0" + "device_version": "1.0.5" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", null, null, null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "C14", "pin_b": "A2"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_109": { "layout": [ @@ -65,77 +64,194 @@ {"matrix": [0, 17], "x": 20.5, "y": 1.25}, {"matrix": [0, 18], "x": 21.5, "y": 1.25}, - {"matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, - {"matrix": [2, 1], "x": 1.5, "y": 2.25}, - {"matrix": [2, 2], "x": 2.5, "y": 2.25}, - {"matrix": [2, 3], "x": 3.5, "y": 2.25}, - {"matrix": [2, 4], "x": 4.5, "y": 2.25}, - {"matrix": [2, 5], "x": 5.5, "y": 2.25}, - {"matrix": [2, 6], "x": 6.5, "y": 2.25}, - {"matrix": [2, 7], "x": 7.5, "y": 2.25}, - {"matrix": [2, 8], "x": 8.5, "y": 2.25}, - {"matrix": [2, 9], "x": 9.5, "y": 2.25}, - {"matrix": [2, 10], "x": 10.5, "y": 2.25}, - {"matrix": [2, 11], "x": 11.5, "y": 2.25}, - {"matrix": [2, 12], "x": 12.5, "y": 2.25}, - {"matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, - {"matrix": [2, 14], "x": 15.25, "y": 2.25}, - {"matrix": [2, 15], "x": 16.25, "y": 2.25}, - {"matrix": [2, 16], "x": 17.25, "y": 2.25}, - {"matrix": [2, 17], "x": 18.5, "y": 2.25}, - {"matrix": [2, 18], "x": 19.5, "y": 2.25}, - {"matrix": [3, 14], "x": 20.5, "y": 2.25}, + {"matrix":[2, 0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2, 1], "x":1.5, "y":2.25}, + {"matrix":[2, 2], "x":2.5, "y":2.25}, + {"matrix":[2, 3], "x":3.5, "y":2.25}, + {"matrix":[2, 4], "x":4.5, "y":2.25}, + {"matrix":[2, 5], "x":5.5, "y":2.25}, + {"matrix":[2, 6], "x":6.5, "y":2.25}, + {"matrix":[2, 7], "x":7.5, "y":2.25}, + {"matrix":[2, 8], "x":8.5, "y":2.25}, + {"matrix":[2, 9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[2,18], "x":19.5, "y":2.25}, + {"matrix":[3,14], "x":20.5, "y":2.25}, + {"matrix":[3,15], "x":21.5, "y":2.25, "h":2}, - {"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, - {"matrix": [3, 1], "x": 1.75, "y": 3.25}, - {"matrix": [3, 2], "x": 2.75, "y": 3.25}, - {"matrix": [3, 3], "x": 3.75, "y": 3.25}, - {"matrix": [3, 4], "x": 4.75, "y": 3.25}, - {"matrix": [3, 5], "x": 5.75, "y": 3.25}, - {"matrix": [3, 6], "x": 6.75, "y": 3.25}, - {"matrix": [3, 7], "x": 7.75, "y": 3.25}, - {"matrix": [3, 8], "x": 8.75, "y": 3.25}, - {"matrix": [3, 9], "x": 9.75, "y": 3.25}, - {"matrix": [3, 10], "x": 10.75, "y": 3.25}, - {"matrix": [3, 11], "x": 11.75, "y": 3.25}, - {"matrix": [3, 13], "x": 12.75, "y": 3.25, "w": 2.25}, - {"matrix": [3, 17], "x": 18.5, "y": 3.25}, - {"matrix": [3, 18], "x": 19.5, "y": 3.25}, - {"matrix": [3, 16], "x": 20.5, "y": 3.25}, - {"matrix": [3, 15], "x": 21.5, "y": 2.25, "h": 2}, + {"matrix":[3, 0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3, 1], "x":1.75, "y":3.25}, + {"matrix":[3, 2], "x":2.75, "y":3.25}, + {"matrix":[3, 3], "x":3.75, "y":3.25}, + {"matrix":[3, 4], "x":4.75, "y":3.25}, + {"matrix":[3, 5], "x":5.75, "y":3.25}, + {"matrix":[3, 6], "x":6.75, "y":3.25}, + {"matrix":[3, 7], "x":7.75, "y":3.25}, + {"matrix":[3, 8], "x":8.75, "y":3.25}, + {"matrix":[3, 9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + {"matrix":[3,18], "x":19.5, "y":3.25}, + {"matrix":[3,16], "x":20.5, "y":3.25}, - {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, - {"matrix": [4, 2], "x": 2.25, "y": 4.25}, - {"matrix": [4, 3], "x": 3.25, "y": 4.25}, - {"matrix": [4, 4], "x": 4.25, "y": 4.25}, - {"matrix": [4, 5], "x": 5.25, "y": 4.25}, - {"matrix": [4, 6], "x": 6.25, "y": 4.25}, - {"matrix": [4, 7], "x": 7.25, "y": 4.25}, - {"matrix": [4, 8], "x": 8.25, "y": 4.25}, - {"matrix": [4, 9], "x": 9.25, "y": 4.25}, - {"matrix": [4, 10], "x": 10.25, "y": 4.25}, - {"matrix": [4, 11], "x": 11.25, "y": 4.25}, - {"matrix": [4, 13], "x": 12.25, "y": 4.25, "w": 2.75}, - {"matrix": [4, 15], "x": 16.25, "y": 4.25}, - {"matrix": [4, 17], "x": 18.5, "y": 4.25}, - {"matrix": [4, 18], "x": 19.5, "y": 4.25}, - {"matrix": [4, 14], "x": 20.5, "y": 4.25}, + {"matrix":[4, 0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4, 2], "x":2.25, "y":4.25}, + {"matrix":[4, 3], "x":3.25, "y":4.25}, + {"matrix":[4, 4], "x":4.25, "y":4.25}, + {"matrix":[4, 5], "x":5.25, "y":4.25}, + {"matrix":[4, 6], "x":6.25, "y":4.25}, + {"matrix":[4, 7], "x":7.25, "y":4.25}, + {"matrix":[4, 8], "x":8.25, "y":4.25}, + {"matrix":[4, 9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[4,18], "x":19.5, "y":4.25}, + {"matrix":[4,14], "x":20.5, "y":4.25}, + {"matrix":[4,16], "x":21.5, "y":4.25, "h":2} - {"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, - {"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, - {"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, - {"matrix": [5, 6], "x": 3.75, "y": 5.25, "w": 6.25}, - {"matrix": [5, 10], "x": 10, "y": 5.25, "w": 1.25}, - {"matrix": [5, 11], "x": 11.25, "y": 5.25, "w": 1.25}, - {"matrix": [5, 12], "x": 12.5, "y": 5.25, "w": 1.25}, - {"matrix": [5, 13], "x": 13.75, "y": 5.25, "w": 1.25}, - {"matrix": [5, 14], "x": 15.25, "y": 5.25}, - {"matrix": [5, 15], "x": 16.25, "y": 5.25}, - {"matrix": [5, 16], "x": 17.25, "y": 5.25}, - {"matrix": [5, 17], "x": 18.5, "y": 5.25, "w": 2}, - {"matrix": [5, 18], "x": 20.5, "y": 5.25}, - {"matrix": [4, 16], "x": 21.5, "y": 4.25, "h": 2} + {"matrix":[5, 0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5, 1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5, 2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5, 6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25}, + {"matrix":[5,17], "x":18.5, "y":5.25, "w":2}, + {"matrix":[5,18], "x":20.5, "y":5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + {"matrix":[0, 19], "flags":1, "x":193, "y":0}, + {"matrix":[1, 19], "flags":1, "x":203, "y":0}, + {"matrix":[2, 19], "flags":1, "x":214, "y":0}, + {"matrix":[3, 19], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":8, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[0, 17], "flags":4, "x":214, "y":15}, + {"matrix":[0, 18], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 13], "flags":1, "x":143, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[3, 14], "flags":4, "x":214, "y":27}, + {"matrix":[3, 15], "flags":4, "x":214, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":139, "y":40}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 16], "flags":4, "x":214, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 14], "flags":4, "x":214, "y":52}, + {"matrix":[4, 16], "flags":4, "x":214, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64} + ] } } diff --git a/keyboards/keychron/q6/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q6/ansi_encoder/keymaps/default/keymap.c index 25f4852ef7e4..458ffc908f44 100644 --- a/keyboards/keychron/q6/ansi_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q6/ansi_encoder/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_109( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_109( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/keymap.c index 2fdbbb7dd140..5c87536acc83 100644 --- a/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_109( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -66,16 +66,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -// clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q6/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q6/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q6/ansi_encoder/keymaps/via/keymap.c index 762dfe66daf4..fe7d9d6aafb0 100644 --- a/keyboards/keychron/q6/ansi_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q6/ansi_encoder/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_109( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_ansi_109( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/ansi_encoder/rules.mk b/keyboards/keychron/q6/ansi_encoder/rules.mk index 77b90f246666..6e7633bfe015 100644 --- a/keyboards/keychron/q6/ansi_encoder/rules.mk +++ b/keyboards/keychron/q6/ansi_encoder/rules.mk @@ -1,23 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q6/config.h b/keyboards/keychron/q6/config.h index 060804057f9b..599e5e98a501 100644 --- a/keyboards/keychron/q6/config.h +++ b/keyboards/keychron/q6/config.h @@ -16,13 +16,6 @@ #pragma once -/* Key matrix size */ -#define MATRIX_ROWS 6 -#define MATRIX_COLS 20 - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION ROW2COL - /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 @@ -47,51 +40,15 @@ // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES + +/* HC595 Driver Configuration */ +#define HC595_STCP A0 +#define HC595_SHCP A1 +#define HC595_DS C15 + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/q6/halconf.h b/keyboards/keychron/q6/halconf.h index 41bddcb2799b..463d177eabc7 100644 --- a/keyboards/keychron/q6/halconf.h +++ b/keyboards/keychron/q6/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/q6/info.json b/keyboards/keychron/q6/info.json new file mode 100644 index 000000000000..2a60619feec8 --- /dev/null +++ b/keyboards/keychron/q6/info.json @@ -0,0 +1,47 @@ +{ + "keyboard_name": "Keychron Q6", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "band_spiral_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + } + } +} diff --git a/keyboards/keychron/q6/iso/config.h b/keyboards/keychron/q6/iso/config.h index 46c9e1c33a20..18584b9ee1da 100644 --- a/keyboards/keychron/q6/iso/config.h +++ b/keyboards/keychron/q6/iso/config.h @@ -16,21 +16,15 @@ #pragma once -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, A2, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, C14 } -#define NO_PIN_START 11 -#define NO_PIN_OFFSET 1 - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 60 -#define DRIVER_2_LED_TOTAL 49 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 109 /* Enable caps-lock LED*/ #define CAPS_LOCK_LED_INDEX 60 /* Enable NUM_LOCK_LED_INDEX */ -// #define NUM_LOCK_LED_INDEX 37 +#define NUM_LOCK_LED_INDEX 37 + +/* HC595 Driver Configuration */ +#define HC595_START_INDEX 11 +#define HC595_END_INDEX 18 diff --git a/keyboards/keychron/q6/iso/info.json b/keyboards/keychron/q6/iso/info.json index dfaa20aa9317..680996ecd5b9 100644 --- a/keyboards/keychron/q6/iso/info.json +++ b/keyboards/keychron/q6/iso/info.json @@ -1,18 +1,17 @@ { - "keyboard_name": "Keychron Q6", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0162", - "device_version": "1.0.0" + "device_version": "1.0.5" }, - "rgb_matrix": { - "driver": "ckled2001" + "features": { + "encoder": false + }, + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", null, null, null, null, null, null, null, null, "C14"], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_109": { "layout": [ @@ -59,78 +58,196 @@ {"matrix": [0, 17], "x": 20.5, "y": 1.25}, {"matrix": [0, 18], "x": 21.5, "y": 1.25}, - {"matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5}, - {"matrix": [2, 1], "x": 1.5, "y": 2.25}, - {"matrix": [2, 2], "x": 2.5, "y": 2.25}, - {"matrix": [2, 3], "x": 3.5, "y": 2.25}, - {"matrix": [2, 4], "x": 4.5, "y": 2.25}, - {"matrix": [2, 5], "x": 5.5, "y": 2.25}, - {"matrix": [2, 6], "x": 6.5, "y": 2.25}, - {"matrix": [2, 7], "x": 7.5, "y": 2.25}, - {"matrix": [2, 8], "x": 8.5, "y": 2.25}, - {"matrix": [2, 9], "x": 9.5, "y": 2.25}, - {"matrix": [2, 10], "x": 10.5, "y": 2.25}, - {"matrix": [2, 11], "x": 11.5, "y": 2.25}, - {"matrix": [2, 12], "x": 12.5, "y": 2.25}, - {"matrix": [2, 14], "x": 15.25, "y": 2.25}, - {"matrix": [2, 15], "x": 16.25, "y": 2.25}, - {"matrix": [2, 16], "x": 17.25, "y": 2.25}, - {"matrix": [2, 17], "x": 18.5, "y": 2.25}, - {"matrix": [2, 18], "x": 19.5, "y": 2.25}, - {"matrix": [3, 14], "x": 20.5, "y": 2.25}, + {"matrix":[2, 0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2, 1], "x":1.5, "y":2.25}, + {"matrix":[2, 2], "x":2.5, "y":2.25}, + {"matrix":[2, 3], "x":3.5, "y":2.25}, + {"matrix":[2, 4], "x":4.5, "y":2.25}, + {"matrix":[2, 5], "x":5.5, "y":2.25}, + {"matrix":[2, 6], "x":6.5, "y":2.25}, + {"matrix":[2, 7], "x":7.5, "y":2.25}, + {"matrix":[2, 8], "x":8.5, "y":2.25}, + {"matrix":[2, 9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[2,18], "x":19.5, "y":2.25}, + {"matrix":[3,14], "x":20.5, "y":2.25}, + {"matrix":[3,15], "x":21.5, "y":2.25, "h":2}, - {"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, - {"matrix": [3, 1], "x": 1.75, "y": 3.25}, - {"matrix": [3, 2], "x": 2.75, "y": 3.25}, - {"matrix": [3, 3], "x": 3.75, "y": 3.25}, - {"matrix": [3, 4], "x": 4.75, "y": 3.25}, - {"matrix": [3, 5], "x": 5.75, "y": 3.25}, - {"matrix": [3, 6], "x": 6.75, "y": 3.25}, - {"matrix": [3, 7], "x": 7.75, "y": 3.25}, - {"matrix": [3, 8], "x": 8.75, "y": 3.25}, - {"matrix": [3, 9], "x": 9.75, "y": 3.25}, - {"matrix": [3, 10], "x": 10.75, "y": 3.25}, - {"matrix": [3, 11], "x": 11.75, "y": 3.25}, - {"matrix": [3, 13], "x": 12.75, "y": 3.25}, - {"matrix": [2, 13], "x": 13.75, "y": 2.25, "w": 1.25, "h": 2}, - {"matrix": [3, 17], "x": 18.5, "y": 3.25}, - {"matrix": [3, 18], "x": 19.5, "y": 3.25}, - {"matrix": [3, 16], "x": 20.5, "y": 3.25}, - {"matrix": [3, 15], "x": 21.5, "y": 2.25, "h": 2}, + {"matrix":[3, 0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3, 1], "x":1.75, "y":3.25}, + {"matrix":[3, 2], "x":2.75, "y":3.25}, + {"matrix":[3, 3], "x":3.75, "y":3.25}, + {"matrix":[3, 4], "x":4.75, "y":3.25}, + {"matrix":[3, 5], "x":5.75, "y":3.25}, + {"matrix":[3, 6], "x":6.75, "y":3.25}, + {"matrix":[3, 7], "x":7.75, "y":3.25}, + {"matrix":[3, 8], "x":8.75, "y":3.25}, + {"matrix":[3, 9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25}, + {"matrix":[2,13], "x":13.75, "y":2.25, "w":1.25, "h":2}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + {"matrix":[3,18], "x":19.5, "y":3.25}, + {"matrix":[3,16], "x":20.5, "y":3.25}, - {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 1.25}, - {"matrix": [4, 1], "x": 1.25, "y": 4.25}, - {"matrix": [4, 2], "x": 2.25, "y": 4.25}, - {"matrix": [4, 3], "x": 3.25, "y": 4.25}, - {"matrix": [4, 4], "x": 4.25, "y": 4.25}, - {"matrix": [4, 5], "x": 5.25, "y": 4.25}, - {"matrix": [4, 6], "x": 6.25, "y": 4.25}, - {"matrix": [4, 7], "x": 7.25, "y": 4.25}, - {"matrix": [4, 8], "x": 8.25, "y": 4.25}, - {"matrix": [4, 9], "x": 9.25, "y": 4.25}, - {"matrix": [4, 10], "x": 10.25, "y": 4.25}, - {"matrix": [4, 11], "x": 11.25, "y": 4.25}, - {"matrix": [4, 13], "x": 12.25, "y": 4.25, "w": 2.75}, - {"matrix": [4, 15], "x": 16.25, "y": 4.25}, - {"matrix": [4, 17], "x": 18.5, "y": 4.25}, - {"matrix": [4, 18], "x": 19.5, "y": 4.25}, - {"matrix": [4, 14], "x": 20.5, "y": 4.25}, + {"matrix":[4, 0], "x":0, "y":4.25, "w":1.25}, + {"matrix":[4, 1], "x":1.25, "y":4.25}, + {"matrix":[4, 2], "x":2.25, "y":4.25}, + {"matrix":[4, 3], "x":3.25, "y":4.25}, + {"matrix":[4, 4], "x":4.25, "y":4.25}, + {"matrix":[4, 5], "x":5.25, "y":4.25}, + {"matrix":[4, 6], "x":6.25, "y":4.25}, + {"matrix":[4, 7], "x":7.25, "y":4.25}, + {"matrix":[4, 8], "x":8.25, "y":4.25}, + {"matrix":[4, 9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[4,18], "x":19.5, "y":4.25}, + {"matrix":[4,14], "x":20.5, "y":4.25}, + {"matrix":[4,16], "x":21.5, "y":4.25, "h":2}, - {"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, - {"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, - {"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, - {"matrix": [5, 6], "x": 3.75, "y": 5.25, "w": 6.25}, - {"matrix": [5, 10], "x": 10, "y": 5.25, "w": 1.25}, - {"matrix": [5, 11], "x": 11.25, "y": 5.25, "w": 1.25}, - {"matrix": [5, 12], "x": 12.5, "y": 5.25, "w": 1.25}, - {"matrix": [5, 13], "x": 13.75, "y": 5.25, "w": 1.25}, - {"matrix": [5, 14], "x": 15.25, "y": 5.25}, - {"matrix": [5, 15], "x": 16.25, "y": 5.25}, - {"matrix": [5, 16], "x": 17.25, "y": 5.25}, - {"matrix": [5, 17], "x": 18.5, "y": 5.25, "w": 2}, - {"matrix": [5, 18], "x": 20.5, "y": 5.25}, - {"matrix": [4, 16], "x": 21.5, "y": 4.25, "h": 2} + {"matrix":[5, 0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5, 1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5, 2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5, 6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25}, + {"matrix":[5,17], "x":18.5, "y":5.25, "w":2}, + {"matrix":[5,18], "x":20.5, "y":5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":159, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + {"matrix":[0, 19], "flags":1, "x":193, "y":0}, + {"matrix":[1, 19], "flags":1, "x":203, "y":0}, + {"matrix":[2, 19], "flags":1, "x":214, "y":0}, + {"matrix":[3, 19], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":8, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[0, 17], "flags":4, "x":214, "y":15}, + {"matrix":[0, 18], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[3, 14], "flags":4, "x":214, "y":27}, + {"matrix":[3, 15], "flags":4, "x":224, "y":34}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":133, "y":40}, + {"matrix":[2, 13], "flags":1, "x":147, "y":27}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 16], "flags":4, "x":214, "y":40}, + + {"matrix":[4, 0], "flags":1, "x":1, "y":52}, + {"matrix":[4, 1], "flags":1, "x":13, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 14], "flags":4, "x":214, "y":52}, + {"matrix":[4, 16], "flags":4, "x":224, "y":58}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64} + ] } } diff --git a/keyboards/keychron/q6/iso/iso.c b/keyboards/keychron/q6/iso/iso.c index f2081177e919..5a25407d87e4 100644 --- a/keyboards/keychron/q6/iso/iso.c +++ b/keyboards/keychron/q6/iso/iso.c @@ -16,10 +16,8 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off - +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -142,37 +140,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_12, J_12, K_12}, {1, L_9, J_9, K_9}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14, 15, 39, 40, 16 }, - { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 17 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 73, 54, 55, 56, 57, 58, 18 }, - { 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, __, 72, 59, 77, 76, 74, 75, 19 }, - { 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, __, 90, 94, 91, 108, 92, 93, __ }, - { 95, 96, 97, __, __, __, 98, __, __, __, 99, 100, 101, 102, 103, 104, 105, 106, 107, __ }, - }, - { - // LED Index to Physical Position - {0,0}, {21,0}, {31,0}, {42,0}, {52,0}, {68,0}, {78,0}, {89,0}, {99,0}, {115,0}, {125,0}, {136,0}, {146,0}, {159,0}, {169,0}, {180,0}, {193,0}, {203,0}, {214,0}, {224,0}, - {0,15}, {10,15}, {21,15}, {31,15}, {42,15}, {52,15}, {63,15}, {73,15}, {83,15}, {94,15}, {104,15}, {115,15}, {125,15}, {141,15}, {159,15}, {169,15}, {180,15}, {193,15}, {203,15}, {214,15}, {224,15}, - {3,27}, {16,27}, {26,27}, {36,27}, {47,27}, {57,27}, {68,27}, {78,27}, {89,27}, {99,27}, {109,27}, {120,27}, {130,27}, {159,27}, {169,27}, {180,27}, {193,27}, {203,27}, {214,27}, - {4,40}, {18,40}, {29,40}, {39,40}, {50,40}, {60,40}, {70,40}, {81,40}, {91,40}, {102,40}, {112,40}, {123,40}, {133,40}, {147,36}, {193,40}, {203,40}, {214,40}, {224,34}, - {1,52}, {13,52}, {23,52}, {34,52}, {44,52}, {55,52}, {65,52}, {76,52}, {86,52}, {96,52}, {107,52}, {117,52}, {137,52}, {169,52}, {193,52}, {203,52}, {214,52}, - {1,64}, {14,64}, {27,64}, {66,64}, {105,64}, {118,64}, {131,64}, {145,64}, {159,64}, {169,64}, {180,64}, {198,64}, {214,64}, {224,58}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q6/iso/keymaps/default/keymap.c b/keyboards/keychron/q6/iso/keymaps/default/keymap.c index cf376b890483..797ec59bf506 100644 --- a/keyboards/keychron/q6/iso/keymaps/default/keymap.c +++ b/keyboards/keychron/q6/iso/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_109( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_109( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/iso/keymaps/keychron/keymap.c b/keyboards/keychron/q6/iso/keymaps/keychron/keymap.c index 363b10e92e33..9b00c562d92a 100644 --- a/keyboards/keychron/q6/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q6/iso/keymaps/keychron/keymap.c @@ -16,19 +16,19 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_109( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -57,16 +57,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q6/iso/keymaps/keychron/rules.mk b/keyboards/keychron/q6/iso/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/q6/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q6/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q6/iso/keymaps/via/keymap.c b/keyboards/keychron/q6/iso/keymaps/via/keymap.c index cf376b890483..1f68f420a8c9 100644 --- a/keyboards/keychron/q6/iso/keymaps/via/keymap.c +++ b/keyboards/keychron/q6/iso/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_109( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_109( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/iso/rules.mk b/keyboards/keychron/q6/iso/rules.mk index 6548448302c0..6e7633bfe015 100644 --- a/keyboards/keychron/q6/iso/rules.mk +++ b/keyboards/keychron/q6/iso/rules.mk @@ -1,23 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -RAW_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q6/iso_encoder/config.h b/keyboards/keychron/q6/iso_encoder/config.h index 512a33bafdec..a3d4a427a165 100644 --- a/keyboards/keychron/q6/iso_encoder/config.h +++ b/keyboards/keychron/q6/iso_encoder/config.h @@ -16,19 +16,8 @@ #pragma once -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } -#define NO_PIN_START 10 -#define NO_PIN_NUM 10 -#define CLR_REG_VAL 0x3FF - /* RGB Matrix Configuration */ -#define DRIVER_1_LED_TOTAL 60 -#define DRIVER_2_LED_TOTAL 49 -#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_COUNT 109 /* Encoder Configuration */ #define ENCODER_DEFAULT_POS 0x3 @@ -37,4 +26,8 @@ #define CAPS_LOCK_LED_INDEX 60 /* Enable NUM_LOCK_LED_INDEX */ -// #define NUM_LOCK_LED_INDEX 37 +#define NUM_LOCK_LED_INDEX 37 + +/* HC595 Driver Configuration */ +#define HC595_START_INDEX 10 +#define HC595_END_INDEX 19 diff --git a/keyboards/keychron/q6/iso_encoder/info.json b/keyboards/keychron/q6/iso_encoder/info.json index 45906168312c..39724a717278 100644 --- a/keyboards/keychron/q6/iso_encoder/info.json +++ b/keyboards/keychron/q6/iso_encoder/info.json @@ -1,23 +1,22 @@ { - "keyboard_name": "Keychron Q6", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0163", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" + "matrix_pins": { + "cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", null, null, null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, + "features": { + "encoder": true }, "encoder": { "rotary": [ {"pin_a": "C14", "pin_b": "A2"} ] }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_iso_110": { "layout": [ @@ -138,5 +137,123 @@ {"matrix": [4, 16], "x": 21.5, "y": 4.25, "h": 2} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":21, "y":0}, + {"matrix":[0, 2], "flags":1, "x":31, "y":0}, + {"matrix":[0, 3], "flags":1, "x":42, "y":0}, + {"matrix":[0, 4], "flags":1, "x":52, "y":0}, + {"matrix":[0, 5], "flags":1, "x":68, "y":0}, + {"matrix":[0, 6], "flags":1, "x":78, "y":0}, + {"matrix":[0, 7], "flags":1, "x":89, "y":0}, + {"matrix":[0, 8], "flags":1, "x":99, "y":0}, + {"matrix":[0, 9], "flags":1, "x":115, "y":0}, + {"matrix":[0, 10], "flags":1, "x":125, "y":0}, + {"matrix":[0, 11], "flags":1, "x":136, "y":0}, + {"matrix":[0, 12], "flags":1, "x":146, "y":0}, + {"matrix":[0, 14], "flags":1, "x":169, "y":0}, + {"matrix":[0, 15], "flags":1, "x":169, "y":0}, + {"matrix":[0, 16], "flags":1, "x":180, "y":0}, + {"matrix":[0, 19], "flags":1, "x":193, "y":0}, + {"matrix":[1, 19], "flags":1, "x":203, "y":0}, + {"matrix":[2, 19], "flags":1, "x":214, "y":0}, + {"matrix":[3, 19], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":10, "y":15}, + {"matrix":[1, 2], "flags":4, "x":21, "y":15}, + {"matrix":[1, 3], "flags":4, "x":31, "y":15}, + {"matrix":[1, 4], "flags":4, "x":42, "y":15}, + {"matrix":[1, 5], "flags":4, "x":52, "y":15}, + {"matrix":[1, 6], "flags":4, "x":63, "y":15}, + {"matrix":[1, 7], "flags":4, "x":73, "y":15}, + {"matrix":[1, 8], "flags":4, "x":83, "y":15}, + {"matrix":[1, 9], "flags":4, "x":94, "y":15}, + {"matrix":[1, 10], "flags":4, "x":104, "y":15}, + {"matrix":[1, 11], "flags":4, "x":115, "y":15}, + {"matrix":[1, 12], "flags":4, "x":125, "y":15}, + {"matrix":[1, 13], "flags":1, "x":141, "y":15}, + {"matrix":[1, 14], "flags":1, "x":159, "y":15}, + {"matrix":[1, 15], "flags":1, "x":169, "y":15}, + {"matrix":[1, 16], "flags":1, "x":180, "y":15}, + {"matrix":[1, 17], "flags":8, "x":193, "y":15}, + {"matrix":[1, 18], "flags":4, "x":203, "y":15}, + {"matrix":[0, 17], "flags":4, "x":214, "y":15}, + {"matrix":[0, 18], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":16, "y":27}, + {"matrix":[2, 2], "flags":4, "x":26, "y":27}, + {"matrix":[2, 3], "flags":4, "x":36, "y":27}, + {"matrix":[2, 4], "flags":4, "x":47, "y":27}, + {"matrix":[2, 5], "flags":4, "x":57, "y":27}, + {"matrix":[2, 6], "flags":4, "x":68, "y":27}, + {"matrix":[2, 7], "flags":4, "x":78, "y":27}, + {"matrix":[2, 8], "flags":4, "x":89, "y":27}, + {"matrix":[2, 9], "flags":4, "x":99, "y":27}, + {"matrix":[2, 10], "flags":4, "x":109, "y":27}, + {"matrix":[2, 11], "flags":4, "x":120, "y":27}, + {"matrix":[2, 12], "flags":4, "x":130, "y":27}, + {"matrix":[2, 14], "flags":1, "x":159, "y":27}, + {"matrix":[2, 15], "flags":1, "x":169, "y":27}, + {"matrix":[2, 16], "flags":1, "x":180, "y":27}, + {"matrix":[2, 17], "flags":4, "x":193, "y":27}, + {"matrix":[2, 18], "flags":4, "x":203, "y":27}, + {"matrix":[3, 14], "flags":4, "x":214, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":4, "y":40}, + {"matrix":[3, 1], "flags":4, "x":18, "y":40}, + {"matrix":[3, 2], "flags":4, "x":29, "y":40}, + {"matrix":[3, 3], "flags":4, "x":39, "y":40}, + {"matrix":[3, 4], "flags":4, "x":50, "y":40}, + {"matrix":[3, 5], "flags":4, "x":60, "y":40}, + {"matrix":[3, 6], "flags":4, "x":70, "y":40}, + {"matrix":[3, 7], "flags":4, "x":81, "y":40}, + {"matrix":[3, 8], "flags":4, "x":91, "y":40}, + {"matrix":[3, 9], "flags":4, "x":102, "y":40}, + {"matrix":[3, 10], "flags":4, "x":112, "y":40}, + {"matrix":[3, 11], "flags":4, "x":123, "y":40}, + {"matrix":[3, 13], "flags":1, "x":139, "y":40}, + {"matrix":[2, 13], "flags":1, "x":143, "y":27}, + {"matrix":[3, 17], "flags":4, "x":193, "y":40}, + {"matrix":[3, 18], "flags":4, "x":203, "y":40}, + {"matrix":[3, 16], "flags":4, "x":214, "y":40}, + {"matrix":[3, 15], "flags":4, "x":214, "y":27}, + + {"matrix":[4, 0], "flags":1, "x":7, "y":52}, + {"matrix":[4, 1], "flags":1, "x":7, "y":52}, + {"matrix":[4, 2], "flags":4, "x":23, "y":52}, + {"matrix":[4, 3], "flags":4, "x":34, "y":52}, + {"matrix":[4, 4], "flags":4, "x":44, "y":52}, + {"matrix":[4, 5], "flags":4, "x":55, "y":52}, + {"matrix":[4, 6], "flags":4, "x":65, "y":52}, + {"matrix":[4, 7], "flags":4, "x":76, "y":52}, + {"matrix":[4, 8], "flags":4, "x":86, "y":52}, + {"matrix":[4, 9], "flags":4, "x":96, "y":52}, + {"matrix":[4, 10], "flags":4, "x":107, "y":52}, + {"matrix":[4, 11], "flags":4, "x":117, "y":52}, + {"matrix":[4, 13], "flags":1, "x":137, "y":52}, + {"matrix":[4, 15], "flags":1, "x":169, "y":52}, + {"matrix":[4, 17], "flags":4, "x":193, "y":52}, + {"matrix":[4, 18], "flags":4, "x":203, "y":52}, + {"matrix":[4, 14], "flags":4, "x":214, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":64}, + {"matrix":[5, 1], "flags":1, "x":14, "y":64}, + {"matrix":[5, 2], "flags":1, "x":27, "y":64}, + {"matrix":[5, 6], "flags":4, "x":66, "y":64}, + {"matrix":[5, 10], "flags":1, "x":105, "y":64}, + {"matrix":[5, 11], "flags":1, "x":118, "y":64}, + {"matrix":[5, 12], "flags":1, "x":131, "y":64}, + {"matrix":[5, 13], "flags":1, "x":145, "y":64}, + {"matrix":[5, 14], "flags":1, "x":159, "y":64}, + {"matrix":[5, 15], "flags":1, "x":169, "y":64}, + {"matrix":[5, 16], "flags":1, "x":180, "y":64}, + {"matrix":[5, 17], "flags":4, "x":198, "y":64}, + {"matrix":[5, 18], "flags":4, "x":214, "y":64}, + {"matrix":[4, 16], "flags":4, "x":214, "y":52} + ] } } diff --git a/keyboards/keychron/q6/iso_encoder/iso_encoder.c b/keyboards/keychron/q6/iso_encoder/iso_encoder.c index e9a6f6edfcf1..5a25407d87e4 100644 --- a/keyboards/keychron/q6/iso_encoder/iso_encoder.c +++ b/keyboards/keychron/q6/iso_encoder/iso_encoder.c @@ -16,10 +16,8 @@ #include "quantum.h" -#ifdef RGB_MATRIX_ENABLE - // clang-format off - +#ifdef RGB_MATRIX_ENABLE const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -142,37 +140,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, L_12, J_12, K_12}, {1, L_9, J_9, K_9}, }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, __, 13, 14, 15, 39, 40, 16 }, - { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 17 }, - { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 73, 54, 55, 56, 57, 58, 18 }, - { 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, __, 72, 59, 77, 76, 74, 75, 19 }, - { 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, __, 90, 94, 91, 108, 92, 93, __ }, - { 95, 96, 97, __, __, __, 98, __, __, __, 99, 100, 101, 102, 103, 104, 105, 106, 107, __ }, - }, - { - // LED Index to Physical Position - {0,0}, {13,0}, {24,0}, {34,0}, {45,0}, {57,0}, {68,0}, {78,0}, {89,0}, {102,0}, {112,0}, {123,0}, {133,0}, {159,0}, {169,0}, {180,0}, {193,0}, {203,0}, {214,0}, {224,0}, - {0,15}, {10,15}, {21,15}, {31,15}, {42,15}, {52,15}, {63,15}, {73,15}, {83,15}, {94,15}, {104,15}, {115,15}, {125,15}, {141,15}, {159,15}, {169,15}, {180,15}, {193,15}, {203,15}, {214,15}, {224,15}, - {3,27}, {16,27}, {26,27}, {36,27}, {47,27}, {57,27}, {68,27}, {78,27}, {89,27}, {99,27}, {109,27}, {120,27}, {130,27}, {159,27}, {169,27}, {180,27}, {193,27}, {203,27}, {214,27}, - {4,40}, {18,40}, {29,40}, {39,40}, {50,40}, {60,40}, {70,40}, {81,40}, {91,40}, {102,40}, {112,40}, {123,40}, {133,40}, {147,36}, {193,40}, {203,40}, {214,40}, {224,34}, - {1,52}, {13,52}, {23,52}, {34,52}, {44,52}, {55,52}, {65,52}, {76,52}, {86,52}, {96,52}, {107,52}, {117,52}, {137,52}, {169,52}, {193,52}, {203,52}, {214,52}, - {1,64}, {14,64}, {27,64}, {66,64}, {105,64}, {118,64}, {131,64}, {145,64}, {159,64}, {169,64}, {180,64}, {198,64}, {214,64}, {224,58}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/q6/iso_encoder/keymaps/default/keymap.c b/keyboards/keychron/q6/iso_encoder/keymaps/default/keymap.c index 8eed8a5b76e9..09bdab829c95 100644 --- a/keyboards/keychron/q6/iso_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/q6/iso_encoder/keymaps/default/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_110( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_110( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/q6/iso_encoder/keymaps/keychron/keymap.c index 564d070f93aa..54c6506fc95a 100644 --- a/keyboards/keychron/q6/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/q6/iso_encoder/keymaps/keychron/keymap.c @@ -16,17 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_110( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, @@ -67,16 +66,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { }; #endif -// clang-format on - void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(!process_record_keychron(keycode, record)) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { return false; } - return true; } diff --git a/keyboards/keychron/q6/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/q6/iso_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/q6/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/q6/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/q6/iso_encoder/keymaps/via/keymap.c b/keyboards/keychron/q6/iso_encoder/keymaps/via/keymap.c index bfd60011dee2..74022f5d32a9 100644 --- a/keyboards/keychron/q6/iso_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/q6/iso_encoder/keymaps/via/keymap.c @@ -16,18 +16,20 @@ #include QMK_KEYBOARD_H -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_110( - KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_F13, KC_F14, KC_F15, KC_F16, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), [WIN_FN] = LAYOUT_iso_110( - _______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, RGB_TOG, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/keychron/q6/iso_encoder/rules.mk b/keyboards/keychron/q6/iso_encoder/rules.mk index 548b0d696baa..6e7633bfe015 100644 --- a/keyboards/keychron/q6/iso_encoder/rules.mk +++ b/keyboards/keychron/q6/iso_encoder/rules.mk @@ -1,24 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -ENCODER_ENABLE = yes # Enable Encoder -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -RAW_ENABLE = yes -LTO_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/q6/matrix.c b/keyboards/keychron/q6/matrix.c deleted file mode 100644 index 11f3432e6b18..000000000000 --- a/keyboards/keychron/q6/matrix.c +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "matrix.h" -#include "quantum.h" - -// Pin connected to DS of 74HC595 -#define DATA_PIN C15 -// Pin connected to SH_CP of 74HC595 -#define CLOCK_PIN A1 -// Pin connected to ST_CP of 74HC595 -#define LATCH_PIN A0 - -#ifdef MATRIX_ROW_PINS -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -#endif // MATRIX_ROW_PINS -#ifdef MATRIX_COL_PINS -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif // MATRIX_COL_PINS - -#define ROWS_PER_HAND (MATRIX_ROWS) - -#ifndef NO_PIN_NUM -# define NO_PIN_NUM 8 -#endif - -#ifndef NO_PIN_OFFSET -# define NO_PIN_OFFSET 0 -#endif - -#ifndef CLR_REG_VAL -# define CLR_REG_VAL 0xFF -#endif - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - -static inline uint8_t readMatrixPin(pin_t pin) { - if (pin != NO_PIN) { - return readPin(pin); - } else { - return 1; - } -} - -static void shiftOut(uint16_t dataOut) { - for (uint8_t i = 0; i < NO_PIN_NUM; i++) { - if (dataOut & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - dataOut = dataOut >> 1; - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - } - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static void shiftout_single(uint8_t data) { - if (data & 0x1) { - setPinOutput_writeHigh(DATA_PIN); - } else { - setPinOutput_writeLow(DATA_PIN); - } - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); -} - -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { - setPinOutput_writeLow(pin); - return true; - } else { - if (col == NO_PIN_START) { - shiftout_single(0x00); - } else { - shiftout_single(0x01); - } - return true; - } - return false; -} - -static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - if (col == (MATRIX_COLS - NO_PIN_OFFSET - 1)) - setPinOutput_writeHigh(CLOCK_PIN); - setPinOutput_writeLow(CLOCK_PIN); - setPinOutput_writeHigh(LATCH_PIN); - setPinOutput_writeLow(LATCH_PIN); - } -} - -static void unselect_cols(void) { - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } - if (x == (MATRIX_COLS - NO_PIN_OFFSET - 1)) - // unselect shift Register - shiftOut(CLR_REG_VAL); - } -} - -static void matrix_init_pins(void) { - unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); - } - } -} - -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col - } - - if (current_col < 10) { - matrix_output_select_delay(); - } else { - for (int8_t cycle = 4; cycle > 0; cycle--) { - matrix_output_select_delay(); // 0.25us - matrix_output_select_delay(); - matrix_output_select_delay(); - matrix_output_select_delay(); - } - } - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_matrix[row_index] |= row_shifter; - key_pressed = true; - } else { - // Pin HI, clear col bit - current_matrix[row_index] &= ~row_shifter; - } - } - - // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH -} - -void matrix_init_custom(void) { - // initialize key pins - matrix_init_pins(); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; - - // Set col, read rows - matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); - } - - bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); - - return changed; -} diff --git a/keyboards/keychron/q6/q6.c b/keyboards/keychron/q6/q6.c index 8a9750e9de4f..0f893c788155 100644 --- a/keyboards/keychron/q6/q6.c +++ b/keyboards/keychron/q6/q6.c @@ -38,59 +38,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && (defined(CAPS_LOCK_LED_INDEX) || defined(NUM_LOCK_LED_INDEX)) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { - return false; - } - switch (keycode) { - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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; - } - 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; - } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); -# if defined(CAPS_LOCK_LED_INDEX) - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } -# endif // CAPS_LOCK_LED_INDEX -# if defined(NUM_LOCK_LED_INDEX) - if (host_keyboard_led_state().num_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_LED_INDEX, 0, 0, 0); - } - } -# endif // NUM_LOCK_LED_INDEX - return true; -} - -#endif // RGB_MATRIX_ENABLE... diff --git a/keyboards/keychron/q6/readme.md b/keyboards/keychron/q6/readme.md index a2056c57ae26..fe8196481dc5 100644 --- a/keyboards/keychron/q6/readme.md +++ b/keyboards/keychron/q6/readme.md @@ -1,19 +1,32 @@ # Keychron Q6 +![Keychron Q6](https://i.imgur.com/7h9eBNj.jpg) + A customizable 100% keyboard. * Keyboard Maintainer: [Keychron](https://github.com/keychron) * Hardware Supported: Keychron Q6 -* Hardware Availability: [Keychron](https://www.keychron.com) +* Hardware Availability: [Keychron Q6 QMK Custom Mechanical Keyboard](https://www.keychron.com/products/keychron-q6-qmk-custom-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): make keychron/q6/ansi:default + make keychron/q6/ansi_encoder:default + make keychron/q6/iso:default + make keychron/q6/iso_encoder:default Flashing example for this keyboard: make keychron/q6/ansi:default:flash + make keychron/q6/ansi_encoder:default:flash + make keychron/q6/iso:default:flash + make keychron/q6/iso_encoder:default:flash + +## bootloader + +Enter the bootloader in two ways: -**Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/q6/rules.mk b/keyboards/keychron/q6/rules.mk new file mode 100755 index 000000000000..a515de570cd8 --- /dev/null +++ b/keyboards/keychron/q6/rules.mk @@ -0,0 +1,2 @@ +VPATH += $(TOP_DIR)/keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/switch_pad/config.h b/keyboards/keychron/switch_pad/config.h new file mode 100755 index 000000000000..278c2ce43682 --- /dev/null +++ b/keyboards/keychron/switch_pad/config.h @@ -0,0 +1,43 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* RGB Matrix Driver Configuration */ +#define DRIVER_COUNT 2 +#define DRIVER_ADDR_1 0b1110111 +#define DRIVER_ADDR_2 0b1110100 + +/* RGB Matrix Configuration */ +#define RGB_MATRIX_LED_COUNT 100 + +/* Set LED driver current */ +#define CKLED2001_CURRENT_TUNE \ + { 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 } + +/* Disable RGB lighting when PC is in suspend */ +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +/* RGB Matrix Animation modes. Explicitly enabled + * For full list of effects, see: + * https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects + */ +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS + +/* HC595 Driver Configuration */ +#define HC595_START_INDEX 9 +#define HC595_END_INDEX 16 diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/keymap_user.h b/keyboards/keychron/switch_pad/halconf.h old mode 100644 new mode 100755 similarity index 82% rename from keyboards/keychron/q1/iso/keymaps/kubahorak/keymap_user.h rename to keyboards/keychron/switch_pad/halconf.h index 728114d556ff..41bddcb2799b --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/keymap_user.h +++ b/keyboards/keychron/switch_pad/halconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Grayson Carr +/* Copyright 2020 QMK * * 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 @@ -16,13 +16,6 @@ #pragma once -// clang-format off +#define HAL_USE_I2C TRUE -enum layers { - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN -}; - -// clang-format on +#include_next diff --git a/keyboards/keychron/switch_pad/info.json b/keyboards/keychron/switch_pad/info.json new file mode 100755 index 000000000000..cdeb1e7573f8 --- /dev/null +++ b/keyboards/keychron/switch_pad/info.json @@ -0,0 +1,263 @@ +{ + "keyboard_name": "Keychron Switch Pad", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434", + "pid": "0x0480", + "device_version": "1.0.0" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "breathing": true, + "band_spiral_val": 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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + }, + "layout": [ + {"matrix":[0, 0], "flags":4, "x":0, "y":0}, + {"matrix":[0, 1], "flags":4, "x":25, "y":0}, + {"matrix":[0, 2], "flags":4, "x":50, "y":0}, + {"matrix":[0, 3], "flags":4, "x":75, "y":0}, + {"matrix":[0, 4], "flags":4, "x":100, "y":0}, + {"matrix":[0, 5], "flags":4, "x":124, "y":0}, + {"matrix":[0, 6], "flags":4, "x":149, "y":0}, + {"matrix":[0, 7], "flags":4, "x":174, "y":0}, + {"matrix":[0, 8], "flags":4, "x":199, "y":0}, + {"matrix":[0, 9], "flags":4, "x":224, "y":0}, + {"matrix":[0, 10], "flags":4, "x":0, "y":7}, + {"matrix":[0, 11], "flags":4, "x":25, "y":7}, + {"matrix":[0, 12], "flags":4, "x":50, "y":7}, + {"matrix":[0, 13], "flags":4, "x":75, "y":7}, + {"matrix":[0, 14], "flags":4, "x":100, "y":7}, + {"matrix":[0, 15], "flags":4, "x":124, "y":7}, + {"matrix":[0, 16], "flags":4, "x":149, "y":7}, + {"matrix":[1, 13], "flags":4, "x":174, "y":7}, + {"matrix":[1, 14], "flags":4, "x":199, "y":7}, + {"matrix":[1, 15], "flags":4, "x":224, "y":7}, + {"matrix":[1, 0], "flags":4, "x":0, "y":14}, + {"matrix":[1, 1], "flags":4, "x":25, "y":14}, + {"matrix":[1, 2], "flags":4, "x":50, "y":14}, + {"matrix":[1, 3], "flags":4, "x":75, "y":14}, + {"matrix":[1, 4], "flags":4, "x":100, "y":14}, + {"matrix":[1, 5], "flags":4, "x":124, "y":14}, + {"matrix":[1, 6], "flags":4, "x":149, "y":14}, + {"matrix":[1, 7], "flags":4, "x":174, "y":14}, + {"matrix":[1, 8], "flags":4, "x":199, "y":14}, + {"matrix":[1, 9], "flags":4, "x":224, "y":14}, + {"matrix":[1, 10], "flags":4, "x":0, "y":21}, + {"matrix":[1, 11], "flags":4, "x":25, "y":21}, + {"matrix":[1, 12], "flags":4, "x":50, "y":21}, + {"matrix":[2, 13], "flags":4, "x":75, "y":21}, + {"matrix":[2, 14], "flags":4, "x":100, "y":21}, + {"matrix":[2, 15], "flags":4, "x":124, "y":21}, + {"matrix":[2, 10], "flags":4, "x":149, "y":21}, + {"matrix":[2, 11], "flags":4, "x":174, "y":21}, + {"matrix":[2, 12], "flags":4, "x":199, "y":21}, + {"matrix":[2, 16], "flags":4, "x":224, "y":21}, + {"matrix":[2, 0], "flags":4, "x":0, "y":28}, + {"matrix":[2, 1], "flags":4, "x":25, "y":28}, + {"matrix":[2, 2], "flags":4, "x":50, "y":28}, + {"matrix":[2, 3], "flags":4, "x":75, "y":28}, + {"matrix":[2, 4], "flags":4, "x":100, "y":28}, + {"matrix":[2, 5], "flags":4, "x":124, "y":28}, + {"matrix":[2, 6], "flags":4, "x":149, "y":28}, + {"matrix":[2, 7], "flags":4, "x":174, "y":28}, + {"matrix":[2, 8], "flags":4, "x":199, "y":28}, + {"matrix":[2, 9], "flags":4, "x":224, "y":28}, + {"matrix":[3, 0], "flags":4, "x":0, "y":36}, + {"matrix":[3, 1], "flags":4, "x":25, "y":36}, + {"matrix":[3, 2], "flags":4, "x":50, "y":36}, + {"matrix":[3, 3], "flags":4, "x":75, "y":36}, + {"matrix":[3, 4], "flags":4, "x":100, "y":36}, + {"matrix":[3, 5], "flags":4, "x":124, "y":36}, + {"matrix":[3, 6], "flags":4, "x":149, "y":36}, + {"matrix":[3, 7], "flags":4, "x":174, "y":36}, + {"matrix":[3, 8], "flags":4, "x":199, "y":36}, + {"matrix":[3, 9], "flags":4, "x":224, "y":36}, + {"matrix":[3, 10], "flags":4, "x":0, "y":43}, + {"matrix":[3, 11], "flags":4, "x":25, "y":43}, + {"matrix":[3, 12], "flags":4, "x":50, "y":43}, + {"matrix":[3, 13], "flags":4, "x":75, "y":43}, + {"matrix":[3, 14], "flags":4, "x":100, "y":43}, + {"matrix":[3, 15], "flags":4, "x":124, "y":43}, + {"matrix":[3, 16], "flags":4, "x":149, "y":43}, + {"matrix":[4, 13], "flags":4, "x":174, "y":43}, + {"matrix":[4, 14], "flags":4, "x":199, "y":43}, + {"matrix":[4, 15], "flags":4, "x":224, "y":43}, + {"matrix":[4, 0], "flags":4, "x":0, "y":50}, + {"matrix":[4, 1], "flags":4, "x":25, "y":50}, + {"matrix":[4, 2], "flags":4, "x":50, "y":50}, + {"matrix":[4, 3], "flags":4, "x":75, "y":50}, + {"matrix":[4, 4], "flags":4, "x":100, "y":50}, + {"matrix":[4, 5], "flags":4, "x":124, "y":50}, + {"matrix":[4, 6], "flags":4, "x":149, "y":50}, + {"matrix":[4, 7], "flags":4, "x":174, "y":50}, + {"matrix":[4, 8], "flags":4, "x":199, "y":50}, + {"matrix":[4, 9], "flags":4, "x":224, "y":50}, + {"matrix":[4, 10], "flags":4, "x":0, "y":57}, + {"matrix":[4, 11], "flags":4, "x":25, "y":57}, + {"matrix":[4, 12], "flags":4, "x":50, "y":57}, + {"matrix":[5, 13], "flags":4, "x":75, "y":57}, + {"matrix":[5, 14], "flags":4, "x":100, "y":57}, + {"matrix":[5, 15], "flags":4, "x":124, "y":57}, + {"matrix":[5, 10], "flags":4, "x":149, "y":57}, + {"matrix":[5, 11], "flags":4, "x":194, "y":57}, + {"matrix":[5, 12], "flags":4, "x":199, "y":57}, + {"matrix":[5, 16], "flags":4, "x":224, "y":57}, + {"matrix":[5, 0], "flags":4, "x":0, "y":64}, + {"matrix":[5, 1], "flags":4, "x":25, "y":64}, + {"matrix":[5, 2], "flags":4, "x":50, "y":64}, + {"matrix":[5, 3], "flags":4, "x":75, "y":64}, + {"matrix":[5, 4], "flags":4, "x":100, "y":64}, + {"matrix":[5, 5], "flags":4, "x":124, "y":64}, + {"matrix":[5, 6], "flags":4, "x":149, "y":64}, + {"matrix":[5, 7], "flags":4, "x":174, "y":64}, + {"matrix":[5, 8], "flags":4, "x":199, "y":64}, + {"matrix":[5, 9], "flags":4, "x":224, "y":64} + ] + }, + "matrix_pins": { + "cols": ["B1", "A6", "A5", "A4", "A3", "A2", "A0", "C15", "C14", null, null, null, null, null, null, null, null], + "rows": ["A13", "A14", "A15", "B3", "B4", "B5"], + "custom": true, + "custom_lite": true + }, + "diode_direction": "ROW2COL", + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":1, "y":0}, + {"matrix":[0,2], "x":2, "y":0}, + {"matrix":[0,3], "x":3, "y":0}, + {"matrix":[0,4], "x":4, "y":0}, + {"matrix":[0,5], "x":5, "y":0}, + {"matrix":[0,6], "x":6, "y":0}, + {"matrix":[0,7], "x":7, "y":0}, + {"matrix":[0,8], "x":8, "y":0}, + {"matrix":[0,9], "x":9, "y":0}, + {"matrix":[0,10], "x":0, "y":1}, + {"matrix":[0,11], "x":1, "y":1}, + {"matrix":[0,12], "x":2, "y":1}, + {"matrix":[0,13], "x":3, "y":1}, + {"matrix":[0,14], "x":4, "y":1}, + {"matrix":[0,15], "x":5, "y":1}, + {"matrix":[0,16], "x":6, "y":1}, + {"matrix":[1,13], "x":7, "y":1}, + {"matrix":[1,14], "x":8, "y":1}, + {"matrix":[1,15], "x":9, "y":1}, + {"matrix":[1,0], "x":0, "y":2}, + {"matrix":[1,1], "x":1, "y":2}, + {"matrix":[1,2], "x":2, "y":2}, + {"matrix":[1,3], "x":3, "y":2}, + {"matrix":[1,4], "x":4, "y":2}, + {"matrix":[1,5], "x":5, "y":2}, + {"matrix":[1,6], "x":6, "y":2}, + {"matrix":[1,7], "x":7, "y":2}, + {"matrix":[1,8], "x":8, "y":2}, + {"matrix":[1,9], "x":9, "y":2}, + {"matrix":[1,10], "x":0, "y":3}, + {"matrix":[1,11], "x":1, "y":3}, + {"matrix":[1,12], "x":2, "y":3}, + {"matrix":[2,13], "x":3, "y":3}, + {"matrix":[2,14], "x":4, "y":3}, + {"matrix":[2,15], "x":5, "y":3}, + {"matrix":[2,10], "x":6, "y":3}, + {"matrix":[2,11], "x":7, "y":3}, + {"matrix":[2,12], "x":8, "y":3}, + {"matrix":[2,16], "x":9, "y":3}, + {"matrix":[2,0], "x":0, "y":4}, + {"matrix":[2,1], "x":1, "y":4}, + {"matrix":[2,2], "x":2, "y":4}, + {"matrix":[2,3], "x":3, "y":4}, + {"matrix":[2,4], "x":4, "y":4}, + {"matrix":[2,5], "x":5, "y":4}, + {"matrix":[2,6], "x":6, "y":4}, + {"matrix":[2,7], "x":7, "y":4}, + {"matrix":[2,8], "x":8, "y":4}, + {"matrix":[2,9], "x":9, "y":4}, + {"matrix":[3,0], "x":0, "y":5}, + {"matrix":[3,1], "x":1, "y":5}, + {"matrix":[3,2], "x":2, "y":5}, + {"matrix":[3,3], "x":3, "y":5}, + {"matrix":[3,4], "x":4, "y":5}, + {"matrix":[3,5], "x":5, "y":5}, + {"matrix":[3,6], "x":6, "y":5}, + {"matrix":[3,7], "x":7, "y":5}, + {"matrix":[3,8], "x":8, "y":5}, + {"matrix":[3,9], "x":9, "y":5}, + {"matrix":[3,10], "x":0, "y":6}, + {"matrix":[3,11], "x":1, "y":6}, + {"matrix":[3,12], "x":2, "y":6}, + {"matrix":[3,13], "x":3, "y":6}, + {"matrix":[3,14], "x":4, "y":6}, + {"matrix":[3,15], "x":5, "y":6}, + {"matrix":[3,16], "x":6, "y":6}, + {"matrix":[4,13], "x":7, "y":6}, + {"matrix":[4,14], "x":8, "y":6}, + {"matrix":[4,15], "x":9, "y":6}, + {"matrix":[4,0], "x":0, "y":7}, + {"matrix":[4,1], "x":1, "y":7}, + {"matrix":[4,2], "x":2, "y":7}, + {"matrix":[4,3], "x":3, "y":7}, + {"matrix":[4,4], "x":4, "y":7}, + {"matrix":[4,5], "x":5, "y":7}, + {"matrix":[4,6], "x":6, "y":7}, + {"matrix":[4,7], "x":7, "y":7}, + {"matrix":[4,8], "x":8, "y":7}, + {"matrix":[4,9], "x":9, "y":7}, + {"matrix":[4,10], "x":0, "y":8}, + {"matrix":[4,11], "x":1, "y":8}, + {"matrix":[4,12], "x":2, "y":8}, + {"matrix":[5,13], "x":3, "y":8}, + {"matrix":[5,14], "x":4, "y":8}, + {"matrix":[5,15], "x":5, "y":8}, + {"matrix":[5,10], "x":6, "y":8}, + {"matrix":[5,11], "x":7, "y":8}, + {"matrix":[5,12], "x":8, "y":8}, + {"matrix":[5,16], "x":9, "y":8}, + {"matrix":[5,0], "x":0, "y":9}, + {"matrix":[5,1], "x":1, "y":9}, + {"matrix":[5,2], "x":2, "y":9}, + {"matrix":[5,3], "x":3, "y":9}, + {"matrix":[5,4], "x":4, "y":9}, + {"matrix":[5,5], "x":5, "y":9}, + {"matrix":[5,6], "x":6, "y":9}, + {"matrix":[5,7], "x":7, "y":9}, + {"matrix":[5,8], "x":8, "y":9}, + {"matrix":[5,9], "x":9, "y":9} + ] + } + } +} diff --git a/keyboards/keychron/switch_pad/keymaps/default/keymap.c b/keyboards/keychron/switch_pad/keymaps/default/keymap.c new file mode 100755 index 000000000000..e5de9de41266 --- /dev/null +++ b/keyboards/keychron/switch_pad/keymaps/default/keymap.c @@ -0,0 +1,76 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + BASE, + L1, + L2, + L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT( + RGB_MOD, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, RGB_RMOD + ), + [L1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/keychron/switch_pad/keymaps/keychron/keymap.c b/keyboards/keychron/switch_pad/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..81f9db29074e --- /dev/null +++ b/keyboards/keychron/switch_pad/keymaps/keychron/keymap.c @@ -0,0 +1,99 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" + +enum layers { + BASE, + L1, + L2, + L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT( + RGB_MOD, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, RGB_RMOD + ), + [L1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + + return true; +} + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable = true; + debug_matrix = true; + debug_keyboard=true; + // debug_mouse=true; +} diff --git a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/rules.mk b/keyboards/keychron/switch_pad/keymaps/keychron/rules.mk old mode 100644 new mode 100755 similarity index 55% rename from keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/rules.mk rename to keyboards/keychron/switch_pad/keymaps/keychron/rules.mk index 495e8907b48c..112affea1666 --- a/keyboards/keychron/c1_pro/ansi/rgb/keymaps/keychron/rules.mk +++ b/keyboards/keychron/switch_pad/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common SRC += keychron_common.c diff --git a/keyboards/keychron/switch_pad/keymaps/via/keymap.c b/keyboards/keychron/switch_pad/keymaps/via/keymap.c new file mode 100755 index 000000000000..be9e81c03870 --- /dev/null +++ b/keyboards/keychron/switch_pad/keymaps/via/keymap.c @@ -0,0 +1,76 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + BASE, + L1, + L2, + L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT( + RGB_MOD, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, + KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, RGB_RMOD + ), + [L1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; diff --git a/keyboards/keychron/switch_pad/keymaps/via/rules.mk b/keyboards/keychron/switch_pad/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/switch_pad/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/switch_pad/mcuconf.h b/keyboards/keychron/switch_pad/mcuconf.h new file mode 100755 index 000000000000..0ca8c64850f4 --- /dev/null +++ b/keyboards/keychron/switch_pad/mcuconf.h @@ -0,0 +1,22 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/q1/readme.md b/keyboards/keychron/switch_pad/readme.md old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/q1/readme.md rename to keyboards/keychron/switch_pad/readme.md index 94b7a21f5b03..864d3815a841 --- a/keyboards/keychron/q1/readme.md +++ b/keyboards/keychron/switch_pad/readme.md @@ -1,20 +1,20 @@ -# Keychron Q1 +# Keychron S1 -![Keychron Q1](https://cdn.shopify.com/s/files/1/0059/0630/1017/t/5/assets/pf-823ebdc7--1073.jpg) +![Keychron S1](https://i.imgur.com/X1GFlYK.jpg) A customizable 75% keyboard. * Keyboard Maintainer: [Keychron](https://github.com/keychron) -* Hardware Supported: Keychron Q1 -* Hardware Availability: [Keychron](https://www.keychron.com) +* Hardware Supported: Keychron S1 +* Hardware Availability: [Keychron S1 QMK Custom Mechanical Keyboard](https://www.keychron.com/products/keychron-s1-qmk-custom-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): - make keychron/q1/ansi:default + make keychron/s1/ansi/rgb:default Flashing example for this keyboard: - make keychron/q1/ansi:default:flash + make keychron/s1/ansi/rgb:default:flash **Reset Key**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. diff --git a/keyboards/keychron/switch_pad/rules.mk b/keyboards/keychron/switch_pad/rules.mk new file mode 100755 index 000000000000..2f2902b17297 --- /dev/null +++ b/keyboards/keychron/switch_pad/rules.mk @@ -0,0 +1,2 @@ +VPATH += keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/switch_pad/switch_pad.c b/keyboards/keychron/switch_pad/switch_pad.c new file mode 100755 index 000000000000..bfdf272e2dba --- /dev/null +++ b/keyboards/keychron/switch_pad/switch_pad.c @@ -0,0 +1,294 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, I_1, G_1, H_1}, + {0, I_2, G_2, H_2}, + {0, I_3, G_3, H_3}, + {0, I_4, G_4, H_4}, + {0, I_5, G_5, H_5}, + {0, I_6, G_6, H_6}, + {0, I_7, G_7, H_7}, + {0, I_8, G_8, H_8}, + {0, I_9, G_9, H_9}, + {0, I_10, G_10, H_10}, + + {0, I_11, G_11, H_11}, + {0, I_12, G_12, H_12}, + {0, I_13, G_13, H_13}, + {0, I_14, G_14, H_14}, + {0, I_15, G_15, H_15}, + {0, I_16, G_16, H_16}, + {1, L_6, J_6, K_6}, + {0, C_14, A_14, B_14}, + {0, C_15, A_15, B_15}, + {0, C_16, A_16, B_16}, + + {0, C_1, A_1, B_1}, + {0, C_2, A_2, B_2}, + {0, C_3, A_3, B_3}, + {0, C_4, A_4, B_4}, + {0, C_5, A_5, B_5}, + {0, C_6, A_6, B_6}, + {0, C_7, A_7, B_7}, + {0, C_8, A_8, B_8}, + {0, C_9, A_9, B_9}, + {0, C_10, A_10, B_10}, + + {0, C_11, A_11, B_11}, + {0, C_12, A_12, B_12}, + {0, C_13, A_13, B_13}, + {0, F_14, D_14, E_14}, + {0, F_15, D_15, E_15}, + {0, F_16, D_16, E_16}, + {0, F_11, D_11, E_11}, + {0, F_12, D_12, E_12}, + {0, F_13, D_13, E_13}, + {0, F_10, D_10, E_10}, + + {0, F_1, D_1, E_1}, + {0, F_2, D_2, E_2}, + {0, F_3, D_3, E_3}, + {0, F_4, D_4, E_4}, + {0, F_5, D_5, E_5}, + {0, F_6, D_6, E_6}, + {0, F_7, D_7, E_7}, + {0, F_8, D_8, E_8}, + {0, F_9, D_9, E_9}, + {1, L_7, J_7, K_7}, + + {1, I_1, G_1, H_1}, + {1, I_2, G_2, H_2}, + {1, I_3, G_3, H_3}, + {1, I_4, G_4, H_4}, + {1, I_5, G_5, H_5}, + {1, I_6, G_6, H_6}, + {1, I_7, G_7, H_7}, + {1, I_8, G_8, H_8}, + {1, I_9, G_9, H_9}, + {1, I_10, G_10, H_10}, + + {1, I_11, G_11, H_11}, + {1, I_12, G_12, H_12}, + {1, I_13, G_13, H_13}, + {1, I_14, G_14, H_14}, + {1, I_15, G_15, H_15}, + {1, I_16, G_16, H_16}, + {1, L_8, J_8, K_8}, + {1, C_14, A_14, B_14}, + {1, C_15, A_15, B_15}, + {1, C_16, A_16, B_16}, + + {1, C_1, A_1, B_1}, + {1, C_2, A_2, B_2}, + {1, C_3, A_3, B_3}, + {1, C_4, A_4, B_4}, + {1, C_5, A_5, B_5}, + {1, C_6, A_6, B_6}, + {1, C_7, A_7, B_7}, + {1, C_8, A_8, B_8}, + {1, C_9, A_9, B_9}, + {1, C_10, A_10, B_10}, + + {1, C_11, A_11, B_11}, + {1, C_12, A_12, B_12}, + {1, C_13, A_13, B_13}, + {1, F_14, D_14, E_14}, + {1, F_15, D_15, E_15}, + {1, F_16, D_16, E_16}, + {1, F_11, D_11, E_11}, + {1, F_12, D_12, E_12}, + {1, F_13, D_13, E_13}, + {1, F_10, D_10, E_10}, + + {1, F_1, D_1, E_1}, + {1, F_2, D_2, E_2}, + {1, F_3, D_3, E_3}, + {1, F_4, D_4, E_4}, + {1, F_5, D_5, E_5}, + {1, F_6, D_6, E_6}, + {1, F_7, D_7, E_7}, + {1, F_8, D_8, E_8}, + {1, F_9, D_9, E_9}, + {1, L_9, J_9, K_9}, +}; +#endif + +// clang-format on +uint8_t row1 = 1; +uint8_t row2 = 2; +uint8_t row3 = 4; +uint8_t col = 9; + +uint8_t key_press_status = 0; +uint8_t factory_reset_count = 0; +uint32_t factory_reset_buffer = 0; +uint32_t indicator_buffer = 0; + +#define KEY_PRESS_STEP_0 (0x1 << 0) +#define KEY_PRESS_STEP_1 (0x1 << 1) +#define KEY_PRESS_STEP_2 (0x1 << 2) +#define KEY_PRESS_STEP_3 (0x1 << 3) +#define KEY_PRESS_STEP_4 (0x1 << 4) +#define KEY_PRESS_FACTORY_RESET (KEY_PRESS_STEP_0 | KEY_PRESS_STEP_1) +#define KEY_PRESS_LIGHT_TEST (KEY_PRESS_STEP_2 | KEY_PRESS_STEP_3 | KEY_PRESS_STEP_4) + +enum { + LED_TEST_MODE_OFF, + LED_TEST_MODE_WHITE, + LED_TEST_MODE_RED, + LED_TEST_MODE_GREEN, + LED_TEST_MODE_BLUE, + LED_TEST_MODE_MAX, +} led_test_mode; + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case RGB_MOD: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_STEP_0; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + factory_reset_buffer = timer_read32(); + } + } else { + rgb_matrix_step(); + key_press_status &= ~KEY_PRESS_STEP_0; + factory_reset_buffer = 0; + } + return false; + case RGB_RMOD: + if (record->event.pressed) { + key_press_status |= KEY_PRESS_STEP_1; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + factory_reset_buffer = timer_read32(); + } + } else { + rgb_matrix_step_reverse(); + key_press_status &= ~KEY_PRESS_STEP_1; + factory_reset_buffer = 0; + } + return false; + case KC_P9: + if (record->event.pressed) { + if (matrix_get_row(row1) & (1 << col)) { + key_press_status |= KEY_PRESS_STEP_2; + } + if (matrix_get_row(row2) & (1 << col)) { + key_press_status |= KEY_PRESS_STEP_3; + if (led_test_mode) { + if (++led_test_mode >= LED_TEST_MODE_MAX) { + led_test_mode = LED_TEST_MODE_WHITE; + } + } + } + if (matrix_get_row(row3) & (1 << col)) { + key_press_status |= KEY_PRESS_STEP_4; + if (led_test_mode) { + led_test_mode = LED_TEST_MODE_OFF; + } + } + if (key_press_status == KEY_PRESS_LIGHT_TEST) { + factory_reset_buffer = timer_read32(); + } + } else { + key_press_status &= ~KEY_PRESS_LIGHT_TEST; + factory_reset_buffer = 0; + } + return true; + } + + return true; +} + +void housekeeping_task_kb(void) { + if (factory_reset_buffer && (timer_elapsed32(factory_reset_buffer) > 4000)) { + factory_reset_buffer = 0; + if (key_press_status == KEY_PRESS_FACTORY_RESET) { + indicator_buffer = timer_read32(); + factory_reset_count++; + eeconfig_init(); + if (!rgb_matrix_is_enabled()) { + rgb_matrix_enable(); + } + rgb_matrix_init(); + } else if (key_press_status == KEY_PRESS_LIGHT_TEST) { + led_test_mode = LED_TEST_MODE_WHITE; + if (!rgb_matrix_is_enabled()) { + rgb_matrix_enable(); + } + } + key_press_status = 0; + } + + if (indicator_buffer && (timer_elapsed32(indicator_buffer) > 300)) { + if (factory_reset_count++ > 6) { + indicator_buffer = 0; + factory_reset_count = 0; + } else { + indicator_buffer = timer_read32(); + } + } +} + +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (factory_reset_count) { + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, factory_reset_count % 2 ? 0 : RGB_RED); + } + } + + if (led_test_mode) { + switch (led_test_mode) { + case LED_TEST_MODE_WHITE: + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_WHITE); + } + break; + case LED_TEST_MODE_RED: + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_RED); + } + break; + case LED_TEST_MODE_GREEN: + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_GREEN); + } + break; + case LED_TEST_MODE_BLUE: + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, RGB_BLUE); + } + break; + default: + break; + } + } + return true; +} diff --git a/keyboards/keychron/v1/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/v1/ansi/keymaps/keychron/keymap.c index 4653954d7e9d..a23cf9d2b956 100644 --- a/keyboards/keychron/v1/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/ansi/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, @@ -64,11 +64,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { void housekeeping_task_user(void) { housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/v1/ansi/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/v1/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/ansi/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/keymap.c index f5e6247ca6ab..212ab8616ffb 100644 --- a/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_82( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, @@ -60,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, @@ -72,10 +70,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { #endif // ENCODER_MAP_ENABLE // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/ansi_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/config.h b/keyboards/keychron/v1/config.h index e5b82a143dae..47a41a4b54bc 100644 --- a/keyboards/keychron/v1/config.h +++ b/keyboards/keychron/v1/config.h @@ -31,6 +31,18 @@ /* DIP switch */ #define DIP_SWITCH_MATRIX_GRID { {5,4} } + +/* HC595 Driver Configuration */ +#define HC595_STCP B0 +#define HC595_SHCP B1 +#define HC595_DS A7 +#define HC595_START_INDEX 8 +#define HC595_END_INDEX 15 + +/* Factory test keys */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) + /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 diff --git a/keyboards/keychron/v1/halconf.h b/keyboards/keychron/v1/halconf.h index 41bddcb2799b..463d177eabc7 100644 --- a/keyboards/keychron/v1/halconf.h +++ b/keyboards/keychron/v1/halconf.h @@ -17,5 +17,8 @@ #pragma once #define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif #include_next diff --git a/keyboards/keychron/v1/iso/keymaps/keychron/keymap.c b/keyboards/keychron/v1/iso/keymaps/keychron/keymap.c index 351b426571cc..c53cefb36c4c 100644 --- a/keyboards/keychron/v1/iso/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/iso/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers { +enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, @@ -62,9 +62,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/iso/keymaps/keychron/rules.mk b/keyboards/keychron/v1/iso/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/v1/iso/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/iso/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/iso_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/v1/iso_encoder/keymaps/keychron/keymap.c index 52e1a316546c..3c111ff41888 100644 --- a/keyboards/keychron/v1/iso_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/iso_encoder/keymaps/keychron/keymap.c @@ -16,16 +16,16 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_iso_83( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, @@ -60,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, @@ -72,10 +70,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { #endif // ENCODER_MAP_ENABLE // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/iso_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/v1/iso_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/v1/iso_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/iso_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/jis/keymaps/default/keymap.c b/keyboards/keychron/v1/jis/keymaps/default/keymap.c index 95784d077a28..1b32e55590c7 100644 --- a/keyboards/keychron/v1/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/v1/jis/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v1/jis/keymaps/keychron/keymap.c b/keyboards/keychron/v1/jis/keymaps/keychron/keymap.c index 126288b7f087..0368cf23ee8d 100644 --- a/keyboards/keychron/v1/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/jis/keymaps/keychron/keymap.c @@ -16,22 +16,22 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_86( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -62,9 +62,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/jis/keymaps/keychron/rules.mk b/keyboards/keychron/v1/jis/keymaps/keychron/rules.mk index 495e8907b48c..3c9fcc5c98c2 100644 --- a/keyboards/keychron/v1/jis/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/jis/keymaps/keychron/rules.mk @@ -1,4 +1,3 @@ VIA_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/jis/keymaps/via/keymap.c b/keyboards/keychron/v1/jis/keymaps/via/keymap.c index 95784d077a28..1b32e55590c7 100644 --- a/keyboards/keychron/v1/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/v1/jis/keymaps/via/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v1/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/v1/jis_encoder/keymaps/default/keymap.c index 05f0d38846ef..abd53189ffaf 100644 --- a/keyboards/keychron/v1/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/v1/jis_encoder/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v1/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/v1/jis_encoder/keymaps/keychron/keymap.c index bef69ccea8ec..c564474c136f 100644 --- a/keyboards/keychron/v1/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v1/jis_encoder/keymaps/keychron/keymap.c @@ -16,22 +16,22 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" - -// clang-format off +#include "keychron_ft_common.h" enum layers{ MAC_BASE, MAC_FN, WIN_BASE, - WIN_FN + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_86( KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -60,8 +60,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), }; -// clang-format on - #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { [MAC_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, @@ -72,10 +70,17 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { #endif // ENCODER_MAP_ENABLE // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v1/jis_encoder/keymaps/keychron/rules.mk b/keyboards/keychron/v1/jis_encoder/keymaps/keychron/rules.mk index 9cf1a9b56cba..936769ddc6e2 100644 --- a/keyboards/keychron/v1/jis_encoder/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v1/jis_encoder/keymaps/keychron/rules.mk @@ -1,5 +1,4 @@ VIA_ENABLE = yes ENCODER_MAP_ENABLE = yes -VPATH += keyboards/keychron/common -SRC += keychron_common.c +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v1/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/v1/jis_encoder/keymaps/via/keymap.c index 05f0d38846ef..abd53189ffaf 100644 --- a/keyboards/keychron/v1/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/v1/jis_encoder/keymaps/via/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v1/matrix.c b/keyboards/keychron/v1/matrix.c deleted file mode 100644 index 82a883834f82..000000000000 --- a/keyboards/keychron/v1/matrix.c +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright 2022 @ Keychron (https://www.keychron.com) - * - * 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 - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "matrix.h" -#include "quantum.h" - -// Pin connected to DS of 74HC595 -#define DATA_PIN A7 -// Pin connected to SH_CP of 74HC595 -#define CLOCK_PIN B1 -// Pin connected to ST_CP of 74HC595 -#define LATCH_PIN B0 - -#ifdef MATRIX_ROW_PINS -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -#endif // MATRIX_ROW_PINS -#ifdef MATRIX_COL_PINS -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif // MATRIX_COL_PINS - -#define ROWS_PER_HAND MATRIX_ROWS - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinOutput_writeHigh(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinHigh(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } -} - -static inline uint8_t readMatrixPin(pin_t pin) { - if (pin != NO_PIN) { - return readPin(pin); - } else { - return 1; - } -} - -// At 3.6V input, three nops (37.5ns) should be enough for all signals -#define small_delay() __asm__ __volatile__("nop;nop;nop;\n\t" ::: "memory") -#define compiler_barrier() __asm__ __volatile__("" ::: "memory") - -static void shiftOut(uint8_t dataOut) { - ATOMIC_BLOCK_FORCEON { - for (uint8_t i = 0; i < 8; i++) { - compiler_barrier(); - if (dataOut & 0x1) { - writePinHigh(DATA_PIN); - } else { - writePinLow(DATA_PIN); - } - dataOut = dataOut >> 1; - compiler_barrier(); - writePinHigh(CLOCK_PIN); - small_delay(); - writePinLow(CLOCK_PIN); - } - compiler_barrier(); - writePinHigh(LATCH_PIN); - small_delay(); - writePinLow(LATCH_PIN); - compiler_barrier(); - } -} - -static void shiftOut_single(uint8_t data) { - ATOMIC_BLOCK_FORCEON { - compiler_barrier(); - if (data & 0x1) { - writePinHigh(DATA_PIN); - } else { - writePinLow(DATA_PIN); - } - compiler_barrier(); - writePinHigh(CLOCK_PIN); - small_delay(); - writePinLow(CLOCK_PIN); - compiler_barrier(); - writePinHigh(LATCH_PIN); - small_delay(); - writePinLow(LATCH_PIN); - compiler_barrier(); - } -} - -static bool select_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { - setPinOutput_writeLow(pin); - return true; - } else { - if (col == 8) { - shiftOut_single(0x00); - } - return true; - } - return false; -} - -static void unselect_col(uint8_t col) { - pin_t pin = col_pins[col]; - - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - shiftOut_single(0x01); - } -} - -static void unselect_cols(void) { - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - pin_t pin = col_pins[x]; - if (pin != NO_PIN) { -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - setPinOutput_writeHigh(pin); -#else - setPinInputHigh_atomic(pin); -#endif - } else { - if (x == 8) - // unselect shift Register - shiftOut(0xFF); - } - } -} - -static void matrix_init_pins(void) { - setPinOutput(DATA_PIN); - setPinOutput(CLOCK_PIN); - setPinOutput(LATCH_PIN); -#ifdef MATRIX_UNSELECT_DRIVE_HIGH - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - if (col_pins[x] != NO_PIN) { - setPinOutput(col_pins[x]); - } - } -#endif - unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - if (row_pins[x] != NO_PIN) { - setPinInputHigh_atomic(row_pins[x]); - } - } -} - -static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { - bool key_pressed = false; - - // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col - } - - matrix_output_select_delay(); - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Check row pin state - if (readMatrixPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_matrix[row_index] |= row_shifter; - key_pressed = true; - } else { - // Pin HI, clear col bit - current_matrix[row_index] &= ~row_shifter; - } - } - - // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH -} - -void matrix_init_custom(void) { - // initialize key pins - matrix_init_pins(); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; - - // Set col, read rows - matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { - matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); - } - - bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; - if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); - - return changed; -} diff --git a/keyboards/keychron/v1/rules.mk b/keyboards/keychron/v1/rules.mk new file mode 100644 index 000000000000..a515de570cd8 --- /dev/null +++ b/keyboards/keychron/v1/rules.mk @@ -0,0 +1,2 @@ +VPATH += $(TOP_DIR)/keyboards/keychron/common +SRC += matrix.c diff --git a/keyboards/keychron/v1/v1.c b/keyboards/keychron/v1/v1.c index 79c591917475..579055fd7ddc 100644 --- a/keyboards/keychron/v1/v1.c +++ b/keyboards/keychron/v1/v1.c @@ -16,6 +16,7 @@ #include "quantum.h" +// clang-format off const matrix_row_t matrix_mask[] = { 0b1111111111111111, 0b1111111111111111, @@ -24,6 +25,7 @@ const matrix_row_t matrix_mask[] = { 0b1111111111111111, 0b1111111111101111, }; +// clang-format on #ifdef DIP_SWITCH_ENABLE @@ -42,11 +44,21 @@ bool dip_switch_update_kb(uint8_t index, bool active) { #if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } + if (!process_record_user(keycode, record)) { + return false; + } switch (keycode) { -#ifdef RGB_MATRIX_ENABLE +# ifdef RGB_MATRIX_ENABLE case RGB_TOG: + if (!rgb_matrix_is_enabled()) { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable(); + } if (record->event.pressed) { + if (rgb_matrix_get_val() == 0) { + rgb_matrix_increase_val(); + if (rgb_matrix_get_flags() == LED_FLAG_ALL) return false; + } switch (rgb_matrix_get_flags()) { case LED_FLAG_ALL: { rgb_matrix_set_flags(LED_FLAG_NONE); @@ -57,25 +69,34 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } break; } } + return false; + + case RGB_VAI: if (!rgb_matrix_is_enabled()) { rgb_matrix_set_flags(LED_FLAG_ALL); rgb_matrix_enable(); } - return false; -#endif + if (rgb_matrix_get_flags() == LED_FLAG_NONE) { + rgb_matrix_set_flags(LED_FLAG_ALL); + return false; + } + break; +# endif } 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; } + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { + return false; + } // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); if (host_keyboard_led_state().caps_lock) { RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); } else { if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); + RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); } } return true; diff --git a/keyboards/keychron/v2/jis/keymaps/default/keymap.c b/keyboards/keychron/v2/jis/keymaps/default/keymap.c index 30e83b21a624..c79d141b03f4 100644 --- a/keyboards/keychron/v2/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/v2/jis/keymaps/default/keymap.c @@ -33,14 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v2/jis/keymaps/keychron/keymap.c b/keyboards/keychron/v2/jis/keymaps/keychron/keymap.c index 68c399a18b65..0d331d663e56 100644 --- a/keyboards/keychron/v2/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v2/jis/keymaps/keychron/keymap.c @@ -31,14 +31,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v2/jis/keymaps/via/keymap.c b/keyboards/keychron/v2/jis/keymaps/via/keymap.c index 30e83b21a624..c79d141b03f4 100644 --- a/keyboards/keychron/v2/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/v2/jis/keymaps/via/keymap.c @@ -33,14 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v2/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/v2/jis_encoder/keymaps/default/keymap.c index 68ca97e791b4..e87c982442f9 100644 --- a/keyboards/keychron/v2/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/v2/jis_encoder/keymaps/default/keymap.c @@ -33,14 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v2/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/v2/jis_encoder/keymaps/keychron/keymap.c index 49bdca2fd121..b5e1db969871 100644 --- a/keyboards/keychron/v2/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v2/jis_encoder/keymaps/keychron/keymap.c @@ -31,14 +31,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v2/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/v2/jis_encoder/keymaps/via/keymap.c index 68ca97e791b4..e87c982442f9 100644 --- a/keyboards/keychron/v2/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/v2/jis_encoder/keymaps/via/keymap.c @@ -33,14 +33,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, MO(_FN1), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), [WIN_BASE] = LAYOUT_jis_71( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_HOME, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, MO(_FN2), MO(_FN3), KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis/keymaps/default/keymap.c b/keyboards/keychron/v3/jis/keymaps/default/keymap.c index 7fa980bb0864..2b496d406269 100644 --- a/keyboards/keychron/v3/jis/keymaps/default/keymap.c +++ b/keyboards/keychron/v3/jis/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis/keymaps/keychron/keymap.c b/keyboards/keychron/v3/jis/keymaps/keychron/keymap.c index 38c93f505acf..65a898b567b7 100644 --- a/keyboards/keychron/v3/jis/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v3/jis/keymaps/keychron/keymap.c @@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis/keymaps/via/keymap.c b/keyboards/keychron/v3/jis/keymaps/via/keymap.c index 7fa980bb0864..2b496d406269 100644 --- a/keyboards/keychron/v3/jis/keymaps/via/keymap.c +++ b/keyboards/keychron/v3/jis/keymaps/via/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis_encoder/keymaps/default/keymap.c b/keyboards/keychron/v3/jis_encoder/keymaps/default/keymap.c index 18c17da4fd4b..730e960a39a2 100644 --- a/keyboards/keychron/v3/jis_encoder/keymaps/default/keymap.c +++ b/keyboards/keychron/v3/jis_encoder/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis_encoder/keymaps/keychron/keymap.c b/keyboards/keychron/v3/jis_encoder/keymaps/keychron/keymap.c index 9b69c9443c81..3e23af7c2f55 100644 --- a/keyboards/keychron/v3/jis_encoder/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v3/jis_encoder/keymaps/keychron/keymap.c @@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_SNAP, KC_SIRI, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPTN, KC_LCMMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMMD, KC_ROPTN, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_CRTA, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LCMD, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v3/jis_encoder/keymaps/via/keymap.c b/keyboards/keychron/v3/jis_encoder/keymaps/via/keymap.c index 18c17da4fd4b..730e960a39a2 100644 --- a/keyboards/keychron/v3/jis_encoder/keymaps/via/keymap.c +++ b/keyboards/keychron/v3/jis_encoder/keymaps/via/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_BRID, KC_BRIU, KC_NO, KC_NO, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MUTE, KC_NO, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LOPT, KC_LCMD, KC_LNG2, KC_SPC, KC_LNG1, KC_RCMD, KC_ROPT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE, KC_PSCR, KC_NO, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INT3, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_INT1, KC_RSFT, KC_UP, KC_LCTL, KC_LWIN, KC_LALT, KC_INT5, KC_SPC, KC_INT4, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), diff --git a/keyboards/keychron/v5/ansi/ansi.c b/keyboards/keychron/v5/ansi/ansi.c index f4525dc3dc14..336c07c81a0f 100644 --- a/keyboards/keychron/v5/ansi/ansi.c +++ b/keyboards/keychron/v5/ansi/ansi.c @@ -19,7 +19,6 @@ #ifdef RGB_MATRIX_ENABLE // clang-format off - const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { /* Refer to IS31 manual for these locations * driver @@ -83,6 +82,7 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {0, F_15, D_15, E_15}, {0, F_16, D_16, E_16}, {0, L_15, J_15, K_15}, + {0, L_16, J_16, K_16}, {1, C_16, A_16, B_16}, {1, C_15, A_15, B_15}, @@ -100,7 +100,6 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, C_1, A_1, B_1}, {1, L_3, J_3, K_3}, {1, L_4, J_4, K_4}, - {0, L_16, J_16, K_16}, {1, I_16, G_16, H_16}, {1, I_14, G_14, H_14}, @@ -118,6 +117,7 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, I_1, G_1, H_1}, {1, L_5, J_5, K_5}, {1, L_6, J_6, K_6}, + {1, L_7, J_7, K_7}, {1, F_16, D_16, E_16}, {1, F_15, D_15, E_15}, @@ -131,39 +131,5 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = { {1, F_1, D_1, E_1}, {1, L_1, J_1, K_1}, {1, L_2, J_2, K_2}, - {1, L_7, J_7, K_7} }; - -#define __ NO_LED - -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, - { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, __, 33, 34, 35 }, - { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 70, 51, 52, 53 }, - { 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 18, 66, 36, 67, 68, 69 }, - { 71, __, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, __, 82, 83, 84, 85, 86 }, - { 87, 88, 89, __, __, 99, 90, __, __, __, 91, 92, 93, 94, 95, 96, 97, 98 } - }, - { - // LED Index to Physical Position - {0,0}, {12,0}, {24,0}, {36,0}, {48,0}, {60,0}, {72,0}, {84,0}, {97,0}, {109,0}, {121,0}, {133,0}, {145,0}, {157,0}, {169,0}, {188,0}, {200,0}, {212,0}, {224,0}, - {0,15}, {12,15}, {24,15}, {36,15}, {48,15}, {60,15}, {72,15}, {84,15}, {97,15}, {109,15}, {121,15}, {133,15}, {145,15}, {163,15}, {188,15}, {200,15}, {212,15}, {224,15}, - {3,26}, {18,26}, {30,26}, {42,26}, {54,26}, {66,26}, {78,26}, {91,26}, {103,26}, {115,26}, {127,26}, {139,26}, {151,26}, {166,26}, {188,26}, {200,26}, {212,26}, - {5,38}, {21,38}, {33,38}, {45,38}, {57,38}, {69,38}, {81,38}, {94,38}, {106,38}, {118,38}, {130,38}, {142,38}, {161,38}, {188,38}, {200,38}, {212,38}, {224,32}, - {8,49}, {27,49}, {39,49}, {51,49}, {63,49}, {75,49}, {88,49}, {100,49}, {112,49}, {124,49}, {136,49}, {152,49}, {172,52}, {188,49}, {200,49}, {212,49}, - {1,61}, {17,61}, {32,61}, {77,61}, {121,61}, {133,61}, {145,61}, {160,64}, {172,64}, {184,64}, {200,61}, {212,61}, {224,55}, - }, - { - // RGB LED Index to Flag - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 8, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, - 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - } -}; - #endif // RGB_MATRIX_ENABLE diff --git a/keyboards/keychron/v5/ansi/config.h b/keyboards/keychron/v5/ansi/config.h index 7985d4390156..3a3ba4fd6bff 100644 --- a/keyboards/keychron/v5/ansi/config.h +++ b/keyboards/keychron/v5/ansi/config.h @@ -21,5 +21,6 @@ #define DRIVER_2_LED_TOTAL 45 #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) -/* Enable caps-lock LED */ -#define CAPS_LOCK_LED_INDEX 54 +/* Indication Led Index */ +#define CAPS_LOCK_INDEX 55 +#define NUM_LOCK_INDEX 33 diff --git a/keyboards/keychron/v5/ansi/info.json b/keyboards/keychron/v5/ansi/info.json index bc5eec2ca55e..009048de68d8 100644 --- a/keyboards/keychron/v5/ansi/info.json +++ b/keyboards/keychron/v5/ansi/info.json @@ -1,18 +1,8 @@ { - "keyboard_name": "Keychron V5", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", "pid": "0x0350", "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "ckled2001" - }, - "processor": "STM32L432", - "bootloader": "stm32-dfu", "layouts": { "LAYOUT_ansi_100": { "layout": [ @@ -72,6 +62,7 @@ {"matrix": [2, 15], "x": 15.5, "y": 2.25}, {"matrix": [2, 16], "x": 16.5, "y": 2.25}, {"matrix": [2, 17], "x": 17.5, "y": 2.25}, + {"matrix": [2, 14], "x": 18.5, "y": 2.25, "h": 2}, {"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, {"matrix": [3, 1], "x": 1.75, "y": 3.25}, @@ -89,7 +80,6 @@ {"matrix": [3, 15], "x": 15.5, "y": 3.25}, {"matrix": [3, 16], "x": 16.5, "y": 3.25}, {"matrix": [3, 17], "x": 17.5, "y": 3.25}, - {"matrix": [2, 14], "x": 18.5, "y": 2.25, "h": 2}, {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, {"matrix": [4, 2], "x": 2.25, "y": 4.25}, @@ -107,6 +97,7 @@ {"matrix": [4, 15], "x": 15.5, "y": 4.25}, {"matrix": [4, 16], "x": 16.5, "y": 4.25}, {"matrix": [4, 17], "x": 17.5, "y": 4.25}, + {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2}, {"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, {"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, @@ -119,9 +110,117 @@ {"matrix": [5, 14], "x": 14.25, "y": 5.5}, {"matrix": [5, 15], "x": 15.25, "y": 5.5}, {"matrix": [5, 16], "x": 16.5, "y": 5.25}, - {"matrix": [5, 17], "x": 17.5, "y": 5.25}, - {"matrix": [5, 5], "x": 18.5, "y": 4.25, "h": 2} + {"matrix": [5, 17], "x": 17.5, "y": 5.25} ] } + }, + "rgb_matrix": { + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":12, "y":0}, + {"matrix":[0, 2], "flags":1, "x":24, "y":0}, + {"matrix":[0, 3], "flags":1, "x":36, "y":0}, + {"matrix":[0, 4], "flags":1, "x":48, "y":0}, + {"matrix":[0, 5], "flags":1, "x":60, "y":0}, + {"matrix":[0, 6], "flags":1, "x":72, "y":0}, + {"matrix":[0, 7], "flags":1, "x":84, "y":0}, + {"matrix":[0, 8], "flags":1, "x":97, "y":0}, + {"matrix":[0, 9], "flags":1, "x":109, "y":0}, + {"matrix":[0, 10], "flags":1, "x":121, "y":0}, + {"matrix":[0, 11], "flags":1, "x":133, "y":0}, + {"matrix":[0, 12], "flags":1, "x":145, "y":0}, + {"matrix":[0, 13], "flags":1, "x":169, "y":0}, + {"matrix":[0, 14], "flags":1, "x":188, "y":0}, + {"matrix":[0, 15], "flags":1, "x":188, "y":0}, + {"matrix":[0, 16], "flags":1, "x":200, "y":0}, + {"matrix":[0, 17], "flags":1, "x":212, "y":0}, + {"matrix":[3, 12], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":24, "y":15}, + {"matrix":[1, 3], "flags":4, "x":36, "y":15}, + {"matrix":[1, 4], "flags":4, "x":48, "y":15}, + {"matrix":[1, 5], "flags":4, "x":60, "y":15}, + {"matrix":[1, 6], "flags":4, "x":72, "y":15}, + {"matrix":[1, 7], "flags":4, "x":84, "y":15}, + {"matrix":[1, 8], "flags":4, "x":91, "y":15}, + {"matrix":[1, 9], "flags":4, "x":109, "y":15}, + {"matrix":[1, 10], "flags":4, "x":121, "y":15}, + {"matrix":[1, 11], "flags":4, "x":133, "y":15}, + {"matrix":[1, 12], "flags":4, "x":145, "y":15}, + {"matrix":[1, 13], "flags":1, "x":163, "y":15}, + {"matrix":[1, 15], "flags":8, "x":188, "y":15}, + {"matrix":[1, 16], "flags":4, "x":200, "y":15}, + {"matrix":[1, 17], "flags":4, "x":212, "y":15}, + {"matrix":[3, 14], "flags":4, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":26}, + {"matrix":[2, 1], "flags":4, "x":18, "y":26}, + {"matrix":[2, 2], "flags":4, "x":30, "y":26}, + {"matrix":[2, 3], "flags":4, "x":42, "y":26}, + {"matrix":[2, 4], "flags":4, "x":54, "y":26}, + {"matrix":[2, 5], "flags":4, "x":66, "y":26}, + {"matrix":[2, 6], "flags":4, "x":78, "y":26}, + {"matrix":[2, 7], "flags":4, "x":91, "y":26}, + {"matrix":[2, 8], "flags":4, "x":103, "y":26}, + {"matrix":[2, 9], "flags":4, "x":115, "y":26}, + {"matrix":[2, 10], "flags":4, "x":127, "y":26}, + {"matrix":[2, 11], "flags":4, "x":139, "y":26}, + {"matrix":[2, 12], "flags":4, "x":151, "y":26}, + {"matrix":[2, 13], "flags":1, "x":166, "y":26}, + {"matrix":[2, 15], "flags":4, "x":188, "y":26}, + {"matrix":[2, 16], "flags":4, "x":200, "y":26}, + {"matrix":[2, 17], "flags":4, "x":212, "y":26}, + {"matrix":[2, 14], "flags":4, "x":224, "y":32}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":38}, + {"matrix":[3, 1], "flags":4, "x":21, "y":38}, + {"matrix":[3, 2], "flags":4, "x":33, "y":38}, + {"matrix":[3, 3], "flags":4, "x":45, "y":38}, + {"matrix":[3, 4], "flags":4, "x":57, "y":38}, + {"matrix":[3, 5], "flags":4, "x":69, "y":38}, + {"matrix":[3, 6], "flags":4, "x":81, "y":38}, + {"matrix":[3, 7], "flags":4, "x":94, "y":38}, + {"matrix":[3, 8], "flags":4, "x":106, "y":38}, + {"matrix":[3, 9], "flags":4, "x":118, "y":38}, + {"matrix":[3, 10], "flags":4, "x":130, "y":38}, + {"matrix":[3, 11], "flags":4, "x":142, "y":38}, + {"matrix":[3, 13], "flags":4, "x":161, "y":38}, + {"matrix":[3, 15], "flags":1, "x":188, "y":38}, + {"matrix":[3, 16], "flags":4, "x":212, "y":38}, + {"matrix":[3, 17], "flags":4, "x":224, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":49}, + {"matrix":[4, 2], "flags":4, "x":27, "y":49}, + {"matrix":[4, 3], "flags":4, "x":39, "y":49}, + {"matrix":[4, 4], "flags":4, "x":51, "y":49}, + {"matrix":[4, 5], "flags":4, "x":63, "y":49}, + {"matrix":[4, 6], "flags":4, "x":75, "y":49}, + {"matrix":[4, 7], "flags":4, "x":88, "y":49}, + {"matrix":[4, 8], "flags":4, "x":100, "y":49}, + {"matrix":[4, 9], "flags":4, "x":112, "y":49}, + {"matrix":[4, 10], "flags":4, "x":124, "y":49}, + {"matrix":[4, 11], "flags":1, "x":136, "y":49}, + {"matrix":[4, 13], "flags":1, "x":152, "y":49}, + {"matrix":[4, 14], "flags":4, "x":172, "y":49}, + {"matrix":[4, 15], "flags":4, "x":188, "y":49}, + {"matrix":[4, 16], "flags":4, "x":200, "y":49}, + {"matrix":[4, 17], "flags":4, "x":212, "y":49}, + {"matrix":[5, 5], "flags":4, "x":224, "y":55}, + + {"matrix":[5, 0], "flags":1, "x":1, "y":61}, + {"matrix":[5, 1], "flags":1, "x":17, "y":61}, + {"matrix":[5, 2], "flags":1, "x":32, "y":61}, + {"matrix":[5, 6], "flags":4, "x":77, "y":61}, + {"matrix":[5, 10], "flags":1, "x":121, "y":61}, + {"matrix":[5, 11], "flags":1, "x":133, "y":61}, + {"matrix":[5, 12], "flags":1, "x":145, "y":61}, + {"matrix":[5, 13], "flags":1, "x":160, "y":64}, + {"matrix":[5, 14], "flags":1, "x":172, "y":64}, + {"matrix":[5, 15], "flags":1, "x":184, "y":64}, + {"matrix":[5, 16], "flags":1, "x":200, "y":64}, + {"matrix":[5, 17], "flags":4, "x":212, "y":61} + ] } } diff --git a/keyboards/keychron/v5/ansi/keymaps/keychron/keymap.c b/keyboards/keychron/v5/ansi/keymaps/keychron/keymap.c index 96a213a2d3c2..a6c491ed31f0 100644 --- a/keyboards/keychron/v5/ansi/keymaps/keychron/keymap.c +++ b/keyboards/keychron/v5/ansi/keymaps/keychron/keymap.c @@ -16,52 +16,60 @@ #include QMK_KEYBOARD_H #include "keychron_common.h" +#include "keychron_ft_common.h" -// clang-format off - -enum layers{ - MAC_BASE, - MAC_FN, - WIN_BASE, - WIN_FN +enum layers { + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [MAC_BASE] = LAYOUT_ansi_100( - KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, + KC_ESC, KC_BRID, KC_BRIU, KC_MICT, KC_LAPA, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, - KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [MAC_FN] = LAYOUT_ansi_100( _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [WIN_BASE] = LAYOUT_ansi_100( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, RGB_MOD, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, - KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), [WIN_FN] = LAYOUT_ansi_100( _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), }; // clang-format on +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!process_record_keychron(keycode, record)) { return false; } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } return true; } diff --git a/keyboards/keychron/v5/ansi/keymaps/keychron/rules.mk b/keyboards/keychron/v5/ansi/keymaps/keychron/rules.mk index 495e8907b48c..1e5b99807cb7 100644 --- a/keyboards/keychron/v5/ansi/keymaps/keychron/rules.mk +++ b/keyboards/keychron/v5/ansi/keymaps/keychron/rules.mk @@ -1,4 +1 @@ VIA_ENABLE = yes - -VPATH += keyboards/keychron/common -SRC += keychron_common.c diff --git a/keyboards/keychron/v5/ansi/rules.mk b/keyboards/keychron/v5/ansi/rules.mk index e859eb9c34c6..6e7633bfe015 100644 --- a/keyboards/keychron/v5/ansi/rules.mk +++ b/keyboards/keychron/v5/ansi/rules.mk @@ -1,21 +1 @@ -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable USB N-key Rollover -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output -DIP_SWITCH_ENABLE = yes -RGB_MATRIX_ENABLE = yes -EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = embedded_flash - -# custom matrix setup -CUSTOM_MATRIX = lite - -SRC += matrix.c +# This file intentionally left blank diff --git a/keyboards/keychron/v5/config.h b/keyboards/keychron/v5/config.h index 142dfead34b4..a1ea302d4128 100644 --- a/keyboards/keychron/v5/config.h +++ b/keyboards/keychron/v5/config.h @@ -16,15 +16,6 @@ #pragma once -/* Key matrix pins */ -#define MATRIX_ROW_PINS \ - { B5, B4, B3, A15, A14, A13 } -#define MATRIX_COL_PINS \ - { A10, A9, A8, B1, B0, A7, A6, A5, A4, A3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION ROW2COL - /* RGB Matrix Driver Configuration */ #define DRIVER_COUNT 2 #define DRIVER_ADDR_1 0b1110111 @@ -41,7 +32,10 @@ { 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56, 0xB6, 0xB6, 0x56 } /* DIP switch */ -#define DIP_SWITCH_MATRIX_GRID { {5, 4} } +#define DIP_SWITCH_MATRIX_GRID \ + { \ + { 5, 4 } \ + } /* Disable DIP switch in matrix data */ #define MATRIX_MASKED @@ -52,55 +46,22 @@ /* EEPROM Driver Configuration */ #define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) +#define EECONFIG_USER_DATA_SIZE 8 // 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_ALPHAS_MODS -// #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -#define ENABLE_RGB_MATRIX_BREATHING -// #define ENABLE_RGB_MATRIX_BAND_SAT -// #define ENABLE_RGB_MATRIX_BAND_VAL -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -// #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -// #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -#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_RAINBOW_PINWHEELS -// #define ENABLE_RGB_MATRIX_RAINDROPS -#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -// #define ENABLE_RGB_MATRIX_HUE_BREATHING -// #define ENABLE_RGB_MATRIX_HUE_PENDULUM -// #define ENABLE_RGB_MATRIX_HUE_WAVE -#define ENABLE_RGB_MATRIX_PIXEL_RAIN -// #define ENABLE_RGB_MATRIX_PIXEL_FLOW -// #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -#define ENABLE_RGB_MATRIX_TYPING_HEATMAP -#define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// 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_WIDE -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -// #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#define ENABLE_RGB_MATRIX_SPLASH -// #define ENABLE_RGB_MATRIX_MULTISPLASH -#define ENABLE_RGB_MATRIX_SOLID_SPLASH -// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES + +/* HC595 Driver Configuration */ +#define HC595_STCP A0 +#define HC595_SHCP A1 +#define HC595_DS C15 +#define HC595_START_INDEX 10 +#define HC595_END_INDEX 17 + +/* Factory Reset Key Definition */ +#define FN_KEY1 MO(1) +#define FN_KEY2 MO(3) diff --git a/keyboards/keychron/v5/info.json b/keyboards/keychron/v5/info.json new file mode 100644 index 000000000000..3cc863ceda57 --- /dev/null +++ b/keyboards/keychron/v5/info.json @@ -0,0 +1,54 @@ +{ + "keyboard_name": "Keychron V5", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32L432", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x3434" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true, + "dip_switch": true + }, + "rgb_matrix": { + "driver": "ckled2001", + "animations": { + "breathing": true, + "band_spiral_val": 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, + "jellybean_raindrops": true, + "pixel_rain": true, + "typing_heatmap": true, + "digital_rain": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "splash": true, + "solid_splash": true + } + }, + "matrix_pins": { + "cols":["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", null, null, null, null, null, null, null, null], + "rows": ["B5", "B4", "B3", "A15", "A14", "A13"], + "custom": true, + "custom_lite": true + }, + "diode_direction": "ROW2COL" +} diff --git a/keyboards/keychron/v5/rules.mk b/keyboards/keychron/v5/rules.mk new file mode 100644 index 000000000000..23c407488a57 --- /dev/null +++ b/keyboards/keychron/v5/rules.mk @@ -0,0 +1 @@ +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/v5/v5.c b/keyboards/keychron/v5/v5.c index 6d87524b2333..9e8a093d9a2b 100644 --- a/keyboards/keychron/v5/v5.c +++ b/keyboards/keychron/v5/v5.c @@ -38,47 +38,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } #endif // DIP_SWITCH_ENABLE - -#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - switch (keycode) { -#ifdef RGB_MATRIX_ENABLE - case RGB_TOG: - if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - rgb_matrix_set_color_all(0, 0, 0); - } 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 - } - 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; } - // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue); - - if (host_keyboard_led_state().caps_lock) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 255, 255, 255); - } else { - if (!rgb_matrix_get_flags()) { - RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_LED_INDEX, 0, 0, 0); - } - } - return true; -} - -#endif // CAPS_LOCK_LED_INDEX diff --git a/keyboards/keychron/x0/ansi/red/config.h b/keyboards/keychron/x0/ansi/red/config.h new file mode 100755 index 000000000000..09300afa7dcb --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/config.h @@ -0,0 +1,43 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 35 +# define LED_MATRIX_CENTER \ + { 28, 16 } + +/* Scan phase of led driver set as MSKPHASE_6CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_6CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x0/ansi/red/info.json b/keyboards/keychron/x0/ansi/red/info.json new file mode 100755 index 000000000000..8a8d5b1ff132 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/info.json @@ -0,0 +1,73 @@ +{ + "usb": { + "pid": "0x0200", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":18, "y":0}, + {"matrix":[0, 2], "flags":1, "x":28, "y":0}, + {"matrix":[0, 3], "flags":1, "x":37, "y":0}, + {"matrix":[0, 4], "flags":1, "x":46, "y":0}, + {"matrix":[0, 5], "flags":1, "x":56, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":7}, + {"matrix":[1, 1], "flags":4, "x":9, "y":7}, + {"matrix":[1, 2], "flags":4, "x":18, "y":7}, + {"matrix":[1, 3], "flags":4, "x":28, "y":7}, + {"matrix":[1, 4], "flags":4, "x":37, "y":7}, + {"matrix":[1, 5], "flags":4, "x":46, "y":7}, + {"matrix":[1, 6], "flags":4, "x":56, "y":7}, + + {"matrix":[2, 0], "flags":1, "x":2, "y":13}, + {"matrix":[2, 1], "flags":4, "x":14, "y":13}, + {"matrix":[2, 2], "flags":4, "x":23, "y":13}, + {"matrix":[2, 3], "flags":4, "x":32, "y":13}, + {"matrix":[2, 4], "flags":4, "x":42, "y":13}, + {"matrix":[2, 5], "flags":4, "x":53, "y":13}, + + {"matrix":[3, 0], "flags":1, "x":3, "y":19}, + {"matrix":[3, 1], "flags":4, "x":16, "y":19}, + {"matrix":[3, 2], "flags":4, "x":25, "y":19}, + {"matrix":[3, 3], "flags":4, "x":35, "y":19}, + {"matrix":[3, 4], "flags":4, "x":44, "y":19}, + {"matrix":[3, 5], "flags":4, "x":55, "y":19}, + + {"matrix":[4, 0], "flags":1, "x":6, "y":26}, + {"matrix":[4, 2], "flags":4, "x":21, "y":26}, + {"matrix":[4, 3], "flags":4, "x":30, "y":26}, + {"matrix":[4, 4], "flags":4, "x":40, "y":26}, + {"matrix":[4, 5], "flags":4, "x":52, "y":26}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":32}, + {"matrix":[5, 2], "flags":1, "x":25, "y":32}, + {"matrix":[5, 3], "flags":1, "x":35, "y":32}, + {"matrix":[5, 4], "flags":1, "x":44, "y":32}, + + {"flags":1} + ] + } +} diff --git a/keyboards/keychron/x0/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x0/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..4b0a732b6e04 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, + KC_LCTL, KC_LALT, MO(WIN_FN), MO(WIN_FN), KC_SPC), + + [WIN_FN] = LAYOUT( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, _______, + _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, + _______, _______, _______, _______, NK_TOGG, + _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..601bba9b82e8 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, + KC_LCTL, KC_LALT, MO(WIN_FN), MO(WIN_FN), KC_SPC), + + [WIN_FN] = LAYOUT( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_PSCR, KC_CRTA, + _______, KC_7, KC_8, KC_9, KC_0, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, + _______, _______, _______, _______, NK_TOGG, + _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x0/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x0/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x0/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x0/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..c7680b54344c --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, + KC_LCTL, KC_LALT, MO(WIN_FN), MO(WIN_FN), KC_SPC), + + [WIN_FN] = LAYOUT( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, _______, + _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, + _______, _______, _______, _______, NK_TOGG, + _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT( + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/x0/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x0/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x0/ansi/red/red.c b/keyboards/keychron/x0/ansi/red/red.c new file mode 100755 index 000000000000..f087391e93e2 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/red.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1 }, + {0, F_2 }, + {0, F_3 }, + {0, F_4 }, + {0, F_5 }, + {0, F_6 }, + {0, E_1 }, + {0, E_2 }, + {0, E_3 }, + {0, E_4 }, + {0, E_5 }, + {0, E_6 }, + {0, E_7 }, + {0, D_1 }, + {0, D_2 }, + {0, D_3 }, + {0, D_4 }, + {0, D_5 }, + {0, D_6 }, + {0, C_1 }, + {0, C_2 }, + {0, C_3 }, + {0, C_4 }, + {0, C_5 }, + {0, C_6 }, + {0, B_1 }, + {0, B_3 }, + {0, B_4 }, + {0, B_5 }, + {0, B_6 }, + {0, A_1 }, + {0, A_3 }, + {0, A_4 }, + {0, A_5 }, + {0, A_6 }, +}; +#endif diff --git a/keyboards/keychron/x0/ansi/red/rules.mk b/keyboards/keychron/x0/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x0/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x0/config.h b/keyboards/keychron/x0/config.h new file mode 100755 index 000000000000..e029e9a476d1 --- /dev/null +++ b/keyboards/keychron/x0/config.h @@ -0,0 +1,34 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define F_RESET_KEY1 KC_X +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x0/halconf.h b/keyboards/keychron/x0/halconf.h new file mode 100755 index 000000000000..463d177eabc7 --- /dev/null +++ b/keyboards/keychron/x0/halconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif + +#include_next diff --git a/keyboards/keychron/x0/info.json b/keyboards/keychron/x0/info.json new file mode 100755 index 000000000000..23b9ef9d4a2d --- /dev/null +++ b/keyboards/keychron/x0/info.json @@ -0,0 +1,68 @@ +{ + "keyboard_name": "Lemokey X0", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8","A14", "A15", "C10", "C11"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "A3" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6, "y":0}, + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25, "w":1.5}, + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25, "w":1.25}, + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25, "w":1.75}, + {"matrix":[5,0], "x":0, "y":5.25, "w":1.5}, + {"matrix":[5,2], "x":2.75, "y":5.25}, + {"matrix":[5,3], "x":3.75, "y":5.25}, + {"matrix":[5,4], "x":4.75, "y":5.25}, + {"matrix":[5,5], "x":6, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.h b/keyboards/keychron/x0/mcuconf.h old mode 100644 new mode 100755 similarity index 64% rename from keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.h rename to keyboards/keychron/x0/mcuconf.h index 1fb79c0b2a14..494b71483ff9 --- a/keyboards/keychron/q1/ansi/keymaps/mkillewald/rgb_matrix_user.h +++ b/keyboards/keychron/x0/mcuconf.h @@ -1,4 +1,4 @@ -/* Copyright 2021 @ Mike Killewald +/* Copyright 2020 QMK * * 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 @@ -16,11 +16,19 @@ #pragma once -void rgb_matrix_init_user(void); +#include_next -void rgb_matrix_set_color_by_keycode(uint8_t led_min, uint8_t led_max, uint8_t layer, bool (*is_keycode)(uint16_t), uint8_t red, uint8_t green, uint8_t blue); +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U -bool is_caps_lock_indicator(uint16_t keycode); -bool is_transparent(uint16_t keycode); -bool is_not_transparent(uint16_t keycode); +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x0/readme.md b/keyboards/keychron/x0/readme.md new file mode 100755 index 000000000000..5ff03e9b2308 --- /dev/null +++ b/keyboards/keychron/x0/readme.md @@ -0,0 +1,26 @@ +# Lemokey X4 + +![Lemokey X4]() + +A customizable 75% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X4 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x4/ansi_encoder/red:default + +Flashing example for this keyboard: + + make keychron/x4/ansi_encoder/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x0/via_json/x0_ansi_red.json b/keyboards/keychron/x0/via_json/x0_ansi_red.json new file mode 100644 index 000000000000..94b902bcbe56 --- /dev/null +++ b/keyboards/keychron/x0/via_json/x0_ansi_red.json @@ -0,0 +1,126 @@ +{ + "name": "Lemokey X0 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0200", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 7}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + "0,5" + ], + [ + { + "y": 0.25, + "c": "#aaaaaa" + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + { + "w": 1.5 + }, + "2,5" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + { + "w": 1.25 + }, + "3,5" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + { + "w": 1.75 + }, + "4,5" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "5,0", + { + "x": 1.25 + }, + "5,2", + "5,3", + "5,4", + { + "x": 0.25, + "c": "#777777" + }, + "5,5" + ] + ] + } +} diff --git a/keyboards/keychron/q1/iso/keymaps/kubahorak/config.h b/keyboards/keychron/x0/x0.c old mode 100644 new mode 100755 similarity index 62% rename from keyboards/keychron/q1/iso/keymaps/kubahorak/config.h rename to keyboards/keychron/x0/x0.c index 55dbb74d4a07..b1bf2decdc69 --- a/keyboards/keychron/q1/iso/keymaps/kubahorak/config.h +++ b/keyboards/keychron/x0/x0.c @@ -1,4 +1,4 @@ -/* Copyright 2021 Jakub Horak (@kubahorak) +/* Copyright 2023 @ Keychron (https://www.keychron.com) * * 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 @@ -14,12 +14,16 @@ * along with this program. If not, see . */ -#pragma once +#include "quantum.h" -#ifdef RGB_MATRIX_ENABLE -/* from rev_0100/keymaps/gtg465x */ -# define RGB_DISABLE_WHEN_USB_SUSPENDED -# define CAPS_LOCK_INDICATOR_COLOR RGB_RED -# define CAPS_LOCK_INDICATOR_LIGHT_ALPHAS -# define FN_LAYER_TRANSPARENT_KEYS_OFF +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); #endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + eeconfig_init_user(); +} diff --git a/keyboards/keychron/x1/ansi/red/config.h b/keyboards/keychron/x1/ansi/red/config.h new file mode 100755 index 000000000000..10b68a44cf46 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/config.h @@ -0,0 +1,41 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 87 + +/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x1/ansi/red/info.json b/keyboards/keychron/x1/ansi/red/info.json new file mode 100755 index 000000000000..aaedd779db25 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/info.json @@ -0,0 +1,124 @@ +{ + "usb": { + "pid": "0x0210", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":26, "y":0}, + {"matrix":[0, 2], "flags":1, "x":39, "y":0}, + {"matrix":[0, 3], "flags":1, "x":52, "y":0}, + {"matrix":[0, 4], "flags":1, "x":65, "y":0}, + {"matrix":[0, 5], "flags":1, "x":85, "y":0}, + {"matrix":[0, 6], "flags":1, "x":98, "y":0}, + {"matrix":[0, 7], "flags":1, "x":111, "y":0}, + {"matrix":[0, 8], "flags":1, "x":124, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":156, "y":0}, + {"matrix":[0, 11], "flags":1, "x":169, "y":0}, + {"matrix":[0, 12], "flags":1, "x":182, "y":0}, + {"matrix":[0, 14], "flags":1, "x":198, "y":0}, + {"matrix":[0, 15], "flags":1, "x":211, "y":0}, + {"matrix":[0, 16], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":26, "y":15}, + {"matrix":[1, 3], "flags":4, "x":39, "y":15}, + {"matrix":[1, 4], "flags":4, "x":52, "y":15}, + {"matrix":[1, 5], "flags":4, "x":65, "y":15}, + {"matrix":[1, 6], "flags":4, "x":78, "y":15}, + {"matrix":[1, 7], "flags":4, "x":91, "y":15}, + {"matrix":[1, 8], "flags":4, "x":104, "y":15}, + {"matrix":[1, 9], "flags":4, "x":117, "y":15}, + {"matrix":[1, 10], "flags":4, "x":130, "y":15}, + {"matrix":[1, 11], "flags":4, "x":143, "y":15}, + {"matrix":[1, 12], "flags":4, "x":156, "y":15}, + {"matrix":[1, 13], "flags":1, "x":176, "y":15}, + {"matrix":[1, 14], "flags":1, "x":198, "y":15}, + {"matrix":[1, 15], "flags":1, "x":211, "y":15}, + {"matrix":[1, 16], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":3, "y":27}, + {"matrix":[2, 1], "flags":4, "x":20, "y":27}, + {"matrix":[2, 2], "flags":4, "x":33, "y":27}, + {"matrix":[2, 3], "flags":4, "x":46, "y":27}, + {"matrix":[2, 4], "flags":4, "x":59, "y":27}, + {"matrix":[2, 5], "flags":4, "x":72, "y":27}, + {"matrix":[2, 6], "flags":4, "x":85, "y":27}, + {"matrix":[2, 7], "flags":4, "x":98, "y":27}, + {"matrix":[2, 8], "flags":4, "x":111, "y":27}, + {"matrix":[2, 9], "flags":4, "x":124, "y":27}, + {"matrix":[2, 10], "flags":4, "x":137, "y":27}, + {"matrix":[2, 11], "flags":4, "x":150, "y":27}, + {"matrix":[2, 12], "flags":4, "x":163, "y":27}, + {"matrix":[2, 13], "flags":1, "x":179, "y":27}, + {"matrix":[2, 14], "flags":1, "x":198, "y":27}, + {"matrix":[2, 15], "flags":1, "x":211, "y":27}, + {"matrix":[2, 16], "flags":1, "x":224, "y":27}, + + {"matrix":[3, 0], "flags":8, "x":5, "y":39}, + {"matrix":[3, 1], "flags":4, "x":23, "y":39}, + {"matrix":[3, 2], "flags":4, "x":36, "y":39}, + {"matrix":[3, 3], "flags":4, "x":49, "y":39}, + {"matrix":[3, 4], "flags":4, "x":62, "y":39}, + {"matrix":[3, 5], "flags":4, "x":75, "y":39}, + {"matrix":[3, 6], "flags":4, "x":88, "y":39}, + {"matrix":[3, 7], "flags":4, "x":101, "y":39}, + {"matrix":[3, 8], "flags":4, "x":114, "y":39}, + {"matrix":[3, 9], "flags":4, "x":127, "y":39}, + {"matrix":[3, 10], "flags":4, "x":140, "y":39}, + {"matrix":[3, 11], "flags":4, "x":153, "y":39}, + {"matrix":[3, 13], "flags":1, "x":174, "y":39}, + + {"matrix":[4, 0], "flags":1, "x":8, "y":52}, + {"matrix":[4, 2], "flags":4, "x":29, "y":52}, + {"matrix":[4, 3], "flags":4, "x":42, "y":52}, + {"matrix":[4, 4], "flags":4, "x":55, "y":52}, + {"matrix":[4, 5], "flags":4, "x":68, "y":52}, + {"matrix":[4, 6], "flags":4, "x":82, "y":52}, + {"matrix":[4, 7], "flags":4, "x":95, "y":52}, + {"matrix":[4, 8], "flags":4, "x":108, "y":52}, + {"matrix":[4, 9], "flags":4, "x":121, "y":52}, + {"matrix":[4, 10], "flags":4, "x":134, "y":52}, + {"matrix":[4, 11], "flags":4, "x":147, "y":52}, + {"matrix":[4, 13], "flags":1, "x":171, "y":52}, + {"matrix":[4, 15], "flags":1, "x":211, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":64}, + {"matrix":[5, 1], "flags":1, "x":18, "y":64}, + {"matrix":[5, 2], "flags":1, "x":34, "y":64}, + {"matrix":[5, 6], "flags":4, "x":83, "y":64}, + {"matrix":[5, 10], "flags":1, "x":132, "y":64}, + {"matrix":[5, 11], "flags":1, "x":148, "y":64}, + {"matrix":[5, 12], "flags":1, "x":165, "y":64}, + {"matrix":[5, 13], "flags":1, "x":181, "y":64}, + {"matrix":[5, 14], "flags":1, "x":198, "y":64}, + {"matrix":[5, 15], "flags":1, "x":211, "y":64}, + {"matrix":[5, 16], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/x1/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x1/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..54ab9943393b --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/x1/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x1/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..b6f9bef78fea --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x1/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x1/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x1/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x1/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..ff90375c5a10 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_tkl_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_tkl_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, _______, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; \ No newline at end of file diff --git a/keyboards/keychron/x1/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x1/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x1/ansi/red/red.c b/keyboards/keychron/x1/ansi/red/red.c new file mode 100755 index 000000000000..1c0ef4fadedd --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/red.c @@ -0,0 +1,119 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, A_16}, + {0, A_15}, + {0, A_14}, + {0, A_13}, + {0, A_12}, + {0, A_11}, + {0, A_10}, + {0, A_9 }, + {0, A_8 }, + {0, A_7 }, + {0, A_6 }, + {0, A_5 }, + {0, A_4 }, + {0, A_2 }, + {0, A_1 }, + {0, G_1 }, + + {0, B_16}, + {0, B_15}, + {0, B_14}, + {0, B_13}, + {0, B_12}, + {0, B_11}, + {0, B_10}, + {0, B_9 }, + {0, B_8 }, + {0, B_7 }, + {0, B_6 }, + {0, B_5 }, + {0, B_4 }, + {0, B_3 }, + {0, B_2 }, + {0, B_1 }, + {0, H_1 }, + + {0, C_16}, + {0, C_15}, + {0, C_14}, + {0, C_13}, + {0, C_12}, + {0, C_11}, + {0, C_10}, + {0, C_9 }, + {0, C_8 }, + {0, C_7 }, + {0, C_6 }, + {0, C_5 }, + {0, C_4 }, + {0, C_3 }, + {0, C_2 }, + {0, C_1 }, + {0, G_6 }, + + {0, D_16}, + {0, D_15}, + {0, D_14}, + {0, D_13}, + {0, D_12}, + {0, D_11}, + {0, D_10}, + {0, D_9 }, + {0, D_8 }, + {0, D_7 }, + {0, D_6 }, + {0, D_5 }, + {0, D_3 }, + + {0, E_16}, + {0, E_14}, + {0, E_13}, + {0, E_12}, + {0, E_11}, + {0, E_10}, + {0, E_9 }, + {0, E_8 }, + {0, E_7 }, + {0, E_6 }, + {0, E_5 }, + {0, E_3 }, + {0, E_1 }, + + {0, F_16}, + {0, F_15}, + {0, F_14}, + {0, F_10}, + {0, F_6 }, + {0, F_5 }, + {0, F_4 }, + {0, F_3 }, + {0, F_2 }, + {0, F_1 }, + {0, G_13}, +}; +#endif diff --git a/keyboards/keychron/x1/ansi/red/rules.mk b/keyboards/keychron/x1/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x1/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x1/config.h b/keyboards/keychron/x1/config.h new file mode 100755 index 000000000000..cedfa320222d --- /dev/null +++ b/keyboards/keychron/x1/config.h @@ -0,0 +1,35 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* Winlock indicator */ +#define LED_WIN_LOCK_PIN C10 +#define LED_WIN_LOCK_PIN_ON_STATE 1 + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x1/halconf.h b/keyboards/keychron/x1/halconf.h new file mode 100755 index 000000000000..41bddcb2799b --- /dev/null +++ b/keyboards/keychron/x1/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/keychron/x1/info.json b/keyboards/keychron/x1/info.json new file mode 100755 index 000000000000..0c409830956d --- /dev/null +++ b/keyboards/keychron/x1/info.json @@ -0,0 +1,129 @@ +{ + "keyboard_name": "Lemokey X1", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["A0", "A1", "A2", "A3", "C0", "C1", "C2", "C3", "A8", "C12", "B9", "C6", "C7", "C4", "C5", "A15", "B10"], + "rows": ["B0", "B1", "B8", "B3", "B4", "B5"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "C9", + "scroll_lock": "C11" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "community_layouts": [ + "tkl_ansi" + ], + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/x1/mcuconf.h b/keyboards/keychron/x1/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x1/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x1/readme.md b/keyboards/keychron/x1/readme.md new file mode 100755 index 000000000000..2dc1ce1c5627 --- /dev/null +++ b/keyboards/keychron/x1/readme.md @@ -0,0 +1,26 @@ +# Lemokey X1 + +![Lemokey X1]() + +A customizable 80% TKL keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X1 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x1/ansi/red:default + +Flashing example for this keyboard: + + make keychron/x1/ansi/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x1/via_json/x1_pro_ansi_red.json b/keyboards/keychron/x1/via_json/x1_pro_ansi_red.json new file mode 100755 index 000000000000..13b3d7bf7711 --- /dev/null +++ b/keyboards/keychron/x1/via_json/x1_pro_ansi_red.json @@ -0,0 +1,224 @@ +{ + "name": "Lemokey X1 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0210", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 17}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16" + ] + ] + } +} diff --git a/keyboards/keychron/x1/x1.c b/keyboards/keychron/x1/x1.c new file mode 100755 index 000000000000..4853cd52f60d --- /dev/null +++ b/keyboards/keychron/x1/x1.c @@ -0,0 +1,78 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) + +static void set_led_win_lock_state(void) { + if (win_lock_state) { + SET_LED_WIN_LOCK_ON; + } else { + SET_LED_WIN_LOCK_OFF; + } +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_WIN_LOCK_PIN); + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb() { + set_led_win_lock_state(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +void suspend_power_down_kb(void) { + SET_LED_WIN_LOCK_OFF; + + suspend_power_down_user(); +} diff --git a/keyboards/keychron/x2/ansi/red/config.h b/keyboards/keychron/x2/ansi/red/config.h new file mode 100755 index 000000000000..acc49e001a17 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/config.h @@ -0,0 +1,41 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 104 + +/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x2/ansi/red/info.json b/keyboards/keychron/x2/ansi/red/info.json new file mode 100755 index 000000000000..5b758b77bc22 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/info.json @@ -0,0 +1,141 @@ +{ + "usb": { + "pid": "0x0220", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0,0], "flags":1, "x":0, "y":0}, + {"matrix":[0,1], "flags":1, "x":21, "y":0}, + {"matrix":[0,2], "flags":1, "x":31, "y":0}, + {"matrix":[0,3], "flags":1, "x":42, "y":0}, + {"matrix":[0,4], "flags":1, "x":52, "y":0}, + {"matrix":[0,5], "flags":1, "x":68, "y":0}, + {"matrix":[0,6], "flags":1, "x":78, "y":0}, + {"matrix":[0,7], "flags":1, "x":88, "y":0}, + {"matrix":[0,8], "flags":1, "x":99, "y":0}, + {"matrix":[0,9], "flags":1, "x":114, "y":0}, + {"matrix":[0,10], "flags":1, "x":125, "y":0}, + {"matrix":[0,11], "flags":1, "x":135, "y":0}, + {"matrix":[0,12], "flags":1, "x":146, "y":0}, + {"matrix":[0,14], "flags":1, "x":159, "y":0}, + {"matrix":[0,15], "flags":1, "x":169, "y":0}, + {"matrix":[0,16], "flags":1, "x":180, "y":0}, + + {"matrix":[1,0], "flags":1, "x":0, "y":16}, + {"matrix":[1,1], "flags":4, "x":10, "y":16}, + {"matrix":[1,2], "flags":4, "x":21, "y":16}, + {"matrix":[1,3], "flags":4, "x":31, "y":16}, + {"matrix":[1,4], "flags":4, "x":42, "y":16}, + {"matrix":[1,5], "flags":4, "x":52, "y":16}, + {"matrix":[1,6], "flags":4, "x":62, "y":16}, + {"matrix":[1,7], "flags":4, "x":73, "y":16}, + {"matrix":[1,8], "flags":4, "x":83, "y":16}, + {"matrix":[1,9], "flags":4, "x":94, "y":16}, + {"matrix":[1,10], "flags":4, "x":104, "y":16}, + {"matrix":[1,11], "flags":4, "x":114, "y":16}, + {"matrix":[1,12], "flags":4, "x":125, "y":16}, + {"matrix":[1,13], "flags":1, "x":140, "y":16}, + {"matrix":[1,14], "flags":1, "x":159, "y":16}, + {"matrix":[1,15], "flags":1, "x":169, "y":16}, + {"matrix":[1,16], "flags":1, "x":180, "y":16}, + {"matrix":[1,17], "flags":4, "x":193, "y":16}, + {"matrix":[1,18], "flags":4, "x":203, "y":16}, + {"matrix":[1,19], "flags":4, "x":214, "y":16}, + {"matrix":[1,20], "flags":4, "x":224, "y":16}, + + {"matrix":[2,0], "flags":1, "x":3, "y":28}, + {"matrix":[2,1], "flags":4, "x":16, "y":28}, + {"matrix":[2,2], "flags":4, "x":26, "y":28}, + {"matrix":[2,3], "flags":4, "x":36, "y":28}, + {"matrix":[2,4], "flags":4, "x":47, "y":28}, + {"matrix":[2,5], "flags":4, "x":57, "y":28}, + {"matrix":[2,6], "flags":4, "x":68, "y":28}, + {"matrix":[2,7], "flags":4, "x":78, "y":28}, + {"matrix":[2,8], "flags":4, "x":88, "y":28}, + {"matrix":[2,9], "flags":4, "x":98, "y":28}, + {"matrix":[2,10], "flags":4, "x":109, "y":28}, + {"matrix":[2,11], "flags":4, "x":120, "y":28}, + {"matrix":[2,12], "flags":4, "x":130, "y":28}, + {"matrix":[2,13], "flags":1, "x":143, "y":28}, + {"matrix":[2,14], "flags":1, "x":159, "y":28}, + {"matrix":[2,15], "flags":1, "x":169, "y":28}, + {"matrix":[2,16], "flags":1, "x":180, "y":28}, + {"matrix":[2,17], "flags":4, "x":193, "y":28}, + {"matrix":[2,18], "flags":4, "x":203, "y":28}, + {"matrix":[2,19], "flags":4, "x":214, "y":28}, + {"matrix":[2,20], "flags":4, "x":224, "y":34}, + + {"matrix":[3,0], "flags":1, "x":4, "y":40}, + {"matrix":[3,1], "flags":4, "x":18, "y":40}, + {"matrix":[3,2], "flags":4, "x":29, "y":40}, + {"matrix":[3,3], "flags":4, "x":39, "y":40}, + {"matrix":[3,4], "flags":4, "x":49, "y":40}, + {"matrix":[3,5], "flags":4, "x":60, "y":40}, + {"matrix":[3,6], "flags":4, "x":70, "y":40}, + {"matrix":[3,7], "flags":4, "x":81, "y":40}, + {"matrix":[3,8], "flags":4, "x":91, "y":40}, + {"matrix":[3,9], "flags":4, "x":101, "y":40}, + {"matrix":[3,10], "flags":4, "x":112, "y":40}, + {"matrix":[3,11], "flags":4, "x":122, "y":40}, + {"matrix":[3,13], "flags":1, "x":139, "y":40}, + {"matrix":[3,17], "flags":4, "x":193, "y":40}, + {"matrix":[3,18], "flags":4, "x":203, "y":40}, + {"matrix":[3,19], "flags":4, "x":214, "y":40}, + + {"matrix":[4,0], "flags":1, "x":7, "y":52}, + {"matrix":[4,2], "flags":4, "x":23, "y":52}, + {"matrix":[4,3], "flags":4, "x":34, "y":52}, + {"matrix":[4,4], "flags":4, "x":44, "y":52}, + {"matrix":[4,5], "flags":4, "x":55, "y":52}, + {"matrix":[4,6], "flags":4, "x":65, "y":52}, + {"matrix":[4,7], "flags":4, "x":75, "y":52}, + {"matrix":[4,8], "flags":4, "x":86, "y":52}, + {"matrix":[4,9], "flags":4, "x":96, "y":52}, + {"matrix":[4,10], "flags":4, "x":107, "y":52}, + {"matrix":[4,11], "flags":4, "x":117, "y":52}, + {"matrix":[4,13], "flags":1, "x":137, "y":52}, + {"matrix":[4,15], "flags":1, "x":169, "y":52}, + {"matrix":[4,17], "flags":4, "x":193, "y":52}, + {"matrix":[4,18], "flags":4, "x":203, "y":52}, + {"matrix":[4,19], "flags":4, "x":214, "y":52}, + {"matrix":[4,20], "flags":4, "x":224, "y":58}, + + {"matrix":[5,0], "flags":1, "x":1, "y":64}, + {"matrix":[5,1], "flags":1, "x":14, "y":64}, + {"matrix":[5,2], "flags":1, "x":27, "y":64}, + {"matrix":[5,6], "flags":4, "x":66, "y":64}, + {"matrix":[5,10], "flags":1, "x":105, "y":64}, + {"matrix":[5,11], "flags":1, "x":118, "y":64}, + {"matrix":[5,12], "flags":1, "x":131, "y":64}, + {"matrix":[5,13], "flags":1, "x":144, "y":64}, + {"matrix":[5,14], "flags":1, "x":159, "y":64}, + {"matrix":[5,15], "flags":1, "x":169, "y":64}, + {"matrix":[5,16], "flags":1, "x":180, "y":64}, + {"matrix":[5,17], "flags":4, "x":198, "y":64}, + {"matrix":[5,18], "flags":4, "x":214, "y":64} + ] + } +} diff --git a/keyboards/keychron/x2/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x2/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..a50f66294c8d --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/x2/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x2/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..777b1fa553c8 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x2/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x2/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x2/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x2/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..14b06f34013b --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/x2/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x2/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x2/ansi/red/red.c b/keyboards/keychron/x2/ansi/red/red.c new file mode 100755 index 000000000000..4c3123feaad6 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/red.c @@ -0,0 +1,136 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1 }, + {0, F_2 }, + {0, F_3 }, + {0, F_4 }, + {0, F_5 }, + {0, F_6 }, + {0, F_7 }, + {0, F_8 }, + {0, F_9 }, + {0, F_10}, + {0, F_11}, + {0, F_12}, + {0, F_13}, + {0, F_15}, + {0, F_16}, + {0, G_1 }, + + {0, E_1 }, + {0, E_2 }, + {0, E_3 }, + {0, E_4 }, + {0, E_5 }, + {0, E_6 }, + {0, E_7 }, + {0, E_8 }, + {0, E_9 }, + {0, E_10}, + {0, E_11}, + {0, E_12}, + {0, E_13}, + {0, E_14}, + {0, E_15}, + {0, E_16}, + {0, H_1 }, + {0, H_2 }, + {0, H_3 }, + {0, H_4 }, + {0, H_5 }, + + {0, D_1 }, + {0, D_2 }, + {0, D_3 }, + {0, D_4 }, + {0, D_5 }, + {0, D_6 }, + {0, D_7 }, + {0, D_8 }, + {0, D_9 }, + {0, D_10}, + {0, D_11}, + {0, D_12}, + {0, D_13}, + {0, D_14}, + {0, D_15}, + {0, D_16}, + {0, G_6 }, + {0, G_7 }, + {0, G_8 }, + {0, G_9 }, + {0, G_10}, + + {0, C_1 }, + {0, C_2 }, + {0, C_3 }, + {0, C_4 }, + {0, C_5 }, + {0, C_6 }, + {0, C_7 }, + {0, C_8 }, + {0, C_9 }, + {0, C_10}, + {0, C_11}, + {0, C_12}, + {0, C_14}, + {0, H_7 }, + {0, H_8 }, + {0, H_9 }, + + {0, B_1 }, + {0, B_3 }, + {0, B_4 }, + {0, B_5 }, + {0, B_6 }, + {0, B_7 }, + {0, B_8 }, + {0, B_9 }, + {0, B_10}, + {0, B_11}, + {0, B_12}, + {0, B_14}, + {0, B_16}, + {0, H_6 }, + {0, H_11}, + {0, H_12}, + {0, H_10}, + + {0, A_1 }, + {0, A_2 }, + {0, A_3 }, + {0, A_7 }, + {0, A_11}, + {0, A_12}, + {0, A_13}, + {0, A_14}, + {0, A_15}, + {0, A_16}, + {0, G_13}, + {0, G_11}, + {0, G_12}, +}; +#endif diff --git a/keyboards/keychron/x2/ansi/red/rules.mk b/keyboards/keychron/x2/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x2/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x2/config.h b/keyboards/keychron/x2/config.h new file mode 100755 index 000000000000..f9ce44ad0497 --- /dev/null +++ b/keyboards/keychron/x2/config.h @@ -0,0 +1,37 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* Winlock indicator */ +#define LED_WIN_LOCK_PIN A5 +#define LED_WIN_LOCK_PIN_ON_STATE 1 + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x2/halconf.h b/keyboards/keychron/x2/halconf.h new file mode 100755 index 000000000000..41bddcb2799b --- /dev/null +++ b/keyboards/keychron/x2/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/keychron/x2/info.json b/keyboards/keychron/x2/info.json new file mode 100755 index 000000000000..de8644ecb333 --- /dev/null +++ b/keyboards/keychron/x2/info.json @@ -0,0 +1,144 @@ +{ + "keyboard_name": "Lemokey X2", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "A15", "C10", "C11", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0", "A1", "A2", "B12", "B10", "B13", "B14"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "A3", + "scroll_lock": "A6", + "num_lock": "A4" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT_104_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + {"matrix":[1,17], "x":18.5, "y":1.25}, + {"matrix":[1,18], "x":19.5, "y":1.25}, + {"matrix":[1,19], "x":20.5, "y":1.25}, + {"matrix":[1,20], "x":21.5, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[2,18], "x":19.5, "y":2.25}, + {"matrix":[2,19], "x":20.5, "y":2.25}, + {"matrix":[2,20], "x":21.5, "y":2.25, "h":2}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + {"matrix":[3,18], "x":19.5, "y":3.25}, + {"matrix":[3,19], "x":20.5, "y":3.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[4,18], "x":19.5, "y":4.25}, + {"matrix":[4,19], "x":20.5, "y":4.25}, + {"matrix":[4,20], "x":21.5, "y":4.25, "h":2}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25}, + {"matrix":[5,17], "x":18.5, "y":5.25, "w":2}, + {"matrix":[5,18], "x":20.5, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/x2/mcuconf.h b/keyboards/keychron/x2/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x2/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x2/readme.md b/keyboards/keychron/x2/readme.md new file mode 100755 index 000000000000..c700ef538136 --- /dev/null +++ b/keyboards/keychron/x2/readme.md @@ -0,0 +1,26 @@ +# Lemokey X3 + +![Lemokey X3]() + +A customizable 80% TKL keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X3 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x3/ansi/red:default + +Flashing example for this keyboard: + + make keychron/x3/ansi/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x2/via_json/x2_ansi_red.json b/keyboards/keychron/x2/via_json/x2_ansi_red.json new file mode 100755 index 000000000000..7a47550eced0 --- /dev/null +++ b/keyboards/keychron/x2/via_json/x2_ansi_red.json @@ -0,0 +1,271 @@ +{ + "name": "Lemokey X2 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0220", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 21}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "1,19", + "1,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "2,19", + { + "h": 2 + }, + "2,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,19" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,19", + { + "c": "#777777", + "h": 2 + }, + "4,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,18" + ] + ] + } +} diff --git a/keyboards/keychron/x2/x2.c b/keyboards/keychron/x2/x2.c new file mode 100755 index 000000000000..4853cd52f60d --- /dev/null +++ b/keyboards/keychron/x2/x2.c @@ -0,0 +1,78 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) + +static void set_led_win_lock_state(void) { + if (win_lock_state) { + SET_LED_WIN_LOCK_ON; + } else { + SET_LED_WIN_LOCK_OFF; + } +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_WIN_LOCK_PIN); + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb() { + set_led_win_lock_state(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +void suspend_power_down_kb(void) { + SET_LED_WIN_LOCK_OFF; + + suspend_power_down_user(); +} diff --git a/keyboards/keychron/x3/ansi/red/config.h b/keyboards/keychron/x3/ansi/red/config.h new file mode 100755 index 000000000000..8225cbfc4595 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/config.h @@ -0,0 +1,41 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT (104 + 12) + +/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_9CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x3/ansi/red/info.json b/keyboards/keychron/x3/ansi/red/info.json new file mode 100755 index 000000000000..230cd58e1fe1 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/info.json @@ -0,0 +1,154 @@ +{ + "usb": { + "pid": "0x0230", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0,0], "flags":1, "x":0, "y":0}, + {"matrix":[0,1], "flags":1, "x":21, "y":0}, + {"matrix":[0,2], "flags":1, "x":31, "y":0}, + {"matrix":[0,3], "flags":1, "x":42, "y":0}, + {"matrix":[0,4], "flags":1, "x":52, "y":0}, + {"matrix":[0,5], "flags":1, "x":68, "y":0}, + {"matrix":[0,6], "flags":1, "x":78, "y":0}, + {"matrix":[0,7], "flags":1, "x":88, "y":0}, + {"matrix":[0,8], "flags":1, "x":99, "y":0}, + {"matrix":[0,9], "flags":1, "x":114, "y":0}, + {"matrix":[0,10], "flags":1, "x":125, "y":0}, + {"matrix":[0,11], "flags":1, "x":135, "y":0}, + {"matrix":[0,12], "flags":1, "x":146, "y":0}, + {"matrix":[0,14], "flags":1, "x":159, "y":0}, + {"matrix":[0,15], "flags":1, "x":169, "y":0}, + {"matrix":[0,16], "flags":1, "x":180, "y":0}, + + {"matrix":[1,0], "flags":1, "x":0, "y":16}, + {"matrix":[1,1], "flags":4, "x":10, "y":16}, + {"matrix":[1,2], "flags":4, "x":21, "y":16}, + {"matrix":[1,3], "flags":4, "x":31, "y":16}, + {"matrix":[1,4], "flags":4, "x":42, "y":16}, + {"matrix":[1,5], "flags":4, "x":52, "y":16}, + {"matrix":[1,6], "flags":4, "x":62, "y":16}, + {"matrix":[1,7], "flags":4, "x":73, "y":16}, + {"matrix":[1,8], "flags":4, "x":83, "y":16}, + {"matrix":[1,9], "flags":4, "x":94, "y":16}, + {"matrix":[1,10], "flags":4, "x":104, "y":16}, + {"matrix":[1,11], "flags":4, "x":114, "y":16}, + {"matrix":[1,12], "flags":4, "x":125, "y":16}, + {"matrix":[1,13], "flags":1, "x":140, "y":16}, + {"matrix":[1,14], "flags":1, "x":159, "y":16}, + {"matrix":[1,15], "flags":1, "x":169, "y":16}, + {"matrix":[1,16], "flags":1, "x":180, "y":16}, + {"matrix":[1,17], "flags":4, "x":193, "y":16}, + {"matrix":[1,18], "flags":4, "x":203, "y":16}, + {"matrix":[1,19], "flags":4, "x":214, "y":16}, + {"matrix":[1,20], "flags":4, "x":224, "y":16}, + + {"matrix":[2,0], "flags":1, "x":3, "y":28}, + {"matrix":[2,1], "flags":4, "x":16, "y":28}, + {"matrix":[2,2], "flags":4, "x":26, "y":28}, + {"matrix":[2,3], "flags":4, "x":36, "y":28}, + {"matrix":[2,4], "flags":4, "x":47, "y":28}, + {"matrix":[2,5], "flags":4, "x":57, "y":28}, + {"matrix":[2,6], "flags":4, "x":68, "y":28}, + {"matrix":[2,7], "flags":4, "x":78, "y":28}, + {"matrix":[2,8], "flags":4, "x":88, "y":28}, + {"matrix":[2,9], "flags":4, "x":98, "y":28}, + {"matrix":[2,10], "flags":4, "x":109, "y":28}, + {"matrix":[2,11], "flags":4, "x":120, "y":28}, + {"matrix":[2,12], "flags":4, "x":130, "y":28}, + {"matrix":[2,13], "flags":1, "x":143, "y":28}, + {"matrix":[2,14], "flags":1, "x":159, "y":28}, + {"matrix":[2,15], "flags":1, "x":169, "y":28}, + {"matrix":[2,16], "flags":1, "x":180, "y":28}, + {"matrix":[2,17], "flags":4, "x":193, "y":28}, + {"matrix":[2,18], "flags":4, "x":203, "y":28}, + {"matrix":[2,19], "flags":4, "x":214, "y":28}, + {"matrix":[2,20], "flags":4, "x":224, "y":34}, + + {"matrix":[3,0], "flags":1, "x":4, "y":40}, + {"matrix":[3,1], "flags":4, "x":18, "y":40}, + {"matrix":[3,2], "flags":4, "x":29, "y":40}, + {"matrix":[3,3], "flags":4, "x":39, "y":40}, + {"matrix":[3,4], "flags":4, "x":49, "y":40}, + {"matrix":[3,5], "flags":4, "x":60, "y":40}, + {"matrix":[3,6], "flags":4, "x":70, "y":40}, + {"matrix":[3,7], "flags":4, "x":81, "y":40}, + {"matrix":[3,8], "flags":4, "x":91, "y":40}, + {"matrix":[3,9], "flags":4, "x":101, "y":40}, + {"matrix":[3,10], "flags":4, "x":112, "y":40}, + {"matrix":[3,11], "flags":4, "x":122, "y":40}, + {"matrix":[3,13], "flags":1, "x":139, "y":40}, + {"matrix":[3,17], "flags":4, "x":193, "y":40}, + {"matrix":[3,18], "flags":4, "x":203, "y":40}, + {"matrix":[3,19], "flags":4, "x":214, "y":40}, + + {"matrix":[4,0], "flags":1, "x":7, "y":52}, + {"matrix":[4,2], "flags":4, "x":23, "y":52}, + {"matrix":[4,3], "flags":4, "x":34, "y":52}, + {"matrix":[4,4], "flags":4, "x":44, "y":52}, + {"matrix":[4,5], "flags":4, "x":55, "y":52}, + {"matrix":[4,6], "flags":4, "x":65, "y":52}, + {"matrix":[4,7], "flags":4, "x":75, "y":52}, + {"matrix":[4,8], "flags":4, "x":86, "y":52}, + {"matrix":[4,9], "flags":4, "x":96, "y":52}, + {"matrix":[4,10], "flags":4, "x":107, "y":52}, + {"matrix":[4,11], "flags":4, "x":117, "y":52}, + {"matrix":[4,13], "flags":1, "x":137, "y":52}, + {"matrix":[4,15], "flags":1, "x":169, "y":52}, + {"matrix":[4,17], "flags":4, "x":193, "y":52}, + {"matrix":[4,18], "flags":4, "x":203, "y":52}, + {"matrix":[4,19], "flags":4, "x":214, "y":52}, + {"matrix":[4,20], "flags":4, "x":224, "y":58}, + + {"matrix":[5,0], "flags":1, "x":1, "y":64}, + {"matrix":[5,1], "flags":1, "x":14, "y":64}, + {"matrix":[5,2], "flags":1, "x":27, "y":64}, + {"matrix":[5,6], "flags":4, "x":66, "y":64}, + {"matrix":[5,10], "flags":1, "x":105, "y":64}, + {"matrix":[5,11], "flags":1, "x":118, "y":64}, + {"matrix":[5,12], "flags":1, "x":131, "y":64}, + {"matrix":[5,13], "flags":1, "x":144, "y":64}, + {"matrix":[5,14], "flags":1, "x":159, "y":64}, + {"matrix":[5,15], "flags":1, "x":169, "y":64}, + {"matrix":[5,16], "flags":1, "x":180, "y":64}, + {"matrix":[5,17], "flags":4, "x":198, "y":64}, + {"matrix":[5,18], "flags":4, "x":214, "y":64}, + + {"flags":4, "x":0, "y":0}, + {"flags":4, "x":0, "y":16}, + {"flags":4, "x":0, "y":28}, + {"flags":4, "x":0, "y":40}, + {"flags":4, "x":0, "y":52}, + {"flags":4, "x":0, "y":64}, + {"flags":4, "x":224, "y":0}, + {"flags":4, "x":224, "y":16}, + {"flags":4, "x":224, "y":28}, + {"flags":4, "x":224, "y":40}, + {"flags":4, "x":224, "y":52}, + {"flags":4, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/x3/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x3/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..fe2422c7eaab --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + diff --git a/keyboards/keychron/x3/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x3/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..777b1fa553c8 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x3/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x3/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x3/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x3/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..14b06f34013b --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_104_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_104_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_CRTA, BL_STEP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_104_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/x3/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x3/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x3/ansi/red/red.c b/keyboards/keychron/x3/ansi/red/red.c new file mode 100755 index 000000000000..550326840d6e --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/red.c @@ -0,0 +1,149 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1 }, + {0, F_2 }, + {0, F_3 }, + {0, F_4 }, + {0, F_5 }, + {0, F_6 }, + {0, F_7 }, + {0, F_8 }, + {0, F_9 }, + {0, F_10}, + {0, F_11}, + {0, F_12}, + {0, F_13}, + {0, F_15}, + {0, F_16}, + {0, G_1 }, + + {0, E_1 }, + {0, E_2 }, + {0, E_3 }, + {0, E_4 }, + {0, E_5 }, + {0, E_6 }, + {0, E_7 }, + {0, E_8 }, + {0, E_9 }, + {0, E_10}, + {0, E_11}, + {0, E_12}, + {0, E_13}, + {0, E_14}, + {0, E_15}, + {0, E_16}, + {0, H_1 }, + {0, H_2 }, + {0, H_3 }, + {0, H_4 }, + {0, H_5 }, + + {0, D_1 }, + {0, D_2 }, + {0, D_3 }, + {0, D_4 }, + {0, D_5 }, + {0, D_6 }, + {0, D_7 }, + {0, D_8 }, + {0, D_9 }, + {0, D_10}, + {0, D_11}, + {0, D_12}, + {0, D_13}, + {0, D_14}, + {0, D_15}, + {0, D_16}, + {0, G_6 }, + {0, G_7 }, + {0, G_8 }, + {0, G_9 }, + {0, G_10}, + + {0, C_1 }, + {0, C_2 }, + {0, C_3 }, + {0, C_4 }, + {0, C_5 }, + {0, C_6 }, + {0, C_7 }, + {0, C_8 }, + {0, C_9 }, + {0, C_10}, + {0, C_11}, + {0, C_12}, + {0, C_14}, + {0, H_7 }, + {0, H_8 }, + {0, H_9 }, + + {0, B_1 }, + {0, B_3 }, + {0, B_4 }, + {0, B_5 }, + {0, B_6 }, + {0, B_7 }, + {0, B_8 }, + {0, B_9 }, + {0, B_10}, + {0, B_11}, + {0, B_12}, + {0, B_14}, + {0, B_16}, + {0, H_6 }, + {0, H_11}, + {0, H_12}, + {0, H_10}, + + {0, A_1 }, + {0, A_2 }, + {0, A_3 }, + {0, A_7 }, + {0, A_11}, + {0, A_12}, + {0, A_13}, + {0, A_14}, + {0, A_15}, + {0, A_16}, + {0, G_13}, + {0, G_11}, + {0, G_12}, + + {0, I_1 }, + {0, I_2 }, + {0, I_3 }, + {0, I_4 }, + {0, I_5 }, + {0, I_6 }, + {0, I_7 }, + {0, I_8 }, + {0, I_9 }, + {0, I_10}, + {0, I_11}, + {0, I_12}, +}; +#endif diff --git a/keyboards/keychron/x3/ansi/red/rules.mk b/keyboards/keychron/x3/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x3/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x3/config.h b/keyboards/keychron/x3/config.h new file mode 100755 index 000000000000..edc7cec7b233 --- /dev/null +++ b/keyboards/keychron/x3/config.h @@ -0,0 +1,37 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* Winlock indicator */ +#define LED_WIN_LOCK_PIN A3 +#define LED_WIN_LOCK_PIN_ON_STATE 1 + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x3/halconf.h b/keyboards/keychron/x3/halconf.h new file mode 100755 index 000000000000..41bddcb2799b --- /dev/null +++ b/keyboards/keychron/x3/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/keychron/x3/info.json b/keyboards/keychron/x3/info.json new file mode 100755 index 000000000000..3d6e7a18011d --- /dev/null +++ b/keyboards/keychron/x3/info.json @@ -0,0 +1,139 @@ +{ + "keyboard_name": "Lemokey X3", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "A15", "C10", "C11", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0", "A1", "A2", "B12", "B10", "B13", "B14"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "A4", + "scroll_lock": "A5", + "num_lock": "A6" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT_104_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":2, "y":0}, + {"matrix":[0,2], "x":3, "y":0}, + {"matrix":[0,3], "x":4, "y":0}, + {"matrix":[0,4], "x":5, "y":0}, + {"matrix":[0,5], "x":6.5, "y":0}, + {"matrix":[0,6], "x":7.5, "y":0}, + {"matrix":[0,7], "x":8.5, "y":0}, + {"matrix":[0,8], "x":9.5, "y":0}, + {"matrix":[0,9], "x":11, "y":0}, + {"matrix":[0,10], "x":12, "y":0}, + {"matrix":[0,11], "x":13, "y":0}, + {"matrix":[0,12], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.25, "y":0}, + {"matrix":[0,16], "x":17.25, "y":0}, + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.25, "y":1.25}, + {"matrix":[1,16], "x":17.25, "y":1.25}, + {"matrix":[1,17], "x":18.5, "y":1.25}, + {"matrix":[1,18], "x":19.5, "y":1.25}, + {"matrix":[1,19], "x":20.5, "y":1.25}, + {"matrix":[1,20], "x":21.5, "y":1.25}, + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.25, "y":2.25}, + {"matrix":[2,16], "x":17.25, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[2,18], "x":19.5, "y":2.25}, + {"matrix":[2,19], "x":20.5, "y":2.25}, + {"matrix":[2,20], "x":21.5, "y":2.25, "h":2}, + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + {"matrix":[3,18], "x":19.5, "y":3.25}, + {"matrix":[3,19], "x":20.5, "y":3.25}, + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":2.75}, + {"matrix":[4,15], "x":16.25, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[4,18], "x":19.5, "y":4.25}, + {"matrix":[4,19], "x":20.5, "y":4.25}, + {"matrix":[4,20], "x":21.5, "y":4.25, "h":2}, + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25, "w":1.25}, + {"matrix":[5,11], "x":11.25, "y":5.25, "w":1.25}, + {"matrix":[5,12], "x":12.5, "y":5.25, "w":1.25}, + {"matrix":[5,13], "x":13.75, "y":5.25, "w":1.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.25, "y":5.25}, + {"matrix":[5,16], "x":17.25, "y":5.25}, + {"matrix":[5,17], "x":18.5, "y":5.25, "w":2}, + {"matrix":[5,18], "x":20.5, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/x3/mcuconf.h b/keyboards/keychron/x3/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x3/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x3/readme.md b/keyboards/keychron/x3/readme.md new file mode 100755 index 000000000000..c700ef538136 --- /dev/null +++ b/keyboards/keychron/x3/readme.md @@ -0,0 +1,26 @@ +# Lemokey X3 + +![Lemokey X3]() + +A customizable 80% TKL keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X3 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x3/ansi/red:default + +Flashing example for this keyboard: + + make keychron/x3/ansi/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x3/via_json/x3_ansi_red.json b/keyboards/keychron/x3/via_json/x3_ansi_red.json new file mode 100755 index 000000000000..31e044b399f0 --- /dev/null +++ b/keyboards/keychron/x3/via_json/x3_ansi_red.json @@ -0,0 +1,271 @@ +{ + "name": "Lemokey X3 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0230", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 21}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.5, + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.5, + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,14", + "0,15", + "0,16" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14", + "1,15", + "1,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,17", + "1,18", + "1,19", + "1,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14", + "2,15", + "2,16", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,17", + "2,18", + "2,19", + { + "h": 2 + }, + "2,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 3.5, + "c": "#cccccc" + }, + "3,17", + "3,18", + "3,19" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 2.75 + }, + "4,13", + { + "x": 1.25, + "c": "#777777" + }, + "4,15", + { + "x": 1.25, + "c": "#cccccc" + }, + "4,17", + "4,18", + "4,19", + { + "c": "#777777", + "h": 2 + }, + "4,20" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,10", + { + "w": 1.25 + }, + "5,11", + { + "w": 1.25 + }, + "5,12", + { + "w": 1.25 + }, + "5,13", + { + "x": 0.25, + "c": "#777777" + }, + "5,14", + "5,15", + "5,16", + { + "x": 0.25, + "c": "#cccccc", + "w": 2 + }, + "5,17", + "5,18" + ] + ] + } +} diff --git a/keyboards/keychron/x3/x3.c b/keyboards/keychron/x3/x3.c new file mode 100755 index 000000000000..4853cd52f60d --- /dev/null +++ b/keyboards/keychron/x3/x3.c @@ -0,0 +1,78 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) + +static void set_led_win_lock_state(void) { + if (win_lock_state) { + SET_LED_WIN_LOCK_ON; + } else { + SET_LED_WIN_LOCK_OFF; + } +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_WIN_LOCK_PIN); + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb() { + set_led_win_lock_state(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +void suspend_power_down_kb(void) { + SET_LED_WIN_LOCK_OFF; + + suspend_power_down_user(); +} diff --git a/keyboards/keychron/x4/ansi_encoder/red/config.h b/keyboards/keychron/x4/ansi_encoder/red/config.h new file mode 100755 index 000000000000..1f82ba627704 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/config.h @@ -0,0 +1,52 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 81 + +/* Winlock indicator */ +# define LED_CAPS_LOCK_INDEX 44 +# define DIM_CAPS_LOCK +# define LED_WIN_LOCK_INDEX 72 + +/* Scan phase of led driver set as MSKPHASE_6CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_6CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif + +/* Encoder Configuration*/ +#ifdef ENCODER_ENABLE +# define ENCODER_DEFAULT_POS 0x3 +# define ENCODER_MAP_KEY_DELAY 2 +#endif diff --git a/keyboards/keychron/x4/ansi_encoder/red/info.json b/keyboards/keychron/x4/ansi_encoder/red/info.json new file mode 100755 index 000000000000..6ab175c6499a --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/info.json @@ -0,0 +1,125 @@ +{ + "usb": { + "pid": "0x0240", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true, + "encoder": true + }, + "encoder": { + "enabled": true, + "rotary": [ + {"pin_a": "B14", "pin_b": "B15", "resolution": 4} + ] + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":18, "y":0}, + {"matrix":[0, 2], "flags":1, "x":33, "y":0}, + {"matrix":[0, 3], "flags":1, "x":48, "y":0}, + {"matrix":[0, 4], "flags":1, "x":62, "y":0}, + {"matrix":[0, 5], "flags":1, "x":81, "y":0}, + {"matrix":[0, 6], "flags":1, "x":95, "y":0}, + {"matrix":[0, 7], "flags":1, "x":110, "y":0}, + {"matrix":[0, 8], "flags":1, "x":125, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":158, "y":0}, + {"matrix":[0, 11], "flags":1, "x":173, "y":0}, + {"matrix":[0, 12], "flags":1, "x":187, "y":0}, + {"matrix":[0, 13], "flags":1, "x":206, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 13], "flags":4, "x":202, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":9, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 13], "flags":1, "x":196, "y":38}, + {"matrix":[3, 14], "flags":1, "x":224, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":9, "y":49}, + {"matrix":[4, 2], "flags":4, "x":33, "y":49}, + {"matrix":[4, 3], "flags":4, "x":48, "y":49}, + {"matrix":[4, 4], "flags":4, "x":62, "y":49}, + {"matrix":[4, 5], "flags":4, "x":77, "y":49}, + {"matrix":[4, 6], "flags":4, "x":92, "y":49}, + {"matrix":[4, 7], "flags":4, "x":106, "y":49}, + {"matrix":[4, 8], "flags":4, "x":121, "y":49}, + {"matrix":[4, 9], "flags":4, "x":136, "y":49}, + {"matrix":[4, 10], "flags":4, "x":151, "y":49}, + {"matrix":[4, 11], "flags":4, "x":165, "y":49}, + {"matrix":[4, 13], "flags":1, "x":185, "y":49}, + {"matrix":[4, 14], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 6], "flags":4, "x":94, "y":61}, + {"matrix":[5, 10], "flags":1, "x":147, "y":61}, + {"matrix":[5, 11], "flags":1, "x":162, "y":61}, + {"matrix":[5, 12], "flags":1, "x":176, "y":61}, + {"matrix":[5, 13], "flags":1, "x":195, "y":64}, + {"matrix":[5, 14], "flags":1, "x":209, "y":64}, + {"matrix":[5, 15], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/keymap.c b/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..c94fded11a20 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/keymap.c @@ -0,0 +1,70 @@ +/* Copyright 202 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_FN] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, + [WIN_L2] = { ENCODER_CCW_CW(_______, _______)}, + [WIN_L3] = { ENCODER_CCW_CW(_______, _______)} +}; +#endif // ENCODER_MAP_ENABLE diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/rules.mk b/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/rules.mk new file mode 100755 index 000000000000..ee325681483f --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/keymap.c b/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..f1741d6832b8 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/keymap.c @@ -0,0 +1,86 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_FN] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, + [WIN_L2] = { ENCODER_CCW_CW(_______, _______)}, + [WIN_L3] = { ENCODER_CCW_CW(_______, _______)} +}; +#endif // ENCODER_MAP_ENABLE + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/rules.mk b/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..936769ddc6e2 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/rules.mk @@ -0,0 +1,4 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/keymap.c b/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..294bf8efb91c --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/keymap.c @@ -0,0 +1,70 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [WIN_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_FN] = { ENCODER_CCW_CW(BL_DOWN, BL_UP)}, + [WIN_L2] = { ENCODER_CCW_CW(_______, _______)}, + [WIN_L3] = { ENCODER_CCW_CW(_______, _______)} +}; +#endif // ENCODER_MAP_ENABLE diff --git a/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/rules.mk b/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..f1adcab005e8 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/keychron/x4/ansi_encoder/red/red.c b/keyboards/keychron/x4/ansi_encoder/red/red.c new file mode 100755 index 000000000000..d24851551585 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/red.c @@ -0,0 +1,113 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, A_16}, + {0, A_15}, + {0, A_14}, + {0, A_13}, + {0, A_12}, + {0, A_11}, + {0, A_10}, + {0, A_9 }, + {0, A_8 }, + {0, A_7 }, + {0, A_6 }, + {0, A_5 }, + {0, A_4 }, + {0, A_3 }, + + {0, B_16}, + {0, B_15}, + {0, B_14}, + {0, B_13}, + {0, B_12}, + {0, B_11}, + {0, B_10}, + {0, B_9 }, + {0, B_8 }, + {0, B_7 }, + {0, B_6 }, + {0, B_5 }, + {0, B_4 }, + {0, B_3 }, + {0, B_2 }, + + {0, C_16}, + {0, C_15}, + {0, C_14}, + {0, C_13}, + {0, C_12}, + {0, C_11}, + {0, C_10}, + {0, C_9 }, + {0, C_8 }, + {0, C_7 }, + {0, C_6 }, + {0, C_5 }, + {0, C_4 }, + {0, C_3 }, + {0, C_2 }, + + {0, D_16}, + {0, D_15}, + {0, D_14}, + {0, D_13}, + {0, D_12}, + {0, D_11}, + {0, D_10}, + {0, D_9 }, + {0, D_8 }, + {0, D_7 }, + {0, D_6 }, + {0, D_5 }, + {0, D_3 }, + {0, D_2 }, + + {0, E_16}, + {0, E_14}, + {0, E_13}, + {0, E_12}, + {0, E_11}, + {0, E_10}, + {0, E_9 }, + {0, E_8 }, + {0, E_7 }, + {0, E_6 }, + {0, E_5 }, + {0, E_3 }, + {0, E_2 }, + + {0, F_16}, + {0, F_15}, + {0, F_14}, + {0, F_10}, + {0, F_6 }, + {0, F_5 }, + {0, F_4 }, + {0, F_3 }, + {0, F_2 }, + {0, F_1 }, +}; +#endif diff --git a/keyboards/keychron/x4/ansi_encoder/red/rules.mk b/keyboards/keychron/x4/ansi_encoder/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x4/ansi_encoder/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x4/config.h b/keyboards/keychron/x4/config.h new file mode 100755 index 000000000000..b2d50d5056bb --- /dev/null +++ b/keyboards/keychron/x4/config.h @@ -0,0 +1,31 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x4/halconf.h b/keyboards/keychron/x4/halconf.h new file mode 100755 index 000000000000..463d177eabc7 --- /dev/null +++ b/keyboards/keychron/x4/halconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif + +#include_next diff --git a/keyboards/keychron/x4/info.json b/keyboards/keychron/x4/info.json new file mode 100755 index 000000000000..a4b2515ba326 --- /dev/null +++ b/keyboards/keychron/x4/info.json @@ -0,0 +1,120 @@ +{ + "keyboard_name": "Lemokey X4", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["A0", "A1", "A2", "A3", "C0", "C1", "C2", "C3", "A8", "C12", "B9", "C6", "C7", "C4", "C5", "A15"], + "rows": ["B0", "B1", "B8", "B3", "B4", "B5"] + }, + "diode_direction": "COL2ROW", + "indicators": { + "caps_lock": "C9" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT_82_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":1.25, "y":0}, + {"matrix":[0,2], "x":2.25, "y":0}, + {"matrix":[0,3], "x":3.25, "y":0}, + {"matrix":[0,4], "x":4.25, "y":0}, + {"matrix":[0,5], "x":5.5, "y":0}, + {"matrix":[0,6], "x":6.5, "y":0}, + {"matrix":[0,7], "x":7.5, "y":0}, + {"matrix":[0,8], "x":8.5, "y":0}, + {"matrix":[0,9], "x":9.75, "y":0}, + {"matrix":[0,10], "x":10.75, "y":0}, + {"matrix":[0,11], "x":11.75, "y":0}, + {"matrix":[0,12], "x":12.75, "y":0}, + {"matrix":[0,13], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,13], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,14], "x":15.25, "y":3.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,2], "x":2.25, "y":4.25}, + {"matrix":[4,3], "x":3.25, "y":4.25}, + {"matrix":[4,4], "x":4.25, "y":4.25}, + {"matrix":[4,5], "x":5.25, "y":4.25}, + {"matrix":[4,6], "x":6.25, "y":4.25}, + {"matrix":[4,7], "x":7.25, "y":4.25}, + {"matrix":[4,8], "x":8.25, "y":4.25}, + {"matrix":[4,9], "x":9.25, "y":4.25}, + {"matrix":[4,10], "x":10.25, "y":4.25}, + {"matrix":[4,11], "x":11.25, "y":4.25}, + {"matrix":[4,13], "x":12.25, "y":4.25, "w":1.75}, + {"matrix":[4,14], "x":14.25, "y":4.5}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,6], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,10], "x":10, "y":5.25}, + {"matrix":[5,11], "x":11, "y":5.25}, + {"matrix":[5,12], "x":12, "y":5.25}, + {"matrix":[5,13], "x":13.25, "y":5.5}, + {"matrix":[5,14], "x":14.25, "y":5.5}, + {"matrix":[5,15], "x":15.25, "y":5.5} + ] + } + } +} diff --git a/keyboards/keychron/x4/mcuconf.h b/keyboards/keychron/x4/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x4/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x4/readme.md b/keyboards/keychron/x4/readme.md new file mode 100755 index 000000000000..5ff03e9b2308 --- /dev/null +++ b/keyboards/keychron/x4/readme.md @@ -0,0 +1,26 @@ +# Lemokey X4 + +![Lemokey X4]() + +A customizable 75% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X4 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x4/ansi_encoder/red:default + +Flashing example for this keyboard: + + make keychron/x4/ansi_encoder/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x4/via_json/x4_ansi_encoder_red.json b/keyboards/keychron/x4/via_json/x4_ansi_encoder_red.json new file mode 100644 index 000000000000..8c3f83181174 --- /dev/null +++ b/keyboards/keychron/x4/via_json/x4_ansi_encoder_red.json @@ -0,0 +1,220 @@ +{ + "name": "Lemokey X4 ANSI Knob Red", + "vendorId": "0x362D", + "productId": "0x0240", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 16}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 0.25, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.25 + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.25 + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,13", + { + "x": 0.25 + }, + "0,14\n\n\n\n\n\n\n\n\ne0" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25 + }, + "2,14" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "3,14" + ], + [ + { + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "4,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#777777" + }, + "4,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa" + }, + "5,10", + "5,11", + "5,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#777777" + }, + "5,13", + "5,14", + "5,15" + ] + ] + } +} diff --git a/keyboards/keychron/x4/x4.c b/keyboards/keychron/x4/x4.c new file mode 100755 index 000000000000..f757f3b08d6d --- /dev/null +++ b/keyboards/keychron/x4/x4.c @@ -0,0 +1,96 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { +#ifdef LED_MATRIX_ENABLE + case BL_TOGG: + if (record->event.pressed) { + switch (led_matrix_get_flags()) { + case LED_FLAG_ALL: { + led_matrix_set_flags(LED_FLAG_NONE); + led_matrix_set_value_all(0); + } break; + default: { + led_matrix_set_flags(LED_FLAG_ALL); + } break; + } + } + if (!led_matrix_is_enabled()) { + led_matrix_set_flags(LED_FLAG_ALL); + led_matrix_enable(); + } + return false; +#endif + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +bool led_matrix_indicators_kb(void) { + if (!led_matrix_indicators_user()) { + return false; + } + if (win_lock_state) { + led_matrix_set_value(LED_WIN_LOCK_INDEX, 0xFF); + } else { + if (!led_matrix_get_flags()) { + led_matrix_set_value(LED_WIN_LOCK_INDEX, 0); + } + } +#if defined(LED_CAPS_LOCK_INDEX) + if (host_keyboard_led_state().caps_lock) { +# if defined(DIM_CAPS_LOCK) + led_matrix_set_value(LED_CAPS_LOCK_INDEX, 0); +# endif +#endif + } + return true; +} diff --git a/keyboards/keychron/x5/ansi/red/config.h b/keyboards/keychron/x5/ansi/red/config.h new file mode 100755 index 000000000000..0c82946cd8fc --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/config.h @@ -0,0 +1,41 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 82 + +/* Scan phase of led driver set as MSKPHASE_6CHANNEL(defined as 0x03 in CKLED2001.h) */ +# define PHASE_CHANNEL MSKPHASE_6CHANNEL +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x5/ansi/red/info.json b/keyboards/keychron/x5/ansi/red/info.json new file mode 100755 index 000000000000..ab2eb5656533 --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/info.json @@ -0,0 +1,119 @@ +{ + "usb": { + "pid": "0x0250", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true, + "effect_max": true + }, + "layout": [ + {"matrix":[0, 0], "flags":1, "x":0, "y":0}, + {"matrix":[0, 1], "flags":1, "x":18, "y":0}, + {"matrix":[0, 2], "flags":1, "x":33, "y":0}, + {"matrix":[0, 3], "flags":1, "x":48, "y":0}, + {"matrix":[0, 4], "flags":1, "x":62, "y":0}, + {"matrix":[0, 5], "flags":1, "x":81, "y":0}, + {"matrix":[0, 6], "flags":1, "x":95, "y":0}, + {"matrix":[0, 7], "flags":1, "x":110, "y":0}, + {"matrix":[0, 8], "flags":1, "x":125, "y":0}, + {"matrix":[0, 9], "flags":1, "x":143, "y":0}, + {"matrix":[0, 10], "flags":1, "x":158, "y":0}, + {"matrix":[0, 11], "flags":1, "x":173, "y":0}, + {"matrix":[0, 12], "flags":1, "x":187, "y":0}, + {"matrix":[0, 13], "flags":1, "x":206, "y":0}, + {"matrix":[0, 14], "flags":1, "x":224, "y":0}, + + {"matrix":[1, 0], "flags":1, "x":0, "y":15}, + {"matrix":[1, 1], "flags":4, "x":15, "y":15}, + {"matrix":[1, 2], "flags":4, "x":29, "y":15}, + {"matrix":[1, 3], "flags":4, "x":44, "y":15}, + {"matrix":[1, 4], "flags":4, "x":59, "y":15}, + {"matrix":[1, 5], "flags":4, "x":73, "y":15}, + {"matrix":[1, 6], "flags":4, "x":88, "y":15}, + {"matrix":[1, 7], "flags":4, "x":103, "y":15}, + {"matrix":[1, 8], "flags":4, "x":118, "y":15}, + {"matrix":[1, 9], "flags":4, "x":132, "y":15}, + {"matrix":[1, 10], "flags":4, "x":147, "y":15}, + {"matrix":[1, 11], "flags":4, "x":162, "y":15}, + {"matrix":[1, 12], "flags":4, "x":176, "y":15}, + {"matrix":[1, 13], "flags":1, "x":198, "y":15}, + {"matrix":[1, 14], "flags":1, "x":224, "y":15}, + + {"matrix":[2, 0], "flags":1, "x":4, "y":26}, + {"matrix":[2, 1], "flags":4, "x":22, "y":26}, + {"matrix":[2, 2], "flags":4, "x":37, "y":26}, + {"matrix":[2, 3], "flags":4, "x":51, "y":26}, + {"matrix":[2, 4], "flags":4, "x":66, "y":26}, + {"matrix":[2, 5], "flags":4, "x":81, "y":26}, + {"matrix":[2, 6], "flags":4, "x":95, "y":26}, + {"matrix":[2, 7], "flags":4, "x":110, "y":26}, + {"matrix":[2, 8], "flags":4, "x":125, "y":26}, + {"matrix":[2, 9], "flags":4, "x":140, "y":26}, + {"matrix":[2, 10], "flags":4, "x":154, "y":26}, + {"matrix":[2, 11], "flags":4, "x":169, "y":26}, + {"matrix":[2, 12], "flags":4, "x":184, "y":26}, + {"matrix":[2, 13], "flags":1, "x":202, "y":26}, + {"matrix":[2, 14], "flags":1, "x":224, "y":26}, + + {"matrix":[3, 0], "flags":8, "x":6, "y":38}, + {"matrix":[3, 1], "flags":4, "x":26, "y":38}, + {"matrix":[3, 2], "flags":4, "x":40, "y":38}, + {"matrix":[3, 3], "flags":4, "x":55, "y":38}, + {"matrix":[3, 4], "flags":4, "x":70, "y":38}, + {"matrix":[3, 5], "flags":4, "x":84, "y":38}, + {"matrix":[3, 6], "flags":4, "x":99, "y":38}, + {"matrix":[3, 7], "flags":4, "x":114, "y":38}, + {"matrix":[3, 8], "flags":4, "x":129, "y":38}, + {"matrix":[3, 9], "flags":4, "x":143, "y":38}, + {"matrix":[3, 10], "flags":4, "x":158, "y":38}, + {"matrix":[3, 11], "flags":4, "x":173, "y":38}, + {"matrix":[3, 12], "flags":1, "x":196, "y":38}, + {"matrix":[3, 14], "flags":1, "x":224, "y":38}, + + {"matrix":[4, 0], "flags":1, "x":9, "y":49}, + {"matrix":[4, 1], "flags":4, "x":33, "y":49}, + {"matrix":[4, 2], "flags":4, "x":48, "y":49}, + {"matrix":[4, 3], "flags":4, "x":62, "y":49}, + {"matrix":[4, 4], "flags":4, "x":77, "y":49}, + {"matrix":[4, 5], "flags":4, "x":92, "y":49}, + {"matrix":[4, 6], "flags":4, "x":106, "y":49}, + {"matrix":[4, 7], "flags":4, "x":121, "y":49}, + {"matrix":[4, 8], "flags":4, "x":136, "y":49}, + {"matrix":[4, 9] , "flags":4, "x":151, "y":49}, + {"matrix":[4, 10], "flags":4, "x":165, "y":49}, + {"matrix":[4, 11], "flags":1, "x":185, "y":49}, + {"matrix":[4, 12], "flags":1, "x":209, "y":52}, + + {"matrix":[5, 0], "flags":1, "x":2, "y":61}, + {"matrix":[5, 1], "flags":1, "x":20, "y":61}, + {"matrix":[5, 2], "flags":1, "x":39, "y":61}, + {"matrix":[5, 5], "flags":4, "x":94, "y":61}, + {"matrix":[5, 9], "flags":1, "x":147, "y":61}, + {"matrix":[5, 10], "flags":1, "x":162, "y":61}, + {"matrix":[5, 11], "flags":1, "x":176, "y":61}, + {"matrix":[5, 12], "flags":1, "x":195, "y":64}, + {"matrix":[5, 13], "flags":1, "x":209, "y":64}, + {"matrix":[5, 14], "flags":1, "x":224, "y":64} + ] + } +} diff --git a/keyboards/keychron/x5/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x5/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..fd4a028654ed --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/x5/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x5/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..2edcdfb226ce --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x5/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x5/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x5/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x5/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..51417d302ec4 --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_82_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_82_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + [WIN_L3] = LAYOUT_82_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), +}; diff --git a/keyboards/keychron/x5/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x5/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x5/ansi/red/red.c b/keyboards/keychron/x5/ansi/red/red.c new file mode 100755 index 000000000000..b64272bae6de --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/red.c @@ -0,0 +1,114 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1 }, + {0, F_2 }, + {0, F_3 }, + {0, F_4 }, + {0, F_5 }, + {0, F_6 }, + {0, F_7 }, + {0, F_8 }, + {0, F_9 }, + {0, F_10}, + {0, F_11}, + {0, F_12}, + {0, F_13}, + {0, F_14}, + {0, F_15}, + + {0, E_1 }, + {0, E_2 }, + {0, E_3 }, + {0, E_4 }, + {0, E_5 }, + {0, E_6 }, + {0, E_7 }, + {0, E_8 }, + {0, E_9 }, + {0, E_10}, + {0, E_11}, + {0, E_12}, + {0, E_13}, + {0, E_14}, + {0, E_15}, + + {0, D_1 }, + {0, D_2 }, + {0, D_3 }, + {0, D_4 }, + {0, D_5 }, + {0, D_6 }, + {0, D_7 }, + {0, D_8 }, + {0, D_9 }, + {0, D_10}, + {0, D_11}, + {0, D_12}, + {0, D_13}, + {0, D_14}, + {0, D_15}, + + {0, C_1 }, + {0, C_2 }, + {0, C_3 }, + {0, C_4 }, + {0, C_5 }, + {0, C_6 }, + {0, C_7 }, + {0, C_8 }, + {0, C_9 }, + {0, C_10}, + {0, C_11}, + {0, C_12}, + {0, C_13}, + {0, C_15}, + + {0, B_1 }, + {0, B_2 }, + {0, B_3 }, + {0, B_4 }, + {0, B_5 }, + {0, B_6 }, + {0, B_7 }, + {0, B_8 }, + {0, B_9 }, + {0, B_10}, + {0, B_11}, + {0, B_12}, + {0, B_13}, + + {0, A_1 }, + {0, A_2 }, + {0, A_3 }, + {0, A_6 }, + {0, A_10}, + {0, A_11}, + {0, A_12}, + {0, A_13}, + {0, A_14}, + {0, A_15}, +}; +#endif diff --git a/keyboards/keychron/x5/ansi/red/rules.mk b/keyboards/keychron/x5/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x5/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x5/config.h b/keyboards/keychron/x5/config.h new file mode 100755 index 000000000000..ce74a8ae78b0 --- /dev/null +++ b/keyboards/keychron/x5/config.h @@ -0,0 +1,37 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* LED for WinLock indicating */ +#define LED_WIN_LOCK_PIN C9 +#define LED_WIN_LOCK_PIN_ON_STATE 1 + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x5/halconf.h b/keyboards/keychron/x5/halconf.h new file mode 100755 index 000000000000..463d177eabc7 --- /dev/null +++ b/keyboards/keychron/x5/halconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE +#ifdef ENCODER_ENABLE +# define PAL_USE_CALLBACKS TRUE +#endif + +#include_next diff --git a/keyboards/keychron/x5/info.json b/keyboards/keychron/x5/info.json new file mode 100755 index 000000000000..d846daeaf504 --- /dev/null +++ b/keyboards/keychron/x5/info.json @@ -0,0 +1,120 @@ +{ + "keyboard_name": "Lemokey X5", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "A15", "C10", "C11", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "ROW2COL", + "indicators": { + "caps_lock": "B14" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT_82_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,1], "x":1.25, "y":0}, + {"matrix":[0,2], "x":2.25, "y":0}, + {"matrix":[0,3], "x":3.25, "y":0}, + {"matrix":[0,4], "x":4.25, "y":0}, + {"matrix":[0,5], "x":5.5, "y":0}, + {"matrix":[0,6], "x":6.5, "y":0}, + {"matrix":[0,7], "x":7.5, "y":0}, + {"matrix":[0,8], "x":8.5, "y":0}, + {"matrix":[0,9], "x":9.75, "y":0}, + {"matrix":[0,10], "x":10.75, "y":0}, + {"matrix":[0,11], "x":11.75, "y":0}, + {"matrix":[0,12], "x":12.75, "y":0}, + {"matrix":[0,13], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,12], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,14], "x":15.25, "y":3.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,1], "x":2.25, "y":4.25}, + {"matrix":[4,2], "x":3.25, "y":4.25}, + {"matrix":[4,3], "x":4.25, "y":4.25}, + {"matrix":[4,4], "x":5.25, "y":4.25}, + {"matrix":[4,5], "x":6.25, "y":4.25}, + {"matrix":[4,6], "x":7.25, "y":4.25}, + {"matrix":[4,7], "x":8.25, "y":4.25}, + {"matrix":[4,8], "x":9.25, "y":4.25}, + {"matrix":[4,9], "x":10.25, "y":4.25}, + {"matrix":[4,10], "x":11.25, "y":4.25}, + {"matrix":[4,11], "x":12.25, "y":4.25, "w":1.75}, + {"matrix":[4,12], "x":14.25, "y":4.5}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,5], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,9], "x":10, "y":5.25}, + {"matrix":[5,10], "x":11, "y":5.25}, + {"matrix":[5,11], "x":12, "y":5.25}, + {"matrix":[5,12], "x":13.25, "y":5.5}, + {"matrix":[5,13], "x":14.25, "y":5.5}, + {"matrix":[5,14], "x":15.25, "y":5.5} + ] + } + } +} diff --git a/keyboards/keychron/x5/mcuconf.h b/keyboards/keychron/x5/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x5/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x5/readme.md b/keyboards/keychron/x5/readme.md new file mode 100755 index 000000000000..a74c18f19c8c --- /dev/null +++ b/keyboards/keychron/x5/readme.md @@ -0,0 +1,26 @@ +# Lemokey X5 + +![Lemokey X5]() + +A customizable 75% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X5 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x5/ansi/red:default + +Flashing example for this keyboard: + + make keychron/x5/ansi/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x5/via_json/x5_ansi_red.json b/keyboards/keychron/x5/via_json/x5_ansi_red.json new file mode 100644 index 000000000000..bc13d9d5e9f1 --- /dev/null +++ b/keyboards/keychron/x5/via_json/x5_ansi_red.json @@ -0,0 +1,220 @@ +{ + "name": "Lemokey X5 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0250", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 15}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 0.25, + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "x": 0.25 + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "x": 0.25 + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0,13", + { + "x": 0.25 + }, + "0,14" + ], + [ + { + "y": 0.25 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25 + }, + "1,14" + ], + [ + { + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,12", + { + "x": 0.25 + }, + "2,14" + ], + [ + { + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "3,14" + ], + [ + { + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,1", + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "4,11" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#cccccc" + }, + "4,12" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#777777", + "w": 6.25 + }, + "5,5", + { + "c": "#aaaaaa" + }, + "5,9", + "5,10", + "5,11" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#cccccc" + }, + "5,12", + "5,13", + "5,14" + ] + ] + } +} diff --git a/keyboards/keychron/x5/x5.c b/keyboards/keychron/x5/x5.c new file mode 100755 index 000000000000..4853cd52f60d --- /dev/null +++ b/keyboards/keychron/x5/x5.c @@ -0,0 +1,78 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) + +static void set_led_win_lock_state(void) { + if (win_lock_state) { + SET_LED_WIN_LOCK_ON; + } else { + SET_LED_WIN_LOCK_OFF; + } +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_WIN_LOCK_PIN); + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb() { + set_led_win_lock_state(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +void suspend_power_down_kb(void) { + SET_LED_WIN_LOCK_OFF; + + suspend_power_down_user(); +} diff --git a/keyboards/keychron/x6/ansi/red/config.h b/keyboards/keychron/x6/ansi/red/config.h new file mode 100755 index 000000000000..5439411cc237 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/config.h @@ -0,0 +1,39 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef LED_MATRIX_ENABLE +/* RGB Matrix Driver Configuration */ +# define DRIVER_COUNT 1 +# define DRIVER_ADDR_1 0b1110100 + +/* RGB Matrix Configuration */ +# define LED_MATRIX_LED_COUNT 101 + +# define CKLED2001_CURRENT_TUNE \ + { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60 } + +/* turn off effects when suspended */ +# define LED_DISABLE_WHEN_USB_SUSPENDED + +// LED Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_led_matrix?id=led-matrix-effects +// #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) +# define LED_MATRIX_KEYPRESSES +# define LED_MATRIX_KEYRELEASES +#endif diff --git a/keyboards/keychron/x6/ansi/red/info.json b/keyboards/keychron/x6/ansi/red/info.json new file mode 100755 index 000000000000..fb682f649867 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/info.json @@ -0,0 +1,137 @@ +{ + "usb": { + "pid": "0x0260", + "device_version": "1.0.0" + }, + "features": { + "led_matrix": true + }, + "led_matrix": { + "driver": "ckled2001", + "animations": { + "none": true, + "solid": true, + "breathing": true, + "band_pinwheel": true, + "band_spiral": true, + "cycle_left_right": true, + "cycle_up_down": true, + "cycle_out_in": true, + "dual_beacon": true, + "solid_reactive_simple": true, + "solid_reactive_multiwide": true, + "solid_reactive_multinexus": true, + "solid_splash": true, + "wave_left_right": true, + "wave_up_down": true + }, + "layout": [ + {"matrix":[0,0], "flags":1, "x":0, "y":0}, + {"matrix":[0,2], "flags":1, "x":23, "y":0}, + {"matrix":[0,3], "flags":1, "x":35, "y":0}, + {"matrix":[0,4], "flags":1, "x":47, "y":0}, + {"matrix":[0,5], "flags":1, "x":58, "y":0}, + {"matrix":[0,6], "flags":1, "x":76, "y":0}, + {"matrix":[0,7], "flags":1, "x":87, "y":0}, + {"matrix":[0,8], "flags":1, "x":99, "y":0}, + {"matrix":[0,9], "flags":1, "x":111, "y":0}, + {"matrix":[0,10], "flags":1, "x":128, "y":0}, + {"matrix":[0,11], "flags":1, "x":140, "y":0}, + {"matrix":[0,12], "flags":1, "x":152, "y":0}, + {"matrix":[0,13], "flags":1, "x":163, "y":0}, + {"matrix":[0,14], "flags":1, "x":176, "y":0}, + {"matrix":[0,15], "flags":1, "x":189, "y":0}, + {"matrix":[0,16], "flags":1, "x":201, "y":0}, + {"matrix":[0,17], "flags":1, "x":212, "y":0}, + {"matrix":[0,18], "flags":1, "x":224, "y":0}, + + {"matrix":[1,0], "flags":1, "x":0, "y":13}, + {"matrix":[1,1], "flags":4, "x":12, "y":13}, + {"matrix":[1,2], "flags":4, "x":23, "y":13}, + {"matrix":[1,3], "flags":4, "x":35, "y":13}, + {"matrix":[1,4], "flags":4, "x":47, "y":13}, + {"matrix":[1,5], "flags":4, "x":58, "y":13}, + {"matrix":[1,6], "flags":4, "x":70, "y":13}, + {"matrix":[1,7], "flags":4, "x":82, "y":13}, + {"matrix":[1,8], "flags":4, "x":93, "y":13}, + {"matrix":[1,9], "flags":4, "x":105, "y":13}, + {"matrix":[1,10], "flags":4, "x":117, "y":13}, + {"matrix":[1,11], "flags":4, "x":128, "y":13}, + {"matrix":[1,12], "flags":4, "x":140, "y":13}, + {"matrix":[1,13], "flags":1, "x":157, "y":13}, + {"matrix":[1,14], "flags":1, "x":176, "y":13}, + {"matrix":[1,15], "flags":4, "x":189, "y":13}, + {"matrix":[1,16], "flags":4, "x":201, "y":13}, + {"matrix":[1,17], "flags":4, "x":212, "y":13}, + {"matrix":[1,18], "flags":4, "x":224, "y":13}, + + {"matrix":[2,0], "flags":1, "x":3, "y":25}, + {"matrix":[2,1], "flags":4, "x":17, "y":25}, + {"matrix":[2,2], "flags":4, "x":29, "y":25}, + {"matrix":[2,3], "flags":4, "x":41, "y":25}, + {"matrix":[2,4], "flags":4, "x":52, "y":25}, + {"matrix":[2,5], "flags":4, "x":64, "y":25}, + {"matrix":[2,6], "flags":4, "x":76, "y":25}, + {"matrix":[2,7], "flags":4, "x":87, "y":25}, + {"matrix":[2,8], "flags":4, "x":99, "y":25}, + {"matrix":[2,9], "flags":4, "x":111, "y":25}, + {"matrix":[2,10], "flags":4, "x":122, "y":25}, + {"matrix":[2,11], "flags":4, "x":134, "y":25}, + {"matrix":[2,12], "flags":4, "x":146, "y":25}, + {"matrix":[2,13], "flags":1, "x":160, "y":25}, + {"matrix":[2,14], "flags":1, "x":176, "y":25}, + {"matrix":[2,15], "flags":4, "x":189, "y":25}, + {"matrix":[2,16], "flags":4, "x":201, "y":25}, + {"matrix":[2,17], "flags":4, "x":212, "y":25}, + {"matrix":[3,18], "flags":4, "x":224, "y":31}, + + {"matrix":[3,0], "flags":1, "x":4, "y":38}, + {"matrix":[3,1], "flags":4, "x":20, "y":38}, + {"matrix":[3,2], "flags":4, "x":32, "y":38}, + {"matrix":[3,3], "flags":4, "x":44, "y":38}, + {"matrix":[3,4], "flags":4, "x":55, "y":38}, + {"matrix":[3,5], "flags":4, "x":67, "y":38}, + {"matrix":[3,6], "flags":4, "x":79, "y":38}, + {"matrix":[3,7], "flags":4, "x":90, "y":38}, + {"matrix":[3,8], "flags":4, "x":102, "y":38}, + {"matrix":[3,9], "flags":4, "x":114, "y":38}, + {"matrix":[3,10], "flags":4, "x":125, "y":38}, + {"matrix":[3,11], "flags":4, "x":137, "y":38}, + {"matrix":[3,13], "flags":1, "x":156, "y":38}, + {"matrix":[3,15], "flags":4, "x":189, "y":38}, + {"matrix":[3,16], "flags":4, "x":201, "y":38}, + {"matrix":[3,17], "flags":4, "x":212, "y":38}, + + {"matrix":[4,0], "flags":1, "x":7, "y":50}, + {"matrix":[4,1], "flags":4, "x":26, "y":50}, + {"matrix":[4,2], "flags":4, "x":38, "y":50}, + {"matrix":[4,3], "flags":4, "x":50, "y":50}, + {"matrix":[4,4], "flags":4, "x":61, "y":50}, + {"matrix":[4,5], "flags":4, "x":73, "y":50}, + {"matrix":[4,6], "flags":4, "x":85, "y":50}, + {"matrix":[4,7], "flags":4, "x":96, "y":50}, + {"matrix":[4,8], "flags":4, "x":108, "y":50}, + {"matrix":[4,9], "flags":4, "x":120, "y":50}, + {"matrix":[4,10], "flags":4, "x":131, "y":50}, + {"matrix":[4,11], "flags":1, "x":147, "y":50}, + {"matrix":[4,13], "flags":1, "x":164, "y":51}, + {"matrix":[4,15], "flags":4, "x":189, "y":50}, + {"matrix":[4,16], "flags":4, "x":201, "y":50}, + {"matrix":[4,17], "flags":4, "x":212, "y":50}, + {"matrix":[5,18], "flags":4, "x":224, "y":56}, + + {"matrix":[5,0], "flags":1, "x":1, "y":63}, + {"matrix":[5,1], "flags":1, "x":16, "y":63}, + {"matrix":[5,2], "flags":1, "x":31, "y":63}, + {"matrix":[5,5], "flags":4, "x":74, "y":63}, + {"matrix":[5,9], "flags":1, "x":117, "y":63}, + {"matrix":[5,10], "flags":1, "x":128, "y":63}, + {"matrix":[5,11], "flags":1, "x":140, "y":63}, + {"matrix":[5,12], "flags":1, "x":153, "y":64}, + {"matrix":[5,13], "flags":1, "x":164, "y":64}, + {"matrix":[5,14], "flags":1, "x":176, "y":64}, + {"matrix":[5,15], "flags":4, "x":195, "y":63}, + {"matrix":[5,17], "flags":4, "x":212, "y":63} + ] + } +} diff --git a/keyboards/keychron/x6/ansi/red/keymaps/default/keymap.c b/keyboards/keychron/x6/ansi/red/keymaps/default/keymap.c new file mode 100755 index 000000000000..bbfbd7166081 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_101_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_HOME, KC_END, KC_PSCR, KC_CALC, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGDN, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_101_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/x6/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x6/ansi/red/keymaps/keychron/keymap.c new file mode 100755 index 000000000000..cc51f70d7946 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/keymaps/keychron/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "keychron_common.h" +#include "keychron_ft_common.h" + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_101_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_HOME, KC_END, KC_PSCR, KC_CALC, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGDN, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_101_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; + +// clang-format on + +void housekeeping_task_user(void) { + housekeeping_task_keychron(); + housekeeping_task_keychron_ft(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_record_keychron(keycode, record)) { + return false; + } + if (!process_record_keychron_ft(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/keychron/x6/ansi/red/keymaps/keychron/rules.mk b/keyboards/keychron/x6/ansi/red/keymaps/keychron/rules.mk new file mode 100755 index 000000000000..3c9fcc5c98c2 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/keymaps/keychron/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes + +include keyboards/keychron/common/common.mk diff --git a/keyboards/keychron/x6/ansi/red/keymaps/via/keymap.c b/keyboards/keychron/x6/ansi/red/keymaps/via/keymap.c new file mode 100755 index 000000000000..bbfbd7166081 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/keymaps/via/keymap.c @@ -0,0 +1,61 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_101_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_HOME, KC_END, KC_PSCR, KC_CALC, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGDN, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT ), + + [WIN_FN] = LAYOUT_101_ansi( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, BL_DOWN, BL_UP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + + [WIN_L2] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), + [WIN_L3] = LAYOUT_101_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +}; diff --git a/keyboards/keychron/x6/ansi/red/keymaps/via/rules.mk b/keyboards/keychron/x6/ansi/red/keymaps/via/rules.mk new file mode 100755 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/keychron/x6/ansi/red/red.c b/keyboards/keychron/x6/ansi/red/red.c new file mode 100755 index 000000000000..19f790671505 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/red.c @@ -0,0 +1,133 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifdef LED_MATRIX_ENABLE +// clang-format off +const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT] = { +/* Refer to CKLED2001 manual for these locations + * driver + * | LED address + * | | */ + {0, F_1 }, + {0, F_3 }, + {0, F_4 }, + {0, F_5 }, + {0, F_6 }, + {0, F_7 }, + {0, F_8 }, + {0, F_9 }, + {0, F_10}, + {0, F_11}, + {0, F_12}, + {0, F_13}, + {0, F_14}, + {0, F_15}, + {0, F_16}, + {0, L_16}, + {0, L_15}, + {0, L_14}, + + {0, E_1 }, + {0, E_2 }, + {0, E_3 }, + {0, E_4 }, + {0, E_5 }, + {0, E_6 }, + {0, E_7 }, + {0, E_8 }, + {0, E_9 }, + {0, E_10}, + {0, E_11}, + {0, E_12}, + {0, E_13}, + {0, E_14}, + {0, E_15}, + {0, E_16}, + {0, K_16}, + {0, K_15}, + {0, K_14}, + + {0, D_1 }, + {0, D_2 }, + {0, D_3 }, + {0, D_4 }, + {0, D_5 }, + {0, D_6 }, + {0, D_7 }, + {0, D_8 }, + {0, D_9 }, + {0, D_10}, + {0, D_11}, + {0, D_12}, + {0, D_13}, + {0, D_14}, + {0, D_15}, + {0, D_16}, + {0, J_16}, + {0, J_15}, + {0, I_14}, + + {0, C_1 }, + {0, C_2 }, + {0, C_3 }, + {0, C_4 }, + {0, C_5 }, + {0, C_6 }, + {0, C_7 }, + {0, C_8 }, + {0, C_9 }, + {0, C_10}, + {0, C_11}, + {0, C_12}, + {0, C_13}, + {0, C_16}, + {0, I_16}, + {0, I_15}, + + {0, B_1 }, + {0, B_2 }, + {0, B_3 }, + {0, B_4 }, + {0, B_5 }, + {0, B_6 }, + {0, B_7 }, + {0, B_8 }, + {0, B_9 }, + {0, B_10}, + {0, B_11}, + {0, B_12}, + {0, B_13}, + {0, B_16}, + {0, H_16}, + {0, H_15}, + {0, G_14}, + + {0, A_1 }, + {0, A_2 }, + {0, A_3 }, + {0, A_6 }, + {0, A_10}, + {0, A_11}, + {0, A_12}, + {0, A_13}, + {0, A_14}, + {0, A_15}, + {0, A_16}, + {0, G_15}, +}; +#endif diff --git a/keyboards/keychron/x6/ansi/red/rules.mk b/keyboards/keychron/x6/ansi/red/rules.mk new file mode 100755 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/keychron/x6/ansi/red/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/keychron/x6/config.h b/keyboards/keychron/x6/config.h new file mode 100755 index 000000000000..05d700e22abd --- /dev/null +++ b/keyboards/keychron/x6/config.h @@ -0,0 +1,37 @@ +/* Copyright 2023 @ Keychron(https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define WEAR_LEVELING_LOGICAL_SIZE 2048 +#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) + +/* Winlock indicator */ +#define LED_WIN_LOCK_PIN B15 +#define LED_WIN_LOCK_PIN_ON_STATE 1 + +/* User used eeprom */ +#define EECONFIG_USER_DATA_SIZE 1 + +/* Factory test keys */ +#define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x6/halconf.h b/keyboards/keychron/x6/halconf.h new file mode 100755 index 000000000000..41bddcb2799b --- /dev/null +++ b/keyboards/keychron/x6/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/keychron/x6/info.json b/keyboards/keychron/x6/info.json new file mode 100755 index 000000000000..c62095c36848 --- /dev/null +++ b/keyboards/keychron/x6/info.json @@ -0,0 +1,140 @@ +{ + "keyboard_name": "Lemokey X6", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "lalalademaxiya1", + "processor": "STM32F401", + "bootloader": "stm32-dfu", + "usb": { + "vid": "0x362D" + }, + "matrix_pins": { + "cols": ["C6", "C7", "C8", "A14", "A15", "C10", "C11", "C13", "C14", "C15", "C0", "C1", "C2", "C3", "A0", "A1", "A2", "A3", "A4"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "ROW2COL", + "indicators": { + "caps_lock": "C9", + "num_lock": "B14" + }, + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "layouts": { + "LAYOUT_101_ansi": { + "layout": [ + {"matrix":[0,0], "x":0, "y":0}, + {"matrix":[0,2], "x":2, "y":0}, + {"matrix":[0,3], "x":3, "y":0}, + {"matrix":[0,4], "x":4, "y":0}, + {"matrix":[0,5], "x":5, "y":0}, + {"matrix":[0,6], "x":6.5, "y":0}, + {"matrix":[0,7], "x":7.5, "y":0}, + {"matrix":[0,8], "x":8.5, "y":0}, + {"matrix":[0,9], "x":9.5, "y":0}, + {"matrix":[0,10], "x":11, "y":0}, + {"matrix":[0,11], "x":12, "y":0}, + {"matrix":[0,12], "x":13, "y":0}, + {"matrix":[0,13], "x":14, "y":0}, + {"matrix":[0,14], "x":15.25, "y":0}, + {"matrix":[0,15], "x":16.5, "y":0}, + {"matrix":[0,16], "x":17.5, "y":0}, + {"matrix":[0,17], "x":18.5, "y":0}, + {"matrix":[0,18], "x":19.5, "y":0}, + + {"matrix":[1,0], "x":0, "y":1.25}, + {"matrix":[1,1], "x":1, "y":1.25}, + {"matrix":[1,2], "x":2, "y":1.25}, + {"matrix":[1,3], "x":3, "y":1.25}, + {"matrix":[1,4], "x":4, "y":1.25}, + {"matrix":[1,5], "x":5, "y":1.25}, + {"matrix":[1,6], "x":6, "y":1.25}, + {"matrix":[1,7], "x":7, "y":1.25}, + {"matrix":[1,8], "x":8, "y":1.25}, + {"matrix":[1,9], "x":9, "y":1.25}, + {"matrix":[1,10], "x":10, "y":1.25}, + {"matrix":[1,11], "x":11, "y":1.25}, + {"matrix":[1,12], "x":12, "y":1.25}, + {"matrix":[1,13], "x":13, "y":1.25, "w":2}, + {"matrix":[1,14], "x":15.25, "y":1.25}, + {"matrix":[1,15], "x":16.5, "y":1.25}, + {"matrix":[1,16], "x":17.5, "y":1.25}, + {"matrix":[1,17], "x":18.5, "y":1.25}, + {"matrix":[1,18], "x":19.5, "y":1.25}, + + {"matrix":[2,0], "x":0, "y":2.25, "w":1.5}, + {"matrix":[2,1], "x":1.5, "y":2.25}, + {"matrix":[2,2], "x":2.5, "y":2.25}, + {"matrix":[2,3], "x":3.5, "y":2.25}, + {"matrix":[2,4], "x":4.5, "y":2.25}, + {"matrix":[2,5], "x":5.5, "y":2.25}, + {"matrix":[2,6], "x":6.5, "y":2.25}, + {"matrix":[2,7], "x":7.5, "y":2.25}, + {"matrix":[2,8], "x":8.5, "y":2.25}, + {"matrix":[2,9], "x":9.5, "y":2.25}, + {"matrix":[2,10], "x":10.5, "y":2.25}, + {"matrix":[2,11], "x":11.5, "y":2.25}, + {"matrix":[2,12], "x":12.5, "y":2.25}, + {"matrix":[2,13], "x":13.5, "y":2.25, "w":1.5}, + {"matrix":[2,14], "x":15.25, "y":2.25}, + {"matrix":[2,15], "x":16.5, "y":2.25}, + {"matrix":[2,16], "x":17.5, "y":2.25}, + {"matrix":[2,17], "x":18.5, "y":2.25}, + {"matrix":[3,18], "x":19.5, "y":2.25, "h":2}, + + {"matrix":[3,0], "x":0, "y":3.25, "w":1.75}, + {"matrix":[3,1], "x":1.75, "y":3.25}, + {"matrix":[3,2], "x":2.75, "y":3.25}, + {"matrix":[3,3], "x":3.75, "y":3.25}, + {"matrix":[3,4], "x":4.75, "y":3.25}, + {"matrix":[3,5], "x":5.75, "y":3.25}, + {"matrix":[3,6], "x":6.75, "y":3.25}, + {"matrix":[3,7], "x":7.75, "y":3.25}, + {"matrix":[3,8], "x":8.75, "y":3.25}, + {"matrix":[3,9], "x":9.75, "y":3.25}, + {"matrix":[3,10], "x":10.75, "y":3.25}, + {"matrix":[3,11], "x":11.75, "y":3.25}, + {"matrix":[3,12], "x":12.75, "y":3.25, "w":2.25}, + {"matrix":[3,15], "x":16.5, "y":3.25}, + {"matrix":[3,16], "x":17.5, "y":3.25}, + {"matrix":[3,17], "x":18.5, "y":3.25}, + + {"matrix":[4,0], "x":0, "y":4.25, "w":2.25}, + {"matrix":[4,1], "x":2.25, "y":4.25}, + {"matrix":[4,2], "x":3.25, "y":4.25}, + {"matrix":[4,3], "x":4.25, "y":4.25}, + {"matrix":[4,4], "x":5.25, "y":4.25}, + {"matrix":[4,5], "x":6.25, "y":4.25}, + {"matrix":[4,6], "x":7.25, "y":4.25}, + {"matrix":[4,7], "x":8.25, "y":4.25}, + {"matrix":[4,8], "x":9.25, "y":4.25}, + {"matrix":[4,9], "x":10.25, "y":4.25}, + {"matrix":[4,10], "x":11.25, "y":4.25}, + {"matrix":[4,11], "x":12.25, "y":4.25, "w":1.75}, + {"matrix":[4,12], "x":14.25, "y":4.25}, + {"matrix":[4,15], "x":16.5, "y":4.25}, + {"matrix":[4,16], "x":17.5, "y":4.25}, + {"matrix":[4,17], "x":18.5, "y":4.25}, + {"matrix":[5,18], "x":19.5, "y":4.25, "h":2}, + + {"matrix":[5,0], "x":0, "y":5.25, "w":1.25}, + {"matrix":[5,1], "x":1.25, "y":5.25, "w":1.25}, + {"matrix":[5,2], "x":2.5, "y":5.25, "w":1.25}, + {"matrix":[5,5], "x":3.75, "y":5.25, "w":6.25}, + {"matrix":[5,9], "x":10, "y":5.25}, + {"matrix":[5,10], "x":11, "y":5.25}, + {"matrix":[5,11], "x":12, "y":5.25}, + {"matrix":[5,12], "x":13.25, "y":5.25}, + {"matrix":[5,13], "x":14.25, "y":5.25}, + {"matrix":[5,14], "x":15.25, "y":5.25}, + {"matrix":[5,15], "x":16.5, "y":5.25, "w":2}, + {"matrix":[5,17], "x":18.5, "y":5.25} + ] + } + } +} diff --git a/keyboards/keychron/x6/mcuconf.h b/keyboards/keychron/x6/mcuconf.h new file mode 100755 index 000000000000..494b71483ff9 --- /dev/null +++ b/keyboards/keychron/x6/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef STM32_HSECLK +#define STM32_HSECLK 16000000U + +#undef STM32_PLLM_VALUE +#define STM32_PLLM_VALUE 8 +#undef STM32_PLLN_VALUE +#define STM32_PLLN_VALUE 168 +#undef STM32_PLLP_VALUE +#define STM32_PLLP_VALUE 4 +#undef STM32_PLLQ_VALUE +#define STM32_PLLQ_VALUE 7 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/keychron/x6/readme.md b/keyboards/keychron/x6/readme.md new file mode 100755 index 000000000000..f4a0f5aa5dc3 --- /dev/null +++ b/keyboards/keychron/x6/readme.md @@ -0,0 +1,26 @@ +# Lemokey X6 + +![Lemokey X6]() + +A customizable 96% low profile keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey X6 +* Hardware Availability: [Keychron](https://www.keychron.com) + +Make example for this keyboard (after setting up your build environment): + + make keychron/x6/ansi/red:default + +Flashing example for this keyboard: + + make keychron/x6/ansi/red:default:flash + +## bootloader + +Enter the bootloader in two ways: + +* **Bootmagic reset**: Hold down the key located at *K00*, commonly programmed as *Esc* while plugging in the keyboard. +* **Physical reset button**: Briefly press the RESET button under the spacebar. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/keychron/x6/via_json/x6_ansi_red.json b/keyboards/keychron/x6/via_json/x6_ansi_red.json new file mode 100755 index 000000000000..6be481fd33b3 --- /dev/null +++ b/keyboards/keychron/x6/via_json/x6_ansi_red.json @@ -0,0 +1,257 @@ +{ + "name": "Lemokey X6 ANSI Red", + "vendorId": "0x362D", + "productId": "0x0260", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Mission Control","title": "Mission Control in macOS","shortName": "MCtrl"}, + {"name": "Launch Pad","title": "Launch Pad in macOS","shortName": "LPad"}, + {"name": "Left Option","title": "Left Option in macOS","shortName": "LOpt"}, + {"name": "Right Option","title": "Right Option in macOS","shortName": "ROpt"}, + {"name": "Left Cmd","title": "Left Command in macOS","shortName": "LCmd"}, + {"name": "Right Cmd","title": "Right Command in macOS","shortName": "RCmd"}, + {"name": "Siri","title": "Siri in macOS","shortName": "Siri"}, + {"name": "Task View","title": "Task View in windows","shortName": "Task"}, + {"name": "File Explorer","title": "File Explorer in windows","shortName": "File"}, + {"name": "Screen Shot","title": "Screenshot in macOS","shortName": "SShot"}, + {"name": "Cortana","title": "Cortana in windows","shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols": 19}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0\nESC", + { + "x": 1, + "c": "#cccccc" + }, + "0,2", + "0,3", + "0,4", + "0,5", + { + "x": 0.5 + }, + "0,6", + "0,7", + "0,8", + "0,9", + { + "x": 0.5 + }, + "0,10", + "0,11", + "0,12", + "0,13", + { + "x": 0.25 + }, + "0,14", + { + "x": 0.25 + }, + "0,15", + "0,16", + "0,17", + "0,18" + ], + [ + { + "y": 0.25, + "c": "#aaaaaa" + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.25, + "c": "#cccccc" + }, + "1,14", + { + "x": 0.25 + }, + "1,15", + "1,16", + "1,17", + "1,18" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.25, + "c": "#cccccc" + }, + "2,14", + { + "x": 0.25 + }, + "2,15", + "2,16", + "2,17", + { + "h": 2 + }, + "3,18" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,12", + { + "x": 1.5, + "c": "#cccccc" + }, + "3,15", + "3,16", + "3,17" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,1", + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "4,11", + { + "x": 0.25, + "c": "#cccccc" + }, + "4,12", + { + "x": 1.25 + }, + "4,15", + "4,16", + "4,17", + { + "c": "#777777", + "h": 2 + }, + "5,18" + ], + [ + { + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#777777", + "w": 6.25 + }, + "5,5", + { + "c": "#aaaaaa" + }, + "5,9", + "5,10", + "5,11", + { + "x": 0.25, + "c": "#cccccc" + }, + "5,12", + "5,13", + "5,14", + { + "x": 0.25, + "w": 2 + }, + "5,15", + "5,17" + ] + ] + } +} diff --git a/keyboards/keychron/x6/x6.c b/keyboards/keychron/x6/x6.c new file mode 100755 index 000000000000..4853cd52f60d --- /dev/null +++ b/keyboards/keychron/x6/x6.c @@ -0,0 +1,78 @@ +/* Copyright 2023 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +static uint8_t win_lock_state = 0; + +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) + +static void set_led_win_lock_state(void) { + if (win_lock_state) { + SET_LED_WIN_LOCK_ON; + } else { + SET_LED_WIN_LOCK_OFF; + } +} + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + + win_lock_state = 0; + eeconfig_update_user_datablock(&win_lock_state); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + setPinOutputPushPull(LED_WIN_LOCK_PIN); + eeconfig_read_user_datablock(&win_lock_state); + + keyboard_post_init_user(); +} + +void housekeeping_task_kb() { + set_led_win_lock_state(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) { + return false; + } + switch (keycode) { + case GU_TOGG: + if (record->event.pressed) { + win_lock_state = !win_lock_state; + eeconfig_update_user_datablock(&win_lock_state); + } + return true; + default: + return true; + } +} + +void suspend_power_down_kb(void) { + SET_LED_WIN_LOCK_OFF; + + suspend_power_down_user(); +} diff --git a/keyboards/lemokey/common/common.mk b/keyboards/lemokey/common/common.mk new file mode 100644 index 000000000000..28aed642b997 --- /dev/null +++ b/keyboards/lemokey/common/common.mk @@ -0,0 +1,6 @@ +COMMON_DIR = common +SRC += \ + $(COMMON_DIR)/lemokey_common.c \ + $(COMMON_DIR)/factory_test.c + +VPATH += $(TOP_DIR)/keyboards/lemokey/$(COMMON_DIR) diff --git a/keyboards/lemokey/common/factory_test.c b/keyboards/lemokey/common/factory_test.c new file mode 100644 index 000000000000..293308efd691 --- /dev/null +++ b/keyboards/lemokey/common/factory_test.c @@ -0,0 +1,355 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" +#include "raw_hid.h" +#include "via.h" +#include "lemokey_task.h" +#include "config.h" +#include "version.h" + +#ifndef RAW_EPSIZE +# define RAW_EPSIZE 32 +#endif + +#ifndef BL_CYCLE_KEY +# define BL_CYCLE_KEY KC_RIGHT +#endif + +#ifndef BL_TRIG_KEY +# define BL_TRIG_KEY KC_HOME +#endif + +enum { + BACKLIGHT_TEST_OFF = 0, + BACKLIGHT_TEST_WHITE, + BACKLIGHT_TEST_RED, + BACKLIGHT_TEST_GREEN, + BACKLIGHT_TEST_BLUE, + BACKLIGHT_TEST_MAX, +}; + +enum { + KEY_PRESS_FN = 0x01 << 0, + KEY_PRESS_J = 0x01 << 1, + KEY_PRESS_Z = 0x01 << 2, + KEY_PRESS_BL_KEY1 = 0x01 << 3, + KEY_PRESS_BL_KEY2 = 0x01 << 4, + KEY_PRESS_FACTORY_RESET = KEY_PRESS_FN | KEY_PRESS_J | KEY_PRESS_Z, + KEY_PRESS_BACKLIGTH_TEST = KEY_PRESS_FN | KEY_PRESS_BL_KEY1 | KEY_PRESS_BL_KEY2, +}; + +enum { + FACTORY_TEST_CMD_BACKLIGHT = 0x01, + FACTORY_TEST_CMD_OS_SWITCH, + FACTORY_TEST_CMD_JUMP_TO_BL, + FACTORY_TEST_CMD_INT_PIN, + FACTORY_TEST_CMD_GET_TRANSPORT, + FACTORY_TEST_CMD_CHARGING_ADC, + FACTORY_TEST_CMD_RADIO_CARRIER, + FACTORY_TEST_CMD_GET_BUILD_TIME, + FACTORY_TEST_CMD_GET_DEVICE_ID, +}; + +static uint32_t factory_reset_timer = 0; +static uint8_t factory_reset_state = 0; +static uint8_t backlight_test_mode = BACKLIGHT_TEST_OFF; + +static uint32_t factory_reset_ind_timer = 0; +static uint8_t factory_reset_ind_state = 0; +static bool report_os_sw_state = false; +static bool keys_released = true; + +void factory_timer_start(void) { + factory_reset_timer = timer_read32(); +} + +static inline void factory_timer_check(void) { + if (timer_elapsed32(factory_reset_timer) > 3000) { + factory_reset_timer = 0; + + if (factory_reset_state == KEY_PRESS_FACTORY_RESET) { + factory_reset_ind_timer = timer_read32(); + factory_reset_ind_state++; + keys_released = false; + + clear_keyboard(); // Avoid key being pressed after NKRO state changed + layer_state_t default_layer_tmp = default_layer_state; + eeconfig_init(); + keymap_config.raw = eeconfig_read_keymap(); + default_layer_set(default_layer_tmp); +#ifdef LED_MATRIX_ENABLE + if (!led_matrix_is_enabled()) led_matrix_enable(); + led_matrix_init(); +#endif +#ifdef RGB_MATRIX_ENABLE + if (!rgb_matrix_is_enabled()) rgb_matrix_enable(); + rgb_matrix_init(); +#endif + } else if (factory_reset_state == KEY_PRESS_BACKLIGTH_TEST) { +#ifdef LED_MATRIX_ENABLE + if (!led_matrix_is_enabled()) led_matrix_enable(); +#endif +#ifdef RGB_MATRIX_ENABLE + if (!rgb_matrix_is_enabled()) rgb_matrix_enable(); +#endif + backlight_test_mode = BACKLIGHT_TEST_WHITE; + } + + factory_reset_state = 0; + } +} + +static inline void factory_reset_ind_timer_check(void) { + if (factory_reset_ind_timer && timer_elapsed32(factory_reset_ind_timer) > 250) { + if (factory_reset_ind_state++ > 6) { + factory_reset_ind_timer = factory_reset_ind_state = 0; + } else { + factory_reset_ind_timer = timer_read32(); + } + } +} + +bool process_record_factory_test(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#if defined(FN_KEY_1) || defined(FN_KEY_2) +# if defined(FN_KEY_1) + case FN_KEY_1: /* fall through */ +# endif +# if defined(FN_KEY_2) + case FN_KEY_2: +# endif +# if defined(FN_KEY_3) + case FN_KEY_3: +# endif + if (record->event.pressed) { + factory_reset_state |= KEY_PRESS_FN; + } else { + factory_reset_state &= ~KEY_PRESS_FN; + factory_reset_timer = 0; + } + break; +#endif + + case KC_J: + if (record->event.pressed) { + factory_reset_state |= KEY_PRESS_J; + if (factory_reset_state == 0x07) factory_timer_start(); + if (factory_reset_state & KEY_PRESS_FN) return false; + } else { + factory_reset_state &= ~KEY_PRESS_J; + factory_reset_timer = 0; + } + break; + + case KC_Z: +#if defined(FN_Z_KEY) + case FN_Z_KEY: +#endif + if (record->event.pressed) { + factory_reset_state |= KEY_PRESS_Z; + if (factory_reset_state == 0x07) factory_timer_start(); + if ((factory_reset_state & KEY_PRESS_FN) && keycode == KC_Z) return false; + } else { + factory_reset_state &= ~KEY_PRESS_Z; + factory_reset_timer = 0; + /* Avoid changing backlight effect on key repleased if FN_Z_KEY is mode*/ + + if (!keys_released && keycode >= QK_BACKLIGHT_ON && keycode <= RGB_MODE_TWINKLE) { + keys_released = true; + return false; + } + } + break; + +#if defined(BL_CYCLE_KEY) || defined(BL_CYCLE_KEY_2) +# if defined(BL_CYCLE_KEY) + case BL_CYCLE_KEY: +# endif +# if defined(FN_BL_CYCLE_KEY) + case FN_BL_CYCLE_KEY: +# endif + if (record->event.pressed) { + if (backlight_test_mode) { + if (++backlight_test_mode >= BACKLIGHT_TEST_MAX) { + backlight_test_mode = BACKLIGHT_TEST_WHITE; + } + } else { + factory_reset_state |= KEY_PRESS_BL_KEY1; + if (factory_reset_state == 0x19) { + factory_timer_start(); + } + } + } else { + factory_reset_state &= ~KEY_PRESS_BL_KEY1; + factory_reset_timer = 0; + } + break; +#endif +#if defined(BL_TRIG_KEY) || defined(BL_TRIG_KEY_2) +# if defined(BL_TRIG_KEY) + case BL_TRIG_KEY: +# endif +# if defined(FN_BL_TRIG_KEY) + case FN_BL_TRIG_KEY: +# endif + if (record->event.pressed) { + if (backlight_test_mode) { + backlight_test_mode = BACKLIGHT_TEST_OFF; + } else { + factory_reset_state |= KEY_PRESS_BL_KEY2; + if (factory_reset_state == 0x19) { + factory_timer_start(); + } + } + } else { + factory_reset_state &= ~KEY_PRESS_BL_KEY2; + factory_reset_timer = 0; + } + break; +#endif + } + + return true; +} + +#ifdef LED_MATRIX_ENABLE +bool factory_test_indicator(void) { + if (factory_reset_ind_state) { + led_matrix_set_value_all(factory_reset_ind_state % 2 ? 0 : 255); + return false; + } + + return true; +} +#endif + +#ifdef RGB_MATRIX_ENABLE +bool factory_test_indicator(void) { + if (factory_reset_ind_state) { + backlight_test_mode = BACKLIGHT_TEST_OFF; + rgb_matrix_set_color_all(factory_reset_ind_state % 2 ? 0 : 255, 0, 0); + return false; + } else if (backlight_test_mode) { + switch (backlight_test_mode) { + case BACKLIGHT_TEST_WHITE: + rgb_matrix_set_color_all(255, 255, 255); + break; + + case BACKLIGHT_TEST_RED: + rgb_matrix_set_color_all(255, 0, 0); + break; + + case BACKLIGHT_TEST_GREEN: + rgb_matrix_set_color_all(0, 255, 0); + break; + + case BACKLIGHT_TEST_BLUE: + rgb_matrix_set_color_all(0, 0, 255); + break; + } + return false; + } + + return true; +} +#endif + +bool factory_reset_indicating(void) { + return factory_reset_ind_timer; +} + +bool factory_test_task(void) { + if (factory_reset_timer) factory_timer_check(); + if (factory_reset_ind_timer) factory_reset_ind_timer_check(); + + return true; +} + +void factory_test_send(uint8_t *payload, uint8_t length) { +#ifdef RAW_ENABLE + uint16_t checksum = 0; + uint8_t data[RAW_EPSIZE] = {0}; + + uint8_t i = 0; + data[i++] = 0xAB; + + memcpy(&data[i], payload, length); + i += length; + + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) + checksum += data[i]; + data[RAW_EPSIZE - 2] = checksum & 0xFF; + data[RAW_EPSIZE - 1] = (checksum >> 8) & 0xFF; + + raw_hid_send(data, RAW_EPSIZE); +#endif +} + +void factory_test_rx(uint8_t *data, uint8_t length) { + if (data[0] == 0xAB) { + uint16_t checksum = 0; + + for (uint8_t i = 1; i < RAW_EPSIZE - 3; i++) { + checksum += data[i]; + } + /* Verify checksum */ + if ((checksum & 0xFF) != data[RAW_EPSIZE - 2] || checksum >> 8 != data[RAW_EPSIZE - 1]) return; + + uint8_t payload[32]; + uint8_t len = 0; + + switch (data[1]) { + case FACTORY_TEST_CMD_BACKLIGHT: + backlight_test_mode = data[2]; + factory_reset_timer = 0; + break; + + case FACTORY_TEST_CMD_OS_SWITCH: + report_os_sw_state = data[2]; + break; + + case FACTORY_TEST_CMD_JUMP_TO_BL: + break; + + case FACTORY_TEST_CMD_GET_BUILD_TIME: { + payload[len++] = FACTORY_TEST_CMD_GET_BUILD_TIME; + payload[len++] = 'v'; + if ((DEVICE_VER & 0xF000) != 0) itoa((DEVICE_VER >> 12), (char *)&payload[len++], 16); + itoa((DEVICE_VER >> 8) & 0xF, (char *)&payload[len++], 16); + payload[len++] = '.'; + itoa((DEVICE_VER >> 4) & 0xF, (char *)&payload[len++], 16); + payload[len++] = '.'; + itoa((DEVICE_VER >> 4) & 0xF, (char *)&payload[len++], 16); + payload[len++] = ' '; + memcpy(&payload[len], QMK_BUILDDATE, sizeof(QMK_BUILDDATE)); + len += sizeof(QMK_BUILDDATE); + factory_test_send(payload, len); + } break; + + case FACTORY_TEST_CMD_GET_DEVICE_ID: + payload[len++] = FACTORY_TEST_CMD_GET_DEVICE_ID; + payload[len++] = 12; + memcpy(&payload[len], (uint32_t *)UID_BASE, 4); + memcpy(&payload[len + 4], (uint32_t *)UID_BASE + 4, 4); + memcpy(&payload[len + 8], (uint32_t *)UID_BASE + 8, 4); + + len += 12; + factory_test_send(payload, len); + break; + } + } +} diff --git a/keyboards/lemokey/common/factory_test.h b/keyboards/lemokey/common/factory_test.h new file mode 100644 index 000000000000..953ee10e3453 --- /dev/null +++ b/keyboards/lemokey/common/factory_test.h @@ -0,0 +1,33 @@ +/* Copyright 2022 @ lokher (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define FACTORY_RESET_CHECK process_record_factory_test +#define FACTORY_RESET_TASK factory_test_task + +void factory_test_init(void); + +#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE) || defined(Lightless_Projects) +bool factory_test_indicator(void); +#endif + +bool factory_reset_indicating(void); +void factory_test_task(void); +void factory_test_rx(uint8_t *data, uint8_t length); + +bool process_record_factory_test(uint16_t keycode, keyrecord_t *record); + diff --git a/keyboards/lemokey/common/lemokey_common.c b/keyboards/lemokey/common/lemokey_common.c new file mode 100644 index 000000000000..370571dd021c --- /dev/null +++ b/keyboards/lemokey/common/lemokey_common.c @@ -0,0 +1,113 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "lemokey_common.h" +#include "raw_hid.h" +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic + +#ifdef FACTORY_TEST_ENABLE +# include "factory_test.h" +# include "lemokey_common.h" +#endif + +bool is_siri_active = false; +uint32_t siri_timer = 0; + +static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD,}; + +// clang-format off +static key_combination_t key_comb_list[] = { + {2, {KC_LWIN, KC_TAB}}, + {2, {KC_LWIN, KC_E}}, + {3, {KC_LSFT, KC_LCMD, KC_4}}, + {2, {KC_LWIN, KC_C}}, +#ifdef LOCK_SCREEN_KEY_ENABLE + {2, {KC_LWIN, KC_L}}, + {3, {KC_LCTL, KC_LCMD, KC_Q}}, +#endif +}; +// clang-format on + +bool process_record_lemokey_common(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_MCTRL: + if (record->event.pressed) { + register_code(KC_MISSION_CONTROL); + } else { + unregister_code(KC_MISSION_CONTROL); + } + return false; // Skip all further processing of this key + case KC_LNPAD: + if (record->event.pressed) { + register_code(KC_LAUNCHPAD); + } else { + unregister_code(KC_LAUNCHPAD); + } + return false; // Skip all further processing of this key + case KC_LOPTN: + case KC_ROPTN: + case KC_LCMMD: + case KC_RCMMD: + if (record->event.pressed) { + register_code(mac_keycode[keycode - KC_LOPTN]); + } else { + unregister_code(mac_keycode[keycode - KC_LOPTN]); + } + return false; // Skip all further processing of this key + case KC_SIRI: + if (record->event.pressed) { + if (!is_siri_active) { + is_siri_active = true; + register_code(KC_LCMD); + register_code(KC_SPACE); + } + siri_timer = timer_read32(); + } else { + // Do something else when release + } + return false; // Skip all further processing of this key + case KC_TASK: + case KC_FILE: + case KC_SNAP: + case KC_CTANA: +#ifdef LOCK_SCREEN_KEY_ENABLE + case KC_WLCK: + case KC_MLCK: +#endif + if (record->event.pressed) { + for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) { + register_code(key_comb_list[keycode - KC_TASK].keycode[i]); + } + } else { + for (uint8_t i = 0; i < key_comb_list[keycode - KC_TASK].len; i++) { + unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]); + } + } + return false; // Skip all further processing of this key + default: + return true; // Process all other keycodes normally + } +} + +void lemokey_common_task(void) { + if (is_siri_active && timer_elapsed32(siri_timer) > 500) { + unregister_code(KC_LCMD); + unregister_code(KC_SPACE); + is_siri_active = false; + siri_timer = 0; + } +} diff --git a/keyboards/lemokey/common/lemokey_common.h b/keyboards/lemokey/common/lemokey_common.h new file mode 100644 index 000000000000..de0ba4284a1d --- /dev/null +++ b/keyboards/lemokey/common/lemokey_common.h @@ -0,0 +1,61 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "stdint.h" + +// clang-format off +enum { + KC_LOPTN = QK_KB_0, + KC_ROPTN, + KC_LCMMD, + KC_RCMMD, + KC_MCTRL, + KC_LNPAD, + KC_SIRI, + KC_TASK_VIEW, + KC_FILE_EXPLORER, + KC_SCREEN_SHOT, + KC_CORTANA, +#ifdef LOCK_SCREEN_KEY_ENABLE + KC_WIN_LOCK_SCREEN, + KC_MAC_LOCK_SCREEN, +#endif + NEW_SAFE_RANGE, +}; + +#define KC_TASK KC_TASK_VIEW +#define KC_FILE KC_FILE_EXPLORER +#define KC_SNAP KC_SCREEN_SHOT +#define KC_CTANA KC_CORTANA + +#ifdef LOCK_SCREEN_KEY_ENABLE +#define KC_WLCK KC_WIN_LOCK_SCREEN +#define KC_MLCK KC_MAC_LOCK_SCREEN +#endif + +typedef struct PACKED { + uint8_t len; + uint8_t keycode[3]; +} key_combination_t; + +bool process_record_lemokey_common(uint16_t keycode, keyrecord_t *record); +void lemokey_common_task(void); + +#ifdef ENCODER_ENABLE +void encoder_cb_init(void); +#endif diff --git a/keyboards/lemokey/common/lemokey_common.mk b/keyboards/lemokey/common/lemokey_common.mk new file mode 100644 index 000000000000..ee9200494ccb --- /dev/null +++ b/keyboards/lemokey/common/lemokey_common.mk @@ -0,0 +1,11 @@ +OPT_DEFS += -DFACTORY_TEST_ENABLE + +LEMOKEY_COMMON_DIR = common +SRC += \ + $(LEMOKEY_COMMON_DIR)/lemokey_task.c \ + $(LEMOKEY_COMMON_DIR)/lemokey_common.c \ + $(LEMOKEY_COMMON_DIR)/lemokey_raw_hid.c \ + $(LEMOKEY_COMMON_DIR)/factory_test.c + +VPATH += $(TOP_DIR)/keyboards/lemokey/$(LEMOKEY_COMMON_DIR) + diff --git a/keyboards/lemokey/common/lemokey_raw_hid.c b/keyboards/lemokey/common/lemokey_raw_hid.c new file mode 100644 index 000000000000..62492df5fbdf --- /dev/null +++ b/keyboards/lemokey/common/lemokey_raw_hid.c @@ -0,0 +1,91 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "lemokey_common.h" +#include "raw_hid.h" +#include "version.h" +#ifdef FACTORY_TEST_ENABLE +# include "factory_test.h" +#endif + +#define PROTOCOL_VERSION 0x02 + +enum { + KC_GET_PROTOCOL_VERSION = 0xA0, + KC_GET_FIRMWARE_VERSION = 0xA1, + KC_GET_SUPPORT_FEATURE = 0xA2, + KC_GET_DEFAULT_LAYER = 0xA3, +}; + +enum { + FEATURE_DEFAULT_LAYER = 0x01 << 0, +}; + +void get_support_feature(uint8_t *data) { + data[1] = FEATURE_DEFAULT_LAYER; +} + +bool lemokey_raw_hid_rx(uint8_t *data, uint8_t length) { + switch (data[0]) { + case KC_GET_PROTOCOL_VERSION: + data[1] = PROTOCOL_VERSION; + break; + + case KC_GET_FIRMWARE_VERSION: { + uint8_t i = 1; + data[i++] = 'v'; + if ((DEVICE_VER & 0xF000) != 0) itoa((DEVICE_VER >> 12), (char *)&data[i++], 16); + itoa((DEVICE_VER >> 8) & 0xF, (char *)&data[i++], 16); + data[i++] = '.'; + itoa((DEVICE_VER >> 4) & 0xF, (char *)&data[i++], 16); + data[i++] = '.'; + itoa(DEVICE_VER & 0xF, (char *)&data[i++], 16); + data[i++] = ' '; + memcpy(&data[i], QMK_BUILDDATE, sizeof(QMK_BUILDDATE)); + i += sizeof(QMK_BUILDDATE); + } break; + + case KC_GET_SUPPORT_FEATURE: + get_support_feature(&data[1]); + break; + + case KC_GET_DEFAULT_LAYER: + data[1] = get_highest_layer(default_layer_state); + break; + +#ifdef FACTORY_TEST_ENABLE + case 0xAB: + factory_test_rx(data, length); + return true; +#endif + default: + return false; + } + + raw_hid_send(data, length); + return true; +} + +#if defined(VIA_ENABLE) +bool via_command_kb(uint8_t *data, uint8_t length) { + return lemokey_raw_hid_rx(data, length); +} +#else +void raw_hid_receive(uint8_t *data, uint8_t length) { + lemokey_raw_hid_rx(data, length); +} +#endif diff --git a/keyboards/lemokey/common/lemokey_task.c b/keyboards/lemokey/common/lemokey_task.c new file mode 100644 index 000000000000..4793bba8b9f8 --- /dev/null +++ b/keyboards/lemokey/common/lemokey_task.c @@ -0,0 +1,119 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include "lemokey_task.h" +#include "quantum.h" +#include "lemokey_common.h" +#ifdef FACTORY_TEST_ENABLE +#include "factory_test.h" +#endif + +__attribute__((weak)) bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record) { return true; } + +bool process_record_lemokey(uint16_t keycode, keyrecord_t *record) { + +#ifdef FACTORY_TEST_ENABLE + if (!process_record_factory_test(keycode, record)) + return false; +#endif + + if (!process_record_lemokey_kb(keycode, record)) + return false; + + return true; +} + +#if defined(LED_MATRIX_ENABLE) +bool led_matrix_indicators_lemokey(void) { +#ifdef FACTORY_TEST_ENABLE + factory_test_indicator(); +#endif + return true; +} +#endif + +#if defined(RGB_MATRIX_ENABLE) +bool rgb_matrix_indicators_lemokey(void) { +# if defined(CAPS_LOCK_INDEX) + if (host_keyboard_led_state().caps_lock) { +# if defined(DIM_CAPS_LOCK) + rgb_matrix_set_color(CAPS_LOCK_INDEX, 0, 0, 0); +# else + rgb_matrix_set_color(CAPS_LOCK_INDEX, 255, 255, 255);, +# endif + } +# endif +# if defined(NUM_LOCK_INDEX) + if (host_keyboard_led_state().num_lock) { + rgb_matrix_set_color(NUM_LOCK_INDEX, 255, 255, 255); + } +# endif + +#ifdef FACTORY_TEST_ENABLE + factory_test_indicator(); +#endif + return true; +} +#endif + +__attribute__((weak)) bool lemokey_task_kb(void){ return true; } + +void lemokey_task(void) { +#ifdef FACTORY_TEST_ENABLE + factory_test_task(); +#endif + lemokey_common_task(); + + lemokey_task_kb(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (!process_record_user(keycode, record)) + return false; + + if (!process_record_lemokey(keycode, record)) + return false; + + return true; +} + +#ifdef RGB_MATRIX_ENABLE +bool rgb_matrix_indicators_kb(void) { + if (!rgb_matrix_indicators_user()) + return false; + + rgb_matrix_indicators_lemokey(); + + return true; +} +#endif + +#ifdef LED_MATRIX_ENABLE +bool led_matrix_indicators_kb(void) { + if (!led_matrix_indicators_user()) + return false; + + led_matrix_indicators_lemokey(); + + return true; +} +#endif + +void housekeeping_task_kb(void) { + lemokey_task(); +} + diff --git a/keyboards/lemokey/common/lemokey_task.h b/keyboards/lemokey/common/lemokey_task.h new file mode 100644 index 000000000000..06e49843dc6f --- /dev/null +++ b/keyboards/lemokey/common/lemokey_task.h @@ -0,0 +1,24 @@ +/* Copyright 2024 @ Keychron (https://www.lemokey.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "stdint.h" +#include "action.h" + +bool lemokey_task_kb(void); +void lemokey_task(void); + diff --git a/keyboards/lemokey/common/matrix.c b/keyboards/lemokey/common/matrix.c new file mode 100644 index 000000000000..f58b0c8665a2 --- /dev/null +++ b/keyboards/lemokey/common/matrix.c @@ -0,0 +1,218 @@ +/* Copyright 2023 ~ 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" + +#ifndef HC595_STCP +# define HC595_STCP B0 +#endif +#ifndef HC595_SHCP +# define HC595_SHCP A1 +#endif +#ifndef HC595_DS +# define HC595_DS A7 +#endif + +#ifndef HC595_START_INDEX +# define HC595_START_INDEX 0 +#endif +#ifndef HC595_END_INDEX +# define HC595_END_INDEX 15 +#endif +#ifndef HC595_OFFSET_INDEX +# define HC595_OFFSET_INDEX 0 +#endif + +#if defined(HC595_START_INDEX) && defined(HC595_END_INDEX) +# if ((HC595_END_INDEX - HC595_START_INDEX + 1) > 16) +# define SIZE_T uint32_t +# define UNSELECT_ALL_COL 0xFFFFFFFF +# define SELECT_ALL_COL 0x00000000 +# elif ((HC595_END_INDEX - HC595_START_INDEX + 1) > 8) +# define SIZE_T uint16_t +# define UNSELECT_ALL_COL 0xFFFF +# define SELECT_ALL_COL 0x0000 +# else +# define SIZE_T uint8_t +# define UNSELECT_ALL_COL 0xFF +# define SELECT_ALL_COL 0x00 +# endif +#endif + +pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +static inline uint8_t readMatrixPin(pin_t pin) { + if (pin != NO_PIN) { + return readPin(pin); + } else { + return 1; + } +} + +static inline void setPinOutput_writeLow(pin_t pin) { + setPinOutput(pin); + writePinLow(pin); +} + +static inline void setPinOutput_writeHigh(pin_t pin) { + setPinOutput(pin); + writePinHigh(pin); +} + +static inline void HC595_delay(uint16_t n) { + while (n-- > 0) { + asm volatile("nop" ::: "memory"); + } +} + +static void HC595_output(SIZE_T data, bool bit_flag) { + uint8_t n = 1; + + ATOMIC_BLOCK_FORCEON { + for (uint8_t i = 0; i < (HC595_END_INDEX - HC595_START_INDEX + 1); i++) { + if (data & 0x1) { + writePinHigh(HC595_DS); + } else { + writePinLow(HC595_DS); + } + writePinHigh(HC595_SHCP); + HC595_delay(n); + writePinLow(HC595_SHCP); + HC595_delay(n); + if (bit_flag) { + break; + } else { + data = data >> 1; + } + } + writePinHigh(HC595_STCP); + HC595_delay(n); + writePinLow(HC595_STCP); + HC595_delay(n); + } +} + +static void select_col(uint8_t col) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { + setPinOutput_writeLow(col_pins[col]); + } else { + if (col == HC595_START_INDEX) { + HC595_output(0x00, true); + if (col < HC595_OFFSET_INDEX) { + HC595_output(0x01, true); + } + } + } +} + +static void unselect_col(uint8_t col) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { +#ifdef MATRIX_UNSELECT_DRIVE_HIGH + setPinOutput_writeHigh(col_pins[col]); +#else + setPinInputHigh(col_pins[col]); +#endif + } else { + HC595_output(0x01, true); + } +} + +static void unselect_cols(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { +#ifdef MATRIX_UNSELECT_DRIVE_HIGH + setPinOutput_writeHigh(col_pins[col]); +#else + setPinInputHigh(col_pins[col]); +#endif + } else { + if (col == HC595_START_INDEX) { + HC595_output(UNSELECT_ALL_COL, false); + } + break; + } + } +} + +void select_all_cols(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + if (col < HC595_START_INDEX || col > HC595_END_INDEX) { + setPinOutput_writeLow(col_pins[col]); + } else { + if (col == HC595_START_INDEX) { + HC595_output(SELECT_ALL_COL, false); + } + break; + } + } +} + +static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) { + // Select col + select_col(current_col); // select col + HC595_delay(200); + + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // Check row pin state + if (readMatrixPin(row_pins[row_index]) == 0) { + // Pin LO, set col bit + current_matrix[row_index] |= row_shifter; + } else { + // Pin HI, clear col bit + current_matrix[row_index] &= ~row_shifter; + } + } + + // Unselect col + unselect_col(current_col); + HC595_delay(200); // wait for all Row signals to go HIGH +} + +void matrix_init_custom(void) { + setPinOutput(HC595_DS); + setPinOutput(HC595_STCP); + setPinOutput(HC595_SHCP); + + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + if (row_pins[x] != NO_PIN) { + setPinInputHigh(row_pins[x]); + } + } + + unselect_cols(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; + + // Set col, read rows + matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) { + matrix_read_rows_on_col(curr_matrix, current_col, row_shifter); + } + + bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0; + if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix)); + + return changed; +} + +void suspend_wakeup_init_kb(void) { + // code will run on keyboard wakeup + clear_keyboard(); +} diff --git a/keyboards/lemokey/p1/ansi_encoder/ansi_encoder.c b/keyboards/lemokey/p1/ansi_encoder/ansi_encoder.c new file mode 100644 index 000000000000..9e89e38ff5e3 --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/ansi_encoder.c @@ -0,0 +1,148 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see < http://www.gnu.org/licenses/>. + */ + +#include "quantum.h" + +// clang-format off + +#ifdef RGB_MATRIX_ENABLE +const snled27351_led_t PROGMEM g_snled27351_leds[RGB_MATRIX_LED_COUNT] = { +/* Refer to SNLED27351 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, A_15, C_15, B_15}, + {0, A_14, C_14, B_14}, + {0, A_13, C_13, B_13}, + {0, A_12, C_12, B_12}, + {0, A_11, C_11, B_11}, + {0, A_10, C_10, B_10}, + {0, A_9, C_9, B_9}, + {0, A_8, C_8, B_8}, + {0, A_7, C_7, B_7}, + {0, A_6, C_6, B_6}, + {0, A_5, C_5, B_5}, + {0, A_4, C_4, B_4}, + {0, A_3, C_3, B_3}, + {0, A_2, C_2, B_2}, + + {0, G_15, I_15, H_15}, + {0, G_14, I_14, H_14}, + {0, G_13, I_13, H_13}, + {0, G_12, I_12, H_12}, + {0, G_11, I_11, H_11}, + {0, G_10, I_10, H_10}, + {0, G_9, I_9, H_9}, + {0, G_8, I_8, H_8}, + {0, G_7, I_7, H_7}, + {0, G_6, I_6, H_6}, + {0, G_5, I_5, H_5}, + {0, G_4, I_4, H_4}, + {0, G_3, I_3, H_3}, + {0, G_2, I_2, H_2}, + {0, G_1, I_1, H_1}, + + {0, D_15, F_15, E_15}, + {0, D_14, F_14, E_14}, + {0, D_13, F_13, E_13}, + {0, D_12, F_12, E_12}, + {0, D_11, F_11, E_11}, + {0, D_10, F_10, E_10}, + {0, D_9, F_9, E_9}, + {0, D_8, F_8, E_8}, + {0, D_7, F_7, E_7}, + {0, D_6, F_6, E_6}, + {0, D_5, F_5, E_5}, + {0, D_4, F_4, E_4}, + {0, D_3, F_3, E_3}, + {0, D_2, F_2, E_2}, + {0, D_1, F_1, E_1}, + + {1, A_15, C_15, B_15}, + {1, A_14, C_14, B_14}, + {1, A_13, C_13, B_13}, + {1, A_12, C_12, B_12}, + {1, A_11, C_11, B_11}, + {1, A_10, C_10, B_10}, + {1, A_9, C_9, B_9}, + {1, A_8, C_8, B_8}, + {1, A_7, C_7, B_7}, + {1, A_6, C_6, B_6}, + {1, A_5, C_5, B_5}, + {1, A_4, C_4, B_4}, + {1, A_2, C_2, B_2}, + {1, A_1, C_1, B_1}, + + {1, G_15, I_15, H_15}, + {1, G_13, I_13, H_13}, + {1, G_12, I_12, H_12}, + {1, G_11, I_11, H_11}, + {1, G_10, I_10, H_10}, + {1, G_9, I_9, H_9}, + {1, G_8, I_8, H_8}, + {1, G_7, I_7, H_7}, + {1, G_6, I_6, H_6}, + {1, G_5, I_5, H_5}, + {1, G_4, I_4, H_4}, + {1, G_3, I_3, H_3}, + {1, G_2, I_2, H_2}, + + {1, D_15, F_15, E_15}, + {1, D_14, F_14, E_14}, + {1, D_13, F_13, E_13}, + {1, D_9, F_9, E_9}, + {1, D_6, F_6, E_6}, + {1, D_5, F_5, E_5}, + {1, D_4, F_4, E_4}, + {1, D_3, F_3, E_3}, + {1, D_2, F_2, E_2}, + {1, D_1, F_1, E_1}, +}; + +#define __ NO_LED + +led_config_t g_led_config = { + { + // Key Matrix to LED Index + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, __ }, + { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 }, + { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 }, + { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, __, 56, 57 }, + { 58, __, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, __}, + { 71, 72, 73, __, __, __, 74, __, __, 75, 76, 77, 78, 79, 80 }, + }, + { + // LED Index to Physical Position + {0, 0}, {18, 0}, {33, 0}, {48, 0}, {62, 0}, {81, 0}, {95, 0}, {110, 0}, {125, 0}, {143, 0}, {158, 0}, {178, 0}, {187, 0}, {203, 0}, + {0,15}, {15,15}, {29,15}, {44,15}, {59,15}, {73,15}, {88,15}, {103,15}, {117,15}, {132,15}, {146,15}, {161,15}, {176,15}, {195,15}, {224,15}, + {4,26}, {22,26}, {37,26}, {51,26}, {66,26}, {81,26}, {95,26}, {110,26}, {125,26}, {139,26}, {154,26}, {173,26}, {187,26}, {201,26}, {224,26}, + {6,38}, {26,38}, {40,38}, {55,38}, {70,38}, {84,38}, {99,38}, {114,38}, {128,38}, {143,38}, {158,38}, {172,38}, {195,38}, {224,38}, + {8,49}, {33,49}, {48,49}, {62,49}, {77,49}, {92,49}, {106,49}, {121,49}, {136,49}, {150,49}, {165,49}, {186,49}, {203,52}, + {2,61}, {20,61}, {38,61}, {94,61}, {147,61}, {161,61}, {178,61}, {192,64}, {203,64}, {224,64}, + }, + { + // RGB LED Index to Flag + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + } +}; +#endif diff --git a/keyboards/lemokey/p1/ansi_encoder/config.h b/keyboards/lemokey/p1/ansi_encoder/config.h new file mode 100644 index 000000000000..f9492a72d9dd --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/config.h @@ -0,0 +1,48 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef RGB_MATRIX_ENABLE +/* RGB Matrix driver configuration */ +# define DRIVER_COUNT 2 +# define RGB_MATRIX_LED_COUNT 81 + +# define SPI_SCK_PIN A5 +# define SPI_MISO_PIN A6 +# define SPI_MOSI_PIN A7 + +# define DRIVER_CS_PINS \ + { B15, C6 } +# define SNLED27351_SPI_DIVISOR 16 +# define SPI_DRIVER SPIDQ + +/* Scan phase of led driver set as MSKPHASE_9CHANNEL(defined as 0x03 in SNLED27351.h) */ +# define PHASE_CHANNEL MSKPHASE_9CHANNEL + +/* Set LED driver current */ +# define SNLED27351_CURRENT_TUNE \ + { 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C, 0x2C } + +/* Caps lock indicating led */ +# define CAPS_LOCK_INDEX 44 +# define DIM_CAPS_LOCK + +/* win lock indicating led */ +# define WIN_LOCK_LED_PIN C0 +# define WIN_LOCK_INDEX 72 +# define DIM_WIN_LOCK +#endif diff --git a/keyboards/keychron/q1/iso/info.json b/keyboards/lemokey/p1/ansi_encoder/info.json similarity index 63% rename from keyboards/keychron/q1/iso/info.json rename to keyboards/lemokey/p1/ansi_encoder/info.json index 424ed021e102..ec5e3df8f29f 100644 --- a/keyboards/keychron/q1/iso/info.json +++ b/keyboards/lemokey/p1/ansi_encoder/info.json @@ -1,41 +1,25 @@ { - "keyboard_name": "Q1", - "manufacturer": "Keychron", - "url": "https://github.com/Keychron", - "maintainer": "lalalademaxiya1", "usb": { - "vid": "0x3434", - "pid": "0x0102", - "device_version": "1.0.0", - "force_nkro": true + "pid": "0x0310", + "device_version": "1.0.0" }, - "rgb_matrix": { - "driver": "is31fl3733" - }, - "matrix_pins": { - "cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"], - "rows": ["D3", "D2", "B3", "B2", "B1", "B0"] - }, - "diode_direction": "ROW2COL", - "processor": "atmega32u4", - "bootloader": "atmel-dfu", "layouts": { - "LAYOUT_iso_83": { + "LAYOUT_ansi_82": { "layout": [ {"matrix": [0, 0], "x": 0, "y": 0}, - {"matrix": [0, 2], "x": 1.25, "y": 0}, - {"matrix": [0, 3], "x": 2.25, "y": 0}, - {"matrix": [0, 4], "x": 3.25, "y": 0}, - {"matrix": [0, 5], "x": 4.25, "y": 0}, - {"matrix": [0, 6], "x": 5.5, "y": 0}, - {"matrix": [0, 7], "x": 6.5, "y": 0}, - {"matrix": [0, 8], "x": 7.5, "y": 0}, - {"matrix": [0, 9], "x": 8.5, "y": 0}, - {"matrix": [0, 10], "x": 9.75, "y": 0}, - {"matrix": [0, 11], "x": 10.75, "y": 0}, - {"matrix": [0, 12], "x": 11.75, "y": 0}, - {"matrix": [0, 13], "x": 12.75, "y": 0}, - {"matrix": [4, 14], "x": 14, "y": 0}, + {"matrix": [0, 1], "x": 1.25, "y": 0}, + {"matrix": [0, 2], "x": 2.25, "y": 0}, + {"matrix": [0, 3], "x": 3.25, "y": 0}, + {"matrix": [0, 4], "x": 4.25, "y": 0}, + {"matrix": [0, 5], "x": 5.5, "y": 0}, + {"matrix": [0, 6], "x": 6.5, "y": 0}, + {"matrix": [0, 7], "x": 7.5, "y": 0}, + {"matrix": [0, 8], "x": 8.5, "y": 0}, + {"matrix": [0, 9], "x": 9.75, "y": 0}, + {"matrix": [0, 10], "x": 10.75, "y": 0}, + {"matrix": [0, 11], "x": 11.75, "y": 0}, + {"matrix": [0, 12], "x": 12.75, "y": 0}, + {"matrix": [0, 13], "x": 14, "y": 0}, {"matrix": [0, 14], "x": 15.25, "y": 0}, {"matrix": [1, 0], "x": 0, "y": 1.25}, @@ -67,6 +51,7 @@ {"matrix": [2, 10], "x": 10.5, "y": 2.25}, {"matrix": [2, 11], "x": 11.5, "y": 2.25}, {"matrix": [2, 12], "x": 12.5, "y": 2.25}, + {"matrix": [2, 13], "x": 13.5, "y": 2.25, "w": 1.5}, {"matrix": [2, 14], "x": 15.25, "y": 2.25}, {"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75}, @@ -81,12 +66,10 @@ {"matrix": [3, 9], "x": 9.75, "y": 3.25}, {"matrix": [3, 10], "x": 10.75, "y": 3.25}, {"matrix": [3, 11], "x": 11.75, "y": 3.25}, - {"matrix": [3, 13], "x": 12.75, "y": 3.25}, - {"matrix": [2, 13], "x": 13.75, "y": 2.25, "w": 1.25, "h": 2}, + {"matrix": [3, 13], "x": 12.75, "y": 3.25, "w": 2.25}, {"matrix": [3, 14], "x": 15.25, "y": 3.25}, - {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 1.25}, - {"matrix": [4, 1], "x": 1.25, "y": 4.25}, + {"matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25}, {"matrix": [4, 2], "x": 2.25, "y": 4.25}, {"matrix": [4, 3], "x": 3.25, "y": 4.25}, {"matrix": [4, 4], "x": 4.25, "y": 4.25}, @@ -97,18 +80,18 @@ {"matrix": [4, 9], "x": 9.25, "y": 4.25}, {"matrix": [4, 10], "x": 10.25, "y": 4.25}, {"matrix": [4, 11], "x": 11.25, "y": 4.25}, - {"matrix": [4, 13], "x": 12.25, "y": 4.25, "w": 1.75}, - {"matrix": [3, 12], "x": 14.25, "y": 4.5}, + {"matrix": [4, 12], "x": 12.25, "y": 4.25, "w": 1.75}, + {"matrix": [4, 13], "x": 14.25, "y": 4.5}, {"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25}, {"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25}, {"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25}, {"matrix": [5, 6], "x": 3.75, "y": 5.25, "w": 6.25}, - {"matrix": [5, 10], "x": 10, "y": 5.25}, - {"matrix": [5, 11], "x": 11, "y": 5.25}, - {"matrix": [5, 12], "x": 12, "y": 5.25}, - {"matrix": [5, 13], "x": 13.25, "y": 5.5}, - {"matrix": [4, 12], "x": 14.25, "y": 5.5}, + {"matrix": [5, 9], "x": 10, "y": 5.25}, + {"matrix": [5, 10], "x": 11, "y": 5.25}, + {"matrix": [5, 11], "x": 12, "y": 5.25}, + {"matrix": [5, 12], "x": 13.25, "y": 5.5}, + {"matrix": [5, 13], "x": 14.25, "y": 5.5}, {"matrix": [5, 14], "x": 15.25, "y": 5.5} ] } diff --git a/keyboards/lemokey/p1/ansi_encoder/keymaps/default/keymap.c b/keyboards/lemokey/p1/ansi_encoder/keymaps/default/keymap.c new file mode 100644 index 000000000000..5c4cb9322837 --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/keymaps/default/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 3 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "lemokey_common.h" + +// clang-format off +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + WIN_FN +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_LCMMD,MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_ansi_82( + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, RGB_TOG, + KC_TRNS, BT_HST1, BT_HST2, BT_HST3, P2P4G, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BAT_LVL, NK_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [WIN_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_82( + KC_TRNS, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, RGB_TOG, + KC_TRNS, BT_HST1, BT_HST2, BT_HST3, P2P4G, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BAT_LVL, NK_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) + +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [MAC_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)} +}; +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if(!process_record_lemokey_common(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/lemokey/p1/ansi_encoder/keymaps/via/keymap.c b/keyboards/lemokey/p1/ansi_encoder/keymaps/via/keymap.c new file mode 100644 index 000000000000..fe7b76588ee2 --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/keymaps/via/keymap.c @@ -0,0 +1,77 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H +#include "lemokey_common.h" + +// clang-format off +enum layers { + WIN_BASE, + WIN_FN, + WIN_L2, + WIN_L3, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_ansi_82( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MUTE, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_82( + _______, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, GU_TOGG, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L2] = LAYOUT_ansi_82( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [WIN_L3] = LAYOUT_ansi_82( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) + +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_FN] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)}, + [WIN_L2] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, + [WIN_L3] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)} +}; +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if(!process_record_lemokey_common(keycode, record)) { + return false; + } + return true; +} diff --git a/keyboards/lemokey/p1/ansi_encoder/keymaps/via/rules.mk b/keyboards/lemokey/p1/ansi_encoder/keymaps/via/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/lemokey/p1/ansi_encoder/rules.mk b/keyboards/lemokey/p1/ansi_encoder/rules.mk new file mode 100644 index 000000000000..6e7633bfe015 --- /dev/null +++ b/keyboards/lemokey/p1/ansi_encoder/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank diff --git a/keyboards/lemokey/p1/config.h b/keyboards/lemokey/p1/config.h new file mode 100644 index 000000000000..9c8fb27c926e --- /dev/null +++ b/keyboards/lemokey/p1/config.h @@ -0,0 +1,54 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define UID_BASE 0x1FFFF204U + +/* I2C Driver Configuration */ +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +/* EEPROM Driver Configuration */ +#define EXTERNAL_EEPROM_BYTE_COUNT 2048 +#define EXTERNAL_EEPROM_PAGE_SIZE 32 +#define EXTERNAL_EEPROM_WRITE_TIME 3 + +/* User used eeprom */ +//#define EECONFIG_USER_DATA_SIZE 1 + +#define I2C1_OPMODE OPMODE_I2C +#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100010 + +/* Encoder Configuration */ +#define ENCODER_DEFAULT_POS 0x3 +#define ENCODER_MAP_KEY_DELAY 2 + +# define LED_DRIVER_SHUTDOWN_PIN B14 + +/* Raw hid command for factory test */ +# define RAW_HID_CMD 0xAB + +/* Factory test keys */ +#define FN_KEY_1 MO(1) +#define FN_KEY_2 MO(3) +#define FN_BL_TRIG_KEY KC_END + +#define MATRIX_IO_DELAY 10 + + diff --git a/keyboards/lemokey/p1/halconf.h b/keyboards/lemokey/p1/halconf.h new file mode 100644 index 000000000000..b26e07d7bc8a --- /dev/null +++ b/keyboards/lemokey/p1/halconf.h @@ -0,0 +1,24 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define _CHIBIOS_HAL_CONF_VER_8_0_ + +#define HAL_USE_I2C TRUE +#define HAL_USE_SPI TRUE + +#include_next diff --git a/keyboards/lemokey/p1/info.json b/keyboards/lemokey/p1/info.json new file mode 100644 index 000000000000..7dbf58f8fe05 --- /dev/null +++ b/keyboards/lemokey/p1/info.json @@ -0,0 +1,67 @@ +{ + "keyboard_name": "Lemokey P1", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "Keychron", + "processor": "WB32F3G71", + "bootloader": "wb32-dfu", + "usb": { + "vid": "0x362D" + }, + "features": { + "bootmagic": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true, + "raw" : true, + "send_string" : true + }, + "matrix_pins": { + "cols": ["C14", "C15", "C2", "C3", "A0", "A1", "A2", "A3", "B10", "B12", "B13", "C7", "C8", "C9", "A10"], + "rows": ["C12", "D2", "B3", "B4", "B5", "B6"] + }, + "diode_direction": "ROW2COL", + "eeprom": { + "driver": "i2c" + }, + "encoder": { + "rotary": [ + {"pin_a": "A8", "pin_b": "A9"} + ] + }, + "indicators": { + "caps_lock": "C1" + }, + "rgb_matrix": { + "driver": "snled27351_spi", + "sleep": true, + "animations": { + "band_spiral_val": true, + "breathing": true, + "cycle_all": true, + "cycle_left_right": true, + "cycle_out_in": true, + "cycle_out_in_dual": true, + "cycle_pinwheel": true, + "cycle_spiral": true, + "cycle_up_down": true, + "digital_rain": true, + "dual_beacon": true, + "jellybean_raindrops": true, + "pixel_rain": true, + "rainbow_beacon": true, + "rainbow_moving_chevron": true, + "solid_reactive_multinexus": true, + "solid_reactive_multiwide": true, + "solid_reactive_simple": true, + "solid_splash": true, + "splash": true, + "typing_heatmap": true + } + }, + "build": { + "debounce_type": "sym_eager_pk" + }, + "debounce": 20 +} diff --git a/keyboards/lemokey/p1/mcuconf.h b/keyboards/lemokey/p1/mcuconf.h new file mode 100644 index 000000000000..48e4fa4e67f4 --- /dev/null +++ b/keyboards/lemokey/p1/mcuconf.h @@ -0,0 +1,26 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see < http://www.gnu.org/licenses/>. + */ + +#pragma once +#include_next + +#undef WB32_I2C_USE_I2C1 +#define WB32_I2C_USE_I2C1 TRUE + +#undef WB32_SPI_USE_QSPI +#define WB32_SPI_USE_QSPI TRUE + + diff --git a/keyboards/lemokey/p1/p1.c b/keyboards/lemokey/p1/p1.c new file mode 100644 index 000000000000..2634b2459c66 --- /dev/null +++ b/keyboards/lemokey/p1/p1.c @@ -0,0 +1,34 @@ +/* Copyright 2024 @ Keychron (https://www.keychron.com) + * + * 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 + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "quantum.h" +#include "eeprom.h" + +void eeconfig_init_kb(void) { +#if (EECONFIG_KB_DATA_SIZE) == 0 + // Reset Keyboard EEPROM value to blank, rather than to a set value + eeconfig_update_kb(0); +#endif + + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 0; + eeconfig_update_keymap(keymap_config.raw); + + eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 1U << 0); + default_layer_set(1U << 0); + + eeconfig_init_user(); +} diff --git a/keyboards/lemokey/p1/readme.md b/keyboards/lemokey/p1/readme.md new file mode 100644 index 000000000000..b666fcdf2ec9 --- /dev/null +++ b/keyboards/lemokey/p1/readme.md @@ -0,0 +1,21 @@ +# Lemokey P1 + +![Lemokey P1] + +A customizable 75% keyboard. + +* Keyboard Maintainer: [Keychron](https://github.com/keychron) +* Hardware Supported: Lemokey P1 +* Hardware Availability: [Lemokey P1 QMK/VIA Wireless Custom Mechanical Keyboard] + +Make example for this keyboard (after setting up your build environment): + + make keychron/p1/ansi_encoder:default + +Flashing example for this keyboard: + + make keychron/p1/ansi_encoder:default:flash + +**Reset Key**: Disconnect the USB cable, toggle mode switch to "Cable", hold down the *Esc* key or reset button underneath space bar, then connect the USB cable. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/lemokey/p1/rules.mk b/keyboards/lemokey/p1/rules.mk new file mode 100644 index 000000000000..95cd29f122aa --- /dev/null +++ b/keyboards/lemokey/p1/rules.mk @@ -0,0 +1,3 @@ +include keyboards/lemokey/common/lemokey_common.mk + +VPATH += $(TOP_DIR)/keyboards/lemokey diff --git a/keyboards/lemokey/p1/via_json/p1_ansi_encoder_v1.0.json b/keyboards/lemokey/p1/via_json/p1_ansi_encoder_v1.0.json new file mode 100644 index 000000000000..3274b2fdae72 --- /dev/null +++ b/keyboards/lemokey/p1/via_json/p1_ansi_encoder_v1.0.json @@ -0,0 +1,280 @@ +{ + "name": "Lemokey P1 ANSI Knob", + "vendorId": "0x362D", + "productId": "0x0310", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["None", 0], + ["Solid Color", 1], + ["Breathing", 2], + ["Band Spiral Val", 3], + ["Cycle All", 4], + ["Cycle Left Right", 5], + ["Cycle Up Down", 6], + ["Rainbow Moving Chevron", 7], + ["Cycle Out In", 8], + ["Cycle Out In Dual", 9], + ["Cycle Pinwheel", 10], + ["Cycle Spiral", 11], + ["Dual Beacon", 12], + ["Rainbow Beacon", 13], + ["Jellybean Raindrops", 14], + ["Pixel Rain", 15], + ["Typing Heatmap", 16], + ["Digital Rain", 17], + ["Reactive Simple", 18], + ["Reactive Multiwide", 19], + ["Reactive Multinexus", 20], + ["Splash", 21], + ["Solid Splash", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0 && ( {id_qmk_rgb_matrix_effect} < 4 || {id_qmk_rgb_matrix_effect} == 18 || ({id_qmk_rgb_matrix_effect} > 17 && {id_qmk_rgb_matrix_effect} != 21) ) ", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "customKeycodes": [ + {"name": "Left Option", "title": "Left Option", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command", "shortName": "RCmd"}, + {"name": "Misson Control", "title": "Misson Control in Mac", "shortName": "MCtl"}, + {"name": "Lanuch Pad", "title": "Lanuch Pad in Windows", "shortName": "LPad"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Task View", "title": "Task View in Windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in Windows", "shortName": "File"}, + {"name": "Screen shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in Windows", "shortName": "Cortana"} + ], + "matrix": {"rows": 6, "cols" : 15}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0, 0", + { + "x": 0.25, + "c": "#cccccc" + }, + "0, 1", + "0, 2", + "0, 3", + "0, 4", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0, 5", + "0, 6", + "0, 7", + "0, 8", + { + "x": 0.25, + "c": "#cccccc" + }, + "0, 9", + "0, 10", + "0, 11", + "0, 12", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "0, 13", + { + "x": 0.25 + }, + "0, 14\n\n\n\n\n\n\n\n\ne0" + ], + [ + { + "y": 0.25, + "c": "#aaaaaa" + }, + "1, 0", + { + "c": "#cccccc" + }, + "1, 1", + "1, 2", + "1, 3", + "1, 4", + "1, 5", + "1, 6", + "1, 7", + "1, 8", + "1, 9", + "1, 10", + "1, 11", + "1, 12", + { + "w": 2, + "c": "#aaaaaa" + }, + "1, 13", + { + "x": 0.25 + }, + "1, 14" + ], + [ + { + "w": 1.5, + "c": "#aaaaaa" + }, + "2, 0", + { + "c": "#cccccc" + }, + "2, 1", + "2, 2", + "2, 3", + "2, 4", + "2, 5", + "2, 6", + "2, 7", + "2, 8", + "2, 9", + "2, 10", + "2, 11", + "2, 12", + { + "w": 1.5, + "c": "#aaaaaa" + }, + "2, 13", + { + "x": 0.25 + }, + "2, 14" + ], + [ + { + "w": 1.75, + "c": "#aaaaaa" + }, + "3, 0", + { + "c": "#cccccc" + }, + "3, 1", + "3, 2", + "3, 3", + "3, 4", + "3, 5", + "3, 6", + "3, 7", + "3, 8", + "3, 9", + "3, 10", + "3, 11", + { + "w": 2.25, + "c": "#aaaaaa" + }, + "3, 13", + { + "x": 0.25 + }, + "3, 14" + ], + [ + { + "w": 2.25, + "c": "#aaaaaa" + }, + "4, 0", + { + "c": "#cccccc" + }, + "4, 2", + "4, 3", + "4, 4", + "4, 5", + "4, 6", + "4, 7", + "4, 8", + "4, 9", + "4, 10", + "4, 11", + { + "w": 1.75, + "c": "#aaaaaa" + }, + "4, 12", + { + "x": 0.25, + "y": 0.25 + }, + "4, 13" + ], + [ + { + "y": -0.25, + "w": 1.25, + "c": "#aaaaaa" + }, + "5, 0", + { + "w": 1.25 + }, + "5, 1", + { + "w": 1.25 + }, + "5, 2", + { + "w": 6.25, + "c": "#cccccc" + }, + "5, 6", + { + "c": "#aaaaaa" + }, + "5, 9", + "5, 10", + "5, 11", + { + "x": 0.25, + "y": 0.25 + }, + "5, 12", + "5, 13", + "5, 14" + ] + ] + } +} diff --git a/quantum/encoder.c b/quantum/encoder.c index 7ab194ed5290..807ed9b449cf 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -59,8 +59,9 @@ static uint8_t encoder_resolutions[NUM_ENCODERS] = ENCODER_RESOLUTIONS; #endif static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0}; -static uint8_t encoder_state[NUM_ENCODERS] = {0}; -static int8_t encoder_pulses[NUM_ENCODERS] = {0}; +static uint8_t encoder_state[NUM_ENCODERS] = {0}; +static int8_t encoder_pulses[NUM_ENCODERS] = {0}; +static bool encoder_interrupt_update[NUM_ENCODERS] = {false}; // encoder counts static uint8_t thisCount; @@ -248,15 +249,23 @@ bool encoder_read(void) { bool changed = false; for (uint8_t i = 0; i < thisCount; i++) { uint8_t new_status = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1); - if ((encoder_state[i] & 0x3) != new_status) { + if ((encoder_state[i] & 0x3) != new_status || encoder_interrupt_update[i]) { encoder_state[i] <<= 2; encoder_state[i] |= new_status; changed |= encoder_update(i, encoder_state[i]); + encoder_interrupt_update[i] = false; } } return changed; } +void encoder_interrupt_read(uint8_t index) { + encoder_state[index] <<= 2; + encoder_state[index] |= (readPin(encoders_pad_a[index]) << 0) | (readPin(encoders_pad_b[index]) << 1); + encoder_pulses[index] += encoder_LUT[encoder_state[index] & 0xF]; + encoder_interrupt_update[index] = true; +} + #ifdef SPLIT_KEYBOARD void last_encoder_activity_trigger(void); diff --git a/quantum/encoder.h b/quantum/encoder.h index 1cbac98cb57a..d3c80572179e 100644 --- a/quantum/encoder.h +++ b/quantum/encoder.h @@ -27,6 +27,7 @@ bool encoder_read(void); bool encoder_update_kb(uint8_t index, bool clockwise); bool encoder_update_user(uint8_t index, bool clockwise); +void encoder_interrupt_read(uint8_t index); #ifdef SPLIT_KEYBOARD diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index c2533ca49cbc..5b6b2655e5dc 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -36,6 +36,9 @@ #ifdef CKLED2001 # include "ckled2001-simple.h" #endif +#ifdef SNLED27351_SPI +# include "snled27351-simple-spi.h" +#endif #ifndef LED_MATRIX_LED_FLUSH_LIMIT # define LED_MATRIX_LED_FLUSH_LIMIT 16 diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 13c8935d112f..cd4e374ad347 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -244,4 +244,23 @@ const led_matrix_driver_t led_matrix_driver = { .set_value_all = ckled2001_set_value_all, }; # endif +#elif defined(SNLED27351_SPI) +# include "spi_master.h" + +static void init(void) { + spi_init(); + + snled27351_init_drivers(); +} + +static void flush(void) { + snled27351_flush(); +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = snled27351_set_value, + .set_color_all = snled27351_set_value_all, +}; #endif diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index 38040fb0ccc4..c1ce69fcea64 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -38,6 +38,8 @@ # include "is31flcommon.h" #elif defined(CKLED2001) # include "ckled2001.h" +#elif defined(SNLED27351_SPI) +# include "snled27351-spi.h" #elif defined(AW20216) # include "aw20216.h" #elif defined(WS2812) diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 695ecc78a47a..81fa44898afd 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -392,6 +392,25 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = ckled2001_set_color_all, }; # endif +#elif defined(SNLED27351_SPI) +# include "spi_master.h" + +static void init(void) { + spi_init(); + + snled27351_init_drivers(); +} + +static void flush(void) { + snled27351_flush(); +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = snled27351_set_color, + .set_color_all = snled27351_set_color_all, +}; #elif defined(AW20216) # include "spi_master.h" diff --git a/tmk_core/protocol/host.c b/tmk_core/protocol/host.c index 2c6654e9a652..29df948b2693 100644 --- a/tmk_core/protocol/host.c +++ b/tmk_core/protocol/host.c @@ -131,11 +131,16 @@ void host_system_send(uint16_t usage) { last_system_usage = usage; if (!driver) return; - +#if defined(STM32_USB_USE_OTG1) + static report_extra_t report; + report.report_id = REPORT_ID_SYSTEM; + report.usage = usage; +#else report_extra_t report = { .report_id = REPORT_ID_SYSTEM, .usage = usage, }; +#endif (*driver->send_extra)(&report); } @@ -151,11 +156,16 @@ void host_consumer_send(uint16_t usage) { #endif if (!driver) return; - +#if defined(STM32_USB_USE_OTG1) + static report_extra_t report; + report.report_id = REPORT_ID_CONSUMER; + report.usage = usage; +#else report_extra_t report = { .report_id = REPORT_ID_CONSUMER, .usage = usage, }; +#endif (*driver->send_extra)(&report); }