diff options
author | Joel Challis <[email protected]> | 2020-03-07 12:09:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-07 12:09:49 +0000 |
commit | 3a303bd2aec57fd2d4d0f6d3e5583d746367d6e1 (patch) | |
tree | 8ab57281f90be800b6e3556e2705ffbcabf1494c /quantum/backlight/backlight.c | |
parent | d7ba0ad684a18c07952963427ca89a8e8e7e1903 (diff) | |
download | qmk_firmware-3a303bd2aec57fd2d4d0f6d3e5583d746367d6e1.tar.gz qmk_firmware-3a303bd2aec57fd2d4d0f6d3e5583d746367d6e1.zip |
Backlight - Carve out a better location for private driver functionality (#8329)0.8.20
* rename backlight_soft to match rules.mk
* rename backlight_soft to match rules.mk - update common_features
* Carve out a better location for private driver backlight functionality
Diffstat (limited to 'quantum/backlight/backlight.c')
-rw-r--r-- | quantum/backlight/backlight.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/quantum/backlight/backlight.c b/quantum/backlight/backlight.c index 4a0eac64c6..34dd8cbdb5 100644 --- a/quantum/backlight/backlight.c +++ b/quantum/backlight/backlight.c @@ -20,6 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "eeconfig.h" #include "debug.h" +#if defined(STM32F0XX) || defined(STM32F0xx) +# pragma message("Backlight support for STMF072 has had limited testing, YMMV. If unsure, set 'BACKLIGHT_ENABLE = no' in your rules.mk") +#endif + backlight_config_t backlight_config; #ifdef BACKLIGHT_BREATHING @@ -27,51 +31,6 @@ backlight_config_t backlight_config; static uint8_t breathing_period = BREATHING_PERIOD; #endif -#ifndef BACKLIGHT_CUSTOM_DRIVER -# if defined(BACKLIGHT_PINS) -static const pin_t backlight_pins[] = BACKLIGHT_PINS; -# ifndef BACKLIGHT_LED_COUNT -# define BACKLIGHT_LED_COUNT (sizeof(backlight_pins) / sizeof(pin_t)) -# endif - -# define FOR_EACH_LED(x) \ - for (uint8_t i = 0; i < BACKLIGHT_LED_COUNT; i++) { \ - pin_t backlight_pin = backlight_pins[i]; \ - { x } \ - } -# else -// we support only one backlight pin -static const pin_t backlight_pin = BACKLIGHT_PIN; -# define FOR_EACH_LED(x) x -# endif - -static inline void backlight_on(pin_t backlight_pin) { -# if BACKLIGHT_ON_STATE == 0 - writePinLow(backlight_pin); -# else - writePinHigh(backlight_pin); -# endif -} - -static inline void backlight_off(pin_t backlight_pin) { -# if BACKLIGHT_ON_STATE == 0 - writePinHigh(backlight_pin); -# else - writePinLow(backlight_pin); -# endif -} - -void backlight_pins_init(void) { - // Setup backlight pin as output and output to off state. - FOR_EACH_LED(setPinOutput(backlight_pin); backlight_off(backlight_pin);) -} - -void backlight_pins_on(void) { FOR_EACH_LED(backlight_on(backlight_pin);) } - -void backlight_pins_off(void) { FOR_EACH_LED(backlight_off(backlight_pin);) } - -#endif - /** \brief Backlight initialization * * FIXME: needs doc |