Add more modes for LEDs #4

Merged
localhorst merged 8 commits from feature/modes into main 2025-11-09 13:55:52 +01:00
Showing only changes of commit ca5a36449a - Show all commits
+10 -4
View File
@@ -150,6 +150,9 @@ static inline void switchMode(void)
eModeCurrent = (eModeCurrent + 1) % MAX_COUNT;
}
/**
* @brief Init PWM for PA2
*/
void initPWM(void)
{
// No PORTMUX needed - PA2 is WO2 by default
@@ -164,6 +167,9 @@ void initPWM(void)
TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1_gc | TCA_SINGLE_ENABLE_bm;
}
/**
* @brief Set PWM duty cycle for PA2
*/
void setPWM_PA2(uint8_t duty)
{
TCA0.SINGLE.CMP2 = duty;
@@ -421,14 +427,14 @@ void ledAnimationGlow(void)
brightness += direction;
// Reverse direction at limits
if (brightness >= 100)
if (brightness >= 100U)
{
brightness = 100;
brightness = 100U;
direction = -1;
}
else if (brightness == 0)
else if (brightness == 10U)
{
brightness = 0;
brightness = 10U;
direction = 1;
}