From 12a0fc282a8e4f4bb57985bb1e1ccb3b74ba0884 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 18 Jul 2023 12:08:50 +1000 Subject: [PATCH 1/3] deng/thirty: use PWM backlight driver --- keyboards/deng/thirty/config.h | 3 +++ keyboards/deng/thirty/halconf.h | 20 ++++++++++++++++++++ keyboards/deng/thirty/info.json | 1 - keyboards/deng/thirty/mcuconf.h | 21 +++++++++++++++++++++ keyboards/deng/thirty/thirty.c | 5 +++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 keyboards/deng/thirty/halconf.h create mode 100644 keyboards/deng/thirty/mcuconf.h diff --git a/keyboards/deng/thirty/config.h b/keyboards/deng/thirty/config.h index d80983202fb0..20e6673dd2ce 100644 --- a/keyboards/deng/thirty/config.h +++ b/keyboards/deng/thirty/config.h @@ -15,6 +15,9 @@ */ #pragma once +#define BACKLIGHT_PWM_DRIVER PWMD2 +#define BACKLIGHT_PWM_CHANNEL 4 + /* RGB Matrix */ #ifdef RGB_MATRIX_ENABLE #define RGB_MATRIX_LED_COUNT 30 diff --git a/keyboards/deng/thirty/halconf.h b/keyboards/deng/thirty/halconf.h new file mode 100644 index 000000000000..b107a87e75af --- /dev/null +++ b/keyboards/deng/thirty/halconf.h @@ -0,0 +1,20 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#define HAL_USE_PWM TRUE + +#include_next diff --git a/keyboards/deng/thirty/info.json b/keyboards/deng/thirty/info.json index 1d9b018e6bbc..59f361621592 100644 --- a/keyboards/deng/thirty/info.json +++ b/keyboards/deng/thirty/info.json @@ -17,7 +17,6 @@ }, "diode_direction": "COL2ROW", "backlight": { - "driver": "software", "pin": "B11", "levels": 5, "on_state": 0 diff --git a/keyboards/deng/thirty/mcuconf.h b/keyboards/deng/thirty/mcuconf.h new file mode 100644 index 000000000000..8ff617051f0d --- /dev/null +++ b/keyboards/deng/thirty/mcuconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 TRUE diff --git a/keyboards/deng/thirty/thirty.c b/keyboards/deng/thirty/thirty.c index 2e582d68337a..7d49bc1b036f 100644 --- a/keyboards/deng/thirty/thirty.c +++ b/keyboards/deng/thirty/thirty.c @@ -46,3 +46,8 @@ led_config_t g_led_config = { }; #endif + +void board_init(void) { + // Remap B11 AF to TIM2_CH4 + AFIO->MAPR |= AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2; +} From 6ffe64ebeb23df7749dee289bfcc485ae02d71d6 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 18 Jul 2023 12:09:57 +1000 Subject: [PATCH 2/3] handwired/riblee_f401: use PWM backlight driver --- keyboards/handwired/riblee_f401/config.h | 3 +++ keyboards/handwired/riblee_f401/halconf.h | 3 ++- keyboards/handwired/riblee_f401/info.json | 1 - keyboards/handwired/riblee_f401/mcuconf.h | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 keyboards/handwired/riblee_f401/mcuconf.h diff --git a/keyboards/handwired/riblee_f401/config.h b/keyboards/handwired/riblee_f401/config.h index c39cbc87f5e9..3e384e5b5b36 100644 --- a/keyboards/handwired/riblee_f401/config.h +++ b/keyboards/handwired/riblee_f401/config.h @@ -16,4 +16,7 @@ #pragma once +#define BACKLIGHT_PWM_DRIVER PWMD5 +#define BACKLIGHT_PWM_CHANNEL 1 + #define MOUSEKEY_INTERVAL 32 diff --git a/keyboards/handwired/riblee_f401/halconf.h b/keyboards/handwired/riblee_f401/halconf.h index 3c20471df1a0..b537d56c2687 100644 --- a/keyboards/handwired/riblee_f401/halconf.h +++ b/keyboards/handwired/riblee_f401/halconf.h @@ -23,5 +23,6 @@ #define SERIAL_USB_BUFFERS_SIZE 256 -#include_next +#define HAL_USE_PWM TRUE +#include_next diff --git a/keyboards/handwired/riblee_f401/info.json b/keyboards/handwired/riblee_f401/info.json index 4ff8ec21f63a..933973d5f39a 100644 --- a/keyboards/handwired/riblee_f401/info.json +++ b/keyboards/handwired/riblee_f401/info.json @@ -17,7 +17,6 @@ }, "diode_direction": "COL2ROW", "backlight": { - "driver": "software", "pin": "A0", "levels": 5 }, diff --git a/keyboards/handwired/riblee_f401/mcuconf.h b/keyboards/handwired/riblee_f401/mcuconf.h new file mode 100644 index 000000000000..674f5e362fa4 --- /dev/null +++ b/keyboards/handwired/riblee_f401/mcuconf.h @@ -0,0 +1,6 @@ +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM5 +#define STM32_PWM_USE_TIM5 TRUE From 1ecbbb4474f1abfbcb1ff7c4e5d77e80dba02141 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 18 Jul 2023 12:11:22 +1000 Subject: [PATCH 3/3] handwired/pill60: remove backlight config --- keyboards/handwired/pill60/blackpill_f401/halconf.h | 3 --- keyboards/handwired/pill60/blackpill_f401/mcuconf.h | 3 --- keyboards/handwired/pill60/blackpill_f411/halconf.h | 3 --- keyboards/handwired/pill60/blackpill_f411/mcuconf.h | 3 --- keyboards/handwired/pill60/bluepill/halconf.h | 3 --- keyboards/handwired/pill60/bluepill/mcuconf.h | 4 ---- keyboards/handwired/pill60/info.json | 5 ----- keyboards/handwired/pill60/rules.mk | 3 +-- 8 files changed, 1 insertion(+), 26 deletions(-) diff --git a/keyboards/handwired/pill60/blackpill_f401/halconf.h b/keyboards/handwired/pill60/blackpill_f401/halconf.h index 1e126a8656ac..b2ef07f1c936 100644 --- a/keyboards/handwired/pill60/blackpill_f401/halconf.h +++ b/keyboards/handwired/pill60/blackpill_f401/halconf.h @@ -23,7 +23,4 @@ #define HAL_USE_I2C TRUE -#define HAL_USE_PWM TRUE - #include_next - diff --git a/keyboards/handwired/pill60/blackpill_f401/mcuconf.h b/keyboards/handwired/pill60/blackpill_f401/mcuconf.h index ab89514fb1c7..563b86d26db1 100644 --- a/keyboards/handwired/pill60/blackpill_f401/mcuconf.h +++ b/keyboards/handwired/pill60/blackpill_f401/mcuconf.h @@ -19,6 +19,3 @@ #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE - -#undef STM32_PWM_USE_TIM5 -#define STM32_PWM_USE_TIM5 TRUE \ No newline at end of file diff --git a/keyboards/handwired/pill60/blackpill_f411/halconf.h b/keyboards/handwired/pill60/blackpill_f411/halconf.h index 435bf3274e98..f563693fac76 100644 --- a/keyboards/handwired/pill60/blackpill_f411/halconf.h +++ b/keyboards/handwired/pill60/blackpill_f411/halconf.h @@ -23,7 +23,4 @@ #define HAL_USE_I2C TRUE -#define HAL_USE_PWM TRUE - #include_next - diff --git a/keyboards/handwired/pill60/blackpill_f411/mcuconf.h b/keyboards/handwired/pill60/blackpill_f411/mcuconf.h index ab89514fb1c7..563b86d26db1 100644 --- a/keyboards/handwired/pill60/blackpill_f411/mcuconf.h +++ b/keyboards/handwired/pill60/blackpill_f411/mcuconf.h @@ -19,6 +19,3 @@ #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE - -#undef STM32_PWM_USE_TIM5 -#define STM32_PWM_USE_TIM5 TRUE \ No newline at end of file diff --git a/keyboards/handwired/pill60/bluepill/halconf.h b/keyboards/handwired/pill60/bluepill/halconf.h index 459ec86e2da1..d423df151290 100644 --- a/keyboards/handwired/pill60/bluepill/halconf.h +++ b/keyboards/handwired/pill60/bluepill/halconf.h @@ -23,7 +23,4 @@ #define HAL_USE_I2C TRUE -#define HAL_USE_PWM TRUE - #include_next - diff --git a/keyboards/handwired/pill60/bluepill/mcuconf.h b/keyboards/handwired/pill60/bluepill/mcuconf.h index 22f8b02704ce..f335353541ca 100644 --- a/keyboards/handwired/pill60/bluepill/mcuconf.h +++ b/keyboards/handwired/pill60/bluepill/mcuconf.h @@ -26,9 +26,5 @@ #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE -#undef STM32_PWM_USE_TIM2 -#define STM32_PWM_USE_TIM2 TRUE - #undef STM32_SPI_USE_SPI2 #define STM32_SPI_USE_SPI2 FALSE - diff --git a/keyboards/handwired/pill60/info.json b/keyboards/handwired/pill60/info.json index 6cc337f8eee1..ac8c9013ba93 100644 --- a/keyboards/handwired/pill60/info.json +++ b/keyboards/handwired/pill60/info.json @@ -13,11 +13,6 @@ {"pin_a": "B9", "pin_b": "B8", "resolution": 2} ] }, - "backlight": { - "driver": "software", - "pin": "B14", - "levels": 5 - }, "debounce": 1, "layouts": { "LAYOUT": { diff --git a/keyboards/handwired/pill60/rules.mk b/keyboards/handwired/pill60/rules.mk index f8bae6b6dfad..f7d65c56c2cd 100644 --- a/keyboards/handwired/pill60/rules.mk +++ b/keyboards/handwired/pill60/rules.mk @@ -7,10 +7,9 @@ EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Enable N-Key Rollover -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output -SLEEP_LED_ENABLE = yes OLED_ENABLE = yes OLED_DRIVER = SSD1306 ENCODER_ENABLE = yes