4 #include <util/delay.h>
18 #include "leonardo_led.h"
22 static HIDBoot
<HID_PROTOCOL_KEYBOARD
> kbd(&usb_host
);
23 static KBDReportParser kbd_parser
;
25 static void LUFA_setup(void)
27 /* Disable watchdog if enabled by bootloader/fuses */
28 MCUSR
&= ~(1 << WDRF
);
31 /* Disable clock division */
32 clock_prescale_set(clock_div_1
);
34 // Leonardo needs. Without this USB device is not recognized.
40 USB_Device_EnableSOFEvents();
43 static void HID_setup()
45 // Arduino Timer startup: wiring.c
48 if (usb_host
.Init() == -1) {
49 debug("HID init: failed\n");
55 kbd
.SetReportParser(0, (HIDReportParser
*)&kbd_parser
);
67 debug_keyboard
= true;
73 // wait for startup of sendchar routine
74 while (USB_DeviceState
!= DEVICE_STATE_Configured
) ;
81 debug("init: done\n");
85 #if !defined(INTERRUPT_CONTROL_ENDPOINT)
86 // LUFA Task for control request