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