Skip to content

Commit

Permalink
Fix backlight support for some boards (qmk#21554)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and akeep committed Oct 2, 2023
1 parent 4026f13 commit 2dee5e8
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 29 deletions.
3 changes: 3 additions & 0 deletions keyboards/deng/thirty/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions keyboards/deng/thirty/halconf.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
#pragma once

#define HAL_USE_PWM TRUE

#include_next <halconf.h>
1 change: 0 additions & 1 deletion keyboards/deng/thirty/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"diode_direction": "COL2ROW",
"backlight": {
"driver": "software",
"pin": "B11",
"levels": 5,
"on_state": 0
Expand Down
21 changes: 21 additions & 0 deletions keyboards/deng/thirty/mcuconf.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
#pragma once

#include_next <mcuconf.h>

#undef STM32_PWM_USE_TIM2
#define STM32_PWM_USE_TIM2 TRUE
5 changes: 5 additions & 0 deletions keyboards/deng/thirty/thirty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 0 additions & 3 deletions keyboards/handwired/pill60/blackpill_f401/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@

#define HAL_USE_I2C TRUE

#define HAL_USE_PWM TRUE

#include_next <halconf.h>

3 changes: 0 additions & 3 deletions keyboards/handwired/pill60/blackpill_f401/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions keyboards/handwired/pill60/blackpill_f411/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@

#define HAL_USE_I2C TRUE

#define HAL_USE_PWM TRUE

#include_next <halconf.h>

3 changes: 0 additions & 3 deletions keyboards/handwired/pill60/blackpill_f411/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions keyboards/handwired/pill60/bluepill/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@

#define HAL_USE_I2C TRUE

#define HAL_USE_PWM TRUE

#include_next <halconf.h>

4 changes: 0 additions & 4 deletions keyboards/handwired/pill60/bluepill/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

5 changes: 0 additions & 5 deletions keyboards/handwired/pill60/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
{"pin_a": "B9", "pin_b": "B8", "resolution": 2}
]
},
"backlight": {
"driver": "software",
"pin": "B14",
"levels": 5
},
"debounce": 1,
"layouts": {
"LAYOUT": {
Expand Down
3 changes: 1 addition & 2 deletions keyboards/handwired/pill60/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions keyboards/handwired/riblee_f401/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_PWM_CHANNEL 1

#define MOUSEKEY_INTERVAL 32
3 changes: 2 additions & 1 deletion keyboards/handwired/riblee_f401/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@

#define SERIAL_USB_BUFFERS_SIZE 256

#include_next <halconf.h>
#define HAL_USE_PWM TRUE

#include_next <halconf.h>
1 change: 0 additions & 1 deletion keyboards/handwired/riblee_f401/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"diode_direction": "COL2ROW",
"backlight": {
"driver": "software",
"pin": "A0",
"levels": 5
},
Expand Down
6 changes: 6 additions & 0 deletions keyboards/handwired/riblee_f401/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

#include_next <mcuconf.h>

#undef STM32_PWM_USE_TIM5
#define STM32_PWM_USE_TIM5 TRUE

0 comments on commit 2dee5e8

Please sign in to comment.