~ruther/qmk_firmware

cb2331713c84bb2b7f140f67b41037721f4958a1 — Ryan 2 years ago 636093f
Relocate backlight drivers (#21444)

41 files changed, 17 insertions(+), 164 deletions(-)

M builddefs/common_features.mk
R {quantum => drivers}/backlight/backlight_software.c
M keyboards/4pplet/eagle_viper_rep/rev_a/config.h
M keyboards/acheron/athena/alpha/alpha.c
M keyboards/acheron/athena/alpha/config.h
M keyboards/acheron/athena/beta/config.h
M keyboards/acheron/shark/alpha/config.h
M keyboards/acheron/shark/beta/config.h
M keyboards/checkerboards/nop60/config.h
M keyboards/ebastler/e80_1800/config.h
M keyboards/ebastler/isometria_75/rev1/config.h
M keyboards/geonworks/frogmini/fms/config.h
M keyboards/handwired/onekey/blackpill_f401/config.h
M keyboards/handwired/onekey/blackpill_f401_tinyuf2/config.h
M keyboards/handwired/onekey/blackpill_f411/config.h
M keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h
M keyboards/handwired/onekey/evb_wb32f3g71/config.h
M keyboards/handwired/onekey/evb_wb32fq95/config.h
M keyboards/handwired/onekey/nucleo_f446re/config.h
M keyboards/handwired/onekey/nucleo_l432kc/config.h
M keyboards/handwired/onekey/proton_c/config.h
M keyboards/handwired/onekey/rp2040/config.h
M keyboards/handwired/onekey/stm32f0_disco/config.h
D keyboards/handwired/pill60/config.h
M keyboards/linworks/fave104/config.h
M keyboards/linworks/whale75/config.h
M keyboards/mechlovin/adelais/standard_led/arm/config.h
D keyboards/mechlovin/hannah65/config.h
D keyboards/mechlovin/hex4b/rev2/config.h
M keyboards/mechlovin/hex6c/config.h
M keyboards/mechlovin/infinity87/rev1/config.h
M keyboards/mechlovin/infinity88/config.h
D keyboards/mechlovin/mechlovin9/rev1/config.h
M keyboards/mechlovin/tmkl/config.h
M keyboards/mode/m75s/config.h
M keyboards/smithrune/iron165r2/f411/config.h
R {quantum/backlight/backlight_avr => platforms/avr/drivers/backlight_pwm}.c
R {quantum/backlight/backlight_chibios => platforms/chibios/drivers/backlight_pwm}.c
R {quantum/backlight => platforms/chibios/drivers}/backlight_timer.c
M quantum/backlight/backlight.c
M quantum/backlight/backlight_driver_common.c
M builddefs/common_features.mk => builddefs/common_features.mk +6 -6
@@ 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

R quantum/backlight/backlight_software.c => drivers/backlight/backlight_software.c +1 -1
@@ 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."

M keyboards/4pplet/eagle_viper_rep/rev_a/config.h => keyboards/4pplet/eagle_viper_rep/rev_a/config.h +0 -1
@@ 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

M keyboards/acheron/athena/alpha/alpha.c => keyboards/acheron/athena/alpha/alpha.c +1 -1
@@ 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) {

M keyboards/acheron/athena/alpha/config.h => keyboards/acheron/athena/alpha/config.h +0 -1
@@ 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

M keyboards/acheron/athena/beta/config.h => keyboards/acheron/athena/beta/config.h +0 -2
@@ 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

M keyboards/acheron/shark/alpha/config.h => keyboards/acheron/shark/alpha/config.h +0 -1
@@ 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

M keyboards/acheron/shark/beta/config.h => keyboards/acheron/shark/beta/config.h +0 -1
@@ 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

M keyboards/checkerboards/nop60/config.h => keyboards/checkerboards/nop60/config.h +0 -2
@@ 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

M keyboards/ebastler/e80_1800/config.h => keyboards/ebastler/e80_1800/config.h +0 -2
@@ 16,8 16,6 @@

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


#ifdef OLED_ENABLE


M keyboards/ebastler/isometria_75/rev1/config.h => keyboards/ebastler/isometria_75/rev1/config.h +0 -1
@@ 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 */

M keyboards/geonworks/frogmini/fms/config.h => keyboards/geonworks/frogmini/fms/config.h +0 -1
@@ 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

M keyboards/handwired/onekey/blackpill_f401/config.h => keyboards/handwired/onekey/blackpill_f401/config.h +0 -1
@@ 19,7 19,6 @@

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

#define ADC_PIN A0


M keyboards/handwired/onekey/blackpill_f401_tinyuf2/config.h => keyboards/handwired/onekey/blackpill_f401_tinyuf2/config.h +0 -1
@@ 19,7 19,6 @@

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

#define ADC_PIN A0


M keyboards/handwired/onekey/blackpill_f411/config.h => keyboards/handwired/onekey/blackpill_f411/config.h +0 -1
@@ 19,7 19,6 @@

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

#define ADC_PIN A0


M keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h => keyboards/handwired/onekey/blackpill_f411_tinyuf2/config.h +0 -1
@@ 19,7 19,6 @@

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

#define ADC_PIN A0


M keyboards/handwired/onekey/evb_wb32f3g71/config.h => keyboards/handwired/onekey/evb_wb32f3g71/config.h +0 -5
@@ 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

M keyboards/handwired/onekey/evb_wb32fq95/config.h => keyboards/handwired/onekey/evb_wb32fq95/config.h +0 -5
@@ 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

M keyboards/handwired/onekey/nucleo_f446re/config.h => keyboards/handwired/onekey/nucleo_f446re/config.h +0 -5
@@ 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 }

