b15f/main.cpp

51 lines
721 B
C++
Raw Normal View History

#include <avr/io.h>
2019-03-25 12:00:22 +00:00
#include <avr/interrupt.h>
#include <util/delay.h>
2019-03-25 14:02:24 +00:00
#include <avr/wdt.h>
2019-03-26 07:44:30 +00:00
#include "global_vars.h"
2019-03-25 15:15:00 +00:00
#include "selftest.h"
2019-03-25 12:00:22 +00:00
2019-03-26 07:44:30 +00:00
#define LED PB0
2019-03-25 14:02:24 +00:00
ISR(WDT_vect)
{
while(1)
{
2019-03-26 07:44:30 +00:00
PORTB ^= _BV(LED);
2019-03-25 14:02:24 +00:00
_delay_ms(200);
}
WDTCSR |= _BV(WDIE);
}
2019-03-25 15:15:00 +00:00
void initAll()
2019-03-25 14:02:24 +00:00
{
2019-03-25 12:00:22 +00:00
spi.init();
2019-03-25 15:15:00 +00:00
2019-03-25 12:42:32 +00:00
beba0.setDirA(0x00); // alle Ausgang
beba0.setDirB(0xFF); // alle Eingang
2019-03-25 15:15:00 +00:00
beba1.setDirA(0x00); // alle Ausgang
beba1.setDirB(0xFF); // alle Eingang
2019-03-25 14:02:24 +00:00
sw.setDirB(0xFF); // alle Eingang
2019-03-25 14:40:36 +00:00
adu.init();
2019-03-25 15:15:00 +00:00
}
int main()
{
/*WDTCSR = _BV(WDIE) | _BV(WDP3) | _BV(WDP0);
2019-03-26 07:44:30 +00:00
DDRB |= _BV(LED);
PORTB &= ~_BV(LED);
2019-03-25 15:15:00 +00:00
wdt_reset();
sei();*/
initAll();
2019-03-25 12:00:22 +00:00
2019-03-25 14:02:24 +00:00
while(1)
{
2019-03-25 15:15:00 +00:00
testAll();
2019-03-25 12:00:22 +00:00
}
2019-03-22 14:51:52 +00:00
return 0;
}