Skip to content

Commit cb23317

Browse files
authored
Relocate backlight drivers (qmk#21444)
1 parent 636093f commit cb23317

File tree

41 files changed

+17
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+17
-164
lines changed

builddefs/common_features.mk

+6-6
Original file line numberDiff line numberDiff line change
@@ -565,18 +565,18 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
565565
endif
566566

567567
COMMON_VPATH += $(QUANTUM_DIR)/backlight
568+
COMMON_VPATH += $(DRIVER_PATH)/backlight
568569
SRC += $(QUANTUM_DIR)/backlight/backlight.c
569570
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
570571
OPT_DEFS += -DBACKLIGHT_ENABLE
571572

572-
ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
573-
OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
574-
else
573+
ifneq ($(strip $(BACKLIGHT_DRIVER)), custom)
575574
SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
576-
ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
577-
SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c
575+
576+
ifeq ($(strip $(BACKLIGHT_DRIVER)), software)
577+
SRC += $(DRIVER_PATH)/backlight/backlight_software.c
578578
else
579-
SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
579+
SRC += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/backlight_$(strip $(BACKLIGHT_DRIVER)).c
580580
endif
581581
endif
582582
endif

quantum/backlight/backlight_software.c drivers/backlight/backlight_software.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "quantum.h"
21
#include "backlight.h"
32
#include "backlight_driver_common.h"
3+
#include "util.h"
44

55
#ifdef BACKLIGHT_BREATHING
66
# error "Backlight breathing is not available for software PWM. Please disable."

keyboards/4pplet/eagle_viper_rep/rev_a/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818

1919
#define BACKLIGHT_PWM_DRIVER PWMD2
2020
#define BACKLIGHT_PWM_CHANNEL 4
21-
#define BACKLIGHT_PAL_MODE 2
2221

2322
/* Underglow */
2423
#define WS2812_SPI SPID1

keyboards/acheron/athena/alpha/alpha.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void board_init(void) {
2323

2424
void keyboard_post_init_kb(void){
2525
// Defining the backlight pin (A6) as an floating (no pullup or pulldown resistor) opendrain output pin
26-
palSetLineMode(BACKLIGHT_PIN, PAL_MODE_ALTERNATE(BACKLIGHT_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
26+
palSetLineMode(BACKLIGHT_PIN, PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
2727
}
2828

2929
void led_init_ports(void) {

keyboards/acheron/athena/alpha/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

2323
#define BACKLIGHT_PWM_DRIVER PWMD3
2424
#define BACKLIGHT_PWM_CHANNEL 1
25-
#define BACKLIGHT_PAL_MODE 2
2625

2726
#define RGBLIGHT_EFFECT_BREATHING
2827
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/acheron/athena/beta/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
#define LOCKING_RESYNC_ENABLE
2222

2323
#define BACKLIGHT_PWM_DRIVER PWMD3
24-
#define BACKLIGHT_PWM_CHANNEL 3
25-
#define BACKLIGHT_PAL_MODE 2
2624

2725
#define RGBLIGHT_EFFECT_BREATHING
2826
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/acheron/shark/alpha/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
#pragma once
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
2221

2322
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
2423
#define LOCKING_SUPPORT_ENABLE

keyboards/acheron/shark/beta/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2222

2323
#define BACKLIGHT_PWM_DRIVER PWMD3
2424
#define BACKLIGHT_PWM_CHANNEL 1
25-
#define BACKLIGHT_PAL_MODE 2
2625

2726
#define RGBLIGHT_EFFECT_BREATHING
2827
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/checkerboards/nop60/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Copyright 2021 Nathan Spears
1717

1818
#pragma once
1919

20-
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
2220
// ws2812 options
2321
#define RGBLIGHT_EFFECT_BREATHING
2422
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/ebastler/e80_1800/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#define BACKLIGHT_PWM_DRIVER PWMD1
1818
#define BACKLIGHT_PWM_CHANNEL 2
19-
#define BACKLIGHT_PAL_MODE 2
20-
2119

2220
#ifdef OLED_ENABLE
2321

keyboards/ebastler/isometria_75/rev1/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
/* Backlight */
2121
#define BACKLIGHT_PWM_DRIVER PWMD1
2222
#define BACKLIGHT_PWM_CHANNEL 2
23-
#define BACKLIGHT_PAL_MODE 2
2423
#define BACKLIGHT_PWM_OUTPUT_FREQUENCY 1000 // Increases backlight PWM freq if compiled with an unmerged PR. Does no harm without it.
2524

2625
/* Underglow */

keyboards/geonworks/frogmini/fms/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
#pragma once
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD1
21-
#define BACKLIGHT_PWM_CHANNEL 3
2221
#define BACKLIGHT_PAL_MODE 1
2322

2423
#define I2C_DRIVER I2CD1

keyboards/handwired/onekey/blackpill_f401/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD5
2121
#define BACKLIGHT_PWM_CHANNEL 1
22-
#define BACKLIGHT_PAL_MODE 2
2322

2423
#define ADC_PIN A0
2524

keyboards/handwired/onekey/blackpill_f401_tinyuf2/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD5
2121
#define BACKLIGHT_PWM_CHANNEL 1
22-
#define BACKLIGHT_PAL_MODE 2
2322

2423
#define ADC_PIN A0
2524

keyboards/handwired/onekey/blackpill_f411/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD5
2121
#define BACKLIGHT_PWM_CHANNEL 1
22-
#define BACKLIGHT_PAL_MODE 2
2322

2423
#define ADC_PIN A0
2524

keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD5
2121
#define BACKLIGHT_PWM_CHANNEL 1
22-
#define BACKLIGHT_PAL_MODE 2
2322

2423
#define ADC_PIN A0
2524

keyboards/handwired/onekey/evb_wb32f3g71/config.h

-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33

44
#pragma once
55

6-
76
#define ADC_PIN A0
87

9-
#define BACKLIGHT_PWM_DRIVER PWMD4
10-
#define BACKLIGHT_PWM_CHANNEL 3
11-
#define BACKLIGHT_PAL_MODE 2
12-
138
#define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))
149

1510
#define SOLENOID_PIN B12

keyboards/handwired/onekey/evb_wb32fq95/config.h

-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33

44
#pragma once
55

6-
76
#define ADC_PIN A0
87

9-
#define BACKLIGHT_PWM_DRIVER PWMD4
10-
#define BACKLIGHT_PWM_CHANNEL 3
11-
#define BACKLIGHT_PAL_MODE 2
12-
138
#define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))
149

1510
#define SOLENOID_PIN B12

keyboards/handwired/onekey/nucleo_f446re/config.h

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// SPDX-License-Identifier: GPL-2.0-or-later
33
#pragma once
44

5-
6-
#define BACKLIGHT_PWM_DRIVER PWMD4
7-
#define BACKLIGHT_PWM_CHANNEL 3
8-
#define BACKLIGHT_PAL_MODE 2
9-
105
#define ADC_PIN A0
116

127
#define SOLENOID_PINS { B12, B13, B14, B15 }

keyboards/handwired/onekey/nucleo_l432kc/config.h

-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22
// SPDX-License-Identifier: GPL-2.0-or-later
33
#pragma once
44

5-
6-
#define BACKLIGHT_PWM_DRIVER PWMD4
7-
#define BACKLIGHT_PWM_CHANNEL 3
8-
#define BACKLIGHT_PAL_MODE 2
9-
105
#define ADC_PIN A0

keyboards/handwired/onekey/proton_c/config.h

-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,4 @@
1616

1717
#pragma once
1818

19-
20-
#define BACKLIGHT_PWM_DRIVER PWMD4
21-
#define BACKLIGHT_PWM_CHANNEL 3
22-
#define BACKLIGHT_PAL_MODE 2
23-
2419
#define ADC_PIN A0

keyboards/handwired/onekey/rp2040/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25
1414
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
1515

16-
#define BACKLIGHT_PWM_DRIVER PWMD4
1716
#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_B
1817

1918
#define AUDIO_PIN GP16

keyboards/handwired/onekey/stm32f0_disco/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
#pragma once
1818

19-
2019
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
2220
#define BACKLIGHT_PAL_MODE 0
2321

2422
#define ADC_PIN A0

keyboards/handwired/pill60/config.h

-19
This file was deleted.

keyboards/linworks/fave104/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD2
2121
#define BACKLIGHT_PWM_CHANNEL 2
22-
#define BACKLIGHT_PAL_MODE 2
2322
#define BACKLIGHT_PWM_OUTPUT_FREQUENCY 1000 // Increases backlight PWM freq if compiled with an unmerged PR. Does no harm without it.

keyboards/linworks/whale75/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
#pragma once
1616

1717
#define BACKLIGHT_PWM_DRIVER PWMD1
18-
#define BACKLIGHT_PWM_CHANNEL 3
1918
#define BACKLIGHT_PAL_MODE 6
2019
#define BACKLIGHT_PWM_OUTPUT_FREQUENCY 1000 // Increases backlight PWM freq if compiled with an unmerged PR. Does no harm without it.
2120

keyboards/mechlovin/adelais/standard_led/arm/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
#pragma once
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
2221

2322
#define RGBLIGHT_EFFECT_BREATHING
2423
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/mechlovin/hannah65/config.h

-21
This file was deleted.

keyboards/mechlovin/hex4b/rev2/config.h

-20
This file was deleted.

keyboards/mechlovin/hex6c/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
#pragma once
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
2221

2322
#define WEAR_LEVELING_BACKING_SIZE 4096
2423
#define WEAR_LEVELING_LOGICAL_SIZE 2048

keyboards/mechlovin/infinity87/rev1/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@
1717
#pragma once
1818

1919
#define BACKLIGHT_PWM_DRIVER PWMD3
20-
#define BACKLIGHT_PWM_CHANNEL 3

keyboards/mechlovin/infinity88/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
#pragma once
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
2221

2322
/*== all animations enable ==*/#define RGBLIGHT_EFFECT_BREATHING
2423
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

keyboards/mechlovin/mechlovin9/rev1/config.h

-21
This file was deleted.

keyboards/mechlovin/tmkl/config.h

-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
#pragma once
1919

20-
#define BACKLIGHT_PWM_DRIVER PWMD3
21-
#define BACKLIGHT_PWM_CHANNEL 3
22-
2320
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
2421
#define LOCKING_SUPPORT_ENABLE

keyboards/mode/m75s/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
#define BACKLIGHT_DEFAULT_LEVEL 20
2121
#define BACKLIGHT_PWM_DRIVER PWMD3
2222
#define BACKLIGHT_PWM_CHANNEL 1
23-
#define BACKLIGHT_PAL_MODE 2
2423

2524
#define WEAR_LEVELING_LOGICAL_SIZE 2048
2625
#define WEAR_LEVELING_BACKING_SIZE 4096

keyboards/smithrune/iron165r2/f411/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

2020
#define BACKLIGHT_PWM_DRIVER PWMD3
2121
#define BACKLIGHT_PWM_CHANNEL 1
22-
#define BACKLIGHT_PAL_MODE 2
2322

2423
#define RGBLIGHT_EFFECT_BREATHING
2524
#define RGBLIGHT_EFFECT_RAINBOW_MOOD

0 commit comments

Comments
 (0)