Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Keychron K3 RGB ISO : add k3 keyboard on sn32_develop #341

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions keyboards/keychron/k3/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Keychron K3

![Keychron K3](https://cdn.shopify.com/s/files/1/0059/0630/1017/products/Keychron-K3-ultra-slim-wireless-mechanical-keyboard--3_1800x1800.jpg?v=1634644047)

A Compact 75% Layout Ultra-Slim Wireless Mechanical keyboard.

Brought to you by: [SonixQMK](https://github.com/SonixQMK/qmk_firmware)

* Hardware Supported: SN32F248BF
* Hardware Availability: [keychron.com](https://www.keychron.com/)

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).
31 changes: 31 additions & 0 deletions keyboards/keychron/k3/rgb/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2020 Adam Honse <calcprogrammer1@gmail.com>
* Copyright 2020 Dimitris Mantzouranis <d3xter93@gmail.com>
* Copyright 2022 Harrison Chan (Xelus)
* Copyright 2023 Seyyid Ahmed Doğan (seyahdoo)
*
* 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

// Connects each switch in the dip switch to the GPIO pin of the MCU
#define DIP_SWITCH_PINS { D6, D5 }

// RGB LED Config
#define LED_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 }


// RGB Matrix Effects
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
82 changes: 82 additions & 0 deletions keyboards/keychron/k3/rgb/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"keyboard_name": "Keychron K3",
"manufacturer": "Keychron",
"url": "https://www.keychron.com/products/keychron-k3-wireless-mechanical-keyboard",
"processor": "SN32F248BF",
"maintainer": "seyahdoo",
"bootloader": "sn32-dfu",
"debounce": 5,
"diode_direction": "COL2ROW",
"features": {
"rgb_matrix": true,
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": false,
"nkro": true,
"dip_switch": true
},
"rgb_matrix": {
"animations": {
"alphas_mods" : true,
"band_pinwheel_sat" : true,
"band_pinwheel_val" : true,
"band_sat" : true,
"band_spiral_sat" : true,
"band_spiral_val" : true,
"band_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,
"gradient_left_right" : true,
"gradient_up_down" : true,
"hue_breathing" : true,
"hue_pendulum" : true,
"hue_wave" : true,
"jellybean_raindrops" : true,
"multisplash" : true,
"pixel_flow" : true,
"pixel_fractal" : true,
"pixel_rain" : true,
"rainbow_beacon" : true,
"rainbow_moving_chevron" : true,
"rainbow_pinwheels" : true,
"raindrops" : true,
"solid_multisplash" : true,
"solid_reactive" : true,
"solid_reactive_cross" : true,
"solid_reactive_multicross" : true,
"solid_reactive_multinexus" : true,
"solid_reactive_multiwide" : true,
"solid_reactive_nexus" : true,
"solid_reactive_simple" : true,
"solid_reactive_wide" : true,
"solid_splash" : true,
"splash" : true,
"typing_heatmap" : true,
},
"driver": "SN32F24xB"
},
"matrix_pins": {
"cols": [ "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7"],
"rows": [ "C15", "D11", "D10", "D9", "D8", "D7"]
},
"indicators": {
"caps_lock": "D4"
},
"usb": {
"vid": "0x3434",
"device_version": "1.0.0",
"wait_for": false
}
}


173 changes: 173 additions & 0 deletions keyboards/keychron/k3/rgb/keymaps/iso/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
/*
Copyright 2020 Dimitris Mantzouranis
Copyright 2022 Pablo Ramirez
Copyright 2023 Seyyid Ahmed Doğan (seyahdoo)

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

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_names {
MAC_BASE = 0,
WIN_BASE,
MAC_FN,
WIN_FN
};

#define KC_TASK LGUI(KC_TAB) // Task viewer
#define KC_FLXP LGUI(KC_E) // Windows file explorer
#define KC_SNIP LGUI(LSFT(KC_S)) // Windows snip tool

#define KC_MSSN LGUI(KC_F3) // Mission Control
#define KC_FIND LALT(LGUI(KC_SPC)) // Finder
#define KC_MSCR LSFT(LGUI(KC_3)) // Mac screenshot
#define KC_MSNP LSFT(LGUI(KC_4)) // Mac snip tool

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* Mac base layout
+------------------------------------------------------------------------------+
| ESC| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10| F11| F12|PSCR|DEL|RMOD|
+------------------------------------------------------------------------------+
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP |PGUP|
+------------------------------------------------------------------------------+
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | |PGDN|
+------------------------------------------------------------------- RET -----+
|CAPSLCK| A | S | D | F | G | H | J | K | L | ; | ' | # | |HOME|
+------------------------------------------------------------------------------+
|LSHFT| \ | Z | X | C | V | B | N | M | , | . | / | RSHIFT| UP | END|
+------------------------------------------------------------------------------+
|LCTRL| LALT| LGUI| SPACE | RALT| FN |RCTL|LEFT|DOWN|RGHT|
+------------------------------------------------------------------------------+
*/
[MAC_BASE] = LAYOUT_75_iso(
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
KC_ESC, QK_BOOT, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MSCR, KC_INS, 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_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_END ,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),

/* Mac Fn overlay
+------------------------------------------------------------------------------+
| RST|BRID|BRIU|MCTL|LPAD|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU|MSNP|INS|RTOG|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | |RM_P|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------- -----+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | |RSAI| |
+------------------------------------------------------------------------------+
| | | | | | | |RHUD|RSAD|RHUI|
+------------------------------------------------------------------------------+
*/
[MAC_FN] = LAYOUT_75_iso(
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
QK_BOOT, KC_BRID, KC_BRIU, KC_MSSN, KC_FIND, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_MSNP, RGB_TOG, RGB_MOD ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_P ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ ,
_______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI
),

/* Windows base layout
+------------------------------------------------------------------------------+
| ESC| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10| F11| F12|PSCR|INS| DEL|
+------------------------------------------------------------------------------+
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP |PGUP|
+------------------------------------------------------------------------------+
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | |PGDN|
+------------------------------------------------------------------- RET -----+
|CAPSLCK| A | S | D | F | G | H | J | K | L | ; | ' | # | |HOME|
+------------------------------------------------------------------------------+
|LSHFT| \ | Z | X | C | V | B | N | M | , | . | / | RSHIFT| UP | END|
+------------------------------------------------------------------------------+
|LCTRL| LGUI| LALT| SPACE | RALT| FN |RCTL|LEFT|DOWN|RGHT|
+------------------------------------------------------------------------------+
*/
[WIN_BASE] = LAYOUT_75_iso(
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
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_INS, 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_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_END ,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),

/* Windows Fn overlay
+------------------------------------------------------------------------------+
| RST|BRID|BRIU|TASK|FLXP|RVAD|RVAI|MPRV|MPLY|MNXT|MUTE|VOLD|VOLU| |RTOG|RMOD|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | |RM_P|
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------- -----+
| | | | | | | | | | | | | | | |
+------------------------------------------------------------------------------+
| | | | | | | | | | | | | |RSAI| |
+------------------------------------------------------------------------------+
| | | | | | | |RHUD|RSAD|RHUI|
+------------------------------------------------------------------------------+
*/ qwAS
[WIN_FN] = LAYOUT_75_iso(
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
QK_BOOT, 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_M_P ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, _______ ,
_______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI
),
};

bool dip_switch_update_user(uint8_t index, bool active) {
switch(index) {
case 0: // OS switch
if (active) { // Mac/iOS mode
layer_move(MAC_BASE);
}
else { // Windows/Android mode
layer_move(WIN_BASE);
}
break;
case 1: // Connection switch
// Probably it's not possible to do anything sensible here as switching from Cable to BT requires turning off the board. (BT / OFF / Cable)
if (active) { // BT mode
rgblight_disable_noeeprom();
}
else { //Cable mode
rgblight_enable_noeeprom();
}
break;
}
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;
}
21 changes: 21 additions & 0 deletions keyboards/keychron/k3/rgb/optical_iso/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2020 Adam Honse <calcprogrammer1@gmail.com>
* Copyright 2020 Dimitris Mantzouranis <d3xter93@gmail.com>
* Copyright 2022 Harrison Chan (Xelus)
* Copyright 2023 Seyyid Ahmed Doğan (seyahdoo)
*
* 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/>.
*/

// RGB Matrix Config
#define RGB_MATRIX_LED_COUNT 85
Loading
Loading