summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2014-03-20 19:06:21 +0100
committerFlorian Jung <flo@windfisch.org>2014-03-20 19:06:21 +0100
commit0089ffa778c2ee955c90750752c18679d7018f4c (patch)
treeb0fe7d9eb691bcab9f2bd6582c38c465ee97467c
parent83605db2fd3e290cf7fff98e50476e92c5c1e987 (diff)
device gets detected (most of the time, that is)
-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
}