LEDs now operating on button push
Fixed several bugs: - TCB wasn't running. The datasheet steps were not complete. - TCA was waking the MCU and causing the main program to run. Added checks to ensure program only runs on button or TCB wakeup. - Fixed some peculiarities with specific RGBLED programs
This commit is contained in:
@@ -19,6 +19,7 @@ ISR(TCB0_INT_vect)
|
||||
|
||||
// in this program, this interrupt is only used for timing.
|
||||
// we'll now return to executing loop()
|
||||
rgb_run_next = 1;
|
||||
|
||||
// reset the INTFLAGS - necessary on this series
|
||||
TCB0.INTFLAGS = intflags;
|
||||
@@ -30,12 +31,15 @@ ISR(PORTA_PORT_vect)
|
||||
uint8_t intflags = PORTA.INTFLAGS;
|
||||
|
||||
// shitty debounce; this is bad practice
|
||||
delay(5);
|
||||
delay(8);
|
||||
|
||||
// was our pin changed?
|
||||
if (intflags & PIN2_bm) {
|
||||
// start or re-start running a program
|
||||
run_rgbprog = 1; // run a new program
|
||||
if (!digitalRead(PIN_PA2)) {
|
||||
run_rgbprog = 1; // run a new program
|
||||
rgb_run_next = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// reset the INTFLAGS - necessary on this series
|
||||
|
||||
Reference in New Issue
Block a user