M keyboards/handwired/onekey/nucleo_l432kc/config.h => keyboards/handwired/onekey/nucleo_l432kc/config.h +0 -5
@@ 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

M keyboards/handwired/onekey/proton_c/config.h => keyboards/handwired/onekey/proton_c/config.h +0 -5
@@ 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

M keyboards/handwired/onekey/rp2040/config.h => keyboards/handwired/onekey/rp2040/config.h +0 -1
@@ 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

M keyboards/handwired/onekey/stm32f0_disco/config.h => keyboards/handwired/onekey/stm32f0_disco/config.h +0 -2
@@ 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

D keyboards/handwired/pill60/config.h => keyboards/handwired/pill60/config.h +0 -19
@@ 1,19 0,0 @@
 /* Copyright 2020 Imam Rafii
  *
  * 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 2 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 <http://www.gnu.org/licenses/>.
  */
#pragma once

#define BACKLIGHT_PWM_DRIVER    PWMD5
#define BACKLIGHT_PWM_CHANNEL   1

M keyboards/linworks/fave104/config.h => keyboards/linworks/fave104/config.h +0 -1
@@ 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.

M keyboards/linworks/whale75/config.h => keyboards/linworks/whale75/config.h +0 -1
@@ 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.


M keyboards/mechlovin/adelais/standard_led/arm/config.h => keyboards/mechlovin/adelais/standard_led/arm/config.h +0 -1
@@ 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

