You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.3 KiB
C
63 lines
1.3 KiB
C
14 years ago
|
/* PS/2 to USB keyboard converter
|
||
|
* 2011/02/20
|
||
|
* Copyright (c) 2011 tmk
|
||
|
*/
|
||
14 years ago
|
/* 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>
|
||
14 years ago
|
#include <avr/interrupt.h>
|
||
|
#include <util/delay.h>
|
||
14 years ago
|
#include "usbdrv.h"
|
||
14 years ago
|
#include "oddebug.h"
|
||
14 years ago
|
#include "host_vusb.h"
|
||
14 years ago
|
#include "keyboard.h"
|
||
14 years ago
|
|
||
14 years ago
|
|
||
|
#if 0
|
||
14 years ago
|
#define DEBUGP_INIT() do { DDRC = 0xFF; } while (0)
|
||
|
#define DEBUGP(x) do { PORTC = x; } while (0)
|
||
14 years ago
|
#else
|
||
|
#define DEBUGP_INIT()
|
||
|
#define DEBUGP(x)
|
||
|
#endif
|
||
|
|
||
14 years ago
|
|
||
|
int main(void)
|
||
|
{
|
||
14 years ago
|
DEBUGP_INIT();
|
||
14 years ago
|
wdt_enable(WDTO_1S);
|
||
|
odDebugInit();
|
||
|
usbInit();
|
||
14 years ago
|
|
||
|
/* enforce re-enumeration, do this while interrupts are disabled! */
|
||
|
usbDeviceDisconnect();
|
||
|
uint8_t i = 0;
|
||
14 years ago
|
/* fake USB disconnect for > 250 ms */
|
||
|
while(--i){
|
||
14 years ago
|
wdt_reset();
|
||
|
_delay_ms(1);
|
||
|
}
|
||
|
usbDeviceConnect();
|
||
|
|
||
14 years ago
|
keyboard_init();
|
||
|
|
||
14 years ago
|
sei();
|
||
14 years ago
|
while (1) {
|
||
|
DEBUGP(0x1);
|
||
14 years ago
|
wdt_reset();
|
||
|
usbPoll();
|
||
14 years ago
|
DEBUGP(0x2);
|
||
14 years ago
|
keyboard_proc();
|
||
14 years ago
|
DEBUGP(0x3);
|
||
14 years ago
|
host_vusb_keyboard_send();
|
||
14 years ago
|
}
|
||
|
}
|