parent
d2a83dae8f
commit
e3bcdd8211
@ -1,122 +0,0 @@
|
|||||||
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
|
|
@ -0,0 +1,76 @@
|
|||||||
|
PS/2 to USB keyboard converter
|
||||||
|
==============================
|
||||||
|
This firmware converts PS/2 keyboard protocol to USB and supports only Scan Code Set 2.
|
||||||
|
|
||||||
|
|
||||||
|
PS/2 signal handling implementations
|
||||||
|
------------------------------------
|
||||||
|
Following three methods are used to implement PS/2 signal handling.
|
||||||
|
|
||||||
|
### Simple and stupid busy-wait(ps2_busywait.c)
|
||||||
|
This is expected to implemented with portable C code for reference.
|
||||||
|
### Interrupt driven(ps2_interrupt.c)
|
||||||
|
Uses pin interrupt to detect falling edge of clock line.
|
||||||
|
### USART hardware module(ps2_usart.c)
|
||||||
|
Uses AVR USART engine to recevie PS/2 signal.
|
||||||
|
|
||||||
|
To select method edit Makefile.
|
||||||
|
|
||||||
|
|
||||||
|
Connect Wires
|
||||||
|
-------------
|
||||||
|
In case of Teensy2.0(ATMega32U4):
|
||||||
|
|
||||||
|
1. Connect Vcc and GND.
|
||||||
|
2. Connect Clock and Data line.
|
||||||
|
- Busywait: Clock is on PD5 and Data on PD2.
|
||||||
|
- Interrupt: Clock is on PD1 and Data on PD2.
|
||||||
|
- USART: Clock is on PD5 and Data on PD2.
|
||||||
|
3. Optionally you need pull-up register. 1K-10K Ohm is OK.
|
||||||
|
|
||||||
|
To change pin configuration edit config.h.
|
||||||
|
|
||||||
|
|
||||||
|
Build Frimware
|
||||||
|
--------------
|
||||||
|
Just run `make`:
|
||||||
|
|
||||||
|
$ make
|
||||||
|
|
||||||
|
To select keymap:
|
||||||
|
|
||||||
|
$ make KEYMAP=[plain|jis|spacefn|...]
|
||||||
|
|
||||||
|
|
||||||
|
Keymap
|
||||||
|
------
|
||||||
|
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files.
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* SpaceFN layout
|
||||||
|
* http://geekhack.org/index.php?topic=51069.0
|
||||||
|
*/
|
||||||
|
#include "keymap_common.h"
|
||||||
|
|
||||||
|
|
||||||
|
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* 0: default
|
||||||
|
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
|
||||||
|
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
|
||||||
|
* `---' `---------------' `---------------' `---------------' `-----------' `-----------'
|
||||||
|
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||||
|
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
|
||||||
|
* |-----------------------------------------------------------| |-----------| |---------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
|
||||||
|
* |-----------------------------------------------------------| `-----------' |-----------| +|
|
||||||
|
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
|
||||||
|
* |-----------------------------------------------------------| ,---. |---------------|
|
||||||
|
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
||||||
|
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
|
||||||
|
* `-----------------------------------------------------------' `-----------' `---------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
||||||
|
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
||||||
|
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
|
||||||
|
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
|
||||||
|
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
|
||||||
|
LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
||||||
|
),
|
||||||
|
|
||||||
|
/* 1: SpaceFN
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | |Hom|Up |End|Psc|Slk|Pau|Ins |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | |PgU|Lef|Dow|Rig| | | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | |Spc|PgD|` |~ | | | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | | |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
||||||
|
TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,TRNS, TRNS, UP, P1, P2, P3,
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM fn_actions[] = {
|
||||||
|
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
|
||||||
|
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in new issue