From de751501b6210dbc603984572be526089f102b91 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 20 Dec 2022 18:46:45 +0800 Subject: [PATCH] lotus: Implement single-zone backlight Signed-off-by: Daniel Schaefer --- keyboards/lotus/config.h | 7 +++++++ keyboards/lotus/halconf.h | 3 +++ keyboards/lotus/info.json | 3 +++ keyboards/lotus/mcuconf.h | 4 ++++ keyboards/lotus/rules.mk | 8 +++++++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/keyboards/lotus/config.h b/keyboards/lotus/config.h index d9699507da..0e1cf6e538 100644 --- a/keyboards/lotus/config.h +++ b/keyboards/lotus/config.h @@ -4,6 +4,8 @@ #pragma once +#include + #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25 #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U @@ -22,6 +24,11 @@ #define DRIVER_COUNT 1 #define RGB_MATRIX_LED_COUNT 78 +// PWM single one backlight configuration +// The RP2040 datasheet says GPIO25 maps to PWM channel 4B +#define BACKLIGHT_PWM_DRIVER PWMD4 +#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B + /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST diff --git a/keyboards/lotus/halconf.h b/keyboards/lotus/halconf.h index 6b60c85ea3..723c91b9ab 100644 --- a/keyboards/lotus/halconf.h +++ b/keyboards/lotus/halconf.h @@ -5,4 +5,7 @@ #define HAL_USE_SIO TRUE +// For single-zone backlight +#define HAL_USE_PWM TRUE + #include_next diff --git a/keyboards/lotus/info.json b/keyboards/lotus/info.json index 5d3e979606..6f00f28184 100644 --- a/keyboards/lotus/info.json +++ b/keyboards/lotus/info.json @@ -26,6 +26,9 @@ "pid": "0x0013", "vid": "0x32AC" }, + "backlight": { + "pin": "GP25" + }, "rgblight": { "led_count": 12, "pin": "GP6", diff --git a/keyboards/lotus/mcuconf.h b/keyboards/lotus/mcuconf.h index 9533540683..f3b79dc984 100644 --- a/keyboards/lotus/mcuconf.h +++ b/keyboards/lotus/mcuconf.h @@ -9,3 +9,7 @@ #define RP_SIO_USE_UART0 TRUE #undef RP_SIO_USE_UART1 #define RP_SIO_USE_UART1 FALSE + +// For single-zone backlight +#undef RP_PWM_USE_PWM4 +#define RP_PWM_USE_PWM4 TRUE diff --git a/keyboards/lotus/rules.mk b/keyboards/lotus/rules.mk index 106a8b30b3..b89b045f60 100644 --- a/keyboards/lotus/rules.mk +++ b/keyboards/lotus/rules.mk @@ -1,6 +1,12 @@ WS2812_DRIVER = vendor SERIAL_DRIVER = vendor -#RGB_MATRIX_ENABLE = false + +# Backlight for one variant +BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = pwm + +# TODO: Enable RGB matrix for one variant +RGB_MATRIX_ENABLE = no RGB_MATRIX_DRIVER = IS31FL3745 # Custom matrix scanning code via ADC