Skip to content

Commit

Permalink
Keychron C2 RGB ANSI (#426)
Browse files Browse the repository at this point in the history
* Updated C2 files with older SN32_Master files in separate folder.

* Update config.h

Changed definitions of config.h to match current tree of sn32_develop

* Keychron C2 SN32_Develop Corrections

Removed c2/rgb/old folder as appended files are no longer needed, updated rgb.c with new functions for dip_switch_enable, and updated keymaps with appropriate QMK optimizations and dipswitch toggle function.

* Update rgb.c

Correction on line 68 - Added ; after false parameter.

* keymap.c, rgb.c sleep LED, config.h optimizations

Corrected and adjusted the appropriate keys for default/via keymap files, corrected and adjusted rgb.c sleep LEDs when power matrix goes to sleep, and removed unnecessary code from config.h.

* Removed VIA code due to EEPROM limits.

Removed, adjusted, and optimized code.

* Update readme.md

Added additional comments and changes to manual.

* Update keyboards/keychron/c2/rgb/rgb.c

Co-authored-by: Dimitris Mantzouranis <[email protected]>

---------

Co-authored-by: Dimitris Mantzouranis <[email protected]>
  • Loading branch information
JAO1988 and dexter93 authored Sep 27, 2024
1 parent ab109ef commit 569f280
Show file tree
Hide file tree
Showing 5 changed files with 602 additions and 0 deletions.
28 changes: 28 additions & 0 deletions keyboards/keychron/c2/rgb/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2024 SiphonedAnomaly
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/>.
*/
#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 }
#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH /* Parameter added for PWM Transistor Permutations */
#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_LOW /* Parameter added for RGB Transistor Permutations */

#define LED_WIN_PIN B12
#define LED_MAC_PIN B15

// START LAYER DEFINITIONS
#define WIN_BASE 0
#define WIN_FN 1
#define MAC_BASE 2
#define MAC_FN 3
291 changes: 291 additions & 0 deletions keyboards/keychron/c2/rgb/keyboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
{
"manufacturer": "Keychron",
"keyboard_name": "Keychron C2 RGB",
"maintainer": "SiphonedAnomaly",
"bootloader": "sn32-dfu",
"diode_direction": "ROW2COL",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": false,
"nkro": true,
"rgb_matrix": true,
"dip_switch": true
},
"bootloader_instructions": "Hold FN + ESC",
"indicators": {
"caps_lock": "B13",
"num_lock": "B14",
"on_state": 1
},
"dip_switch": {
"pins": ["D6"]
},
"matrix_pins": {
"rows": ["C15", "D11", "D10", "D9", "D8", "D7"]
"cols": ["A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "A13", "A14", "B0", "B1", "B2", "B3", "B4", "B5"],
},
"debounce": 1,
"processor": "SN32F248BF",
"url": "https://www.keychron.com/products/keychron-c2-wired-mechanical-keyboard?variant=32294075170905"
"usb": {
"device_version": "1.0.0",
"pid": "0xFE22",
"vid": "0x3434"
},
"layouts": {
"LAYOUT_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.25, "y":2.25},
{"matrix":[2,18], "x":19.25, "y":2.25},
{"matrix":[2,19], "x":20.25, "y":2.25},
{"matrix":[2,20], "x":21.25, "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.25, "y":4.25},
{"matrix":[4,18], "x":19.25, "y":4.25},
{"matrix":[4,19], "x":20.25, "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, 9], "x":10, "y":5.25, "w":1.25},
{"matrix":[5,10], "x":11.25, "y":5.25, "w":1.25},
{"matrix":[5,11], "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,18], "x":18.5, "y":5.25, "w":2},
{"matrix":[5,19], "x":20.5, "y":5.25}
]
}
},
"rgb_matrix": {
"driver": "sn32f2xx",
"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":12, "y":0},
{"matrix":[0, 2], "flags":4, "x":25, "y":0},
{"matrix":[0, 3], "flags":4, "x":37, "y":0},
{"matrix":[0, 4], "flags":4, "x":50, "y":0},
{"matrix":[0, 5], "flags":4, "x":62, "y":0},
{"matrix":[0, 6], "flags":4, "x":75, "y":0},
{"matrix":[0, 7], "flags":4, "x":87, "y":0},
{"matrix":[0, 8], "flags":4, "x":100, "y":0},
{"matrix":[0, 9], "flags":4, "x":112, "y":0},
{"matrix":[0, 10], "flags":4, "x":124, "y":0},
{"matrix":[0, 11], "flags":4, "x":137, "y":0},
{"matrix":[0, 12], "flags":4, "x":149, "y":0},
{"matrix":[0, 14], "flags":4, "x":174, "y":0},
{"matrix":[0, 15], "flags":4, "x":187, "y":0},
{"matrix":[0, 16], "flags":4, "x":199, "y":0},

{"matrix":[1, 0], "flags":4, "x":0, "y":13},
{"matrix":[1, 1], "flags":4, "x":12, "y":13},
{"matrix":[1, 2], "flags":4, "x":25, "y":13},
{"matrix":[1, 3], "flags":4, "x":37, "y":13},
{"matrix":[1, 4], "flags":4, "x":50, "y":13},
{"matrix":[1, 5], "flags":4, "x":62, "y":13},
{"matrix":[1, 6], "flags":4, "x":75, "y":13},
{"matrix":[1, 7], "flags":4, "x":87, "y":13},
{"matrix":[1, 8], "flags":4, "x":100, "y":13},
{"matrix":[1, 9], "flags":4, "x":112, "y":13},
{"matrix":[1, 10], "flags":4, "x":124, "y":13},
{"matrix":[1, 11], "flags":4, "x":137, "y":13},
{"matrix":[1, 12], "flags":4, "x":149, "y":13},
{"matrix":[1, 13], "flags":4, "x":168, "y":13},
{"matrix":[1, 14], "flags":4, "x":174, "y":13},
{"matrix":[1, 15], "flags":4, "x":187, "y":13},
{"matrix":[1, 16], "flags":4, "x":199, "y":13},
{"matrix":[1, 17], "flags":4, "x":211, "y":13},
{"matrix":[1, 18], "flags":4, "x":224, "y":13},
{"matrix":[1, 19], "flags":4, "x":236, "y":13},
{"matrix":[1, 20], "flags":4, "x":249, "y":13},

{"matrix":[2, 0], "flags":4, "x":3, "y":26},
{"matrix":[2, 1], "flags":4, "x":19, "y":26},
{"matrix":[2, 2], "flags":4, "x":31, "y":26},
{"matrix":[2, 3], "flags":4, "x":44, "y":26},
{"matrix":[2, 4], "flags":4, "x":56, "y":26},
{"matrix":[2, 5], "flags":4, "x":68, "y":26},
{"matrix":[2, 6], "flags":4, "x":81, "y":26},
{"matrix":[2, 7], "flags":4, "x":93, "y":26},
{"matrix":[2, 8], "flags":4, "x":106, "y":26},
{"matrix":[2, 9], "flags":4, "x":118, "y":26},
{"matrix":[2, 10], "flags":4, "x":131, "y":26},
{"matrix":[2, 11], "flags":4, "x":143, "y":26},
{"matrix":[2, 12], "flags":4, "x":156, "y":26},
{"matrix":[2, 13], "flags":4, "x":168, "y":26},
{"matrix":[2, 14], "flags":4, "x":174, "y":26},
{"matrix":[2, 15], "flags":4, "x":187, "y":26},
{"matrix":[2, 16], "flags":4, "x":199, "y":26},
{"matrix":[2, 17], "flags":4, "x":211, "y":26},
{"matrix":[2, 18], "flags":4, "x":224, "y":26},
{"matrix":[2, 19], "flags":4, "x":236, "y":26},
{"matrix":[2, 20], "flags":4, "x":249, "y":26},

{"matrix":[3, 0], "flags":4, "x":5, "y":38},
{"matrix":[3, 1], "flags":4, "x":22, "y":38},
{"matrix":[3, 2], "flags":4, "x":34, "y":38},
{"matrix":[3, 3], "flags":4, "x":47, "y":38},
{"matrix":[3, 4], "flags":4, "x":59, "y":38},
{"matrix":[3, 5], "flags":4, "x":72, "y":38},
{"matrix":[3, 6], "flags":4, "x":84, "y":38},
{"matrix":[3, 7], "flags":4, "x":96, "y":38},
{"matrix":[3, 8], "flags":4, "x":109, "y":38},
{"matrix":[3, 9], "flags":4, "x":121, "y":38},
{"matrix":[3, 10], "flags":4, "x":134, "y":38},
{"matrix":[3, 11], "flags":4, "x":146, "y":38},
{"matrix":[3, 13], "flags":4, "x":166, "y":38},
{"matrix":[3, 17], "flags":4, "x":211, "y":38},
{"matrix":[3, 18], "flags":4, "x":224, "y":38},
{"matrix":[3, 19], "flags":4, "x":236, "y":38},

{"matrix":[4, 0], "flags":4, "x":8, "y":51},
{"matrix":[4, 2], "flags":4, "x":28, "y":51},
{"matrix":[4, 3], "flags":4, "x":40, "y":51},
{"matrix":[4, 4], "flags":4, "x":53, "y":51},
{"matrix":[4, 5], "flags":4, "x":65, "y":51},
{"matrix":[4, 6], "flags":4, "x":78, "y":51},
{"matrix":[4, 7], "flags":4, "x":90, "y":51},
{"matrix":[4, 8], "flags":4, "x":103, "y":51},
{"matrix":[4, 9], "flags":4, "x":115, "y":51},
{"matrix":[4, 10], "flags":4, "x":128, "y":51},
{"matrix":[4, 11], "flags":4, "x":140, "y":51},
{"matrix":[4, 13], "flags":4, "x":157, "y":51},
{"matrix":[4, 15], "flags":4, "x":187, "y":51},
{"matrix":[4, 17], "flags":4, "x":211, "y":51},
{"matrix":[4, 18], "flags":4, "x":224, "y":51},
{"matrix":[4, 19], "flags":4, "x":236, "y":51},
{"matrix":[4, 20], "flags":4, "x":249, "y":51},

{"matrix":[5, 0], "flags":4, "x":2, "y":64},
{"matrix":[5, 1], "flags":4, "x":17, "y":64},
{"matrix":[5, 2], "flags":4, "x":33, "y":64},
{"matrix":[5, 6], "flags":4, "x":79, "y":64},
{"matrix":[5, 9], "flags":4, "x":124, "y":64},
{"matrix":[5, 10], "flags":4, "x":137, "y":64},
{"matrix":[5, 11], "flags":4, "x":149, "y":64},
{"matrix":[5, 13], "flags":4, "x":162, "y":64},
{"matrix":[5, 14], "flags":4, "x":174, "y":64},
{"matrix":[5, 15], "flags":4, "x":187, "y":64},
{"matrix":[5, 16], "flags":4, "x":199, "y":64},
{"matrix":[5, 18], "flags":4, "x":224, "y":64},
{"matrix":[5, 19], "flags":4, "x":236, "y":64}
],
"sleep": true
}
}
Loading

0 comments on commit 569f280

Please sign in to comment.