13 #include "action_util.h"
17 static int8_t sendchar_func(uint8_t c)
24 static void SetupHardware(void)
26 /* Disable watchdog if enabled by bootloader/fuses */
27 MCUSR &= ~(1 << WDRF);
30 /* Disable clock division */
31 clock_prescale_set(clock_div_1);
33 // Leonardo needs. Without this USB device is not recognized.
39 USB_Device_EnableSOFEvents();
40 print_set_sendchar(sendchar_func);
42 // SUART PD0:output, PD1:input
49 int main(void) __attribute__ ((weak));
55 /* wait for USB startup to get ready for debug output */
56 uint8_t timeout = 255; // timeout when USB is not available(Bluetooth)
57 while (timeout-- && USB_DeviceState != DEVICE_STATE_Configured) {
59 #if defined(INTERRUPT_CONTROL_ENDPOINT)
65 print("USB configured.\n");
69 print("RN-42 init\n");
75 host_set_driver(&rn42_driver);
77 host_set_driver(&lufa_driver);
80 #ifdef SLEEP_LED_ENABLE
84 print("Keyboard start.\n");
86 while (USB_DeviceState == DEVICE_STATE_Suspended) {
88 if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
89 USB_Device_SendRemoteWakeup();
95 #if !defined(INTERRUPT_CONTROL_ENDPOINT)