Remove spi config as it's default now from qmk main and move backlight config to halcyon.c as we always want that to happen (display on slave otherwise wouldn't turn off)

This commit is contained in:
VeyPatch 2024-11-05 14:46:12 +01:00
parent f81d2a9fa8
commit aa7b5b89e1
6 changed files with 63 additions and 51 deletions

View file

@ -43,6 +43,20 @@ module_t module;
module_t module = hlc_tft_display;
#endif
bool backlight_off = false;
// Timeout handling
void backlight_wakeup(void) {
backlight_off = false;
backlight_enable();
}
// Timeout handling
void backlight_suspend(void) {
backlight_off = true;
backlight_disable();
}
void module_sync_slave_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
if (initiator2target_buffer_size == sizeof(module)) {
memcpy(&module_master, initiator2target_buffer, sizeof(module_master));
@ -76,6 +90,15 @@ void housekeeping_task_kb(void) {
display_module_housekeeping_task_kb(false); // Otherwise be the main display
}
}
// Backlight feature
if (backlight_off && last_input_activity_elapsed() <= HLC_BACKLIGHT_TIMEOUT) {
backlight_wakeup();
}
if (!backlight_off && last_input_activity_elapsed() > HLC_BACKLIGHT_TIMEOUT) {
backlight_suspend();
}
module_housekeeping_task_kb();
housekeeping_task_user();