Modify softpwm_led to support more custom callback function
This commit is contained in:
parent
e7e58c1658
commit
9ffd371c50
@ -269,7 +269,7 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||||
// LED on
|
// LED on
|
||||||
if (pwm == 0) {
|
if (pwm == 0) {
|
||||||
softpwm_led_on(i);
|
if (softpwm_led_ocr[i]) softpwm_led_on(i);
|
||||||
softpwm_led_ocr[i] = softpwm_led_ocr_buff[i];
|
softpwm_led_ocr[i] = softpwm_led_ocr_buff[i];
|
||||||
}
|
}
|
||||||
// LED off
|
// LED off
|
||||||
@ -284,7 +284,7 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
counter = 0;
|
counter = 0;
|
||||||
fading_led_proc();
|
fading_led_proc();
|
||||||
breathing_led_proc();
|
breathing_led_proc();
|
||||||
custom_led_proc();
|
softpwm_led_custom();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -306,6 +306,9 @@ void fading_led_proc(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef CUSTOM_LED_ENABLE
|
||||||
|
fading_led_custom(softpwm_led_ocr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,6 +329,9 @@ void breathing_led_proc(void)
|
|||||||
softpwm_led_ocr_buff[i] = value;
|
softpwm_led_ocr_buff[i] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef CUSTOM_LED_ENABLE
|
||||||
|
breathing_led_custom(softpwm_led_ocr);
|
||||||
|
#endif
|
||||||
if (direction) {
|
if (direction) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
direction = 0;
|
direction = 0;
|
||||||
|
@ -70,7 +70,9 @@ void breathing_led_set_duration(uint8_t dur);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUSTOM_LED_ENABLE
|
#ifdef CUSTOM_LED_ENABLE
|
||||||
void custom_led_proc(void);
|
void softpwm_led_custom(void);
|
||||||
|
void fading_led_custom(uint8_t *value);
|
||||||
|
void breathing_led_custom(uint8_t *value);
|
||||||
#else
|
#else
|
||||||
#define custom_led_proc()
|
#define custom_led_proc()
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user