Compare commits
11 Commits
mousefood
...
keyboard-w
| Author | SHA1 | Date | |
|---|---|---|---|
| 42a3f4c104 | |||
| dd909a7f4a | |||
| c1b49622a3 | |||
| 7f8e10d33d | |||
| a537d9ea69 | |||
| 19b52eb7a9 | |||
| c387b5ebf8 | |||
| a0fb1a0da5 | |||
| 65ad7bab48 | |||
| 5e537be5a3 | |||
| b3e721a8be |
225
Cargo.lock
generated
225
Cargo.lock
generated
@@ -42,7 +42,7 @@ version = "4.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891"
|
checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"term 1.0.2",
|
"term 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -138,6 +138,18 @@ version = "2.9.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitvec"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
|
||||||
|
dependencies = [
|
||||||
|
"funty",
|
||||||
|
"radium",
|
||||||
|
"tap",
|
||||||
|
"wyz",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
version = "0.10.4"
|
version = "0.10.4"
|
||||||
@@ -447,12 +459,13 @@ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-embedded-hal"
|
name = "embassy-embedded-hal"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12"
|
checksum = "8578db196d74db92efdd5ebc546736dac1685499ee245b22eff92fa5e4b57945"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-hal-internal 0.3.0",
|
||||||
|
"embassy-sync 0.7.0",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-hal 0.2.7",
|
"embedded-hal 0.2.7",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
@@ -505,6 +518,15 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embassy-hal-internal"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-net-driver"
|
name = "embassy-net-driver"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -513,13 +535,13 @@ checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-net-driver-channel"
|
name = "embassy-net-driver-channel"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7"
|
checksum = "25a567ab50319d866ad5e6c583ed665ba9b07865389644d3d82e45bf1497c934"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-net-driver",
|
"embassy-net-driver",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-sync 0.7.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -536,7 +558,7 @@ dependencies = [
|
|||||||
"document-features",
|
"document-features",
|
||||||
"embassy-embedded-hal",
|
"embassy-embedded-hal",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-hal-internal",
|
"embassy-hal-internal 0.2.0",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-sync 0.6.2",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embassy-usb-driver",
|
"embassy-usb-driver",
|
||||||
@@ -574,7 +596,7 @@ dependencies = [
|
|||||||
"document-features",
|
"document-features",
|
||||||
"embassy-embedded-hal",
|
"embassy-embedded-hal",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-hal-internal",
|
"embassy-hal-internal 0.2.0",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-sync 0.6.2",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embassy-time-driver",
|
"embassy-time-driver",
|
||||||
@@ -666,11 +688,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-usb-driver"
|
name = "embassy-usb-driver"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970"
|
checksum = "340c5ce591ef58c6449e43f51d2c53efe1bf0bb6a40cbf80afa0d259c7d52c76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"defmt 0.3.100",
|
"defmt 1.0.1",
|
||||||
|
"embedded-io-async",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -844,6 +867,12 @@ version = "1.0.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "funty"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@@ -989,15 +1018,6 @@ version = "0.5.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "home"
|
|
||||||
version = "0.5.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
|
|
||||||
dependencies = [
|
|
||||||
"windows-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ident_case"
|
name = "ident_case"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@@ -1006,9 +1026,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.9.0"
|
version = "2.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -1022,7 +1042,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1101,7 +1121,7 @@ dependencies = [
|
|||||||
"regex-syntax 0.8.5",
|
"regex-syntax 0.8.5",
|
||||||
"sha3",
|
"sha3",
|
||||||
"string_cache",
|
"string_cache",
|
||||||
"term 1.0.2",
|
"term 1.1.0",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
@@ -1288,7 +1308,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"windows-targets",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1336,6 +1356,7 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
|||||||
name = "picocalc-os-rs"
|
name = "picocalc-os-rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bitflags 2.9.1",
|
||||||
"bt-hci",
|
"bt-hci",
|
||||||
"cortex-m",
|
"cortex-m",
|
||||||
"cortex-m-rt",
|
"cortex-m-rt",
|
||||||
@@ -1354,10 +1375,13 @@ dependencies = [
|
|||||||
"embedded-hal-async",
|
"embedded-hal-async",
|
||||||
"embedded-hal-bus",
|
"embedded-hal-bus",
|
||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
|
"heapless",
|
||||||
"panic-probe",
|
"panic-probe",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
|
"spin",
|
||||||
"st7365p-lcd",
|
"st7365p-lcd",
|
||||||
"static_cell",
|
"static_cell",
|
||||||
|
"talc",
|
||||||
"trouble-host",
|
"trouble-host",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1540,6 +1564,12 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "radium"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
@@ -1603,9 +1633,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rgb"
|
name = "rgb"
|
||||||
version = "0.8.50"
|
version = "0.8.52"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
|
checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
@@ -1727,11 +1757,24 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "st7365p-lcd"
|
name = "spin"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "st7365p-lcd"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "git+https://github.com/legitcamper/st7365p-lcd-rs?branch=async#87abf450404865dcb535292e9e1a6a2457fd4599"
|
||||||
|
dependencies = [
|
||||||
|
"bitvec",
|
||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
|
"embedded-hal-async",
|
||||||
|
"heapless",
|
||||||
"nb 1.1.0",
|
"nb 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1790,6 +1833,21 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "talc"
|
||||||
|
version = "4.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a3ae828aa394de34c7de08f522d1b86bd1c182c668d27da69caadda00590f26d"
|
||||||
|
dependencies = [
|
||||||
|
"lock_api",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tap"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "term"
|
name = "term"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -1803,12 +1861,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "term"
|
name = "term"
|
||||||
version = "1.0.2"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a984c8d058c627faaf5e8e2ed493fa3c51771889196de1016cf9c1c6e90d750"
|
checksum = "a43bddab41f8626c7bdaab872bbba75f8df5847b516d77c569c746e2ae5eb746"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"home",
|
"windows-sys 0.60.2",
|
||||||
"windows-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2059,7 +2116,7 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2074,7 +2131,16 @@ version = "0.59.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets",
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.53.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2083,14 +2149,30 @@ version = "0.52.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm 0.52.6",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc 0.52.6",
|
||||||
"windows_i686_gnu",
|
"windows_i686_gnu 0.52.6",
|
||||||
"windows_i686_gnullvm",
|
"windows_i686_gnullvm 0.52.6",
|
||||||
"windows_i686_msvc",
|
"windows_i686_msvc 0.52.6",
|
||||||
"windows_x86_64_gnu",
|
"windows_x86_64_gnu 0.52.6",
|
||||||
"windows_x86_64_gnullvm",
|
"windows_x86_64_gnullvm 0.52.6",
|
||||||
"windows_x86_64_msvc",
|
"windows_x86_64_msvc 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.53.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm 0.53.0",
|
||||||
|
"windows_aarch64_msvc 0.53.0",
|
||||||
|
"windows_i686_gnu 0.53.0",
|
||||||
|
"windows_i686_gnullvm 0.53.0",
|
||||||
|
"windows_i686_msvc 0.53.0",
|
||||||
|
"windows_x86_64_gnu 0.53.0",
|
||||||
|
"windows_x86_64_gnullvm 0.53.0",
|
||||||
|
"windows_x86_64_msvc 0.53.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2099,48 +2181,105 @@ version = "0.52.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wyz"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
|
||||||
|
dependencies = [
|
||||||
|
"tap",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.8.26"
|
version = "0.8.26"
|
||||||
|
|||||||
@@ -71,7 +71,10 @@ defmt-rtt = "0.4.2"
|
|||||||
|
|
||||||
embedded-graphics = { version = "0.8.1" }
|
embedded-graphics = { version = "0.8.1" }
|
||||||
embedded-sdmmc = { git = "https://github.com/Be-ing/embedded-sdmmc-rs", branch = "bisync", default-features = false }
|
embedded-sdmmc = { git = "https://github.com/Be-ing/embedded-sdmmc-rs", branch = "bisync", default-features = false }
|
||||||
# st7365p-lcd = { git = "https://github.com/legitcamper/st7365p-lcd-rs" }
|
st7365p-lcd = { git = "https://github.com/legitcamper/st7365p-lcd-rs", branch = "async" }
|
||||||
st7365p-lcd = { path = "../ST7365P-lcd-rs" }
|
|
||||||
|
|
||||||
static_cell = "2.1.1"
|
static_cell = "2.1.1"
|
||||||
|
bitflags = "2.9.1"
|
||||||
|
talc = "4.4.3"
|
||||||
|
spin = "0.10.0"
|
||||||
|
heapless = "0.8.0"
|
||||||
|
|||||||
140
src/display.rs
140
src/display.rs
@@ -1,21 +1,35 @@
|
|||||||
|
use core::sync::atomic::Ordering;
|
||||||
|
|
||||||
|
use defmt::info;
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
gpio::{Level, Output},
|
gpio::{Level, Output},
|
||||||
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
||||||
spi::{Blocking, Spi},
|
spi::{Async, Spi},
|
||||||
};
|
};
|
||||||
use embassy_time::{Delay, Timer};
|
use embassy_sync::{blocking_mutex::raw::ThreadModeRawMutex, signal::Signal};
|
||||||
|
use embassy_time::{Delay, Instant, Timer};
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable, Pixel,
|
Drawable,
|
||||||
pixelcolor::{Rgb565, raw::RawU16},
|
draw_target::DrawTarget,
|
||||||
prelude::{DrawTarget, OriginDimensions, Point, Primitive, RawData, RgbColor, Size},
|
mono_font::{MonoTextStyle, ascii::FONT_10X20},
|
||||||
primitives::{PrimitiveStyle, Rectangle},
|
pixelcolor::Rgb565,
|
||||||
|
prelude::{Dimensions, Point, RgbColor, Size},
|
||||||
|
primitives::Rectangle,
|
||||||
|
text::{Alignment, Text},
|
||||||
};
|
};
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use st7365p_lcd::{Orientation, ST7365P};
|
use portable_atomic::AtomicBool;
|
||||||
|
use st7365p_lcd::{FrameBuffer, ST7365P};
|
||||||
|
|
||||||
#[embassy_executor::task]
|
use crate::LAST_TEXT_RECT;
|
||||||
pub async fn display_task(
|
|
||||||
spi: Spi<'static, SPI1, Blocking>,
|
const SCREEN_WIDTH: usize = 320;
|
||||||
|
const SCREEN_HEIGHT: usize = 320;
|
||||||
|
|
||||||
|
pub static DISPLAY_SIGNAL: Signal<ThreadModeRawMutex, ()> = Signal::new();
|
||||||
|
|
||||||
|
pub async fn display_handler(
|
||||||
|
spi: Spi<'static, SPI1, Async>,
|
||||||
cs: PIN_13,
|
cs: PIN_13,
|
||||||
data: PIN_14,
|
data: PIN_14,
|
||||||
reset: PIN_15,
|
reset: PIN_15,
|
||||||
@@ -25,89 +39,49 @@ pub async fn display_task(
|
|||||||
spi_device,
|
spi_device,
|
||||||
Output::new(data, Level::Low),
|
Output::new(data, Level::Low),
|
||||||
Some(Output::new(reset, Level::High)),
|
Some(Output::new(reset, Level::High)),
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
320,
|
true,
|
||||||
320,
|
Delay,
|
||||||
);
|
);
|
||||||
display.init(&mut Delay).unwrap();
|
let mut framebuffer: FrameBuffer<
|
||||||
display.set_orientation(&Orientation::Landscape).unwrap();
|
SCREEN_WIDTH,
|
||||||
let mut virtual_display = VirtualDisplay::new(display, 320 / 2, 320 / 2);
|
SCREEN_HEIGHT,
|
||||||
|
{ SCREEN_WIDTH * SCREEN_HEIGHT },
|
||||||
|
> = FrameBuffer::new();
|
||||||
|
display.init().await.unwrap();
|
||||||
|
display.set_custom_orientation(0x40).await.unwrap();
|
||||||
|
framebuffer.draw(&mut display).await.unwrap();
|
||||||
|
display.set_on().await.unwrap();
|
||||||
|
|
||||||
let thin_stroke = PrimitiveStyle::with_stroke(Rgb565::RED, 20);
|
DISPLAY_SIGNAL.signal(());
|
||||||
|
|
||||||
Rectangle::new(Point::new(10, 10), Size::new(100, 100))
|
|
||||||
.into_styled(thin_stroke)
|
|
||||||
.draw(&mut virtual_display)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
Timer::after_millis(500).await;
|
DISPLAY_SIGNAL.wait().await;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// simple abstraction over real display & resolution to reduce frame buffer size
|
let text_string = crate::STRING.lock().await.clone();
|
||||||
/// by cutting the resolution by 1/4
|
|
||||||
struct VirtualDisplay {
|
|
||||||
display: ST7365P<
|
|
||||||
ExclusiveDevice<Spi<'static, SPI1, Blocking>, Output<'static>, Delay>,
|
|
||||||
Output<'static>,
|
|
||||||
Output<'static>,
|
|
||||||
>,
|
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl VirtualDisplay {
|
let text = Text::with_alignment(
|
||||||
pub fn new(
|
&text_string,
|
||||||
display: ST7365P<
|
Point::new(160, 160),
|
||||||
ExclusiveDevice<Spi<'static, SPI1, Blocking>, Output<'static>, Delay>,
|
MonoTextStyle::new(&FONT_10X20, Rgb565::RED),
|
||||||
Output<'static>,
|
Alignment::Center,
|
||||||
Output<'static>,
|
);
|
||||||
>,
|
|
||||||
new_width: u32,
|
|
||||||
new_height: u32,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
display,
|
|
||||||
width: new_width,
|
|
||||||
height: new_height,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DrawTarget for VirtualDisplay {
|
{
|
||||||
type Color = Rgb565;
|
let rect = LAST_TEXT_RECT.lock().await;
|
||||||
type Error = ();
|
if let Some(rect) = *rect.borrow() {
|
||||||
|
framebuffer.fill_solid(&rect, Rgb565::BLACK).unwrap();
|
||||||
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
|
|
||||||
where
|
|
||||||
I: IntoIterator<Item = Pixel<Self::Color>>,
|
|
||||||
{
|
|
||||||
for Pixel(coord, color) in pixels.into_iter() {
|
|
||||||
// Check bounds on the *virtual* (already reduced) resolution
|
|
||||||
if coord.x >= 0
|
|
||||||
&& coord.y >= 0
|
|
||||||
&& coord.x < self.width as i32
|
|
||||||
&& coord.y < self.height as i32
|
|
||||||
{
|
|
||||||
let px = coord.x as u16 * 2;
|
|
||||||
let py = coord.y as u16 * 2;
|
|
||||||
let raw_color = RawU16::from(color).into_inner();
|
|
||||||
|
|
||||||
// Draw the 2x2 block on the underlying hardware
|
|
||||||
self.display.set_pixel(px, py, raw_color)?;
|
|
||||||
self.display.set_pixel(px + 1, py, raw_color)?;
|
|
||||||
self.display.set_pixel(px, py + 1, raw_color)?;
|
|
||||||
self.display.set_pixel(px + 1, py + 1, raw_color)?;
|
|
||||||
}
|
}
|
||||||
|
*rect.borrow_mut() = Some(text.bounding_box());
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OriginDimensions for VirtualDisplay {
|
text.draw(&mut framebuffer).unwrap();
|
||||||
fn size(&self) -> Size {
|
|
||||||
Size::new(self.width, self.height)
|
let start = Instant::now();
|
||||||
|
framebuffer
|
||||||
|
.partial_draw_batched(&mut display)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
info!("Elapsed {}ms", start.elapsed().as_millis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
88
src/main.rs
88
src/main.rs
@@ -1,62 +1,82 @@
|
|||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
#![feature(ascii_char)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
use crate::{
|
||||||
use defmt::*;
|
display::DISPLAY_SIGNAL,
|
||||||
|
peripherals::keyboard::{KeyCode, KeyState, read_keyboard_fifo},
|
||||||
|
};
|
||||||
|
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
use core::cell::RefCell;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_futures::join::join;
|
||||||
use embassy_rp::peripherals::I2C1;
|
use embassy_rp::peripherals::I2C1;
|
||||||
use embassy_rp::spi::Spi;
|
use embassy_rp::{i2c, i2c::I2c, spi};
|
||||||
use embassy_rp::{
|
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||||
bind_interrupts,
|
use embassy_sync::mutex::Mutex;
|
||||||
gpio::{Level, Output},
|
|
||||||
i2c,
|
|
||||||
i2c::I2c,
|
|
||||||
spi,
|
|
||||||
};
|
|
||||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
|
||||||
use embassy_sync::channel::Channel;
|
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_graphics::primitives::Rectangle;
|
||||||
use embedded_sdmmc::asynchronous::{File, SdCard, ShortFileName, VolumeIdx, VolumeManager};
|
use heapless::String;
|
||||||
use static_cell::StaticCell;
|
|
||||||
|
|
||||||
mod peripherals;
|
mod peripherals;
|
||||||
use peripherals::{keyboard::KeyEvent, peripherals_task};
|
use peripherals::conf_peripherals;
|
||||||
mod display;
|
mod display;
|
||||||
use display::display_task;
|
use display::display_handler;
|
||||||
|
|
||||||
embassy_rp::bind_interrupts!(struct Irqs {
|
embassy_rp::bind_interrupts!(struct Irqs {
|
||||||
I2C1_IRQ => i2c::InterruptHandler<I2C1>;
|
I2C1_IRQ => i2c::InterruptHandler<I2C1>;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static STRING: Mutex<ThreadModeRawMutex, String<25>> = Mutex::new(String::new());
|
||||||
|
static LAST_TEXT_RECT: Mutex<ThreadModeRawMutex, RefCell<Option<Rectangle>>> =
|
||||||
|
Mutex::new(RefCell::new(None));
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_rp::init(Default::default());
|
let p = embassy_rp::init(Default::default());
|
||||||
|
|
||||||
static KEYBOARD_EVENTS: StaticCell<Channel<NoopRawMutex, KeyEvent, 10>> = StaticCell::new();
|
STRING.lock().await.push_str("Press Del").unwrap();
|
||||||
let keyboard_events = KEYBOARD_EVENTS.init(Channel::new());
|
|
||||||
|
|
||||||
// configure keyboard event handler
|
// configure keyboard event handler
|
||||||
let config = i2c::Config::default();
|
let mut config = i2c::Config::default();
|
||||||
|
config.frequency = 400_000;
|
||||||
let i2c1 = I2c::new_async(p.I2C1, p.PIN_7, p.PIN_6, Irqs, config);
|
let i2c1 = I2c::new_async(p.I2C1, p.PIN_7, p.PIN_6, Irqs, config);
|
||||||
spawner
|
conf_peripherals(i2c1).await;
|
||||||
.spawn(peripherals_task(i2c1, keyboard_events.sender()))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// configure display handler
|
|
||||||
let mut config = spi::Config::default();
|
let mut config = spi::Config::default();
|
||||||
config.frequency = 16_000_000;
|
config.frequency = 16_000_000;
|
||||||
let spi1 = spi::Spi::new_blocking(p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, config);
|
let spi1 = spi::Spi::new(
|
||||||
spawner
|
p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, p.DMA_CH0, p.DMA_CH1, config,
|
||||||
.spawn(display_task(spi1, p.PIN_13, p.PIN_14, p.PIN_15))
|
);
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let receiver = keyboard_events.receiver();
|
join(
|
||||||
loop {
|
async {
|
||||||
let key = receiver.receive().await;
|
loop {
|
||||||
info!("got key: {}", key.key as u8);
|
Timer::after_millis(20).await;
|
||||||
}
|
if let Some(key) = read_keyboard_fifo().await
|
||||||
|
&& key.state == KeyState::Pressed
|
||||||
|
{
|
||||||
|
let mut string = STRING.lock().await;
|
||||||
|
match key.key {
|
||||||
|
KeyCode::Backspace => {
|
||||||
|
string.pop().unwrap();
|
||||||
|
}
|
||||||
|
KeyCode::Del => {
|
||||||
|
string.clear();
|
||||||
|
}
|
||||||
|
KeyCode::Char(c) => {
|
||||||
|
string.push(c).unwrap();
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
DISPLAY_SIGNAL.signal(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
display_handler(spi1, p.PIN_13, p.PIN_14, p.PIN_15),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
use embassy_rp::{
|
|
||||||
i2c::{Async, I2c},
|
|
||||||
peripherals::I2C1,
|
|
||||||
};
|
|
||||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex, watch::Watch};
|
|
||||||
|
|
||||||
const REG_ID_BAT: u8 = 0x0b;
|
|
||||||
|
|
||||||
pub static BATTERY_PCT: Watch<CriticalSectionRawMutex, u8, 1> = Watch::new();
|
|
||||||
|
|
||||||
pub async fn read_battery(i2c: &mut I2c<'static, I2C1, Async>) {
|
|
||||||
let mut buf = [0_u8; 2];
|
|
||||||
i2c.write_read_async(super::MCU_ADDR, [REG_ID_BAT], &mut buf)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if buf[0] == REG_ID_BAT {
|
|
||||||
BATTERY_PCT.sender().send(buf[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,5 @@
|
|||||||
use embassy_rp::{
|
|
||||||
i2c::{Async, I2c},
|
use crate::peripherals::PERIPHERAL_BUS;
|
||||||
peripherals::I2C1,
|
|
||||||
};
|
|
||||||
use embassy_sync::{
|
|
||||||
blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex},
|
|
||||||
channel::Sender,
|
|
||||||
};
|
|
||||||
|
|
||||||
const REG_ID_KEY: u8 = 0x04;
|
const REG_ID_KEY: u8 = 0x04;
|
||||||
const REG_ID_FIF: u8 = 0x09;
|
const REG_ID_FIF: u8 = 0x09;
|
||||||
@@ -14,10 +8,10 @@ const KEY_CAPSLOCK: u8 = 1 << 5;
|
|||||||
const KEY_NUMLOCK: u8 = 1 << 6;
|
const KEY_NUMLOCK: u8 = 1 << 6;
|
||||||
const KEY_COUNT_MASK: u8 = 0x1F; // 0x1F == 31
|
const KEY_COUNT_MASK: u8 = 0x1F; // 0x1F == 31
|
||||||
|
|
||||||
pub async fn read_keyboard_fifo(
|
pub async fn read_keyboard_fifo() -> Option<KeyEvent> {
|
||||||
i2c: &mut I2c<'static, I2C1, Async>,
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
channel: &mut Sender<'static, NoopRawMutex, KeyEvent, 10>,
|
let i2c = i2c.as_mut().unwrap();
|
||||||
) {
|
|
||||||
let mut key_status = [0_u8; 1];
|
let mut key_status = [0_u8; 1];
|
||||||
|
|
||||||
if i2c
|
if i2c
|
||||||
@@ -25,9 +19,8 @@ pub async fn read_keyboard_fifo(
|
|||||||
.await
|
.await
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
// TODO: use caps & num lock
|
let _caps = key_status[0] & KEY_CAPSLOCK == KEY_CAPSLOCK;
|
||||||
let caps = key_status[0] & KEY_CAPSLOCK == KEY_CAPSLOCK;
|
let _num = key_status[0] & KEY_NUMLOCK == KEY_NUMLOCK;
|
||||||
let num = key_status[0] & KEY_NUMLOCK == KEY_NUMLOCK;
|
|
||||||
let fifo_count = key_status[0] & KEY_COUNT_MASK;
|
let fifo_count = key_status[0] & KEY_COUNT_MASK;
|
||||||
|
|
||||||
if fifo_count >= 1 {
|
if fifo_count >= 1 {
|
||||||
@@ -38,78 +31,98 @@ pub async fn read_keyboard_fifo(
|
|||||||
.await
|
.await
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
if let Ok(state) = KeyState::try_from(event[0]) {
|
return Some(KeyEvent {
|
||||||
if let Ok(key) = KeyCode::try_from(event[1]) {
|
state: KeyState::from(event[0]),
|
||||||
let _ = channel.try_send(KeyEvent { key, state });
|
key: KeyCode::from(event[1]),
|
||||||
}
|
mods: Modifiers::NONE,
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const REG_ID_DEB: u8 = 0x06;
|
||||||
|
const REG_ID_FRQ: u8 = 0x07;
|
||||||
|
|
||||||
|
pub async fn configure_keyboard(debounce: u8, poll_freq: u8) {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let _ = i2c
|
||||||
|
.write_read_async(super::MCU_ADDR, [REG_ID_DEB], &mut [debounce])
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let _ = i2c
|
||||||
|
.write_read_async(super::MCU_ADDR, [REG_ID_FRQ], &mut [poll_freq])
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
bitflags::bitflags! {
|
||||||
|
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
|
pub struct Modifiers: u8 {
|
||||||
|
const NONE = 0;
|
||||||
|
const CTRL = 1;
|
||||||
|
const ALT = 2;
|
||||||
|
const LSHIFT = 4;
|
||||||
|
const RSHIFT = 8;
|
||||||
|
const SYM = 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct KeyEvent {
|
pub struct KeyEvent {
|
||||||
pub key: KeyCode,
|
pub key: KeyCode,
|
||||||
pub state: KeyState,
|
pub state: KeyState,
|
||||||
|
pub mods: Modifiers,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum KeyState {
|
pub enum KeyState {
|
||||||
Idle = 0,
|
Idle = 0,
|
||||||
Pressed,
|
Pressed = 1,
|
||||||
Hold,
|
Hold = 2,
|
||||||
Released,
|
Released = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<u8> for KeyState {
|
impl From<u8> for KeyState {
|
||||||
type Error = ();
|
fn from(value: u8) -> Self {
|
||||||
|
|
||||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
|
||||||
match value {
|
match value {
|
||||||
0 => Ok(KeyState::Idle),
|
1 => KeyState::Pressed,
|
||||||
1 => Ok(KeyState::Pressed),
|
2 => KeyState::Hold,
|
||||||
2 => Ok(KeyState::Hold),
|
3 => KeyState::Released,
|
||||||
3 => Ok(KeyState::Released),
|
0 | _ => KeyState::Idle,
|
||||||
_ => Err(()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u8)]
|
||||||
pub enum KeyCode {
|
pub enum KeyCode {
|
||||||
// Joystick
|
|
||||||
JoyUp = 0x01,
|
JoyUp = 0x01,
|
||||||
JoyDown = 0x02,
|
JoyDown = 0x02,
|
||||||
JoyLeft = 0x03,
|
JoyLeft = 0x03,
|
||||||
JoyRight = 0x04,
|
JoyRight = 0x04,
|
||||||
JoyCenter = 0x05,
|
JoyCenter = 0x05,
|
||||||
|
|
||||||
// Buttons
|
|
||||||
BtnLeft1 = 0x06,
|
BtnLeft1 = 0x06,
|
||||||
BtnRight1 = 0x07,
|
BtnRight1 = 0x07,
|
||||||
BtnLeft2 = 0x11,
|
BtnLeft2 = 0x11,
|
||||||
BtnRight2 = 0x12,
|
BtnRight2 = 0x12,
|
||||||
|
|
||||||
// Basic Keys
|
|
||||||
Backspace = 0x08,
|
Backspace = 0x08,
|
||||||
Tab = 0x09,
|
Tab = 0x09,
|
||||||
Enter = 0x0A,
|
Enter = 0x0A,
|
||||||
|
|
||||||
// Modifiers
|
|
||||||
ModAlt = 0xA1,
|
ModAlt = 0xA1,
|
||||||
ModShiftLeft = 0xA2,
|
ModShiftLeft = 0xA2,
|
||||||
ModShiftRight = 0xA3,
|
ModShiftRight = 0xA3,
|
||||||
ModSym = 0xA4,
|
ModSym = 0xA4,
|
||||||
ModCtrl = 0xA5,
|
ModCtrl = 0xA5,
|
||||||
|
|
||||||
// Navigation
|
|
||||||
Esc = 0xB1,
|
Esc = 0xB1,
|
||||||
Left = 0xB4,
|
Left = 0xB4,
|
||||||
Up = 0xB5,
|
Up = 0xB5,
|
||||||
Down = 0xB6,
|
Down = 0xB6,
|
||||||
Right = 0xB7,
|
Right = 0xB7,
|
||||||
|
|
||||||
// Specials
|
|
||||||
Break = 0xD0,
|
Break = 0xD0,
|
||||||
Insert = 0xD1,
|
Insert = 0xD1,
|
||||||
Home = 0xD2,
|
Home = 0xD2,
|
||||||
@@ -117,11 +130,7 @@ pub enum KeyCode {
|
|||||||
End = 0xD5,
|
End = 0xD5,
|
||||||
PageUp = 0xD6,
|
PageUp = 0xD6,
|
||||||
PageDown = 0xD7,
|
PageDown = 0xD7,
|
||||||
|
|
||||||
// Locks
|
|
||||||
CapsLock = 0xC1,
|
CapsLock = 0xC1,
|
||||||
|
|
||||||
// Function keys
|
|
||||||
F1 = 0x81,
|
F1 = 0x81,
|
||||||
F2 = 0x82,
|
F2 = 0x82,
|
||||||
F3 = 0x83,
|
F3 = 0x83,
|
||||||
@@ -132,55 +141,57 @@ pub enum KeyCode {
|
|||||||
F8 = 0x88,
|
F8 = 0x88,
|
||||||
F9 = 0x89,
|
F9 = 0x89,
|
||||||
F10 = 0x90,
|
F10 = 0x90,
|
||||||
|
Char(char),
|
||||||
|
Unknown(u8),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<u8> for KeyCode {
|
impl From<u8> for KeyCode {
|
||||||
type Error = ();
|
fn from(value: u8) -> Self {
|
||||||
|
|
||||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
|
||||||
use KeyCode::*;
|
|
||||||
match value {
|
match value {
|
||||||
0x01 => Ok(JoyUp),
|
0x01 => Self::JoyUp,
|
||||||
0x02 => Ok(JoyDown),
|
0x02 => Self::JoyDown,
|
||||||
0x03 => Ok(JoyLeft),
|
0x03 => Self::JoyLeft,
|
||||||
0x04 => Ok(JoyRight),
|
0x04 => Self::JoyRight,
|
||||||
0x05 => Ok(JoyCenter),
|
0x05 => Self::JoyCenter,
|
||||||
0x06 => Ok(BtnLeft1),
|
0x06 => Self::BtnLeft1,
|
||||||
0x07 => Ok(BtnRight1),
|
0x07 => Self::BtnRight1,
|
||||||
0x08 => Ok(Backspace),
|
0x08 => Self::Backspace,
|
||||||
0x09 => Ok(Tab),
|
0x09 => Self::Tab,
|
||||||
0x0A => Ok(Enter),
|
0x0A => Self::Enter,
|
||||||
0x11 => Ok(BtnLeft2),
|
0x11 => Self::BtnLeft2,
|
||||||
0x12 => Ok(BtnRight2),
|
0x12 => Self::BtnRight2,
|
||||||
0xA1 => Ok(ModAlt),
|
0xA1 => Self::ModAlt,
|
||||||
0xA2 => Ok(ModShiftLeft),
|
0xA2 => Self::ModShiftLeft,
|
||||||
0xA3 => Ok(ModShiftRight),
|
0xA3 => Self::ModShiftRight,
|
||||||
0xA4 => Ok(ModSym),
|
0xA4 => Self::ModSym,
|
||||||
0xA5 => Ok(ModCtrl),
|
0xA5 => Self::ModCtrl,
|
||||||
0xB1 => Ok(Esc),
|
0xB1 => Self::Esc,
|
||||||
0xB4 => Ok(Left),
|
0xB4 => Self::Left,
|
||||||
0xB5 => Ok(Up),
|
0xB5 => Self::Up,
|
||||||
0xB6 => Ok(Down),
|
0xB6 => Self::Down,
|
||||||
0xB7 => Ok(Right),
|
0xB7 => Self::Right,
|
||||||
0xC1 => Ok(CapsLock),
|
0xC1 => Self::CapsLock,
|
||||||
0xD0 => Ok(Break),
|
0xD0 => Self::Break,
|
||||||
0xD1 => Ok(Insert),
|
0xD1 => Self::Insert,
|
||||||
0xD2 => Ok(Home),
|
0xD2 => Self::Home,
|
||||||
0xD4 => Ok(Del),
|
0xD4 => Self::Del,
|
||||||
0xD5 => Ok(End),
|
0xD5 => Self::End,
|
||||||
0xD6 => Ok(PageUp),
|
0xD6 => Self::PageUp,
|
||||||
0xD7 => Ok(PageDown),
|
0xD7 => Self::PageDown,
|
||||||
0x81 => Ok(F1),
|
0x81 => Self::F1,
|
||||||
0x82 => Ok(F2),
|
0x82 => Self::F2,
|
||||||
0x83 => Ok(F3),
|
0x83 => Self::F3,
|
||||||
0x84 => Ok(F4),
|
0x84 => Self::F4,
|
||||||
0x85 => Ok(F5),
|
0x85 => Self::F5,
|
||||||
0x86 => Ok(F6),
|
0x86 => Self::F6,
|
||||||
0x87 => Ok(F7),
|
0x87 => Self::F7,
|
||||||
0x88 => Ok(F8),
|
0x88 => Self::F8,
|
||||||
0x89 => Ok(F9),
|
0x89 => Self::F9,
|
||||||
0x90 => Ok(F10),
|
0x90 => Self::F10,
|
||||||
_ => Err(()),
|
_ => match char::from_u32(value as u32) {
|
||||||
|
Some(c) => Self::Char(c),
|
||||||
|
None => Self::Unknown(value),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,72 +1,98 @@
|
|||||||
//! handles all the peripherals exposed by mcu through i2c (keyboard & battery registers)
|
//! handles all the peripherals exposed by mcu through i2c (keyboard & battery registers)
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use embassy_futures::join::join;
|
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
i2c::{Async, I2c},
|
i2c::{Async, I2c},
|
||||||
peripherals::I2C1,
|
peripherals::I2C1,
|
||||||
};
|
};
|
||||||
use embassy_sync::{blocking_mutex::raw::NoopRawMutex, channel::Sender, mutex::Mutex};
|
use embassy_sync::{blocking_mutex::raw::NoopRawMutex, lazy_lock::LazyLock, mutex::Mutex};
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::Timer;
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
use defmt::info;
|
|
||||||
|
|
||||||
pub mod keyboard;
|
pub mod keyboard;
|
||||||
use keyboard::{KeyCode, KeyEvent, KeyState};
|
|
||||||
mod battery;
|
|
||||||
pub use battery::BATTERY_PCT;
|
|
||||||
use battery::read_battery;
|
|
||||||
|
|
||||||
use crate::peripherals::keyboard::read_keyboard_fifo;
|
use crate::peripherals::keyboard::{configure_keyboard, read_keyboard_fifo};
|
||||||
|
|
||||||
const MCU_ADDR: u8 = 0x1F;
|
const MCU_ADDR: u8 = 0x1F;
|
||||||
|
|
||||||
const REG_ID_VER: u8 = 0x01;
|
type I2CBUS = I2c<'static, I2C1, Async>;
|
||||||
const REG_ID_CFG: u8 = 0x02;
|
pub static PERIPHERAL_BUS: LazyLock<Mutex<NoopRawMutex, Option<I2CBUS>>> =
|
||||||
const REG_ID_INT: u8 = 0x03;
|
LazyLock::new(|| Mutex::new(None));
|
||||||
const REG_ID_KEY: u8 = 0x04;
|
|
||||||
const REG_ID_BKL: u8 = 0x05;
|
|
||||||
const REG_ID_DEB: u8 = 0x06;
|
|
||||||
const REG_ID_FRQ: u8 = 0x07;
|
|
||||||
const REG_ID_RST: u8 = 0x08;
|
|
||||||
const REG_ID_FIF: u8 = 0x09;
|
|
||||||
const REG_ID_BK2: u8 = 0x0A;
|
|
||||||
const REG_ID_C64_MTX: u8 = 0x0c;
|
|
||||||
const REG_ID_C64_JS: u8 = 0x0d;
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
const REG_ID_VER: u8 = 0x01;
|
||||||
pub async fn peripherals_task(
|
const REG_ID_RST: u8 = 0x08;
|
||||||
mut i2c: I2c<'static, I2C1, Async>,
|
const REG_ID_INT: u8 = 0x03;
|
||||||
mut keyboard_channel: Sender<'static, NoopRawMutex, KeyEvent, 10>,
|
|
||||||
) {
|
pub async fn conf_peripherals(i2c: I2CBUS) {
|
||||||
Timer::after(embassy_time::Duration::from_millis(100)).await;
|
Timer::after(embassy_time::Duration::from_millis(100)).await;
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
PERIPHERAL_BUS.get().lock().await.replace(i2c);
|
||||||
{
|
|
||||||
let mut ver = [0_u8; 1];
|
|
||||||
if let Ok(firm_ver) = i2c.write_read_async(MCU_ADDR, [REG_ID_VER], &mut ver).await {
|
|
||||||
info!("stm32 firmware version: v{}", ver[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let i2c: Mutex<NoopRawMutex, I2c<'static, I2C1, Async>> = Mutex::new(i2c);
|
configure_keyboard(200, 100).await;
|
||||||
|
|
||||||
join(
|
// empty keys
|
||||||
async {
|
while read_keyboard_fifo().await.is_some() {}
|
||||||
loop {
|
|
||||||
Timer::after(Duration::from_secs(10)).await;
|
// set_lcd_backlight(255).await;
|
||||||
let mut guard = i2c.lock().await;
|
set_key_backlight(0).await;
|
||||||
read_battery(&mut guard).await;
|
}
|
||||||
}
|
|
||||||
},
|
/// return major & minor mcu version
|
||||||
async {
|
async fn get_version() -> (u8, u8) {
|
||||||
loop {
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
Timer::after(Duration::from_millis(50)).await;
|
let i2c = i2c.as_mut().unwrap();
|
||||||
let mut guard = i2c.lock().await;
|
|
||||||
read_keyboard_fifo(&mut guard, &mut keyboard_channel).await;
|
let mut ver = [0_u8; 1];
|
||||||
}
|
let _ = i2c.write_read_async(MCU_ADDR, [REG_ID_VER], &mut ver).await;
|
||||||
},
|
|
||||||
)
|
(ver[0] >> 4, ver[0] & 0x0F)
|
||||||
.await;
|
}
|
||||||
|
|
||||||
|
const REG_ID_BKL: u8 = 0x05;
|
||||||
|
pub async fn set_lcd_backlight(brightness: u8) {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let _ = i2c
|
||||||
|
.write_read_async(MCU_ADDR, [REG_ID_BKL], &mut [brightness])
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
pub async fn get_lcd_backlight() -> u8 {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let mut buf = [0_u8; 2];
|
||||||
|
|
||||||
|
let _ = i2c.write_read_async(MCU_ADDR, [REG_ID_BKL], &mut buf).await;
|
||||||
|
buf[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
const REG_ID_BK2: u8 = 0x0A;
|
||||||
|
pub async fn set_key_backlight(brightness: u8) {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let _ = i2c
|
||||||
|
.write_read_async(MCU_ADDR, [REG_ID_BK2], &mut [brightness])
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
pub async fn get_key_backlight() -> u8 {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let mut buf = [0_u8; 2];
|
||||||
|
|
||||||
|
let _ = i2c.write_read_async(MCU_ADDR, [REG_ID_BK2], &mut buf).await;
|
||||||
|
buf[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
const REG_ID_BAT: u8 = 0x0b;
|
||||||
|
pub async fn get_battery() -> u8 {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let mut buf = [0_u8; 2];
|
||||||
|
|
||||||
|
let _ = i2c.write_read_async(MCU_ADDR, [REG_ID_BAT], &mut buf).await;
|
||||||
|
|
||||||
|
buf[1]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user