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);
74 // wait for startup of sendchar routine
75 while (USB_DeviceState != DEVICE_STATE_Configured) ;
82 debug("init: done\n");
88 #if !defined(INTERRUPT_CONTROL_ENDPOINT)
89 // LUFA Task for control request