diff options
author | tmk <hasu@tmk-kbd.com> | 2015-05-13 13:55:11 +0900 |
---|---|---|
committer | tmk <hasu@tmk-kbd.com> | 2015-05-13 13:58:10 +0900 |
commit | 6057e915b53728f7b9d421b604c7c4654ca58743 (patch) | |
tree | a80b669d1a8a1eb5c039bf3ac72b1bebeb8c29bd | |
parent | f1f2066657f4a0998adc016c95d7e541b436e09f (diff) |
usb_usb: Fix initialize procedure
-rw-r--r-- | converter/usb_usb/Makefile | 7 | ||||
-rw-r--r-- | converter/usb_usb/main.cpp | 23 |
2 files changed, 13 insertions, 17 deletions
diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile index 51c9271820..f1a1c24d36 100644 --- a/converter/usb_usb/Makefile +++ b/converter/usb_usb/Makefile @@ -27,7 +27,7 @@ # make flip-ee = Download the eeprom file to the device, using Atmel FLIP # (must have Atmel FLIP installed). # -# make debug = Start either simulavr or avarice as specified for debugging, +# make debug = Start either simulavr or avarice as specified for debugging, # with avr-gdb or avr-insight as the front end for debugging. # # make filename.s = Just compile filename.c into the assembler code only. @@ -93,6 +93,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Media control and System control CONSOLE_ENABLE = yes # Console for debug +#COMMAND_ENABLE = yes # Commands for debug and configuration #NKRO_ENABLE = yes # USB Nkey Rollover # Boot Section Size in bytes @@ -101,7 +102,11 @@ CONSOLE_ENABLE = yes # Console for debug # LUFA bootloader 4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096 +#LDFLAGS += -Wl,--relax +#OPT_DEFS += -DNO_ACTION_TAPPING +#OPT_DEFS += -DNO_ACTION_LAYER +#OPT_DEFS += -DNO_ACTION_MACRO SRC = \ keymap_common.c \ diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp index 30fd3348a3..011baf1d66 100644 --- a/converter/usb_usb/main.cpp +++ b/converter/usb_usb/main.cpp @@ -56,12 +56,11 @@ static void LUFA_setup(void) static void HID_setup() { if (usb_host.Init() == -1) { - debug("HID init: failed\n"); LED_TX_OFF; } - + _delay_ms(200); - + kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); } @@ -72,35 +71,27 @@ int main(void) LED_TX_ON; debug_enable = true; -/* - debug_matrix = true; - debug_keyboard = true; - debug_mouse = true; -*/ host_set_driver(&lufa_driver); keyboard_init(); LUFA_setup(); + HID_setup(); + /* NOTE: Don't insert time consuming job here. + * It'll cause unclear initialization failure when DFU reset(worm start). + */ sei(); -uint8_t ret; // wait for startup of sendchar routine while (USB_DeviceState != DEVICE_STATE_Configured) ; if (debug_enable) { _delay_ms(1000); } - debug("init: start\n"); - HID_setup(); - debug("init: done\n"); uint16_t timer; -// to see loop pulse with oscillo scope -DDRF = (1<<7); for (;;) { -PORTF ^= (1<<7); keyboard_task(); timer = timer_read(); @@ -115,6 +106,6 @@ if (timer > 100) { USB_USBTask(); #endif } - + return 0; } |