tidy up code and fix backlight bug

This commit is contained in:
VeyPatch 2024-12-03 17:18:20 +01:00
parent 29cd17cdbc
commit 27e9b17189
10 changed files with 23 additions and 51 deletions

View file

@ -11,18 +11,18 @@
#define RP_PWM_USE_PWM5 TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_SPI TRUE
#define SPLIT_POINTING_ENABLE
#define POINTING_DEVICE_COMBINED
#define HLC_BACKLIGHT_TIMEOUT 120000
#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_LEVELS 10
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
#if !defined(HLC_TFT_DISPLAY)
#define BACKLIGHT_PIN NO_PIN
#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_LEVELS 10
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
#endif
#if !defined(HLC_CIRQUE_TRACKPAD)

View file

@ -1,13 +1,9 @@
// Copyright 2024 splitkb.com (support@splitkb.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "halcyon.h"
#include "transactions.h"
#include "print.h"
#include "split_util.h"
#include "pointing_device.h"
__attribute__((weak)) bool module_post_init_kb(void) {
return module_post_init_user();
@ -49,6 +45,9 @@ bool backlight_off = false;
void backlight_wakeup(void) {
backlight_off = false;
backlight_enable();
if (get_backlight_level() == 0) {
backlight_level(BACKLIGHT_LEVELS);
}
}
// Timeout handling
@ -79,6 +78,8 @@ void housekeeping_task_kb(void) {
static bool synced = 0;
if(is_transport_connected() && synced == 0) {
transaction_rpc_send(MODULE_SYNC, sizeof(module), &module); // Sync to slave
// Good moment to make sure the backlight wakes up after boot for both halves
backlight_wakeup();
synced = 1;
}
display_module_housekeeping_task_kb(false); // Is master so can never be the second display

View file

@ -1,7 +1,3 @@
CURRENT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
SPI_DRIVER_REQUIRED = yes
POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi
CONFIG_H += $(CURRENT_DIR)/config.h

View file

@ -1,11 +1,7 @@
// Copyright 2024 splitkb.com (support@splitkb.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "util.h"
#include "split_util.h"
#include "matrix.h"
#include "debounce.h"
#include "atomic_util.h"
#ifdef SPLIT_KEYBOARD

View file

@ -29,9 +29,6 @@
// Backlight configuration
#define BACKLIGHT_PIN GP27
#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_LEVELS 10
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
// Timeout configuration
#define QUANTUM_PAINTER_DISPLAY_TIMEOUT HLC_BACKLIGHT_TIMEOUT

View file

@ -1,17 +1,10 @@
// Copyright 2024 splitkb.com (support@splitkb.com)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "halcyon.h"
#include "hlc_tft_display.h"
#include "config.h"
#include "qp.h"
#include "qp_comms.h"
#include "qp_surface.h"
#include "qp_st77xx_opcodes.h"
#include "split_util.h"
#include <time.h>
// Fonts mono2

View file

@ -1,15 +1,9 @@
CURRENT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
QUANTUM_PAINTER_ENABLE = yes
QUANTUM_PAINTER_DRIVERS += st7789_spi surface
BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = pwm
SRC += $(CURRENT_DIR)/hlc_tft_display.c
CONFIG_H += $(CURRENT_DIR)/config.h
# Fonts
SRC += $(CURRENT_DIR)/graphics/fonts/Retron2000-27.qff.c $(CURRENT_DIR)/graphics/fonts/Retron2000-underline-27.qff.c
# Numbers in image format
SRC += $(CURRENT_DIR)/graphics/numbers/0.qgf.c $(CURRENT_DIR)/graphics/numbers/1.qgf.c $(CURRENT_DIR)/graphics/numbers/2.qgf.c $(CURRENT_DIR)/graphics/numbers/3.qgf.c $(CURRENT_DIR)/graphics/numbers/4.qgf.c $(CURRENT_DIR)/graphics/numbers/5.qgf.c $(CURRENT_DIR)/graphics/numbers/6.qgf.c $(CURRENT_DIR)/graphics/numbers/7.qgf.c $(CURRENT_DIR)/graphics/numbers/8.qgf.c $(CURRENT_DIR)/graphics/numbers/9.qgf.c $(CURRENT_DIR)/graphics/numbers/undef.qgf.c
CONFIG_H += $(CURRENT_DIR)/config.h
SRC += $(CURRENT_DIR)/graphics/numbers/0.qgf.c $(CURRENT_DIR)/graphics/numbers/1.qgf.c $(CURRENT_DIR)/graphics/numbers/2.qgf.c $(CURRENT_DIR)/graphics/numbers/3.qgf.c $(CURRENT_DIR)/graphics/numbers/4.qgf.c $(CURRENT_DIR)/graphics/numbers/5.qgf.c $(CURRENT_DIR)/graphics/numbers/6.qgf.c $(CURRENT_DIR)/graphics/numbers/7.qgf.c $(CURRENT_DIR)/graphics/numbers/8.qgf.c $(CURRENT_DIR)/graphics/numbers/9.qgf.c $(CURRENT_DIR)/graphics/numbers/undef.qgf.c

View file

@ -4,21 +4,16 @@ SRC += halcyon.c
LTO_ENABLE ?= yes
ifndef HLC_CIRQUE_TRACKPAD #add any other pointing devices here
# Needed otherwise pointing devices will not work
POINTING_DEVICE_ENABLE = yes
# cirque defined here as otherwise sensitivity on slave is way too high
# may need to be changed when we start supporting other pointing devices
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi
endif
# May need to be changed when adding more pointing devices
POINTING_DEVICE_ENABLE = yes
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi
ifndef HLC_TFT_DISPLAY #add any other displays here
# Needed otherwise displays will not work
QUANTUM_PAINTER_ENABLE = yes
QUANTUM_PAINTER_DRIVERS += st7789_spi
BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = pwm
endif
# May need to be changed when adding more displays
QUANTUM_PAINTER_ENABLE = yes
QUANTUM_PAINTER_DRIVERS += st7789_spi surface
BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = pwm
ifdef HLC_ENCODER
include $(CURRENT_DIR)/hlc_encoder/rules.mk