Add vial support for keychron c3_pro/ansi/red. (#884)

* LEDs are working
* mac/win switch is working
* Vial gui is working

Build with:
qmk compile -kb keychron/c3_pro/ansi/red -km vial

Co-authored-by: Ken <kenxieca@gmail.com>
This commit is contained in:
Master Coder 2025-05-11 21:38:31 -07:00 committed by GitHub
parent cab779b912
commit 4ba3834f0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 298 additions and 0 deletions

View file

@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#define VIAL_KEYBOARD_UID {0x76, 0x08, 0x76, 0xC9, 0x59, 0x64, 0xE0, 0x1D}
#define VIAL_UNLOCK_COMBO_ROWS { 0, 3 }
#define VIAL_UNLOCK_COMBO_COLS { 0, 13 }

View file

@ -0,0 +1,88 @@
/* 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 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, _______, _______, LM_BRID, LM_BRIU, 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, LM_BRIU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_OSSW, _______, LM_BRID, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, 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, _______, _______, LM_BRID, LM_BRIU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, BL_STEP,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
BL_TOGG, BL_STEP, LM_BRIU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_OSSW, _______, LM_BRID, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
// clang-format on
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) {
gpio_set_pin_output(LED_MAC_OS_PIN);
gpio_set_pin_output(LED_WIN_OS_PIN);
gpio_write_pin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE);
gpio_write_pin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE);
}
void housekeeping_task_user(void) {
housekeeping_task_keychron();
if (default_layer_state == (1U << 0)) {
gpio_write_pin(LED_MAC_OS_PIN, LED_OS_PIN_ON_STATE);
gpio_write_pin(LED_WIN_OS_PIN, !LED_OS_PIN_ON_STATE);
} else if (default_layer_state == (1U << 2)) {
gpio_write_pin(LED_MAC_OS_PIN, !LED_OS_PIN_ON_STATE);
gpio_write_pin(LED_WIN_OS_PIN, LED_OS_PIN_ON_STATE);
}
}

View file

@ -0,0 +1,5 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
VPATH += keyboards/keychron/common
SRC += keychron_common.c

View file

@ -0,0 +1,197 @@
{
"name": "Keychron C3 Pro",
"vendorId": "0x3434",
"productId": "0x0430",
"lighting": "qmk_backlight",
"matrix": {
"rows": 6,
"cols": 17
},
"layouts": {
"labels": [],
"keymap":
[
[
{
"c": "#cc0000"
},
"0,0\nESC",
{
"x": 1,
"c": "#333333",
"t": "#ffffff"
},
"0,2\nF1",
"0,3\nF2",
"0,4\nF3",
"0,5\nF4",
{
"x": 0.5
},
"0,6\nF5",
"0,7\nF6",
"0,8\nF7",
"0,9\nF8",
{
"x": 0.5
},
"0,10\nF9",
"0,11\nF10",
"0,12\nF11",
"0,13\nF12",
{
"x": 0.5
},
"0,14\nPS",
"0,15\nSL",
"0,16\nPB"
],
[
"1,0\n` ~",
"1,1\n\n\n\n\n\n1 !",
"1,2\n2 @",
"1,3\n3 #",
"1,4\n4 $",
"1,5\n5 %",
"1,6\n6 ^",
"1,7\n7 &",
"1,8\n8 *",
"1,9\n9 (",
"1,10\n0 )",
"1,11\n- _",
"1,12\n= +",
{
"w": 2
},
"1,13\nBackspace",
{
"x": 0.5
},
"1,14\nINS",
"1,15\nHOME",
"1,16\nPGUP"
],
[
{
"w": 1.5
},
"2,0\nTAB",
"2,1\nQ",
"2,2\nW",
"2,3\nE",
"2,4\nR",
"2,5\nT",
"2,6\nY",
"2,7\nU",
"2,8\nI",
"2,9\nO",
"2,10\nP",
"2,11\n[ {",
"2,12\n] }",
{
"w": 1.5
},
"2,13\n\\ |",
{
"x": 0.5
},
"2,14\nDEL",
"2,15\nEND",
"2,16\nPGDN"
],
[
{
"w": 1.75
},
"3,0\nCAPS mac/win",
"3,1\nA",
"3,2\nS",
"3,3\nD",
"3,4\nF",
"3,5\nG",
"3,6\nH",
"3,7\nJ",
"3,8\nK",
"3,9\nL",
"3,10\n; :",
"3,11\n “",
{
"c": "#cc0000",
"t": "#000000",
"w": 2.25
},
"3,13\nENTER"
],
[
{
"c": "#333333",
"t": "#ffffff",
"w": 2.25
},
"4,0\nSHIFT",
"4,2\nZ",
"4,3\nX",
"4,4\nC",
"4,5\nV",
"4,6\nB",
"4,7\nN",
"4,8\nM",
"4,9\n, <",
"4,10\n. >",
"4,11\n/ ?",
{
"w": 2.75
},
"4,13\nSHIFT",
{
"x": 1.5
},
"4,15\n↑"
],
[
{
"w": 1.25
},
"5,0\nCTRL",
{
"w": 1.25
},
"5,1\nWIN",
{
"w": 1.25
},
"5,2\nALT",
{
"c": "#cc0000",
"t": "#000000",
"w": 6.25
},
"5,6",
{
"c": "#333333",
"t": "#ffffff",
"w": 1.25
},
"5,10\nALT",
{
"w": 1.25
},
"5,11\nFN",
{
"w": 1.25
},
"5,12\nMENU",
{
"w": 1.25
},
"5,13\nCTRL",
{
"x": 0.5
},
"5,14\n←",
"5,15\n↓",
"5,16\n→"
]
]
}
}