Skip to content

Better layout docs and source #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Fix Ctrl combination handling for Colemak and De105Key layouts
* Fix 102/105-key German layout: Add missing Alt-Gr combinations
* Added tool to print keyboard layouts as ASCII-art
* Cleaned up how layouts are implemented

## v0.8.0 (13 Sep 2024)

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ categories = ["embedded", "no-std"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-embedded-community/pc-keyboard.git"
edition = "2021"
rust-version = "1.61"

[dependencies]
290 changes: 1 addition & 289 deletions README.md

Large diffs are not rendered by default.

506 changes: 506 additions & 0 deletions examples/print_keyboard.rs

Large diffs are not rendered by default.

668 changes: 171 additions & 497 deletions src/layouts/azerty.rs

Large diffs are not rendered by default.

626 changes: 158 additions & 468 deletions src/layouts/colemak.rs

Large diffs are not rendered by default.

398 changes: 165 additions & 233 deletions src/layouts/de105.rs

Large diffs are not rendered by default.

457 changes: 172 additions & 285 deletions src/layouts/dvorak104.rs

Large diffs are not rendered by default.

654 changes: 188 additions & 466 deletions src/layouts/dvorak_programmer104.rs

Large diffs are not rendered by default.

363 changes: 161 additions & 202 deletions src/layouts/fi_se105.rs

Large diffs are not rendered by default.

321 changes: 165 additions & 156 deletions src/layouts/jis109.rs

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions src/layouts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//! see [`Uk105Key`] and [`Us104Key`] as an example of that.

mod dvorak_programmer104;
use crate::PhysicalKeyboard;

pub use self::dvorak_programmer104::DVP104Key;

mod dvorak104;
Expand Down Expand Up @@ -68,6 +70,21 @@ impl super::KeyboardLayout for AnyLayout {
AnyLayout::FiSe105Key(inner) => inner.map_keycode(keycode, modifiers, handle_ctrl),
}
}

fn get_physical(&self) -> PhysicalKeyboard {
match self {
AnyLayout::DVP104Key(inner) => inner.get_physical(),
AnyLayout::Dvorak104Key(inner) => inner.get_physical(),
AnyLayout::Us104Key(inner) => inner.get_physical(),
AnyLayout::Uk105Key(inner) => inner.get_physical(),
AnyLayout::Jis109Key(inner) => inner.get_physical(),
AnyLayout::Azerty(inner) => inner.get_physical(),
AnyLayout::Colemak(inner) => inner.get_physical(),
AnyLayout::De105Key(inner) => inner.get_physical(),
AnyLayout::No105Key(inner) => inner.get_physical(),
AnyLayout::FiSe105Key(inner) => inner.get_physical(),
}
}
}

impl super::KeyboardLayout for &AnyLayout {
Expand All @@ -90,6 +107,21 @@ impl super::KeyboardLayout for &AnyLayout {
AnyLayout::FiSe105Key(inner) => inner.map_keycode(keycode, modifiers, handle_ctrl),
}
}

fn get_physical(&self) -> PhysicalKeyboard {
match self {
AnyLayout::DVP104Key(inner) => inner.get_physical(),
AnyLayout::Dvorak104Key(inner) => inner.get_physical(),
AnyLayout::Us104Key(inner) => inner.get_physical(),
AnyLayout::Uk105Key(inner) => inner.get_physical(),
AnyLayout::Jis109Key(inner) => inner.get_physical(),
AnyLayout::Azerty(inner) => inner.get_physical(),
AnyLayout::Colemak(inner) => inner.get_physical(),
AnyLayout::De105Key(inner) => inner.get_physical(),
AnyLayout::No105Key(inner) => inner.get_physical(),
AnyLayout::FiSe105Key(inner) => inner.get_physical(),
}
}
}

#[cfg(test)]
Expand Down
379 changes: 166 additions & 213 deletions src/layouts/no105.rs

Large diffs are not rendered by default.

208 changes: 150 additions & 58 deletions src/layouts/uk105.rs

Large diffs are not rendered by default.

776 changes: 308 additions & 468 deletions src/layouts/us104.rs

Large diffs are not rendered by default.

482 changes: 468 additions & 14 deletions src/lib.rs

Large diffs are not rendered by default.