From dc53809625dfb96bffb313dd76085dfc0024a6b5 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 9 Aug 2023 10:39:36 +0800 Subject: [PATCH 1/2] [Core] Allow customizing PWM frequency Some frequencies can cause audible noise. Changing the frequency eliminates that. Signed-off-by: Daniel Schaefer --- platforms/chibios/chibios_config.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h index 52632a051ed2..594e99b19feb 100644 --- a/platforms/chibios/chibios_config.h +++ b/platforms/chibios/chibios_config.h @@ -37,7 +37,9 @@ # define BACKLIGHT_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) # endif # define BACKLIGHT_PWM_COUNTER_FREQUENCY 1000000 -# define BACKLIGHT_PWM_PERIOD BACKLIGHT_PWM_COUNTER_FREQUENCY / 2048 +# ifndef BACKLIGHT_PWM_PERIOD +# define BACKLIGHT_PWM_PERIOD BACKLIGHT_PWM_COUNTER_FREQUENCY / 2048 +# endif # ifndef AUDIO_PWM_PAL_MODE # define AUDIO_PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) From 90d8a7ccf33a2d76ead8140eb2e2a28108370266 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 10 Aug 2023 13:15:05 +0800 Subject: [PATCH 2/2] docs/feature-backlight: Mention PWM frequency Signed-off-by: Daniel Schaefer --- docs/feature_backlight.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index 24057c608f8c..59bb40dc9c31 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md @@ -73,6 +73,7 @@ To configure the backlighting, `#define` these in your `config.h`: |`BACKLIGHT_LIMIT_VAL` |`255` |The maximum duty cycle of the backlight -- `255` allows for full brightness, any lower will decrease the maximum.| |`BACKLIGHT_DEFAULT_LEVEL` |`BACKLIGHT_LEVELS`|The default backlight level to use upon clearing the EEPROM | |`BACKLIGHT_DEFAULT_BREATHING`|*Not defined* |Whether to enable backlight breathing upon clearing the EEPROM | +|`BACKLIGHT_PWM_PERIOD` |2048Hz |Defaults to `BACKLIGHT_PWM_COUNTER_FREQUENCY / 2048`, which results in a PWM frequency of 2048Hz. | Unless you are designing your own keyboard, you generally should not need to change the `BACKLIGHT_PIN` or `BACKLIGHT_ON_STATE`.