13 #include "action_util.h"
18 static int8_t sendchar_func(uint8_t c)
25 static void SetupHardware(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();
41 print_set_sendchar(sendchar_func);
43 // SUART PD0:output, PD1:input
50 int main(void) __attribute__ ((weak));
56 /* wait for USB startup to get ready for debug output */
57 uint8_t timeout = 255; // timeout when USB is not available(Bluetooth)
58 while (timeout-- && USB_DeviceState != DEVICE_STATE_Configured) {
60 #if defined(INTERRUPT_CONTROL_ENDPOINT)
66 print("\nUSB init\n");
70 print("RN-42 init\n");
76 host_set_driver(&rn42_driver);
78 host_set_driver(&lufa_driver);
81 #ifdef SLEEP_LED_ENABLE
85 print("Keyboard start\n");
87 while (rn42_rts() && // RN42 is off
88 USB_DeviceState == DEVICE_STATE_Suspended) {
98 if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
99 USB_Device_SendRemoteWakeup();
105 #if !defined(INTERRUPT_CONTROL_ENDPOINT)