summaryrefslogtreecommitdiff
path: root/keyboards/tzarc
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2023-03-21 20:16:11 +1100
committerGitHub <noreply@github.com>2023-03-21 10:16:11 +0100
commita518e1e5d88864f47b99780c325bfc8c1dbd8ada (patch)
tree9aefbd77dfcdd7d5635b273dbaa1468c3249414f /keyboards/tzarc
parent0e1e543836653c48fb6ddf6f57adeb62ed8318d8 (diff)
Sync activity timestamps between sides. (#20192)
Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Diffstat (limited to 'keyboards/tzarc')
-rw-r--r--keyboards/tzarc/djinn/config.h3
-rw-r--r--keyboards/tzarc/djinn/djinn.c21
-rw-r--r--keyboards/tzarc/djinn/djinn.h3
-rw-r--r--keyboards/tzarc/djinn/djinn_split_sync.c5
4 files changed, 12 insertions, 20 deletions
diff --git a/keyboards/tzarc/djinn/config.h b/keyboards/tzarc/djinn/config.h
index e8b2abc1f6..c1c2f6832a 100644
--- a/keyboards/tzarc/djinn/config.h
+++ b/keyboards/tzarc/djinn/config.h
@@ -1,4 +1,4 @@
1// Copyright 2018-2022 Nick Brassel (@tzarc) 1// Copyright 2018-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4 4
@@ -16,6 +16,7 @@
16#define SPLIT_LED_STATE_ENABLE 16#define SPLIT_LED_STATE_ENABLE
17#define SPLIT_MODS_ENABLE 17#define SPLIT_MODS_ENABLE
18#define SPLIT_WPM_ENABLE 18#define SPLIT_WPM_ENABLE
19#define SPLIT_ACTIVITY_ENABLE
19 20
20// SPI Configuration 21// SPI Configuration
21#define SPI_DRIVER SPID3 22#define SPI_DRIVER SPID3
diff --git a/keyboards/tzarc/djinn/djinn.c b/keyboards/tzarc/djinn/djinn.c
index 93b1ee775e..17e5833ee9 100644
--- a/keyboards/tzarc/djinn/djinn.c
+++ b/keyboards/tzarc/djinn/djinn.c
@@ -1,4 +1,4 @@
1// Copyright 2018-2022 Nick Brassel (@tzarc) 1// Copyright 2018-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#include <string.h> 3#include <string.h>
4#include "quantum.h" 4#include "quantum.h"
@@ -74,7 +74,6 @@ void keyboard_post_init_kb(void) {
74 qp_init(lcd, QP_ROTATION_0); 74 qp_init(lcd, QP_ROTATION_0);
75 75
76 // Turn on the LCD and clear the display 76 // Turn on the LCD and clear the display
77 kb_state.lcd_power = 1;
78 qp_power(lcd, true); 77 qp_power(lcd, true);
79 qp_rect(lcd, 0, 0, 239, 319, HSV_BLACK, true); 78 qp_rect(lcd, 0, 0, 239, 319, HSV_BLACK, true);
80 79
@@ -187,18 +186,14 @@ void housekeeping_task_kb(void) {
187 } 186 }
188 187
189 // Turn on/off the LCD 188 // Turn on/off the LCD
190 static bool lcd_on = false; 189 bool peripherals_on = last_input_activity_elapsed() < LCD_ACTIVITY_TIMEOUT;
191 if (lcd_on != (bool)kb_state.lcd_power) {
192 lcd_on = (bool)kb_state.lcd_power;
193 qp_power(lcd, lcd_on);
194 }
195 190
196 // Enable/disable RGB 191 // Enable/disable RGB
197 if (lcd_on) { 192 if (peripherals_on) {
198 // Turn on RGB 193 // Turn on RGB
199 writePinHigh(RGB_POWER_ENABLE_PIN); 194 writePinHigh(RGB_POWER_ENABLE_PIN);
200 // Modify the RGB state if different to the LCD state 195 // Modify the RGB state if different to the LCD state
201 if (rgb_matrix_is_enabled() != lcd_on) { 196 if (rgb_matrix_is_enabled() != peripherals_on) {
202 // Wait for a small amount of time to allow the RGB capacitors to charge, before enabling RGB output 197 // Wait for a small amount of time to allow the RGB capacitors to charge, before enabling RGB output
203 wait_ms(10); 198 wait_ms(10);
204 // Enable RGB 199 // Enable RGB
@@ -208,21 +203,21 @@ void housekeeping_task_kb(void) {
208 // Turn off RGB 203 // Turn off RGB
209 writePinLow(RGB_POWER_ENABLE_PIN); 204 writePinLow(RGB_POWER_ENABLE_PIN);
210 // Disable the PWM output for the RGB 205 // Disable the PWM output for the RGB
211 if (rgb_matrix_is_enabled() != lcd_on) { 206 if (rgb_matrix_is_enabled() != peripherals_on) {
212 rgb_matrix_disable_noeeprom(); 207 rgb_matrix_disable_noeeprom();
213 } 208 }
214 } 209 }
215 210
216 // Match the backlight to the LCD state 211 // Match the backlight to the LCD state
217 if (is_keyboard_master() && is_backlight_enabled() != lcd_on) { 212 if (is_keyboard_master() && is_backlight_enabled() != peripherals_on) {
218 if (lcd_on) 213 if (peripherals_on)
219 backlight_enable(); 214 backlight_enable();
220 else 215 else
221 backlight_disable(); 216 backlight_disable();
222 } 217 }
223 218
224 // Draw the UI 219 // Draw the UI
225 if (kb_state.lcd_power) { 220 if (peripherals_on) {
226 draw_ui_user(false); 221 draw_ui_user(false);
227 } 222 }
228 223
diff --git a/keyboards/tzarc/djinn/djinn.h b/keyboards/tzarc/djinn/djinn.h
index ff6b555e8e..70aa34ff08 100644
--- a/keyboards/tzarc/djinn/djinn.h
+++ b/keyboards/tzarc/djinn/djinn.h
@@ -1,4 +1,4 @@
1// Copyright 2018-2022 Nick Brassel (@tzarc) 1// Copyright 2018-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "quantum.h" 4#include "quantum.h"
@@ -20,7 +20,6 @@ const char* usbpd_str(usbpd_allowance_t allowance);
20#pragma pack(push) 20#pragma pack(push)
21#pragma pack(1) 21#pragma pack(1)
22typedef struct kb_runtime_config { 22typedef struct kb_runtime_config {
23 unsigned lcd_power : 1;
24 usbpd_allowance_t current_setting : 2; 23 usbpd_allowance_t current_setting : 2;
25} kb_runtime_config; 24} kb_runtime_config;
26#pragma pack(pop) 25#pragma pack(pop)
diff --git a/keyboards/tzarc/djinn/djinn_split_sync.c b/keyboards/tzarc/djinn/djinn_split_sync.c
index 3c7a58d155..8b10e88b4b 100644
--- a/keyboards/tzarc/djinn/djinn_split_sync.c
+++ b/keyboards/tzarc/djinn/djinn_split_sync.c
@@ -1,4 +1,4 @@
1// Copyright 2018-2022 Nick Brassel (@tzarc) 1// Copyright 2018-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#include <string.h> 3#include <string.h>
4#include "quantum.h" 4#include "quantum.h"
@@ -13,9 +13,6 @@ void kb_state_update(void) {
13 if (is_keyboard_master()) { 13 if (is_keyboard_master()) {
14 // Modify allowed current limits 14 // Modify allowed current limits
15 usbpd_update(); 15 usbpd_update();
16
17 // Turn off the LCD if there's been no matrix activity
18 kb_state.lcd_power = (last_input_activity_elapsed() < LCD_ACTIVITY_TIMEOUT) ? 1 : 0;
19 } 16 }
20} 17}
21 18