Skip to content

Commit

Permalink
Merge pull request #186 from lalalademaxiya1/playground
Browse files Browse the repository at this point in the history
Playground
  • Loading branch information
KeychronMacro authored Oct 17, 2023
2 parents c029409 + f6df8a1 commit 5ed22b2
Show file tree
Hide file tree
Showing 24 changed files with 1,123 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

<<<<<<< HEAD
include keyboards/keychron/common/common.mk
=======
VPATH += keyboards/keychron/common
SRC += keychron_common.c
>>>>>>> temp
2 changes: 1 addition & 1 deletion keyboards/keychron/x3/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A customizable 80% TKL keyboard.

Make example for this keyboard (after setting up your build environment):

make keychron/x1/ansi/red:default
make keychron/x3/ansi/red:default

Flashing example for this keyboard:

Expand Down
49 changes: 49 additions & 0 deletions keyboards/keychron/x4/ansi_encoder/red/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* 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 <http://www.gnu.org/licenses/>.
*/

#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_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
#endif
125 changes: 125 additions & 0 deletions keyboards/keychron/x4/ansi_encoder/red/info.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
}
70 changes: 70 additions & 0 deletions keyboards/keychron/x4/ansi_encoder/red/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
86 changes: 86 additions & 0 deletions keyboards/keychron/x4/ansi_encoder/red/keymaps/keychron/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

include keyboards/keychron/common/common.mk
Loading

0 comments on commit 5ed22b2

Please sign in to comment.