Skip to content

Commit 71e571e

Browse files
Show all layouts in README.
1 parent 119e32a commit 71e571e

File tree

2 files changed

+50
-33
lines changed

2 files changed

+50
-33
lines changed

README.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,45 @@ output directly).
66

77
## Supports:
88

9-
- Scancode Set 1 and 2
10-
- Dvorak 104-key layout
11-
- US 104-key layout
12-
- UK 105-key layout
13-
- JIS 109-key layout
14-
- Azerty full layout
9+
- Scancode Set 1 (from the i8042 PC keyboard controller)
10+
- Scancode Set 2 (direct from the AT or PS/2 interface keyboard)
11+
- Several keyboard layouts:
12+
13+
| Name | No. Keys | Description | Link |
14+
| ---------------------------------------------------- | -------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
15+
| [`Us104`](./src/layouts/us104.rs) | 101/104 | North American standard English | [Uncyclopedia](https://en.wikipedia.org/wiki/QWERTY#United_States) |
16+
| [`Uk105`](./src/layouts/uk105.rs) | 102/105 | United Kingdom standard English | [Uncyclopedia](https://en.wikipedia.org/wiki/QWERTY#United_Kingdom) |
17+
| [`Azerty`](./src/layouts/azerty.rs) | 102/105 | Typically used in French locales | [Uncyclopedia](https://en.wikipedia.org/wiki/AZERTY) |
18+
| [`De104`](./src/layouts/de104.rs) | 102/105 | German layout | [Uncyclopedia](https://en.wikipedia.org/wiki/QWERTZ) |
19+
| [`Jis109`](./src/layouts/jis109.rs) | 106/109 | JIS 109-key layout (Latin chars only) | [Uncyclopedia](https://en.wikipedia.org/wiki/Japanese_input_method#Japanese_keyboards) |
20+
| [`Colemak`](./src/layouts/colemak.rs) | 101/104 | A keyboard layout designed to make typing more efficient and comfortable | [Uncyclopedia](https://en.wikipedia.org/wiki/Colemak) |
21+
| [`Dvorak104Key`](./src/layouts/dvorak104.rs) | 101/104 | The more 'ergonomic' alternative to QWERTY | [Uncyclopedia](https://en.wikipedia.org/wiki/Dvorak_keyboard_layout) |
22+
| [`DVP104Key`](./src/layouts/dvorak_programmer104.rs) | 101/104 | Dvorak for Programmers | [Uncyclopedia](https://en.wikipedia.org/wiki/Dvorak_keyboard_layout#Programmer_Dvorak) |
23+
24+
101/104 keys is ANSI layout (wide Enter key) and 102/105 keys is ISO layout
25+
(tall Enter key). The difference between 101 and 104 (and between 102 and
26+
105) comes from the two Windows keys and the Menu key that were added when
27+
Windows 95 came out. JIS keyboards have extra keys, added by making the
28+
space-bar and backspace keys shorter.
29+
1530

1631
## Usage
1732

18-
```rust
19-
extern crate pc_keyboard;
20-
21-
use pc_keyboard::{Keyboard, layouts, ScancodeSet2, HandleControl};
22-
23-
fn main() {
24-
let mut kb: Keyboard<layouts::Us104Key, ScancodeSet2> = Keyboard::new(HandleControl::MapLettersToUnicode);
25-
match kb.add_byte(0x20) {
26-
Ok(Some(event)) => {
27-
println!("Event {:?}", event);
28-
}
29-
Ok(None) => {
30-
println!("Need more data");
31-
}
32-
Err(e) => {
33-
println!("Error decoding: {:?}", e);
34-
}
35-
}
36-
}
37-
```
33+
There are three basic steps to handling keyboard input. Your application may bypass some of these.
34+
35+
* `Ps2Decoder` - converts 11-bit PS/2 words into bytes, removing the start/stop
36+
bits and checking the parity bits. Only needed if you talk to the PS/2
37+
keyboard over GPIO pins and not required if you talk to the i8042 PC keyboard
38+
controller.
39+
* `ScancodeSet` - converts from Scancode Set 1 (i8042 PC keyboard controller) or
40+
Scancode Set 2 (raw PS/2 keyboard output) into a symbolic `KeyCode` and an
41+
up/down `KeyState`.
42+
* `EventDecoder` - converts symbolic `KeyCode` and `KeyState` into a Unicode
43+
characters (where possible) according to the currently selected `KeyboardLayout`.
44+
45+
There is also `Keyboard` which combines the above three functions into a single object.
46+
47+
See the [`examples`](./examples) folder for more details.
3848

3949
## [Documentation](https://docs.rs/crate/pc-keyboard)
4050

src/lib.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
//! Driver for a PS/2 keyboard.
1+
//! Driver for a PS/2 PC keyboard.
22
//!
33
//! Supports PS/2 Scan Code Set 1 and 2, on a variety of keyboard layouts. See
44
//! [the OSDev Uncyclo](https://wiki.osdev.org/PS/2_Keyboard).
55
//!
6-
//! Requires that you sample a pin in an interrupt routine and shift in the bit.
7-
//! We don't sample the pin in this library, as that makes testing difficult,
8-
//! and it means you have to make this object a global static mut that the
9-
//! interrupt can access, which is unsafe.
6+
//! There are three basic steps to handling keyboard input. Your application may bypass some of these.
7+
//!
8+
//! * [`Ps2Decoder`] - converts 11-bit PS/2 words into bytes, removing the start/stop
9+
//! bits and checking the parity bits. Only needed if you talk to the PS/2
10+
//! keyboard over GPIO pins and not required if you talk to the i8042 PC keyboard
11+
//! controller.
12+
//! * [`ScancodeSet`] - converts from Scancode Set 1 (i8042 PC keyboard controller) or
13+
//! Scancode Set 2 (raw PS/2 keyboard output) into a symbolic [`KeyCode`] and an
14+
//! up/down [`KeyState`].
15+
//! * [`EventDecoder`] - converts symbolic [`KeyCode`] and [`KeyState`] into a Unicode
16+
//! characters (where possible) according to the currently selected `KeyboardLayout`.
17+
//!
18+
//! There is also [`Keyboard`] which combines the above three functions into a single object.
1019
1120
#![cfg_attr(not(test), no_std)]
12-
#[cfg(test)]
13-
extern crate std as core;
1421

1522
// ****************************************************************************
1623
//

0 commit comments

Comments
 (0)