summaryrefslogtreecommitdiff
path: root/ps2_vusb/main.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-02-20 17:46:02 +0900
committertmk <nobody@nowhere>2011-02-22 03:09:12 +0900
commit47f5d8b545eec12ca74d8e7048bb5daa290d937e (patch)
tree048918055caafa7a6503d8fb5a077181d954dd85 /ps2_vusb/main.c
parent239bdbf41936566c0ae5b0cbd8c6bf7dd824f7fb (diff)
Synchronous USART support for PS/2 on V-USB stack
Diffstat (limited to 'ps2_vusb/main.c')
-rw-r--r--ps2_vusb/main.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/ps2_vusb/main.c b/ps2_vusb/main.c
index 5afbde01b4..1ffe5e6ec0 100644
--- a/ps2_vusb/main.c
+++ b/ps2_vusb/main.c
@@ -1,3 +1,7 @@
+/* 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
@@ -8,65 +12,51 @@
* This Revision: $Id: main.c 790 2010-05-30 21:00:26Z cs $
*/
#include <stdint.h>
-#include <avr/io.h>
#include <avr/wdt.h>
-#include <avr/interrupt.h> /* for sei() */
-#include <avr/pgmspace.h> /* required by usbdrv.h */
-#include <util/delay.h> /* for _delay_ms() */
+#include <avr/interrupt.h>
+#include <util/delay.h>
#include "usbdrv.h"
-#include "usart_print.h" /* This is also an example for using debug macros */
-#include "usb_keycodes.h"
-#include "matrix_skel.h"
-#include "keymap_skel.h"
-#include "mousekey.h"
-#include "layer.h"
-#include "print.h"
-#include "debug.h"
-#include "sendchar.h"
-#include "host.h"
+#include "oddebug.h"
#include "host_vusb.h"
-#include "timer.h"
-#include "led.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
+
-//static uint8_t last_led = 0;
int main(void)
{
DEBUGP_INIT();
wdt_enable(WDTO_1S);
- /* Even if you don't use the watchdog, turn it off here. On newer devices,
- * the status of the watchdog (on/off, period) is PRESERVED OVER RESET!
- */
-
- /* RESET status: all port bits are inputs without pull-up.
- * That's the way we need D+ and D-. Therefore we don't need any
- * additional hardware initialization.
- */
odDebugInit();
usbInit();
- print_enable = true;
- debug_enable = true;
- keyboard_init();
-
/* enforce re-enumeration, do this while interrupts are disabled! */
usbDeviceDisconnect();
uint8_t i = 0;
- while(--i){ /* fake USB disconnect for > 250 ms */
+ /* fake USB disconnect for > 250 ms */
+ while(--i){
wdt_reset();
_delay_ms(1);
}
usbDeviceConnect();
sei();
- //uint8_t fn_bits = 0;
- while (1) { /* main event loop */
+ keyboard_init();
+
+ while (1) {
+ DEBUGP(0x1);
wdt_reset();
usbPoll();
+ DEBUGP(0x2);
keyboard_proc();
+ DEBUGP(0x3);
host_vusb_keyboard_send();
}
}