Skip to content

Commit

Permalink
first implementation of pin handling + sorting + reporting in console…
Browse files Browse the repository at this point in the history
… on click
  • Loading branch information
65787978 committed Aug 22, 2024
1 parent 457d432 commit 10fc79b
Show file tree
Hide file tree
Showing 3 changed files with 268 additions and 72 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "esp"
name = "esp32-rust-split-keyboard"
version = "0.1.0"
authors = ["65787978"]
edition = "2021"
resolver = "2"
rust-version = "1.77"

[[bin]]
name = "esp"
name = "esp32-rust-split-keyboard"
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors

[profile.release]
Expand All @@ -24,12 +24,14 @@ pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"]
experimental = ["esp-idf-svc/experimental", "esp-idf-svc/bt"]
experimental = ["esp-idf-svc/experimental"]
embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.49", default-features = false }
esp-idf-hal = "0.44.1"
chrono = "0.4.38"

[build-dependencies]
embuild = "0.32.0"
embuild = "0.32.0"
86 changes: 43 additions & 43 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
___| 0 | 1 | 2 | 3 | 4 | 5 | ___| 0 | 1 | 2 | 3 | 4 | 5 |
0 |_ESC_|__1__|__2__|__3__|__4__|__5__| 0 |__6__|__7__|__8__|__9__|__0__|__-__|
1 |_TAB_|__Q__|__W__|__E__|__R__|__T__| 1 |__Y__|__U__|__I__|__O__|__P__|__{__|
2 |_CAP_|__A__|__S__|__D__|__F__|__G__| 2 |__H__|__J__|__K__|__L__|__;__|__}__|
3 |_SFT_|__Z__|__X__|__C__|__V__|__B__| 3 |__N__|__M__|__,__|__.__|__/__|__\__|
4 |_____|_____|_____|_CTL_|_BSP_|_DEL_| 4 |_CTL_|_ENT_|_SPC_|_FUN_|_____|_____|
PINS PINS
___| 0 | 1 | 12 | 18 | 19 | 13 | ___| 0 | 1 | 12 | 18 | 19 | 13 |
2 |_ESC_|__1__|__2__|__3__|__4__|__5__| 2 |__6__|__7__|__8__|__9__|__0__|__-__|
3 |_TAB_|__Q__|__W__|__E__|__R__|__T__| 3 |__Y__|__U__|__I__|__O__|__P__|__{__|
10 |_CAP_|__A__|__S__|__D__|__F__|__G__| 10|__H__|__J__|__K__|__L__|__;__|__}__|
6 |_SFT_|__Z__|__X__|__C__|__V__|__B__| 6 |__N__|__M__|__,__|__.__|__/__|__\__|
7 |_____|_____|_____|_CTL_|_BSP_|_DEL_| 7 |_CTL_|_ENT_|_SPC_|_FUN_|_____|_____|
*/
use std::collections::HashMap;

#[derive(Clone, Default, Debug)]
pub struct KeyboardLeftSide {
pub key: HashMap<(u8, u8), bool>,
pub key: HashMap<(i32, i32), &'static str>,
}

impl KeyboardLeftSide {
Expand All @@ -22,40 +22,40 @@ impl KeyboardLeftSide {
}
}

pub fn initialize_keys(&mut self) {
self.key.insert((0, 0), false); /* ESC */
self.key.insert((0, 1), false); /* 1 */
self.key.insert((0, 2), false); /* 2 */
self.key.insert((0, 3), false); /* 3 */
self.key.insert((0, 4), false); /* 4 */
self.key.insert((0, 5), false); /* 5 */

self.key.insert((1, 0), false); /* TAB */
self.key.insert((1, 1), false); /* Q */
self.key.insert((1, 2), false); /* W */
self.key.insert((1, 3), false); /* E */
self.key.insert((1, 4), false); /* R */
self.key.insert((1, 5), false); /* T */

self.key.insert((2, 0), false); /* CAP */
self.key.insert((2, 1), false); /* A */
self.key.insert((2, 2), false); /* S */
self.key.insert((2, 3), false); /* D */
self.key.insert((2, 4), false); /* F */
self.key.insert((2, 5), false); /* G */

self.key.insert((3, 0), false); /* SFT */
self.key.insert((3, 1), false); /* Z */
self.key.insert((3, 2), false); /* X */
self.key.insert((3, 3), false); /* C */
self.key.insert((3, 4), false); /* V */
self.key.insert((3, 5), false); /* B */

self.key.insert((4, 0), false); /* placeHolder */
self.key.insert((4, 1), false); /* placeHolder */
self.key.insert((4, 2), false); /* placeHolder */
self.key.insert((4, 3), false); /* CTL */
self.key.insert((4, 4), false); /* BSP */
self.key.insert((4, 5), false); /* DEL */
pub fn initialize_hashmap(&mut self) {
self.key.insert((2, 0), "ESC"); /* ESC */
self.key.insert((2, 1), "1"); /* 1 */
self.key.insert((2, 12), "2"); /* 2 */
self.key.insert((2, 18), "3"); /* 3 */
self.key.insert((2, 19), "4"); /* 4 */
self.key.insert((2, 13), "5"); /* 5 */

self.key.insert((3, 0), "TAB"); /* TAB */
self.key.insert((3, 1), "Q"); /* Q */
self.key.insert((3, 12), "W"); /* W */
self.key.insert((3, 18), "E"); /* E */
self.key.insert((3, 19), "R"); /* R */
self.key.insert((3, 13), "T"); /* T */

self.key.insert((10, 0), "CAP"); /* CAP */
self.key.insert((10, 1), "A"); /* A */
self.key.insert((10, 12), "S"); /* S */
self.key.insert((10, 18), "D"); /* D */
self.key.insert((10, 19), "F"); /* F */
self.key.insert((10, 13), "G"); /* G */

self.key.insert((6, 0), "SFT"); /* SFT */
self.key.insert((6, 1), "Z"); /* Z */
self.key.insert((6, 12), "X"); /* X */
self.key.insert((6, 18), "C"); /* C */
self.key.insert((6, 19), "V"); /* V */
self.key.insert((6, 13), "B"); /* B */

self.key.insert((7, 0), "PLACEHOLDER"); /* placeHolder */
self.key.insert((7, 1), "PLACEHOLDER"); /* placeHolder */
self.key.insert((7, 12), "PLACEHOLDER"); /* placeHolder */
self.key.insert((7, 18), "CTL"); /* CTL */
self.key.insert((7, 19), "BSP"); /* BSP */
self.key.insert((7, 13), "DEL"); /* DEL */
}
}
Loading

0 comments on commit 10fc79b

Please sign in to comment.