summaryrefslogtreecommitdiff
path: root/quantum/backlight/backlight_arm.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/backlight/backlight_arm.c')
-rw-r--r--quantum/backlight/backlight_arm.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/quantum/backlight/backlight_arm.c b/quantum/backlight/backlight_arm.c
index 8c6909a4ae..f7065906f8 100644
--- a/quantum/backlight/backlight_arm.c
+++ b/quantum/backlight/backlight_arm.c
@@ -106,7 +106,6 @@ void backlight_task(void) {}
# define BREATHING_HALT_ON 2
# define BREATHING_STEPS 128
-static uint8_t breathing_period = BREATHING_PERIOD;
static uint8_t breathing_halt = BREATHING_NO_HALT;
static uint16_t breathing_counter = 0;
@@ -114,7 +113,7 @@ bool is_breathing(void) { return BACKLIGHT_PWM_DRIVER.config == &pwmCFG_breathin
static inline void breathing_min(void) { breathing_counter = 0; }
-static inline void breathing_max(void) { breathing_counter = breathing_period * 256 / 2; }
+static inline void breathing_max(void) { breathing_counter = get_breathing_period() * 256 / 2; }
void breathing_interrupt_enable(void) {
pwmStop(&BACKLIGHT_PWM_DRIVER);
@@ -166,17 +165,6 @@ void breathing_toggle(void) {
breathing_enable();
}
-void breathing_period_set(uint8_t value) {
- if (!value) value = 1;
- breathing_period = value;
-}
-
-void breathing_period_default(void) { breathing_period_set(BREATHING_PERIOD); }
-
-void breathing_period_inc(void) { breathing_period_set(breathing_period + 1); }
-
-void breathing_period_dec(void) { breathing_period_set(breathing_period - 1); }
-
/* To generate breathing curve in python:
* from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)]
*/
@@ -187,7 +175,8 @@ static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS
static void breathing_callback(PWMDriver *pwmp) {
(void)pwmp;
- uint16_t interval = (uint16_t)breathing_period * 256 / BREATHING_STEPS;
+ uint8_t breathing_period = get_breathing_period();
+ uint16_t interval = (uint16_t)breathing_period * 256 / BREATHING_STEPS;
// resetting after one period to prevent ugly reset at overflow.
breathing_counter = (breathing_counter + 1) % (breathing_period * 256);
uint8_t index = breathing_counter / interval % BREATHING_STEPS;
@@ -203,12 +192,4 @@ static void breathing_callback(PWMDriver *pwmp) {
chSysUnlockFromISR();
}
-#else
-
-__attribute__((weak)) void backlight_init_ports(void) {}
-
-__attribute__((weak)) void backlight_set(uint8_t level) {}
-
-__attribute__((weak)) void backlight_task(void) {}
-
#endif