migrate code to AS7, including fucked up arduino import
arduino as a library will not build with -flto. I can't figure it out. so we waste some space compared to what platformio was building. oh well. there's still over 1K of space left for programs.
This commit is contained in:
43
fw/HackSpaceCon_AS7/HSC_Wand/isr.cpp
Normal file
43
fw/HackSpaceCon_AS7/HSC_Wand/isr.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
hackspacecon wand firmware
|
||||
|
||||
interrupt routines
|
||||
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "rgbled.h"
|
||||
|
||||
extern uint8_t run_rgbprog;
|
||||
|
||||
|
||||
// TCB0 general interrupt
|
||||
ISR(TCB0_INT_vect)
|
||||
{
|
||||
uint8_t intflags = TCB0.INTFLAGS;
|
||||
|
||||
// in this program, this interrupt is only used for timing.
|
||||
// we'll now return to executing loop()
|
||||
|
||||
// reset the INTFLAGS - necessary on this series
|
||||
TCB0.INTFLAGS = intflags;
|
||||
}
|
||||
|
||||
// button interrupt
|
||||
ISR(PORTA_PORT_vect)
|
||||
{
|
||||
uint8_t intflags = PORTA.INTFLAGS;
|
||||
|
||||
// shitty debounce; this is bad practice
|
||||
delay(5);
|
||||
|
||||
// was our pin changed?
|
||||
if (intflags & PIN3_bm) {
|
||||
// start or re-start running a program
|
||||
run_rgbprog = 1; // run a new program
|
||||
}
|
||||
|
||||
// reset the INTFLAGS - necessary on this series
|
||||
PORTA.INTFLAGS = intflags;
|
||||
}
|
||||
Reference in New Issue
Block a user