You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
677 B
48 lines
677 B
#include "main.h"
|
|
#include "spi.h"
|
|
|
|
|
|
void hardinit() {
|
|
/* initializes the hardware */
|
|
|
|
// enable softtimer isr
|
|
TIMSK1 |= _BV(TOIE1);
|
|
|
|
sei();
|
|
}
|
|
|
|
void softinit() {
|
|
|
|
}
|
|
|
|
|
|
int __attribute__((noreturn)) main(void) {
|
|
hardinit();
|
|
softinit();
|
|
|
|
for(;;){
|
|
|
|
SOFTTIMER(1,500) {
|
|
// do_stuff();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
|
|
uint16_t tmp;
|
|
tmp=timer1_acc;
|
|
tmp++;
|
|
|
|
/* the ATOMIC is acutally only needed if timer1_acc is never read from an ISR, which
|
|
* is probably the case.
|
|
* ATOMIC_FORCEON: the ISR_NOBLOCK sets sei() a few cycles before.
|
|
*/
|
|
ATOMIC_BLOCK(ATOMIC_FORCEON){
|
|
timer1_acc=tmp;
|
|
}
|
|
|
|
}
|