keychron_qmk_firmware/converter/ps2_usb/README
2012-10-14 20:06:50 +09:00

123 lines
3.9 KiB
Plaintext

PS/2 to USB keyboard converter
==============================
This firmware converts PS/2 keyboard protocol to USB and supports only Scan Code Set 2.
This will works on USB AVR(ATMega32U4, AT90USB) or V-USB(ATMega168, 328...).
Features
--------
Mouse keys
You can emulates mouse move and button click using keyboard.
System/Media control
You can sends Power event, Volume down/up and Mute.
USB NKRO(actually 120KRO+8Modifiers)
You can tolggles NKRO feature.
Keymap customization
You can customize keymaps easily by editing source code. See keymap.c.
PS/2 signal handling implementations
------------------------------------
Following three methods are used to implement PS/2 signal handling.
a. Simple and stupid busy-wait(ps2.c)
This is expected to implemented with portable C code for reference.
b. Interrupt driven(ps2.c)
Uses external interrupt to detect falling edge of clock line.
c. USART hardware module(ps2_usart.c)
Uses AVR USART engine to recevie PS/2 signal. Recomended and default.
This is required to work with V-USB, preceding two methods tend to
miss signal edges while V-USB handles USB.
To select method edit Makefile.
Connect Wires
-------------
In case of Teensy2.0(ATMega32U4):
0. Connect Vcc and GND.
1. Connect Clock and Data line.
For a. Clock is on PF0 and Data on PF1.
For b. Clock is on PD1 and Data on PD2.
For c. Clock is on PD5 and Data on PD2.
2. Optionally you need pull-up register. 1K-10K Ohm is OK.
To change pin configuration edit config.h.
Build Frimware
--------------
1. Edit Makefile for build options and MCU setting.
Use 'atmega32u4' for Teensy 2.0 or 'at90usb1286' for Teensy++ 2.0.
2. make
Just type `make` in a terminal.
Use `-f Makefile.vusb` option to build V-USB converter.
Use `-f Makefile.jis` option to use JIS keyboard.
3. program MCU.
In case of Teensy use `Teensy Loader`.(http://www.pjrc.com/teensy/loader.html)
Otherwise you want to use `avrdude` or `dfu-programmer`.
Demonstration of Features
-------------------------
In default configuration, you can try several keymaps, mousekeys and USB NKRO.
Use following magic key combinations to enable some features.
keymaps and NKRO:
Magic+0: Qwerty with mousekeys(default)
Magic+1: Qwerty without mousekeys
Magic+2: Colemak
Magic+3: Dvorak
Magic+4: Workman
Magic+N: toggles NKRO/6KRO(6KRO by default)
Magic+Esc: sends Power Event(Power button)
where Magic=(LShift+RShift) or (LControl+RShift)
Fn layer function:
Fn0+(hjkl): Mousekey move(vi cursor like)
Fn0+(yuio): Mouse wheel(left,down,up,right)
Fn0+space: Mouse left button
Fn0+(mnb): Mouse buttons(m=left, n=right, b=middle)
Fn0+(zxc): Media control(Volup, Voldown, Mute)
Fn1+(hjkl): Cursor move(vi cursor like)
Fn1+(nm,.): Cursor move(Home,PageDown,PageUp,End)
where Fn0=;, Fn1=/
Keymap
------
You can change a keymap by editing code of keymap. See common/keycode.h for key symbols.
V-USB Support
-------------
You can also use this converter on ATmega(168/328) with V-USB instead of Teensy.
The converter on V-USB lacks some features for now: USB NKRO and System/Media control.
Circuit
-------
+---+ +---------------+
USB GND | | ATmega168 |
=== C3 | |
5V <-------+--------+---|Vcc,AVCC | PS/2
R1 | | ====
D- <----+--+-----R2-----|INT1 RXD|------->DATA
D+ <----|---+----R3-----|INT0 XCK|------->CLOCK
Z1 Z2 | | ->5V
GND<----+---+--+--+-----|GND | ->GND
| | | |
| C2-+--|XTAL1 |
| X1 | |
+--C3-+--|XTAL2 |
+---------------+
R1: 1.5K Ohm
R2,R3: 68 Ohm
Z1,Z2: Zenner 3.6V
C1,C2: 22pF
C3: 0.1uF
X1: Crystal 20MHz(16MHz/12MHz)
EOF