From a7ff2b8d54e1b56c5c25f4a7b6c8c5d9dedee2ab Mon Sep 17 00:00:00 2001 From: Wolf Van Herreweghe Date: Fri, 30 Dec 2022 01:51:12 +0100 Subject: [PATCH] Typ65+ Add code to auto turn off LEDs when the PC goes to sleep (#19365) Co-authored-by: Wolf --- keyboards/kopibeng/typ65/info.json | 5 ++++- .../kopibeng/typ65/keymaps/default/keymap.c | 8 ++++---- keyboards/kopibeng/typ65/keymaps/via/keymap.c | 8 ++++---- keyboards/kopibeng/typ65/typ65.c | 16 ++++++++++++++++ keyboards/kopibeng/typ65/typ65.h | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/keyboards/kopibeng/typ65/info.json b/keyboards/kopibeng/typ65/info.json index b41daf736c..01abcaa433 100644 --- a/keyboards/kopibeng/typ65/info.json +++ b/keyboards/kopibeng/typ65/info.json @@ -8,8 +8,11 @@ "pid": "0x065E", "device_version": "0.0.1" }, + "layout_aliases": { + "LAYOUT_all": "LAYOUT" + }, "layouts": { - "LAYOUT_all": { + "LAYOUT": { "layout": [ { "label": "K01", "x": 1.25, "y": 0 }, { "label": "K02", "x": 2.25, "y": 0 }, diff --git a/keyboards/kopibeng/typ65/keymaps/default/keymap.c b/keyboards/kopibeng/typ65/keymaps/default/keymap.c index 6cdf423f76..d871561a3b 100644 --- a/keyboards/kopibeng/typ65/keymaps/default/keymap.c +++ b/keyboards/kopibeng/typ65/keymaps/default/keymap.c @@ -19,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer - [0] = LAYOUT_all( + [0] = LAYOUT( QK_GESC, 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_BSPC, KC_HOME, KC_TRNS, 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_TRNS, 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, @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn1 Layer - [1] = LAYOUT_all( + [1] = LAYOUT( KC_TRNS, 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_TRNS, KC_TRNS, QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -37,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn2 Layer - [2] = LAYOUT_all( + [2] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn3 Layer - [3] = LAYOUT_all( + [3] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, diff --git a/keyboards/kopibeng/typ65/keymaps/via/keymap.c b/keyboards/kopibeng/typ65/keymaps/via/keymap.c index 6cdf423f76..d871561a3b 100644 --- a/keyboards/kopibeng/typ65/keymaps/via/keymap.c +++ b/keyboards/kopibeng/typ65/keymaps/via/keymap.c @@ -19,7 +19,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer - [0] = LAYOUT_all( + [0] = LAYOUT( QK_GESC, 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_BSPC, KC_HOME, KC_TRNS, 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_TRNS, 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, @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn1 Layer - [1] = LAYOUT_all( + [1] = LAYOUT( KC_TRNS, 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_TRNS, KC_TRNS, QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -37,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn2 Layer - [2] = LAYOUT_all( + [2] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Fn3 Layer - [3] = LAYOUT_all( + [3] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, diff --git a/keyboards/kopibeng/typ65/typ65.c b/keyboards/kopibeng/typ65/typ65.c index 152b2e7737..2844f2ca83 100644 --- a/keyboards/kopibeng/typ65/typ65.c +++ b/keyboards/kopibeng/typ65/typ65.c @@ -48,4 +48,20 @@ __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { break; } return state; +} + +void suspend_power_down_kb(void) { + writePinLow(INDICATOR_0); + writePinLow(INDICATOR_1); + writePinLow(INDICATOR_2); + + suspend_power_down_user(); +} + +void suspend_wakeup_init_kb(void) { + writePinHigh(INDICATOR_0); + writePinHigh(INDICATOR_1); + writePinHigh(INDICATOR_2); + + suspend_wakeup_init_user(); } \ No newline at end of file diff --git a/keyboards/kopibeng/typ65/typ65.h b/keyboards/kopibeng/typ65/typ65.h index 189139df3b..a4bbf9ab99 100644 --- a/keyboards/kopibeng/typ65/typ65.h +++ b/keyboards/kopibeng/typ65/typ65.h @@ -39,7 +39,7 @@ * */ -#define LAYOUT_all( \ +#define LAYOUT( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K1E, K0E, K0F, \ K00, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K2E, K1F, \ K10, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \