usb_usb: Add Makefiles
authortmk <hasu@tmk-kbd.com>
Wed, 10 May 2017 15:59:20 +0000 (00:59 +0900)
committertmk <hasu@tmk-kbd.com>
Wed, 10 May 2017 15:59:20 +0000 (00:59 +0900)
converter/usb_usb/Makefile.8mhz [new file with mode: 0644]
converter/usb_usb/Makefile.debug [new file with mode: 0644]
converter/usb_usb/main.cpp
converter/usb_usb/usb_usb.cpp

diff --git a/converter/usb_usb/Makefile.8mhz b/converter/usb_usb/Makefile.8mhz
new file mode 100644 (file)
index 0000000..845a02b
--- /dev/null
@@ -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 (file)
index 0000000..e229cd7
--- /dev/null
@@ -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
index 2d9f56025e7a5298bae766d28abfd36e56b1f038..76e88922cb41205243ce78da89263033ca48cc0b 100644 (file)
@@ -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();
index 26721de0a5e2f9a63e9fd02c3dc6829262a52d4a..be690ffc55118681f5d1436c26ea1bdbaa381f71 100644 (file)
@@ -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());
         }
     }
Imprint / Impressum