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
commit aa7b5b89e1
6 changed files with 63 additions and 51 deletions

View file

@ -235,4 +235,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// //
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
// ), // ),
}; };
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// Volume control
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else if (index == 1) {
// Page up/Page down
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else if (index == 2) {
// Page up/Page down
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
} else if (index == 3) {
// Page up/Page down
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
}
return false;
}
#endif

View file

@ -3,34 +3,20 @@
#pragma once #pragma once
#define SPLIT_POINTING_ENABLE
#define SPLIT_TRANSACTION_IDS_KB MODULE_SYNC #define SPLIT_TRANSACTION_IDS_KB MODULE_SYNC
#include_next <mcuconf.h> #include_next <mcuconf.h>
#undef RP_SPI_USE_SPI1
#define RP_SPI_USE_SPI1 TRUE
#undef RP_PWM_USE_PWM5 #undef RP_PWM_USE_PWM5
#define RP_PWM_USE_PWM5 TRUE #define RP_PWM_USE_PWM5 TRUE
#define HAL_USE_PWM TRUE #define HAL_USE_PWM TRUE
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#define SPI_USE_WAIT TRUE
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_COMBINED #define POINTING_DEVICE_COMBINED
// Blank SPI config, otherwise a SPI module won't work as slave #define HLC_BACKLIGHT_TIMEOUT 120000
#if !defined(HLC_SPI_DEVICE)
#define SPI_SCK_PIN GP0 //NOT CONNECTED
#define SPI_MOSI_PIN NO_PIN
#define SPI_MISO_PIN NO_PIN
#undef SPI_SELECT_MODE
#define SPI_SELECT_MODE SPI_SELECT_MODE_NONE
#endif
#if !defined(HLC_TFT_DISPLAY) #if !defined(HLC_TFT_DISPLAY)
#define BACKLIGHT_PIN NO_PIN #define BACKLIGHT_PIN NO_PIN

View file

@ -43,6 +43,20 @@ module_t module;
module_t module = hlc_tft_display; module_t module = hlc_tft_display;
#endif #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) { 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)) { if (initiator2target_buffer_size == sizeof(module)) {
memcpy(&module_master, initiator2target_buffer, sizeof(module_master)); 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 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(); module_housekeeping_task_kb();
housekeeping_task_user(); housekeeping_task_user();

View file

@ -8,11 +8,6 @@
#define HLC_SPI_DEVICE #define HLC_SPI_DEVICE
#define HLC_CIRQUE_TRACKPAD #define HLC_CIRQUE_TRACKPAD
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN GP14
#define SPI_MOSI_PIN GP15
#define SPI_MISO_PIN GP12
#define CIRQUE_PINNACLE_DIAMETER_MM 35 #define CIRQUE_PINNACLE_DIAMETER_MM 35
#define POINTING_DEVICE_CS_PIN GP13 #define POINTING_DEVICE_CS_PIN GP13
#define POINTING_DEVICE_ROTATION_180 #define POINTING_DEVICE_ROTATION_180

View file

@ -8,11 +8,6 @@
#define HLC_SPI_DEVICE #define HLC_SPI_DEVICE
#define HLC_TFT_DISPLAY #define HLC_TFT_DISPLAY
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN GP14
#define SPI_MOSI_PIN GP15
#define SPI_MISO_PIN GP12
// LCD Configuration // LCD Configuration
#define LCD_RST_PIN GP26 #define LCD_RST_PIN GP26
#define LCD_CS_PIN GP13 #define LCD_CS_PIN GP13
@ -40,4 +35,4 @@
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B #define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
// Timeout configuration // Timeout configuration
#define QUANTUM_PAINTER_DISPLAY_TIMEOUT 120000 #define QUANTUM_PAINTER_DISPLAY_TIMEOUT HLC_BACKLIGHT_TIMEOUT

View file

@ -42,7 +42,6 @@ backlight_config_t backlight_config;
static uint16_t lcd_surface_fb[135*240]; static uint16_t lcd_surface_fb[135*240];
bool backlight_off = false;
int color_value = 0; int color_value = 0;
led_t last_led_usb_state = {0}; led_t last_led_usb_state = {0};
@ -243,7 +242,6 @@ void update_display(void) {
// Quantum function // Quantum function
void suspend_power_down_kb(void) { void suspend_power_down_kb(void) {
// backlight_suspend(); Disabled as it gives some weird behavior when rebooting the host
qp_power(lcd, false); qp_power(lcd, false);
suspend_power_down_user(); suspend_power_down_user();
} }
@ -251,22 +249,9 @@ void suspend_power_down_kb(void) {
// Quantum function // Quantum function
void suspend_wakeup_init_kb(void) { void suspend_wakeup_init_kb(void) {
qp_power(lcd, true); qp_power(lcd, true);
// backlight_wakeup(); Disabled as it gives some weird behavior when rebooting the host
suspend_wakeup_init_user(); suspend_wakeup_init_user();
} }
// Timeout handling
void backlight_wakeup(void) {
backlight_off = false;
backlight_enable();
}
// Timeout handling
void backlight_suspend(void) {
backlight_off = true;
backlight_disable();
}
// Called from halcyon.c // Called from halcyon.c
bool module_post_init_kb(void) { bool module_post_init_kb(void) {
setPinOutput(LCD_RST_PIN); setPinOutput(LCD_RST_PIN);
@ -296,14 +281,6 @@ bool module_post_init_kb(void) {
// Called from halcyon.c // Called from halcyon.c
bool display_module_housekeeping_task_kb(bool second_display) { bool display_module_housekeeping_task_kb(bool second_display) {
// Backlight feature
if (backlight_off && last_input_activity_elapsed() <= QUANTUM_PAINTER_DISPLAY_TIMEOUT) {
backlight_wakeup();
}
if (!backlight_off && last_input_activity_elapsed() > QUANTUM_PAINTER_DISPLAY_TIMEOUT) {
backlight_suspend();
}
if(!display_module_housekeeping_task_user(second_display)) { return false; } if(!display_module_housekeeping_task_user(second_display)) { return false; }
if(second_display) { if(second_display) {