D keyboards/mechlovin/hannah65/config.h => keyboards/mechlovin/hannah65/config.h +0 -21
@@ 1,21 0,0 @@
/*
Copyright 2020 Team Mechlovin

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 2 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD4
#define BACKLIGHT_PWM_CHANNEL 3

D keyboards/mechlovin/hex4b/rev2/config.h => keyboards/mechlovin/hex4b/rev2/config.h +0 -20
@@ 1,20 0,0 @@
/*
Copyright 2020 Team Mechlovin

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 2 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD4

M keyboards/mechlovin/hex6c/config.h => keyboards/mechlovin/hex6c/config.h +0 -1
@@ 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

M keyboards/mechlovin/infinity87/rev1/config.h => keyboards/mechlovin/infinity87/rev1/config.h +0 -1
@@ 17,4 17,3 @@
#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

M keyboards/mechlovin/infinity88/config.h => keyboards/mechlovin/infinity88/config.h +0 -1
@@ 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

D keyboards/mechlovin/mechlovin9/rev1/config.h => keyboards/mechlovin/mechlovin9/rev1/config.h +0 -21
@@ 1,21 0,0 @@
/*
Copyright 2021 Mechlovin' Studio

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 2 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 3

M keyboards/mechlovin/tmkl/config.h => keyboards/mechlovin/tmkl/config.h +0 -3
@@ 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

M keyboards/mode/m75s/config.h => keyboards/mode/m75s/config.h +0 -1
@@ 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

M keyboards/smithrune/iron165r2/f411/config.h => keyboards/smithrune/iron165r2/f411/config.h +0 -1
@@ 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

R quantum/backlight/backlight_avr.c => platforms/avr/drivers/backlight_pwm.c +3 -13
@@ 1,7 1,8 @@
#include "quantum.h"
#include "backlight.h"
#include "backlight_driver_common.h"
#include "debug.h"
#include "progmem.h"
#include <avr/io.h>
#include <avr/interrupt.h>

// Maximum duty cycle limit
#ifndef BACKLIGHT_LIMIT_VAL


@@ 17,7 18,6 @@
//   3. Full software PWM, driven by the matrix scan, if both timers are used by Audio.

#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) && (BACKLIGHT_PIN == B5 || BACKLIGHT_PIN == B6 || BACKLIGHT_PIN == B7)
#    define HARDWARE_PWM
#    define ICRx ICR1
#    define TCCRxA TCCR1A
#    define TCCRxB TCCR1B


@@ 39,7 39,6 @@
#        define OCRxx OCR1C
#    endif
#elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) && (BACKLIGHT_PIN == C4 || BACKLIGHT_PIN == C5 || BACKLIGHT_PIN == C6)
#    define HARDWARE_PWM
#    define ICRx ICR3
#    define TCCRxA TCCR3A
#    define TCCRxB TCCR3B


@@ 69,7 68,6 @@
#        define OCRxx OCR3A
#    endif
#elif (defined(__AVR_AT90USB162__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__)) && (BACKLIGHT_PIN == B7 || BACKLIGHT_PIN == C5 || BACKLIGHT_PIN == C6)
#    define HARDWARE_PWM
#    define ICRx ICR1
#    define TCCRxA TCCR1A
#    define TCCRxB TCCR1B


@@ 91,7 89,6 @@
#        define OCRxx OCR1A
#    endif
#elif defined(__AVR_ATmega32A__) && (BACKLIGHT_PIN == D4 || BACKLIGHT_PIN == D5)
#    define HARDWARE_PWM
#    define ICRx ICR1
#    define TCCRxA TCCR1A
#    define TCCRxB TCCR1B


@@ 109,7 106,6 @@
#        define OCRxx OCR1A
#    endif
#elif (defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)) && (BACKLIGHT_PIN == B1 || BACKLIGHT_PIN == B2)
#    define HARDWARE_PWM
#    define ICRx ICR1
#    define TCCRxA TCCR1A
#    define TCCRxB TCCR1B


@@ 129,7 125,6 @@
#elif (AUDIO_PIN != B5) && (AUDIO_PIN != B6) && (AUDIO_PIN != B7) && (AUDIO_PIN_ALT != B5) && (AUDIO_PIN_ALT != B6) && (AUDIO_PIN_ALT != B7)
// Timer 1 is not in use by Audio feature, Backlight can use it
#    pragma message "Using hardware timer 1 with software PWM"
#    define HARDWARE_PWM
#    define BACKLIGHT_PWM_TIMER
#    define ICRx ICR1
#    define TCCRxA TCCR1A


@@ 148,7 143,6 @@
#elif (AUDIO_PIN != C4) && (AUDIO_PIN != C5) && (AUDIO_PIN != C6)
#    pragma message "Using hardware timer 3 with software PWM"
// Timer 3 is not in use by Audio feature, Backlight can use it
#    define HARDWARE_PWM
#    define BACKLIGHT_PWM_TIMER
#    define ICRx ICR1
#    define TCCRxA TCCR3A


@@ 160,10 154,6 @@

#    define OCIExA OCIE3A
#    define OCRxx OCR3A
#elif defined(BACKLIGHT_CUSTOM_DRIVER)
error("Please set 'BACKLIGHT_DRIVER = custom' within rules.mk")
#else
error("Please set 'BACKLIGHT_DRIVER = software' within rules.mk")
#endif

#ifndef BACKLIGHT_PWM_TIMER // pwm through software

R quantum/backlight/backlight_chibios.c => platforms/chibios/drivers/backlight_pwm.c +3 -3
@@ 1,7 1,7 @@
#include "quantum.h"
#include "backlight.h"
#include "gpio.h"
#include "wait.h"
#include <hal.h>
#include "debug.h"

// Maximum duty cycle limit
#ifndef BACKLIGHT_LIMIT_VAL


@@ 13,7 13,7 @@
#        define BACKLIGHT_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
#    else
// GPIOV2 && GPIOV3
#        define BACKLIGHT_PAL_MODE 5
#        define BACKLIGHT_PAL_MODE 2
#    endif
#endif


R quantum/backlight/backlight_timer.c => platforms/chibios/drivers/backlight_timer.c +1 -2
@@ 1,7 1,6 @@
#include "quantum.h"
#include "backlight.h"
#include "backlight_driver_common.h"
#include "debug.h"
#include "wait.h"

#ifndef BACKLIGHT_GPT_DRIVER
#    define BACKLIGHT_GPT_DRIVER GPTD15

M quantum/backlight/backlight.c => quantum/backlight/backlight.c +0 -1
@@ 15,7 15,6 @@ You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "quantum.h"
#include "backlight.h"
#include "eeprom.h"
#include "eeconfig.h"

M quantum/backlight/backlight_driver_common.c => quantum/backlight/backlight_driver_common.c +2 -1
@@ 1,6 1,7 @@
#include "quantum.h"
#include "backlight.h"
#include "backlight_driver_common.h"
#include "gpio.h"
#include "util.h"

#if !defined(BACKLIGHT_PIN) && !defined(BACKLIGHT_PINS)
#    error "Backlight pin/pins not defined. Please configure."