From 996a9006d3f101dc5c48b58339e2e7323040fd59 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Tue, 4 Oct 2022 23:10:24 +0200 Subject: [Core] PWM Backlight for RP2040 (#17706) --- keyboards/handwired/onekey/blackpill_f401/config.h | 1 + keyboards/handwired/onekey/blackpill_f411/config.h | 1 + keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h | 1 + keyboards/handwired/onekey/rp2040/config.h | 3 +++ keyboards/handwired/onekey/rp2040/halconf.h | 9 +++++++++ keyboards/handwired/onekey/rp2040/info.json | 5 ++++- keyboards/handwired/onekey/rp2040/mcuconf.h | 9 +++++++++ 7 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 keyboards/handwired/onekey/rp2040/halconf.h create mode 100644 keyboards/handwired/onekey/rp2040/mcuconf.h (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/onekey/blackpill_f401/config.h b/keyboards/handwired/onekey/blackpill_f401/config.h index 4e9552480f..05f3f07763 100644 --- a/keyboards/handwired/onekey/blackpill_f401/config.h +++ b/keyboards/handwired/onekey/blackpill_f401/config.h @@ -20,6 +20,7 @@ #define BACKLIGHT_PWM_DRIVER PWMD5 #define BACKLIGHT_PWM_CHANNEL 1 +#define BACKLIGHT_PAL_MODE 2 #define ADC_PIN A0 diff --git a/keyboards/handwired/onekey/blackpill_f411/config.h b/keyboards/handwired/onekey/blackpill_f411/config.h index b97df0c666..c890043b09 100644 --- a/keyboards/handwired/onekey/blackpill_f411/config.h +++ b/keyboards/handwired/onekey/blackpill_f411/config.h @@ -20,6 +20,7 @@ #define BACKLIGHT_PWM_DRIVER PWMD5 #define BACKLIGHT_PWM_CHANNEL 1 +#define BACKLIGHT_PAL_MODE 2 #define ADC_PIN A0 diff --git a/keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h b/keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h index c8800fa163..2b60320fc1 100755 --- a/keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h +++ b/keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h @@ -20,6 +20,7 @@ #define BACKLIGHT_PWM_DRIVER PWMD5 #define BACKLIGHT_PWM_CHANNEL 1 +#define BACKLIGHT_PAL_MODE 2 #define ADC_PIN A0 diff --git a/keyboards/handwired/onekey/rp2040/config.h b/keyboards/handwired/onekey/rp2040/config.h index bcf4047a4f..82c5592dc9 100644 --- a/keyboards/handwired/onekey/rp2040/config.h +++ b/keyboards/handwired/onekey/rp2040/config.h @@ -13,3 +13,6 @@ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25 #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U + +#define BACKLIGHT_PWM_DRIVER PWMD4 +#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B diff --git a/keyboards/handwired/onekey/rp2040/halconf.h b/keyboards/handwired/onekey/rp2040/halconf.h new file mode 100644 index 0000000000..5890122e5e --- /dev/null +++ b/keyboards/handwired/onekey/rp2040/halconf.h @@ -0,0 +1,9 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_PWM TRUE + +#include_next diff --git a/keyboards/handwired/onekey/rp2040/info.json b/keyboards/handwired/onekey/rp2040/info.json index b34a1cc206..32bde911bb 100644 --- a/keyboards/handwired/onekey/rp2040/info.json +++ b/keyboards/handwired/onekey/rp2040/info.json @@ -6,7 +6,10 @@ "cols": ["GP4"], "rows": ["GP5"] }, + "backlight": { + "pin": "GP25" + }, "rgblight": { - "pin": "A1" + "pin": "GP25" } } diff --git a/keyboards/handwired/onekey/rp2040/mcuconf.h b/keyboards/handwired/onekey/rp2040/mcuconf.h new file mode 100644 index 0000000000..86f821640f --- /dev/null +++ b/keyboards/handwired/onekey/rp2040/mcuconf.h @@ -0,0 +1,9 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next "mcuconf.h" + +#undef RP_PWM_USE_PWM4 +#define RP_PWM_USE_PWM4 TRUE -- cgit v1.2.3