From: tmk Date: Wed, 10 May 2017 15:59:20 +0000 (+0900) Subject: usb_usb: Add Makefiles X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=a38dd9dda55edde763faecbf4f18970b7682cce8;p=max%2Ftmk_keyboard.git usb_usb: Add Makefiles --- diff --git a/converter/usb_usb/Makefile.8mhz b/converter/usb_usb/Makefile.8mhz new file mode 100644 index 00000000..845a02be --- /dev/null +++ b/converter/usb_usb/Makefile.8mhz @@ -0,0 +1,5 @@ +F_CPU = 8000000 +F_USB = 16000000 +UNIMAP_ENABLE = yes +KEYMAP_SECTION_ENABLE = yes +include Makefile diff --git a/converter/usb_usb/Makefile.debug b/converter/usb_usb/Makefile.debug new file mode 100644 index 00000000..e229cd78 --- /dev/null +++ b/converter/usb_usb/Makefile.debug @@ -0,0 +1,6 @@ +TARGET = usb_usb_debug +UNIMAP_ENABLE = yes +#KEYMAP_SECTION_ENABLE = yes +#LUFA_DEBUG = yes +OPT_DEFS += -DDEBUG_USB_HOST +include Makefile diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp index 2d9f5602..76e88922 100644 --- a/converter/usb_usb/main.cpp +++ b/converter/usb_usb/main.cpp @@ -42,7 +42,11 @@ static void LUFA_setup(void) wdt_disable(); /* Disable clock division */ +#if (F_CPU == 8000000) + clock_prescale_set(clock_div_2); // 16MHz crystal divided by 2 +#else clock_prescale_set(clock_div_1); +#endif // Leonardo needs. Without this USB device is not recognized. USB_Disable(); diff --git a/converter/usb_usb/usb_usb.cpp b/converter/usb_usb/usb_usb.cpp index 26721de0..be690ffc 100644 --- a/converter/usb_usb/usb_usb.cpp +++ b/converter/usb_usb/usb_usb.cpp @@ -160,6 +160,7 @@ uint8_t matrix_scan(void) { // restore LED state when keyboard comes up if (usb_state == USB_STATE_RUNNING) { + dprintf("speed: %s\n", usb_host.getVbusState()==FSHOST ? "full" : "low"); keyboard_set_leds(host_keyboard_leds()); } }