Skip to content

Commit

Permalink
Relocate backlight drivers (qmk#21444)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and jesperhellberg committed Sep 9, 2023
1 parent 060a562 commit 72773f4
Show file tree
Hide file tree
Showing 41 changed files with 17 additions and 164 deletions.
12 changes: 6 additions & 6 deletions builddefs/common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -565,18 +565,18 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
endif

COMMON_VPATH += $(QUANTUM_DIR)/backlight
COMMON_VPATH += $(DRIVER_PATH)/backlight
SRC += $(QUANTUM_DIR)/backlight/backlight.c
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
OPT_DEFS += -DBACKLIGHT_ENABLE

ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
else
ifneq ($(strip $(BACKLIGHT_DRIVER)), custom)
SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c

ifeq ($(strip $(BACKLIGHT_DRIVER)), software)
SRC += $(DRIVER_PATH)/backlight/backlight_software.c
else
SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
SRC += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/backlight_$(strip $(BACKLIGHT_DRIVER)).c
endif
endif
endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "quantum.h"
#include "backlight.h"
#include "backlight_driver_common.h"
#include "util.h"

#ifdef BACKLIGHT_BREATHING
# error "Backlight breathing is not available for software PWM. Please disable."
Expand Down
1 change: 0 additions & 1 deletion keyboards/4pplet/eagle_viper_rep/rev_a/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define BACKLIGHT_PWM_DRIVER PWMD2
#define BACKLIGHT_PWM_CHANNEL 4
#define BACKLIGHT_PAL_MODE 2

/* Underglow */
#define WS2812_SPI SPID1
Expand Down
2 changes: 1 addition & 1 deletion keyboards/acheron/athena/alpha/alpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void board_init(void) {

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

void led_init_ports(void) {
Expand Down
1 change: 0 additions & 1 deletion keyboards/acheron/athena/alpha/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
2 changes: 0 additions & 2 deletions keyboards/acheron/athena/beta/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOCKING_RESYNC_ENABLE

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
1 change: 0 additions & 1 deletion keyboards/acheron/shark/alpha/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
Expand Down
1 change: 0 additions & 1 deletion keyboards/acheron/shark/beta/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
2 changes: 0 additions & 2 deletions keyboards/checkerboards/nop60/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Copyright 2021 Nathan Spears

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3

// ws2812 options
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
2 changes: 0 additions & 2 deletions keyboards/ebastler/e80_1800/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#define BACKLIGHT_PWM_DRIVER PWMD1
#define BACKLIGHT_PWM_CHANNEL 2
#define BACKLIGHT_PAL_MODE 2


#ifdef OLED_ENABLE

Expand Down
1 change: 0 additions & 1 deletion keyboards/ebastler/isometria_75/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Backlight */
#define BACKLIGHT_PWM_DRIVER PWMD1
#define BACKLIGHT_PWM_CHANNEL 2
#define BACKLIGHT_PAL_MODE 2
#define BACKLIGHT_PWM_OUTPUT_FREQUENCY 1000 // Increases backlight PWM freq if compiled with an unmerged PR. Does no harm without it.

/* Underglow */
Expand Down
1 change: 0 additions & 1 deletion keyboards/geonworks/frogmini/fms/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD1
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 1

#define I2C_DRIVER I2CD1
Expand Down
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/blackpill_f401/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0

Expand Down
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/blackpill_f401_tinyuf2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0

Expand Down
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/blackpill_f411/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0

Expand Down
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#define BACKLIGHT_PWM_DRIVER PWMD5
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0

Expand Down
5 changes: 0 additions & 5 deletions keyboards/handwired/onekey/evb_wb32f3g71/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

#pragma once


#define ADC_PIN A0

#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))

#define SOLENOID_PIN B12
Expand Down
5 changes: 0 additions & 5 deletions keyboards/handwired/onekey/evb_wb32fq95/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@

#pragma once


#define ADC_PIN A0

#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4)))

#define SOLENOID_PIN B12
Expand Down
5 changes: 0 additions & 5 deletions keyboards/handwired/onekey/nucleo_f446re/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once


#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0

#define SOLENOID_PINS { B12, B13, B14, B15 }
Expand Down
5 changes: 0 additions & 5 deletions keyboards/handwired/onekey/nucleo_l432kc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once


#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0
5 changes: 0 additions & 5 deletions keyboards/handwired/onekey/proton_c/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,4 @@

#pragma once


#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 2

#define ADC_PIN A0
1 change: 0 additions & 1 deletion keyboards/handwired/onekey/rp2040/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#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

#define AUDIO_PIN GP16
Expand Down
2 changes: 0 additions & 2 deletions keyboards/handwired/onekey/stm32f0_disco/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#pragma once


#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3
#define BACKLIGHT_PAL_MODE 0

#define ADC_PIN A0
19 changes: 0 additions & 19 deletions keyboards/handwired/pill60/config.h

This file was deleted.

1 change: 0 additions & 1 deletion keyboards/linworks/fave104/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define BACKLIGHT_PWM_DRIVER PWMD2
#define BACKLIGHT_PWM_CHANNEL 2
#define BACKLIGHT_PAL_MODE 2
#define BACKLIGHT_PWM_OUTPUT_FREQUENCY 1000 // Increases backlight PWM freq if compiled with an unmerged PR. Does no harm without it.
1 change: 0 additions & 1 deletion keyboards/linworks/whale75/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

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

Expand Down
1 change: 0 additions & 1 deletion keyboards/mechlovin/adelais/standard_led/arm/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
21 changes: 0 additions & 21 deletions keyboards/mechlovin/hannah65/config.h

This file was deleted.

20 changes: 0 additions & 20 deletions keyboards/mechlovin/hex4b/rev2/config.h

This file was deleted.

1 change: 0 additions & 1 deletion keyboards/mechlovin/hex6c/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

#define WEAR_LEVELING_BACKING_SIZE 4096
#define WEAR_LEVELING_LOGICAL_SIZE 2048
1 change: 0 additions & 1 deletion keyboards/mechlovin/infinity87/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3
1 change: 0 additions & 1 deletion keyboards/mechlovin/infinity88/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

/*== all animations enable ==*/#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
21 changes: 0 additions & 21 deletions keyboards/mechlovin/mechlovin9/rev1/config.h

This file was deleted.

3 changes: 0 additions & 3 deletions keyboards/mechlovin/tmkl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
1 change: 0 additions & 1 deletion keyboards/mode/m75s/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BACKLIGHT_DEFAULT_LEVEL 20
#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE 4096
1 change: 0 additions & 1 deletion keyboards/smithrune/iron165r2/f411/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2

#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
Expand Down
Loading

0 comments on commit 72773f4

Please sign in to comment.