summaryrefslogtreecommitdiff
path: root/main_vusb.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-05-07 00:04:18 +0900
committertmk <nobody@nowhere>2011-05-07 00:48:18 +0900
commit61e12a3157ea6860f23bf8e29372aa70aeb02be0 (patch)
treeb93de00a8deb10713eec89edfb315d5b447201d6 /main_vusb.c
parenta6b31e950fe8de3dc4888e2f90a4001a6caee483 (diff)
move files: main_vusb.c ps2_usart.c sendchar_usart.c from ps2_usb to common dir
Diffstat (limited to 'main_vusb.c')
-rw-r--r--main_vusb.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/main_vusb.c b/main_vusb.c
new file mode 100644
index 0000000000..ec7c5797a1
--- /dev/null
+++ b/main_vusb.c
@@ -0,0 +1,62 @@
+/* PS/2 to USB keyboard converter
+ * 2011/02/20
+ * Copyright (c) 2011 tmk
+ */
+/* Name: main.c
+ * Project: hid-mouse, a very simple HID example
+ * Author: Christian Starkjohann
+ * Creation Date: 2008-04-07
+ * Tabsize: 4
+ * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
+ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
+ * This Revision: $Id: main.c 790 2010-05-30 21:00:26Z cs $
+ */
+#include <stdint.h>
+#include <avr/wdt.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "usbdrv.h"
+#include "oddebug.h"
+#include "host_vusb.h"
+#include "keyboard.h"
+
+
+#if 0
+#define DEBUGP_INIT() do { DDRC = 0xFF; } while (0)
+#define DEBUGP(x) do { PORTC = x; } while (0)
+#else
+#define DEBUGP_INIT()
+#define DEBUGP(x)
+#endif
+
+
+int main(void)
+{
+ DEBUGP_INIT();
+ wdt_enable(WDTO_1S);
+ odDebugInit();
+ usbInit();
+
+ /* enforce re-enumeration, do this while interrupts are disabled! */
+ usbDeviceDisconnect();
+ uint8_t i = 0;
+ /* fake USB disconnect for > 250 ms */
+ while(--i){
+ wdt_reset();
+ _delay_ms(1);
+ }
+ usbDeviceConnect();
+
+ keyboard_init();
+
+ sei();
+ while (1) {
+ DEBUGP(0x1);
+ wdt_reset();
+ usbPoll();
+ DEBUGP(0x2);
+ keyboard_proc();
+ DEBUGP(0x3);
+ host_vusb_keyboard_send();
+ }
+}