From 90c8c8a2af98abde607d830cb9614c834c7381c6 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 25 Mar 2016 23:29:50 +0300 Subject: Initial USB handling code --- keyboard/keyboard.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/keyboard/keyboard.c b/keyboard/keyboard.c index dbba981..b70ac66 100644 --- a/keyboard/keyboard.c +++ b/keyboard/keyboard.c @@ -1,14 +1,35 @@ -#include #include +#include +#include + +#include "usbdrv.h" + #define F_CPU 16500000L // 16.5 MHZ #include +USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) { + return 0; // do nothing for now +} + int main() { - DDRB |= _BV(DDB1); + uchar i; + wdt_enable(WDT0_1S); + + usbInit(); + + usbDeviceDisconnect(); + for (i=0; i<250; i++) { + wdt_reset(); + _delay_ms(2); + } + usbDeviceConnect(); + + sei(); + while (1) { - PORTB ^= _BV(PB1); - _delay_ms(100); - PORTB ^= _BV(PB1); - _delay_ms(900); + wdt_reset(); + usbPoll(); } + + return 0; } -- cgit v1.3.1