From 55325f7476fde9ba59e73a14180700b42676aa88 Mon Sep 17 00:00:00 2001
From: NetUserGet <22157020+NetUserGet@users.noreply.github.com>
Date: Sat, 12 Oct 2024 03:51:42 -0400
Subject: [PATCH] [Keychron C1] Fixed mac keymap, and some code readablitity
changes. (#398)
* Keychron C1 RGB: Inital
* Keychron C1 RGB: Mac and Windows Indicator lights
* Keychron C1 RGB: OpenRGB Support, and changed rgb matrix center to the Y key.
* Keychron C1 RGB: Fix file structure, Remove Rules.mk, fix RGB flags and postions.
* Keychron C1 RGB: Oops, sorry put my custom keymap in there.
* Keychron C1 RGB: Remove dead code.
* Keychron C1 RGB: Ommit Userspace customizations
* Keychron C1 RGB: Fix minor LED postioning error.
* Keychron C1 RGB: Remove custom keycodes for rebooting the keyboard in favor for the built-in reboot keycode, and rename c1.c to rgb.c
* Keychron C1 RGB: Make rgb.c more readable
* Keychron C1 RGB: Added VIA support, updated keymap.c, keyboard.json, and readme.md.
* Keychron C1 RGB: Add c1_rgb_via.json
* Keychron C1 RGB: Patch timetravel.
* Keychron C1 RGB: Wrap suppend_power_down_kb and suppend_wakeup_init_kb with an RGB_MATRIX_ENABLE ifdef.
* Keychron C1 RGB: Remove Keychron and append RGB in keyboard.json under keyboard_name and swap RGB_MATRIX_ENABLE with RGB_MATRIX_SLEEP in rgb.c
* Keychron C1 RGB: Move some funtions into their respective ifdef statements.
* Keychron C1 RGB: change the VID and PID because defaults are owned by apple.
* Keychron C1 RGB: Change Q_RESET to QK_BOOT because Q_RESET doesn't work.
* Keychron C1 RGB: Personal Prefrence Stuff
* Keychron C1 RGB: Currently fixing issues with layers hold on to something
* Keychron C1 RGB: What is happening with layers :(
* Issue after issue
* Keychron C1 RGB: Layers like an oninon or a painting (Fixed layers)
* Keychron C1 RGB: Oops touched something I wasn't supposed to.
* Keychron C1 RGB: Layer state is a bitmap.
* Keychron C1 RGB: Remove the hacky bootm stuff
* Keychron C1 RGB: Remove DF() in via keymap (it seems broken)
* Keychron C1 RGB: add bootloader instructions to info.json
* Keychron C1 RGB: Fix the mac keymap, and remove a notice from README.md
* Keychron C1 RGB: edit keyboard.json and config.h to have updated names
---------
Co-authored-by: Net <22157020+NetIsPrograming@users.noreply.github.com>
---
keyboards/keychron/c1/rgb/config.h | 12 +++--
keyboards/keychron/c1/rgb/keyboard.json | 5 +--
.../keychron/c1/rgb/keymaps/default/keymap.c | 32 ++++++--------
.../keychron/c1/rgb/keymaps/via/keymap.c | 33 ++++++--------
keyboards/keychron/c1/rgb/readme.md | 6 +--
keyboards/keychron/c1/rgb/rgb.c | 44 +++++++++++--------
6 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/keyboards/keychron/c1/rgb/config.h b/keyboards/keychron/c1/rgb/config.h
index 4b1d70684c43..97222211b6b3 100644
--- a/keyboards/keychron/c1/rgb/config.h
+++ b/keyboards/keychron/c1/rgb/config.h
@@ -14,7 +14,13 @@ 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 .
*/
-#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 }
+#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } /* This *is* supposed to be in info.json */
-#define LED_MAC_PIN B11 // Labeled Mac on KB since no Scroll Lock
-#define LED_WIN_PIN B12 // Labeled Windows on KB since no Numpad
+#define LED_MAC_PIN B11 // Labeled Mac on KB since no Scroll Lock
+#define LED_WIN_PIN B12 // Labeled Windows on KB since no Numpad
+
+// START LAYER DEFINITIONS
+#define _WIN_BASE 0
+#define _WIN_FN 1
+#define _MAC_BASE 2
+#define _MAC_FN 3
diff --git a/keyboards/keychron/c1/rgb/keyboard.json b/keyboards/keychron/c1/rgb/keyboard.json
index f7bfef96cb55..dbd5d1b08b3c 100644
--- a/keyboards/keychron/c1/rgb/keyboard.json
+++ b/keyboards/keychron/c1/rgb/keyboard.json
@@ -14,9 +14,7 @@
"rgb_matrix": true,
"dip_switch": true
},
- "bootmagic": {
- "matrix": [0, 0]
- },
+ "bootloader_instructions": "Hold FN + ESC",
"indicators": {
"caps_lock": "B10"
},
@@ -27,7 +25,6 @@
"cols": ["A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8"],
"rows": ["C15", "D11", "D10", "D9", "D8", "D7"]
},
- "debounce": 0,
"processor": "SN32F248BF",
"url": "https://www.keychron.com/products/keychron-c1-wired-mechanical-keyboard?variant=32321247182937",
"usb": {
diff --git a/keyboards/keychron/c1/rgb/keymaps/default/keymap.c b/keyboards/keychron/c1/rgb/keymaps/default/keymap.c
index df7350dcbce6..3fea8711ee31 100644
--- a/keyboards/keychron/c1/rgb/keymaps/default/keymap.c
+++ b/keyboards/keychron/c1/rgb/keymaps/default/keymap.c
@@ -21,13 +21,6 @@ along with this program. If not, see .
// 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 {
- WIN_BASE,
- WIN_FN,
- MAC_BASE,
- MAC_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
@@ -39,9 +32,11 @@ enum layer_names {
#define KC_MSNP LSFT(LGUI(KC_4)) // Mac snip tool
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+
/* Windows layout
+-------------------------------------------------------------------------------------------+
- | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9| F10| F11| F12| | |PSCR|CORT|RGB |
+ | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9| F10| F11| F12| | |PSCR| |RGB |
+--------------------------------------------------------------------------+ +--------------+
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP | |INS |HOME|PGUP|
+--------------------------------------------------------------------------+ +--------------+
@@ -54,16 +49,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|LCTRL| LGUI| LALT | SPACE | RALT| RGUI | FN | RCTRL | |LFT |DWN |RGT |
+-------------------------------------------------------------------------------------------+
*/
- [WIN_BASE] = LAYOUT_tkl_ansi(
+
+ [_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_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ),
+ 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(
- Q_RESET, 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_SNIP, _______, RGB_TOG,
+ [_WIN_FN] = LAYOUT_tkl_ansi(
+ 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, KC_SNIP, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -82,19 +78,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+--------------------------------------------------------------------------+ +----+ |
| LSHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP | |
+--------------------------------------------------------------------------+ +--------------+
- |LCTRL| LALT| LGUI | SPACE | RGUI| RALT | FN | RCTRL | |LFT |DWN |RGT |
+ |LCTRL| LOPT| LCMD | SPACE | RCMD| ROPT | FN | RCTRL | |LFT |DWN |RGT |
+-------------------------------------------------------------------------------------------+
*/
- [MAC_BASE] = LAYOUT_tkl_ansi(
+ [_MAC_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_MSCR, 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_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ),
+ 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(
- Q_RESET, 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,
+ [_MAC_FN] = LAYOUT_tkl_ansi(
+ 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,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
diff --git a/keyboards/keychron/c1/rgb/keymaps/via/keymap.c b/keyboards/keychron/c1/rgb/keymaps/via/keymap.c
index df7350dcbce6..6a12fb74b11a 100644
--- a/keyboards/keychron/c1/rgb/keymaps/via/keymap.c
+++ b/keyboards/keychron/c1/rgb/keymaps/via/keymap.c
@@ -21,12 +21,6 @@ along with this program. If not, see .
// 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 {
- WIN_BASE,
- WIN_FN,
- MAC_BASE,
- MAC_FN,
-};
#define KC_TASK LGUI(KC_TAB) // Task viewer
#define KC_FLXP LGUI(KC_E) // Windows file explorer
@@ -39,9 +33,10 @@ enum layer_names {
#define KC_MSNP LSFT(LGUI(KC_4)) // Mac snip tool
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
/* Windows layout
+-------------------------------------------------------------------------------------------+
- | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9| F10| F11| F12| | |PSCR|CORT|RGB |
+ | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9| F10| F11| F12| | |PSCR| |RGB |
+--------------------------------------------------------------------------+ +--------------+
| ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BACKSP | |INS |HOME|PGUP|
+--------------------------------------------------------------------------+ +--------------+
@@ -54,16 +49,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|LCTRL| LGUI| LALT | SPACE | RALT| RGUI | FN | RCTRL | |LFT |DWN |RGT |
+-------------------------------------------------------------------------------------------+
*/
- [WIN_BASE] = LAYOUT_tkl_ansi(
+
+ [_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_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(WIN_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ),
- [WIN_FN] = LAYOUT_tkl_ansi(
- Q_RESET, 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_SNIP, _______, RGB_TOG,
+ 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(
+ 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, KC_SNIP, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -82,25 +79,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+--------------------------------------------------------------------------+ +----+ |
| LSHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | | UP | |
+--------------------------------------------------------------------------+ +--------------+
- |LCTRL| LALT| LGUI | SPACE | RGUI| RALT | FN | RCTRL | |LFT |DWN |RGT |
+ |LCTRL| LOPT| LCMD | SPACE | RCMD| ROPT | FN | RCTRL | |LFT |DWN |RGT |
+-------------------------------------------------------------------------------------------+
*/
- [MAC_BASE] = LAYOUT_tkl_ansi(
+ [_MAC_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_MSCR, 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_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, MO(MAC_FN),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ),
+ 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(
- Q_RESET, 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,
+ [_MAC_FN] = LAYOUT_tkl_ansi(
+ 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,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, QK_RBT, _______, _______, _______, _______, _______, _______, RGB_HUI,
_______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD, RGB_HUD, RGB_SAI ),
-};
-
-
+};
\ No newline at end of file
diff --git a/keyboards/keychron/c1/rgb/readme.md b/keyboards/keychron/c1/rgb/readme.md
index edfe86a6c478..74020d3bc5fc 100644
--- a/keyboards/keychron/c1/rgb/readme.md
+++ b/keyboards/keychron/c1/rgb/readme.md
@@ -13,9 +13,9 @@ Make example for this keyboard (after setting up your build environment):
make keychron/c1/rgb:default
Flashing example for this keyboard:
1. If your keyboard currently has stock firmware installed, put your keyboard first into bootloader by shorting the boot pins found under the spacebar before plugging in your keyboard to the PC. Otherwise, press `Fn + Esc` to put your keyboard into bootloader.
-1. Download and run [Sonix Flasher](https://github.com/SonixQMK/sonix-flasher/releases).
-1. In Sonix Flasher, select `SN32F24X` under 'Device'. And select `0x00` as the qmk offset.
-1. Lastly, click 'Flash QMK...' and find the compiled firmware.
+2. Download and run [Sonix Flasher](https://github.com/SonixQMK/sonix-flasher/releases).
+3. In Sonix Flasher, select `SN32F24X` under 'Device'. And select `0x00` as the qmk offset.
+4. Lastly, click 'Flash QMK...' and find the compiled firmware.
* * *
# Firmware Details
diff --git a/keyboards/keychron/c1/rgb/rgb.c b/keyboards/keychron/c1/rgb/rgb.c
index 64e285c6f9cc..bce1f2b780ab 100644
--- a/keyboards/keychron/c1/rgb/rgb.c
+++ b/keyboards/keychron/c1/rgb/rgb.c
@@ -18,55 +18,61 @@
bool mode_leds_show = true;
-enum layer_names {
- WIN_BASE,
- WIN_FN,
- MAC_BASE,
- MAC_FN,
-}; /* Taken from the default keymap for readability */
#ifdef DIP_SWITCH_ENABLE
static void mode_leds_update(void){
- if (mode_leds_show && layer_state_is(WIN_BASE)) {
+ if (mode_leds_show && layer_state_is(_WIN_BASE)) {
gpio_write_pin_high(LED_WIN_PIN);
- } else if (mode_leds_show && layer_state_is(MAC_BASE)) {
+ } else if (mode_leds_show && layer_state_is(_MAC_BASE)) {
gpio_write_pin_high(LED_MAC_PIN);
}
}
-
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(active ? MAC_BASE : WIN_BASE);
+ if (active) {
+ default_layer_state_set_kb(1 << _MAC_BASE); /* set layer 2 to be on */
+ }
}
-
mode_leds_update();
return true;
}
-
- void keyboard_pre_init_kb(void) {
- // Setup Win & Mac LED Pins as output
- gpio_set_pin_output(LED_WIN_PIN);
- gpio_set_pin_output(LED_MAC_PIN);
- }
#endif // DIP_SWITCH_ENABLE
+void keyboard_pre_init_kb(void) {
+ // Setup Win & Mac LED Pins as output
+ gpio_set_pin_output(LED_WIN_PIN);
+ gpio_set_pin_output(LED_MAC_PIN);
+}
+
+void keyboard_post_init_kb(void) {
+ // Setup Default Keymap.
+ // If you chose to not have the dipswich enabled change this _WIN_BASE to be your default keymap.
+ // Eg: _MAC_BASE
+ default_layer_state_set_kb(1 << _WIN_BASE); /* set layer 0 to be on */
+}
+
+
#ifdef RGB_MATRIX_SLEEP
void suspend_power_down_kb(void) {
// Turn leds off
mode_leds_show = false;
mode_leds_update();
-
+
+ #ifdef RGB_MATRIX
rgb_matrix_set_suspend_state(true);
+ #endif
+
}
void suspend_wakeup_init_kb(void) {
mode_leds_show = true;
mode_leds_update();
-
+ #ifdef RGB_MATRIX
rgb_matrix_set_suspend_state(false);
+ #endif
}
#endif // RGB_MATRIX_SLEEP