4 #include <util/delay.h>
19 #include "leonardo_led.h"
23 static HIDBoot
<HID_PROTOCOL_KEYBOARD
> kbd(&usb_host
);
24 static KBDReportParser kbd_parser
;
26 static void LUFA_setup(void)
28 /* Disable watchdog if enabled by bootloader/fuses */
29 MCUSR
&= ~(1 << WDRF
);
32 /* Disable clock division */
33 clock_prescale_set(clock_div_1
);
35 // Leonardo needs. Without this USB device is not recognized.
41 USB_Device_EnableSOFEvents();
44 static void HID_setup()
46 if (usb_host
.Init() == -1) {
47 debug("HID init: failed\n");
53 kbd
.SetReportParser(0, (HIDReportParser
*)&kbd_parser
);
65 debug_keyboard
= true;
68 host_set_driver(&lufa_driver
);
75 // wait for startup of sendchar routine
76 while (USB_DeviceState
!= DEVICE_STATE_Configured
) ;
81 debug("init: start\n");
84 debug("init: done\n");
87 // to see loop pulse with oscillo scope
95 timer
= timer_elapsed(timer
);
97 debug("host.Task: "); debug_hex16(timer
); debug("\n");
100 #if !defined(INTERRUPT_CONTROL_ENDPOINT)
101 // LUFA Task for control request