broke out interrupts into isr.cpp

This commit is contained in:
true
2025-04-03 14:41:33 -07:00
parent b5bf65fead
commit 9413b9997a
3 changed files with 44 additions and 34 deletions

View File

@@ -37,15 +37,9 @@ void conf_rgb_timer()
TCB0.CNT = 0;
}
ISR(TCB0_INT_vect)
{
// reset the INTFLAGS - necessary on this series
uint8_t intflags = TCB0.INTFLAGS;
TCB0.INTFLAGS = intflags;
// we don't care why we interrupted.
// we'll now return to executing loop()
}
// globals for all rgb programs
uint16_t prog_timeout;
// rgb program 0: rainbow puke
@@ -56,7 +50,6 @@ ISR(TCB0_INT_vect)
#define RAINBOW_VAL 0x40 // value (brightness); keep low enough to keep average current down
uint16_t rainbow_hue = 0;
uint16_t rainbow_timeout;
uint8_t rgbp_rainbow(uint8_t init)
{
@@ -66,10 +59,10 @@ uint8_t rgbp_rainbow(uint8_t init)
// set our timer when initializing. otherwise every call is identical
if (init) {
rainbow_timeout = RAINBOW_TIMEOUT;
prog_timeout = RAINBOW_TIMEOUT;
}
if (--rainbow_timeout) {
if (--prog_timeout) {
// copy stored hue to working hue
hue = rainbow_hue;