summaryrefslogtreecommitdiff
path: root/quantum/backlight/backlight_arm.c
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-01-13 01:30:56 +0000
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commit060244a7057dd11a76fa95ceb7374702cd21b304 (patch)
tree671e90691633cabd7a323f229b65b3ca910614a8 /quantum/backlight/backlight_arm.c
parentf67c942c49a7f46d52e8ea51704fba17a9372055 (diff)
Relocate common backlight functionally (#7273)
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 3f94ccef8e..d1b3b49452 100644
--- a/quantum/backlight/backlight_arm.c
+++ b/quantum/backlight/backlight_arm.c
@@ -110,7 +110,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;
@@ -118,7 +117,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);
@@ -170,17 +169,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)]
*/
@@ -191,7 +179,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;
@@ -207,12 +196,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