summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/main.c b/main.c
index dea03c1..841cba2 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,22 @@
+#define F_CPU 12000000L
+
#include <avr/io.h>
#include <avr/delay.h>
+#include <avr/wdt.h>
+#include <avr/interrupt.h>
+#include "usbdrv/usbdrv.h"
+
+
+
+/* device is detected, however unreliably. dunno why. */
+
+
+
+USB_PUBLIC uchar usbFunctionSetup(uchar data[8])
+{
+ return 0;
+}
+
int main (void)
@@ -9,17 +26,35 @@ int main (void)
DDRB=0xFF;
+ wdt_enable(WDTO_1S);
-
- while(1)
+/*
+ for (int i=0;i<20;i++)
{
- PORTB|=1;
- _delay_ms(500);
- PORTB&= ~1;
- _delay_ms(500);
+ PORTB|=1;
+ _delay_ms(50);
+ PORTB&=~1;
+ _delay_ms(50);
+ wdt_reset();
+ } */
+ usbInit();
+
+ usbDeviceDisconnect();
+ for (int i=0;i<100;i++)
+ {
+ wdt_reset();
+ _delay_ms(5);
}
+ usbDeviceConnect();
+ sei();
+
+ while(1)
+ {
+ wdt_reset();
+ usbPoll();
+ }
return 0; // never reached
}