From 0089ffa778c2ee955c90750752c18679d7018f4c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 20 Mar 2014 19:06:21 +0100 Subject: device gets detected (most of the time, that is) --- main.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file 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 #include +#include +#include +#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 } -- cgit v1.2.3