Compare commits
10 Commits
mousefood
...
display+si
| Author | SHA1 | Date | |
|---|---|---|---|
| 530e1770f1 | |||
| 7be20e9469 | |||
| 0ad706dfc9 | |||
| 073fa58121 | |||
| 06a158623d | |||
| a687122696 | |||
| a42cfb6bc5 | |||
| cf479cc00a | |||
| 5e537be5a3 | |||
| b3e721a8be |
469
Cargo.lock
generated
469
Cargo.lock
generated
@@ -12,6 +12,12 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler2"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.3"
|
version = "1.1.3"
|
||||||
@@ -22,10 +28,10 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "allocator-api2"
|
name = "aliasable"
|
||||||
version = "0.2.21"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
@@ -33,6 +39,12 @@ version = "0.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arrform"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7cf566ecc5c9d82b973e81d30babf6583c9b497f86295c952d538c3254ef4e6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ascii-canvas"
|
name = "ascii-canvas"
|
||||||
version = "3.0.0"
|
version = "3.0.0"
|
||||||
@@ -81,6 +93,12 @@ dependencies = [
|
|||||||
"rustc_version",
|
"rustc_version",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bisync"
|
name = "bisync"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -187,13 +205,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "castaway"
|
name = "byteorder-lite"
|
||||||
version = "0.2.3"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5"
|
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||||
dependencies = [
|
|
||||||
"rustversion",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -208,21 +223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"unicode-width 0.1.14",
|
"unicode-width",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "compact_str"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a"
|
|
||||||
dependencies = [
|
|
||||||
"castaway",
|
|
||||||
"cfg-if",
|
|
||||||
"itoa",
|
|
||||||
"rustversion",
|
|
||||||
"ryu",
|
|
||||||
"static_assertions",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -275,6 +276,15 @@ dependencies = [
|
|||||||
"debug-helper",
|
"debug-helper",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc32fast"
|
||||||
|
version = "1.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "critical-section"
|
name = "critical-section"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@@ -422,15 +432,6 @@ dependencies = [
|
|||||||
"defmt 0.3.100",
|
"defmt 0.3.100",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deranged"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
|
|
||||||
dependencies = [
|
|
||||||
"powerfmt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diff"
|
name = "diff"
|
||||||
version = "0.1.13"
|
version = "0.1.13"
|
||||||
@@ -737,12 +738,16 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-graphics-unicodefonts"
|
name = "embedded-graphics-simulator"
|
||||||
version = "0.1.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ef96f7e6453093b9ffc738fb025f1a14c31f7f67a5d587db99beb23ab8b433a"
|
checksum = "a31606a4fb7d9d3a79a38d27bc2954cfa98682c8fea4b22c09a442785a80424e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base64",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
|
"image",
|
||||||
|
"ouroboros",
|
||||||
|
"sdl2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -806,6 +811,27 @@ dependencies = [
|
|||||||
"embedded-io",
|
"embedded-io",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-layout"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9a90553247f2b05c59ac7894ea13d830636c2b1203fa03bff400eddbd1fa9f52"
|
||||||
|
dependencies = [
|
||||||
|
"embedded-graphics",
|
||||||
|
"embedded-layout-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-layout-macros"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4f6e621fe4c7e05b695274b722dc0a60bacd1c8696b58191baa0154713d52400"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.104",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-sdmmc"
|
name = "embedded-sdmmc"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@@ -852,6 +878,15 @@ version = "1.0.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fdeflate"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
|
||||||
|
dependencies = [
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixed"
|
name = "fixed"
|
||||||
version = "1.29.0"
|
version = "1.29.0"
|
||||||
@@ -876,6 +911,16 @@ version = "0.5.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
|
checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flate2"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||||
|
dependencies = [
|
||||||
|
"crc32fast",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "float-cmp"
|
name = "float-cmp"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@@ -891,12 +936,6 @@ 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 = "foldhash"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@@ -1025,11 +1064,6 @@ name = "hashbrown"
|
|||||||
version = "0.15.4"
|
version = "0.15.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
dependencies = [
|
|
||||||
"allocator-api2",
|
|
||||||
"equivalent",
|
|
||||||
"foldhash",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heapless"
|
name = "heapless"
|
||||||
@@ -1043,9 +1077,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.5.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
@@ -1068,6 +1102,18 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image"
|
||||||
|
version = "0.25.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db35664ce6b9810857a38a906215e75a9c879f0696556a39f59c62829710251a"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder-lite",
|
||||||
|
"num-traits",
|
||||||
|
"png",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.10.0"
|
version = "2.10.0"
|
||||||
@@ -1078,25 +1124,6 @@ dependencies = [
|
|||||||
"hashbrown",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indoc"
|
|
||||||
version = "2.0.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "instability"
|
|
||||||
version = "0.3.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0bf9fed6d91cfb734e7476a06bde8300a1b94e217e1b523b6f0cd1a01998c71d"
|
|
||||||
dependencies = [
|
|
||||||
"darling",
|
|
||||||
"indoc",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.104",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-terminal"
|
name = "is-terminal"
|
||||||
version = "0.4.16"
|
version = "0.4.16"
|
||||||
@@ -1117,15 +1144,6 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itertools"
|
|
||||||
version = "0.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
|
||||||
dependencies = [
|
|
||||||
"either",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@@ -1135,12 +1153,6 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "1.0.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.77"
|
version = "0.3.77"
|
||||||
@@ -1151,16 +1163,6 @@ dependencies = [
|
|||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "kasuari"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "def1b67294a9fdc95eeeeafd1209c7a1b8a82aa0bf80ac2ab2a7d0318e9c7622"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown",
|
|
||||||
"thiserror 2.0.12",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "keccak"
|
name = "keccak"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@@ -1255,15 +1257,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "line-clipping"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "51a1679740111eb63b7b4cb3c97b1d5d9f82e142292a25edcfdb4120a48b3880"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.9.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litrs"
|
name = "litrs"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@@ -1286,15 +1279,6 @@ version = "0.4.27"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lru"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.5"
|
version = "2.7.5"
|
||||||
@@ -1308,14 +1292,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815"
|
checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mousefood"
|
name = "miniz_oxide"
|
||||||
version = "0.2.1"
|
version = "0.8.9"
|
||||||
source = "git+https://github.com/j-g00da/mousefood#8d78348cebad78ee9929fd09b656bf7382fcd4b5"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-graphics",
|
"adler2",
|
||||||
"embedded-graphics-unicodefonts",
|
"simd-adler32",
|
||||||
"ratatui-core",
|
|
||||||
"thiserror 2.0.12",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1339,12 +1322,6 @@ version = "1.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-conv"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.19"
|
||||||
@@ -1401,6 +1378,30 @@ version = "1.21.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ouroboros"
|
||||||
|
version = "0.18.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59"
|
||||||
|
dependencies = [
|
||||||
|
"aliasable",
|
||||||
|
"ouroboros_macro",
|
||||||
|
"static_assertions",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ouroboros_macro"
|
||||||
|
version = "0.18.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"proc-macro2-diagnostics",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.104",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "panic-probe"
|
name = "panic-probe"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -1479,6 +1480,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",
|
||||||
@@ -1493,14 +1495,14 @@ dependencies = [
|
|||||||
"embassy-sync 0.7.0",
|
"embassy-sync 0.7.0",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
|
"embedded-graphics-simulator",
|
||||||
"embedded-hal 0.2.7",
|
"embedded-hal 0.2.7",
|
||||||
"embedded-hal-async",
|
"embedded-hal-async",
|
||||||
"embedded-hal-bus",
|
"embedded-hal-bus",
|
||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
"mousefood",
|
|
||||||
"panic-probe",
|
"panic-probe",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"ratatui",
|
"shared",
|
||||||
"spin",
|
"spin",
|
||||||
"st7365p-lcd",
|
"st7365p-lcd",
|
||||||
"static_cell",
|
"static_cell",
|
||||||
@@ -1608,6 +1610,19 @@ dependencies = [
|
|||||||
"syn 2.0.104",
|
"syn 2.0.104",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "png"
|
||||||
|
version = "0.17.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"crc32fast",
|
||||||
|
"fdeflate",
|
||||||
|
"flate2",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic"
|
name = "portable-atomic"
|
||||||
version = "1.11.1"
|
version = "1.11.1"
|
||||||
@@ -1617,12 +1632,6 @@ dependencies = [
|
|||||||
"critical-section",
|
"critical-section",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "powerfmt"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "precomputed-hash"
|
name = "precomputed-hash"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@@ -1684,6 +1693,19 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2-diagnostics"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.104",
|
||||||
|
"version_check",
|
||||||
|
"yansi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.40"
|
version = "1.0.40"
|
||||||
@@ -1699,56 +1721,6 @@ version = "0.6.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ratatui"
|
|
||||||
version = "0.30.0-alpha.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "63bfff7501cc6892821f54f1133661e0534413342c8e8efbb41af0ffccdcea45"
|
|
||||||
dependencies = [
|
|
||||||
"instability",
|
|
||||||
"ratatui-core",
|
|
||||||
"ratatui-widgets",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ratatui-core"
|
|
||||||
version = "0.1.0-alpha.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "353047185fbfb81ee05a3f8c573956adb2aa9a505da47fb150c18388806f5e22"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.9.1",
|
|
||||||
"compact_str",
|
|
||||||
"hashbrown",
|
|
||||||
"indoc",
|
|
||||||
"itertools 0.14.0",
|
|
||||||
"kasuari",
|
|
||||||
"lru",
|
|
||||||
"strum",
|
|
||||||
"thiserror 2.0.12",
|
|
||||||
"unicode-segmentation",
|
|
||||||
"unicode-truncate",
|
|
||||||
"unicode-width 0.2.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ratatui-widgets"
|
|
||||||
version = "0.3.0-alpha.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fab55e77e0421bb88944cc0262317688e039d0e58518195f13a6e689f3e22f42"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.9.1",
|
|
||||||
"hashbrown",
|
|
||||||
"indoc",
|
|
||||||
"instability",
|
|
||||||
"itertools 0.14.0",
|
|
||||||
"line-clipping",
|
|
||||||
"ratatui-core",
|
|
||||||
"strum",
|
|
||||||
"time",
|
|
||||||
"unicode-segmentation",
|
|
||||||
"unicode-width 0.2.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.13"
|
version = "0.5.13"
|
||||||
@@ -1853,12 +1825,6 @@ version = "1.0.21"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@@ -1874,6 +1840,29 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2"
|
||||||
|
version = "0.37.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b498da7d14d1ad6c839729bd4ad6fc11d90a57583605f3b4df2cd709a9cd380"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"sdl2-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2-sys"
|
||||||
|
version = "0.37.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "951deab27af08ed9c6068b7b0d05a93c91f0a8eb16b6b816a5e73452a43521d3"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"version-compare",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@@ -1905,6 +1894,32 @@ dependencies = [
|
|||||||
"keccak",
|
"keccak",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shared"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"arrform",
|
||||||
|
"embedded-graphics",
|
||||||
|
"embedded-graphics-core",
|
||||||
|
"embedded-layout",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simd-adler32"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simulator"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"embedded-graphics",
|
||||||
|
"embedded-graphics-simulator",
|
||||||
|
"embedded-layout",
|
||||||
|
"shared",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@@ -1947,10 +1962,11 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "st7365p-lcd"
|
name = "st7365p-lcd"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/legitcamper/st7365p-lcd-rs#d751e8d30f1a3f964ffe05e4bb16f82112fbefce"
|
source = "git+https://github.com/legitcamper/st7365p-lcd-rs?branch=async#9f8da568ff695a00afb6b8b8cf9573fad408a66f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
|
"embedded-hal-async",
|
||||||
"nb 1.1.0",
|
"nb 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1993,28 +2009,6 @@ version = "0.11.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strum"
|
|
||||||
version = "0.27.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32"
|
|
||||||
dependencies = [
|
|
||||||
"strum_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strum_macros"
|
|
||||||
version = "0.27.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
|
|
||||||
dependencies = [
|
|
||||||
"heck",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"rustversion",
|
|
||||||
"syn 2.0.104",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
@@ -2116,24 +2110,6 @@ dependencies = [
|
|||||||
"syn 2.0.104",
|
"syn 2.0.104",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.3.41"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
|
|
||||||
dependencies = [
|
|
||||||
"deranged",
|
|
||||||
"num-conv",
|
|
||||||
"powerfmt",
|
|
||||||
"time-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time-core"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tiny-keccak"
|
name = "tiny-keccak"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
@@ -2188,35 +2164,12 @@ version = "1.0.18"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-segmentation"
|
|
||||||
version = "1.12.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-truncate"
|
|
||||||
version = "2.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8fbf03860ff438702f3910ca5f28f8dac63c1c11e7efb5012b8b175493606330"
|
|
||||||
dependencies = [
|
|
||||||
"itertools 0.13.0",
|
|
||||||
"unicode-segmentation",
|
|
||||||
"unicode-width 0.2.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.14"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
@@ -2239,6 +2192,12 @@ version = "0.1.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
|
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version-compare"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
@@ -2438,6 +2397,12 @@ 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 = "yansi"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.8.26"
|
version = "0.8.26"
|
||||||
|
|||||||
79
Cargo.toml
79
Cargo.toml
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[workspace]
|
||||||
name = "picocalc-os-rs"
|
resolver = "3"
|
||||||
version = "0.1.0"
|
members = ["pico", "shared", "simulator"]
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = 2
|
debug = 2
|
||||||
@@ -9,74 +9,3 @@ debug = 2
|
|||||||
[profile.dev]
|
[profile.dev]
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["rp235x", "defmt"]
|
|
||||||
rp2040 = ["embassy-rp/rp2040"]
|
|
||||||
rp235x = ["embassy-rp/rp235xb"]
|
|
||||||
trouble = ["dep:bt-hci", "dep:cyw43", "dep:cyw43-pio", "dep:trouble-host"]
|
|
||||||
defmt = [
|
|
||||||
"dep:defmt",
|
|
||||||
"panic-probe/print-defmt",
|
|
||||||
"embassy-executor/defmt",
|
|
||||||
"embassy-time/defmt",
|
|
||||||
"embassy-time/defmt-timestamp-uptime",
|
|
||||||
"embassy-rp/defmt",
|
|
||||||
"embassy-sync/defmt",
|
|
||||||
"embedded-graphics/defmt",
|
|
||||||
"embedded-sdmmc/defmt-log",
|
|
||||||
# "bt-hci/defmt",
|
|
||||||
# "cyw43/defmt",
|
|
||||||
# "cyw43-pio/defmt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
embassy-executor = { version = "0.7", features = [
|
|
||||||
"arch-cortex-m",
|
|
||||||
"executor-interrupt",
|
|
||||||
"executor-thread",
|
|
||||||
"nightly",
|
|
||||||
] }
|
|
||||||
embassy-rp = { version = "0.4.0", features = [
|
|
||||||
"critical-section-impl",
|
|
||||||
"unstable-pac",
|
|
||||||
"time-driver",
|
|
||||||
"binary-info",
|
|
||||||
] }
|
|
||||||
embassy-futures = "0.1.1"
|
|
||||||
embassy-time = "0.4.0"
|
|
||||||
embassy-embedded-hal = "0.3.0"
|
|
||||||
embassy-sync = { version = "0.7" }
|
|
||||||
trouble-host = { version = "0.1", features = [
|
|
||||||
"derive",
|
|
||||||
"scan",
|
|
||||||
], optional = true }
|
|
||||||
bt-hci = { version = "0.2", default-features = false, optional = true }
|
|
||||||
cyw43 = { version = "0.3.0", features = [
|
|
||||||
"firmware-logs",
|
|
||||||
"bluetooth",
|
|
||||||
], optional = true }
|
|
||||||
cyw43-pio = { version = "0.3.0", optional = true }
|
|
||||||
|
|
||||||
embedded-hal-bus = { version = "0.3.0", features = ["async"] }
|
|
||||||
embedded-hal = "0.2.7"
|
|
||||||
embedded-hal-async = "1.0.0"
|
|
||||||
cortex-m = { version = "0.7.7" }
|
|
||||||
cortex-m-rt = "0.7.5"
|
|
||||||
panic-probe = "0.3"
|
|
||||||
portable-atomic = { version = "1.11", features = ["critical-section"] }
|
|
||||||
static_cell = "2.1.1"
|
|
||||||
talc = "4.4.3"
|
|
||||||
|
|
||||||
defmt = { version = "0.3", optional = true }
|
|
||||||
defmt-rtt = "0.4.2"
|
|
||||||
|
|
||||||
embedded-graphics = { version = "0.8.1" }
|
|
||||||
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" }
|
|
||||||
mousefood = "0.2.1"
|
|
||||||
ratatui = { version = "0.30.0-alpha.4", default-features = false }
|
|
||||||
spin = "0.10.0"
|
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
mousefood = { git = "https://github.com/j-g00da/mousefood" }
|
|
||||||
|
|||||||
76
pico/Cargo.toml
Normal file
76
pico/Cargo.toml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
[package]
|
||||||
|
name = "picocalc-os-rs"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["rp235x", "defmt"]
|
||||||
|
rp2040 = ["embassy-rp/rp2040"]
|
||||||
|
rp235x = ["embassy-rp/rp235xb"]
|
||||||
|
trouble = ["dep:bt-hci", "dep:cyw43", "dep:cyw43-pio", "dep:trouble-host"]
|
||||||
|
defmt = [
|
||||||
|
"dep:defmt",
|
||||||
|
"panic-probe/print-defmt",
|
||||||
|
"embassy-executor/defmt",
|
||||||
|
"embassy-time/defmt",
|
||||||
|
"embassy-time/defmt-timestamp-uptime",
|
||||||
|
"embassy-rp/defmt",
|
||||||
|
"embassy-sync/defmt",
|
||||||
|
"embedded-graphics/defmt",
|
||||||
|
"embedded-sdmmc/defmt-log",
|
||||||
|
# "bt-hci/defmt",
|
||||||
|
# "cyw43/defmt",
|
||||||
|
# "cyw43-pio/defmt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
embedded-graphics-simulator = { version = "0.7.0", default-features = false }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
embassy-executor = { version = "0.7", features = [
|
||||||
|
"arch-cortex-m",
|
||||||
|
"executor-interrupt",
|
||||||
|
"executor-thread",
|
||||||
|
"nightly",
|
||||||
|
] }
|
||||||
|
embassy-rp = { version = "0.4.0", features = [
|
||||||
|
"critical-section-impl",
|
||||||
|
"unstable-pac",
|
||||||
|
"time-driver",
|
||||||
|
"binary-info",
|
||||||
|
] }
|
||||||
|
embassy-futures = "0.1.1"
|
||||||
|
embassy-time = "0.4.0"
|
||||||
|
embassy-embedded-hal = "0.3.0"
|
||||||
|
embassy-sync = { version = "0.7" }
|
||||||
|
trouble-host = { version = "0.1", features = [
|
||||||
|
"derive",
|
||||||
|
"scan",
|
||||||
|
], optional = true }
|
||||||
|
bt-hci = { version = "0.2", default-features = false, optional = true }
|
||||||
|
cyw43 = { version = "0.3.0", features = [
|
||||||
|
"firmware-logs",
|
||||||
|
"bluetooth",
|
||||||
|
], optional = true }
|
||||||
|
cyw43-pio = { version = "0.3.0", optional = true }
|
||||||
|
|
||||||
|
embedded-hal-bus = { version = "0.3.0", features = ["async"] }
|
||||||
|
embedded-hal = "0.2.7"
|
||||||
|
embedded-hal-async = "1.0.0"
|
||||||
|
cortex-m = { version = "0.7.7" }
|
||||||
|
cortex-m-rt = "0.7.5"
|
||||||
|
panic-probe = "0.3"
|
||||||
|
portable-atomic = { version = "1.11", features = ["critical-section"] }
|
||||||
|
|
||||||
|
defmt = { version = "0.3", optional = true }
|
||||||
|
defmt-rtt = "0.4.2"
|
||||||
|
|
||||||
|
embedded-graphics = { version = "0.8.1" }
|
||||||
|
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", branch = "async" }
|
||||||
|
shared = { path = "../shared" }
|
||||||
|
|
||||||
|
static_cell = "2.1.1"
|
||||||
|
bitflags = "2.9.1"
|
||||||
|
talc = "4.4.3"
|
||||||
|
spin = "0.10.0"
|
||||||
61
pico/src/display.rs
Normal file
61
pico/src/display.rs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
use defmt::info;
|
||||||
|
use embassy_rp::{
|
||||||
|
gpio::{Level, Output},
|
||||||
|
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
||||||
|
spi::{Async, Spi},
|
||||||
|
};
|
||||||
|
use embassy_time::{Delay, Timer};
|
||||||
|
use embedded_graphics::{
|
||||||
|
Drawable,
|
||||||
|
mono_font::{MonoFont, MonoTextStyle, ascii::FONT_10X20},
|
||||||
|
pixelcolor::Rgb565,
|
||||||
|
prelude::{Point, WebColors},
|
||||||
|
text::{Baseline, Text, TextStyle},
|
||||||
|
};
|
||||||
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
|
use st7365p_lcd::{FrameBuffer, ST7365P};
|
||||||
|
|
||||||
|
use shared::{SCREEN_HEIGHT, SCREEN_WIDTH, TextBuffer};
|
||||||
|
|
||||||
|
type SPI = Spi<'static, SPI1, Async>;
|
||||||
|
|
||||||
|
type FRAMEBUFFER = FrameBuffer<
|
||||||
|
SCREEN_WIDTH,
|
||||||
|
SCREEN_HEIGHT,
|
||||||
|
ExclusiveDevice<Spi<'static, SPI1, Async>, Output<'static>, Delay>,
|
||||||
|
Output<'static>,
|
||||||
|
Output<'static>,
|
||||||
|
>;
|
||||||
|
|
||||||
|
#[embassy_executor::task]
|
||||||
|
pub async fn display_task(spi: SPI, cs: PIN_13, data: PIN_14, reset: PIN_15) {
|
||||||
|
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
||||||
|
let display = ST7365P::new(
|
||||||
|
spi_device,
|
||||||
|
Output::new(data, Level::Low),
|
||||||
|
Some(Output::new(reset, Level::High)),
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
SCREEN_WIDTH as u32,
|
||||||
|
SCREEN_HEIGHT as u32,
|
||||||
|
);
|
||||||
|
let mut framebuffer: FRAMEBUFFER = FrameBuffer::new(display);
|
||||||
|
|
||||||
|
framebuffer.init(&mut Delay).await.unwrap();
|
||||||
|
framebuffer.display.set_offset(0, 0);
|
||||||
|
framebuffer
|
||||||
|
.display
|
||||||
|
.set_custom_orientation(0x60)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut textbuffer = TextBuffer::new();
|
||||||
|
textbuffer.fill('A');
|
||||||
|
textbuffer.draw(&mut framebuffer);
|
||||||
|
info!("finished rendering");
|
||||||
|
|
||||||
|
loop {
|
||||||
|
framebuffer.draw().await.unwrap();
|
||||||
|
Timer::after_millis(500).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
#![feature(ascii_char)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
@@ -22,7 +23,6 @@ use embassy_time::Timer;
|
|||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use embedded_sdmmc::asynchronous::{File, SdCard, ShortFileName, VolumeIdx, VolumeManager};
|
use embedded_sdmmc::asynchronous::{File, SdCard, ShortFileName, VolumeIdx, VolumeManager};
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use talc::*;
|
|
||||||
|
|
||||||
mod peripherals;
|
mod peripherals;
|
||||||
use peripherals::{keyboard::KeyEvent, peripherals_task};
|
use peripherals::{keyboard::KeyEvent, peripherals_task};
|
||||||
@@ -33,16 +33,6 @@ embassy_rp::bind_interrupts!(struct Irqs {
|
|||||||
I2C1_IRQ => i2c::InterruptHandler<I2C1>;
|
I2C1_IRQ => i2c::InterruptHandler<I2C1>;
|
||||||
});
|
});
|
||||||
|
|
||||||
static mut ARENA: [u8; 400_000] = [0; 400_000];
|
|
||||||
|
|
||||||
#[global_allocator]
|
|
||||||
static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> = Talc::new(unsafe {
|
|
||||||
// if we're in a hosted environment, the Rust runtime may allocate before
|
|
||||||
// main() is called, so we need to initialize the arena automatically
|
|
||||||
ClaimOnOom::new(Span::from_array(core::ptr::addr_of!(ARENA).cast_mut()))
|
|
||||||
})
|
|
||||||
.lock();
|
|
||||||
|
|
||||||
#[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());
|
||||||
@@ -50,24 +40,21 @@ async fn main(spawner: Spawner) {
|
|||||||
static KEYBOARD_EVENTS: StaticCell<Channel<NoopRawMutex, KeyEvent, 10>> = StaticCell::new();
|
static KEYBOARD_EVENTS: StaticCell<Channel<NoopRawMutex, KeyEvent, 10>> = StaticCell::new();
|
||||||
let keyboard_events = KEYBOARD_EVENTS.init(Channel::new());
|
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();
|
||||||
let i2c1 = I2c::new_async(p.I2C1, p.PIN_7, p.PIN_6, Irqs, config);
|
// config.frequency = 100_000;
|
||||||
spawner
|
// let i2c1 = I2c::new_async(p.I2C1, p.PIN_7, p.PIN_6, Irqs, config);
|
||||||
.spawn(peripherals_task(i2c1, keyboard_events.sender()))
|
// spawner
|
||||||
.unwrap();
|
// .spawn(peripherals_task(i2c1, keyboard_events.sender()))
|
||||||
|
// .unwrap();
|
||||||
|
|
||||||
// configure display handler
|
// 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(
|
||||||
|
p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, p.DMA_CH0, p.DMA_CH1, config,
|
||||||
|
);
|
||||||
spawner
|
spawner
|
||||||
.spawn(display_task(spi1, p.PIN_13, p.PIN_14, p.PIN_15))
|
.spawn(display_task(spi1, p.PIN_13, p.PIN_14, p.PIN_15))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let receiver = keyboard_events.receiver();
|
|
||||||
loop {
|
|
||||||
let key = receiver.receive().await;
|
|
||||||
info!("got key: {}", key.key as u8);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
207
pico/src/peripherals/keyboard.rs
Normal file
207
pico/src/peripherals/keyboard.rs
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
use defmt::{info, warn};
|
||||||
|
use embassy_rp::{
|
||||||
|
i2c::{Async, I2c},
|
||||||
|
peripherals::I2C1,
|
||||||
|
};
|
||||||
|
use embassy_sync::{
|
||||||
|
blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex},
|
||||||
|
channel::Sender,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::peripherals::PERIPHERAL_BUS;
|
||||||
|
|
||||||
|
const REG_ID_KEY: u8 = 0x04;
|
||||||
|
const REG_ID_FIF: u8 = 0x09;
|
||||||
|
|
||||||
|
const KEY_CAPSLOCK: u8 = 1 << 5;
|
||||||
|
const KEY_NUMLOCK: u8 = 1 << 6;
|
||||||
|
const KEY_COUNT_MASK: u8 = 0x1F; // 0x1F == 31
|
||||||
|
|
||||||
|
pub async fn read_keyboard_fifo(channel: &mut Sender<'static, NoopRawMutex, KeyEvent, 10>) {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
let mut key_status = [0_u8; 1];
|
||||||
|
|
||||||
|
if i2c
|
||||||
|
.write_read_async(super::MCU_ADDR, [REG_ID_KEY], &mut key_status)
|
||||||
|
.await
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
|
let _caps = key_status[0] & KEY_CAPSLOCK == KEY_CAPSLOCK;
|
||||||
|
let _num = key_status[0] & KEY_NUMLOCK == KEY_NUMLOCK;
|
||||||
|
let fifo_count = key_status[0] & KEY_COUNT_MASK;
|
||||||
|
|
||||||
|
if fifo_count >= 1 {
|
||||||
|
let mut event = [0_u8; 2];
|
||||||
|
|
||||||
|
if i2c
|
||||||
|
.write_read_async(super::MCU_ADDR, [REG_ID_FIF], &mut event)
|
||||||
|
.await
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
|
channel
|
||||||
|
.try_send(KeyEvent {
|
||||||
|
state: KeyState::from(event[0]),
|
||||||
|
key: KeyCode::from(event[1]),
|
||||||
|
mods: Modifiers::NONE,
|
||||||
|
})
|
||||||
|
.expect("Failed to push key");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 key: KeyCode,
|
||||||
|
pub state: KeyState,
|
||||||
|
pub mods: Modifiers,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum KeyState {
|
||||||
|
Idle = 0,
|
||||||
|
Pressed = 1,
|
||||||
|
Hold = 2,
|
||||||
|
Released = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<u8> for KeyState {
|
||||||
|
fn from(value: u8) -> Self {
|
||||||
|
match value {
|
||||||
|
1 => KeyState::Pressed,
|
||||||
|
2 => KeyState::Hold,
|
||||||
|
3 => KeyState::Released,
|
||||||
|
0 | _ => KeyState::Idle,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum KeyCode {
|
||||||
|
JoyUp = 0x01,
|
||||||
|
JoyDown = 0x02,
|
||||||
|
JoyLeft = 0x03,
|
||||||
|
JoyRight = 0x04,
|
||||||
|
JoyCenter = 0x05,
|
||||||
|
BtnLeft1 = 0x06,
|
||||||
|
BtnRight1 = 0x07,
|
||||||
|
BtnLeft2 = 0x11,
|
||||||
|
BtnRight2 = 0x12,
|
||||||
|
Backspace = 0x08,
|
||||||
|
Tab = 0x09,
|
||||||
|
Enter = 0x0A,
|
||||||
|
ModAlt = 0xA1,
|
||||||
|
ModShiftLeft = 0xA2,
|
||||||
|
ModShiftRight = 0xA3,
|
||||||
|
ModSym = 0xA4,
|
||||||
|
ModCtrl = 0xA5,
|
||||||
|
Esc = 0xB1,
|
||||||
|
Left = 0xB4,
|
||||||
|
Up = 0xB5,
|
||||||
|
Down = 0xB6,
|
||||||
|
Right = 0xB7,
|
||||||
|
Break = 0xD0,
|
||||||
|
Insert = 0xD1,
|
||||||
|
Home = 0xD2,
|
||||||
|
Del = 0xD4,
|
||||||
|
End = 0xD5,
|
||||||
|
PageUp = 0xD6,
|
||||||
|
PageDown = 0xD7,
|
||||||
|
CapsLock = 0xC1,
|
||||||
|
F1 = 0x81,
|
||||||
|
F2 = 0x82,
|
||||||
|
F3 = 0x83,
|
||||||
|
F4 = 0x84,
|
||||||
|
F5 = 0x85,
|
||||||
|
F6 = 0x86,
|
||||||
|
F7 = 0x87,
|
||||||
|
F8 = 0x88,
|
||||||
|
F9 = 0x89,
|
||||||
|
F10 = 0x90,
|
||||||
|
Char(char),
|
||||||
|
Unknown(u8),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<u8> for KeyCode {
|
||||||
|
fn from(value: u8) -> Self {
|
||||||
|
match value {
|
||||||
|
0x01 => Self::JoyUp,
|
||||||
|
0x02 => Self::JoyDown,
|
||||||
|
0x03 => Self::JoyLeft,
|
||||||
|
0x04 => Self::JoyRight,
|
||||||
|
0x05 => Self::JoyCenter,
|
||||||
|
0x06 => Self::BtnLeft1,
|
||||||
|
0x07 => Self::BtnRight1,
|
||||||
|
0x08 => Self::Backspace,
|
||||||
|
0x09 => Self::Tab,
|
||||||
|
0x0A => Self::Enter,
|
||||||
|
0x11 => Self::BtnLeft2,
|
||||||
|
0x12 => Self::BtnRight2,
|
||||||
|
0xA1 => Self::ModAlt,
|
||||||
|
0xA2 => Self::ModShiftLeft,
|
||||||
|
0xA3 => Self::ModShiftRight,
|
||||||
|
0xA4 => Self::ModSym,
|
||||||
|
0xA5 => Self::ModCtrl,
|
||||||
|
0xB1 => Self::Esc,
|
||||||
|
0xB4 => Self::Left,
|
||||||
|
0xB5 => Self::Up,
|
||||||
|
0xB6 => Self::Down,
|
||||||
|
0xB7 => Self::Right,
|
||||||
|
0xC1 => Self::CapsLock,
|
||||||
|
0xD0 => Self::Break,
|
||||||
|
0xD1 => Self::Insert,
|
||||||
|
0xD2 => Self::Home,
|
||||||
|
0xD4 => Self::Del,
|
||||||
|
0xD5 => Self::End,
|
||||||
|
0xD6 => Self::PageUp,
|
||||||
|
0xD7 => Self::PageDown,
|
||||||
|
0x81 => Self::F1,
|
||||||
|
0x82 => Self::F2,
|
||||||
|
0x83 => Self::F3,
|
||||||
|
0x84 => Self::F4,
|
||||||
|
0x85 => Self::F5,
|
||||||
|
0x86 => Self::F6,
|
||||||
|
0x87 => Self::F7,
|
||||||
|
0x88 => Self::F8,
|
||||||
|
0x89 => Self::F9,
|
||||||
|
0x90 => Self::F10,
|
||||||
|
_ => match char::from_u32(value as u32) {
|
||||||
|
Some(c) => Self::Char(c),
|
||||||
|
None => Self::Unknown(value),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
106
pico/src/peripherals/mod.rs
Normal file
106
pico/src/peripherals/mod.rs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
//! handles all the peripherals exposed by mcu through i2c (keyboard & battery registers)
|
||||||
|
//!
|
||||||
|
|
||||||
|
use embassy_rp::{
|
||||||
|
i2c::{Async, I2c},
|
||||||
|
peripherals::I2C1,
|
||||||
|
};
|
||||||
|
use embassy_sync::{
|
||||||
|
blocking_mutex::raw::NoopRawMutex, channel::Sender, lazy_lock::LazyLock, mutex::Mutex,
|
||||||
|
};
|
||||||
|
use embassy_time::{Duration, Timer};
|
||||||
|
|
||||||
|
pub mod keyboard;
|
||||||
|
use keyboard::{KeyCode, KeyEvent, KeyState};
|
||||||
|
|
||||||
|
use crate::peripherals::keyboard::{configure_keyboard, read_keyboard_fifo};
|
||||||
|
|
||||||
|
const MCU_ADDR: u8 = 0x1F;
|
||||||
|
|
||||||
|
type I2CBUS = I2c<'static, I2C1, Async>;
|
||||||
|
pub static PERIPHERAL_BUS: LazyLock<Mutex<NoopRawMutex, Option<I2CBUS>>> =
|
||||||
|
LazyLock::new(|| Mutex::new(None));
|
||||||
|
|
||||||
|
const REG_ID_VER: u8 = 0x01;
|
||||||
|
const REG_ID_RST: u8 = 0x08;
|
||||||
|
const REG_ID_INT: u8 = 0x03;
|
||||||
|
|
||||||
|
#[embassy_executor::task]
|
||||||
|
pub async fn peripherals_task(
|
||||||
|
i2c: I2CBUS,
|
||||||
|
mut keyboard_channel: Sender<'static, NoopRawMutex, KeyEvent, 10>,
|
||||||
|
) {
|
||||||
|
Timer::after(embassy_time::Duration::from_millis(100)).await;
|
||||||
|
|
||||||
|
PERIPHERAL_BUS.get().lock().await.replace(i2c);
|
||||||
|
|
||||||
|
configure_keyboard(200, 100).await;
|
||||||
|
set_lcd_backlight(255).await;
|
||||||
|
set_key_backlight(0).await;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
Timer::after(Duration::from_millis(200)).await;
|
||||||
|
read_keyboard_fifo(&mut keyboard_channel).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// return major & minor mcu version
|
||||||
|
async fn get_version() -> (u8, u8) {
|
||||||
|
let mut i2c = PERIPHERAL_BUS.get().lock().await;
|
||||||
|
let i2c = i2c.as_mut().unwrap();
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
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]
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-06-18"
|
channel = "nightly-2025-06-18"
|
||||||
components = ["rust-src", "rustfmt", "rust-analyzer"]
|
components = ["rust-src", "rustfmt", "rust-analyzer"]
|
||||||
targets = ["thumbv6m-none-eabi"]
|
targets = ["thumbv6m-none-eabi", "x86_64-unknown-linux-gnu"]
|
||||||
|
|||||||
10
shared/Cargo.toml
Normal file
10
shared/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "shared"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arrform = "0.1.1"
|
||||||
|
embedded-graphics = "0.8.1"
|
||||||
|
embedded-graphics-core = "0.4.0"
|
||||||
|
embedded-layout = "0.4.2"
|
||||||
77
shared/src/lib.rs
Normal file
77
shared/src/lib.rs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
pub mod screen {
|
||||||
|
use arrform::{ArrForm, arrform};
|
||||||
|
use embedded_graphics::{
|
||||||
|
Drawable,
|
||||||
|
draw_target::DrawTarget,
|
||||||
|
mono_font::{
|
||||||
|
MonoTextStyle,
|
||||||
|
ascii::{FONT_6X10, FONT_9X15, FONT_10X20},
|
||||||
|
},
|
||||||
|
pixelcolor::Rgb565,
|
||||||
|
prelude::{Point, RgbColor, Size},
|
||||||
|
primitives::Rectangle,
|
||||||
|
text::Text,
|
||||||
|
};
|
||||||
|
use embedded_layout::{
|
||||||
|
align::{horizontal, vertical},
|
||||||
|
layout::linear::LinearLayout,
|
||||||
|
prelude::*,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const SCREEN_WIDTH: usize = 320;
|
||||||
|
pub const SCREEN_HEIGHT: usize = 320;
|
||||||
|
|
||||||
|
pub const STATUS_BAR_WIDTH: usize = 320;
|
||||||
|
pub const STATUS_BAR_HEIGHT: usize = 40;
|
||||||
|
|
||||||
|
pub struct UI {
|
||||||
|
pub status_bar: StatusBar,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UI {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
status_bar: StatusBar {
|
||||||
|
battery: 100,
|
||||||
|
backlight: 100,
|
||||||
|
volume: 100,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn draw_status_bar<D: DrawTarget<Color = Rgb565>>(&mut self, target: &mut D) {
|
||||||
|
let text_style = MonoTextStyle::new(&FONT_9X15, Rgb565::WHITE);
|
||||||
|
|
||||||
|
let status_bar = Rectangle::new(
|
||||||
|
Point::new(0, 0),
|
||||||
|
Size::new(STATUS_BAR_WIDTH as u32, STATUS_BAR_HEIGHT as u32),
|
||||||
|
);
|
||||||
|
let _ = LinearLayout::horizontal(
|
||||||
|
Chain::new(Text::new(
|
||||||
|
arrform!(20, "Bat: {}", self.status_bar.battery).as_str(),
|
||||||
|
Point::zero(),
|
||||||
|
text_style,
|
||||||
|
))
|
||||||
|
.append(Text::new(
|
||||||
|
arrform!(20, "Lght: {}", self.status_bar.backlight).as_str(),
|
||||||
|
Point::zero(),
|
||||||
|
text_style,
|
||||||
|
))
|
||||||
|
.append(Text::new(
|
||||||
|
arrform!(20, "Vol: {}", self.status_bar.volume).as_str(),
|
||||||
|
Point::zero(),
|
||||||
|
text_style,
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
.arrange()
|
||||||
|
.align_to(&status_bar, horizontal::Center, vertical::Center)
|
||||||
|
.draw(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct StatusBar {
|
||||||
|
pub battery: u8,
|
||||||
|
pub backlight: u8,
|
||||||
|
pub volume: u8,
|
||||||
|
}
|
||||||
|
}
|
||||||
10
simulator/Cargo.toml
Normal file
10
simulator/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "simulator"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
embedded-graphics = "0.8.1"
|
||||||
|
embedded-graphics-simulator = "0.7.0"
|
||||||
|
embedded-layout = "0.4.2"
|
||||||
|
shared = { path = "../shared" }
|
||||||
20
simulator/src/main.rs
Normal file
20
simulator/src/main.rs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
use embedded_graphics::{pixelcolor::Rgb565, prelude::Size};
|
||||||
|
use embedded_graphics_simulator::{
|
||||||
|
BinaryColorTheme, OutputSettingsBuilder, SimulatorDisplay, Window,
|
||||||
|
};
|
||||||
|
|
||||||
|
use shared::screen::{SCREEN_HEIGHT, SCREEN_WIDTH, UI};
|
||||||
|
|
||||||
|
fn main() -> Result<(), core::convert::Infallible> {
|
||||||
|
let mut display =
|
||||||
|
SimulatorDisplay::<Rgb565>::new(Size::new(SCREEN_WIDTH as u32, SCREEN_HEIGHT as u32));
|
||||||
|
|
||||||
|
let mut ui = UI::new();
|
||||||
|
|
||||||
|
ui.draw_status_bar(&mut display);
|
||||||
|
|
||||||
|
let output_settings = OutputSettingsBuilder::new().build();
|
||||||
|
Window::new("Hello World", &output_settings).show_static(&display);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
118
src/display.rs
118
src/display.rs
@@ -1,118 +0,0 @@
|
|||||||
use embassy_rp::{
|
|
||||||
gpio::{Level, Output},
|
|
||||||
peripherals::{PIN_13, PIN_14, PIN_15, SPI1},
|
|
||||||
spi::{Blocking, Spi},
|
|
||||||
};
|
|
||||||
use embassy_time::{Delay, Timer};
|
|
||||||
use embedded_graphics::{
|
|
||||||
Drawable, Pixel,
|
|
||||||
pixelcolor::{Rgb565, raw::RawU16},
|
|
||||||
prelude::{DrawTarget, OriginDimensions, Point, Primitive, RawData, RgbColor, Size},
|
|
||||||
primitives::{PrimitiveStyle, Rectangle, StyledDrawable},
|
|
||||||
};
|
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
|
||||||
use mousefood::prelude::*;
|
|
||||||
use ratatui::{
|
|
||||||
Frame, Terminal,
|
|
||||||
style::{Color, Style},
|
|
||||||
widgets::Paragraph,
|
|
||||||
};
|
|
||||||
use st7365p_lcd::ST7365P;
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
|
||||||
pub async fn display_task(
|
|
||||||
spi: Spi<'static, SPI1, Blocking>,
|
|
||||||
cs: PIN_13,
|
|
||||||
data: PIN_14,
|
|
||||||
reset: PIN_15,
|
|
||||||
) {
|
|
||||||
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
|
||||||
let mut display = ST7365P::new(
|
|
||||||
spi_device,
|
|
||||||
Output::new(data, Level::Low),
|
|
||||||
Some(Output::new(reset, Level::High)),
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
320,
|
|
||||||
320,
|
|
||||||
);
|
|
||||||
display.init(&mut Delay).unwrap();
|
|
||||||
display.set_address_window(0, 0, 319, 319).unwrap();
|
|
||||||
display.set_custom_orientation(0x40).unwrap(); // inverts X axis (reverts the natural mirroring)
|
|
||||||
|
|
||||||
let mut virtual_display = VirtualDisplay::new(display, 320, 320);
|
|
||||||
|
|
||||||
let backend = EmbeddedBackend::new(&mut virtual_display, EmbeddedBackendConfig::default());
|
|
||||||
let mut terminal = Terminal::new(backend).unwrap();
|
|
||||||
|
|
||||||
loop {
|
|
||||||
terminal.draw(draw).unwrap();
|
|
||||||
}
|
|
||||||
loop {
|
|
||||||
Timer::after_millis(100).await
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn draw(frame: &mut Frame) {
|
|
||||||
let greeting = Paragraph::new("Hello World!\nLine2").style(Style::new().red());
|
|
||||||
frame.render_widget(greeting, frame.area());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// simple abstraction over real display & resolution to reduce frame buffer size
|
|
||||||
/// 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 {
|
|
||||||
pub fn new(
|
|
||||||
display: ST7365P<
|
|
||||||
ExclusiveDevice<Spi<'static, SPI1, Blocking>, Output<'static>, Delay>,
|
|
||||||
Output<'static>,
|
|
||||||
Output<'static>,
|
|
||||||
>,
|
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
display,
|
|
||||||
width: width / 2,
|
|
||||||
height: height / 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DrawTarget for VirtualDisplay {
|
|
||||||
type Color = Rgb565;
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
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() {
|
|
||||||
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)?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OriginDimensions for VirtualDisplay {
|
|
||||||
fn size(&self) -> Size {
|
|
||||||
Size::new(self.width, self.height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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,186 +0,0 @@
|
|||||||
use embassy_rp::{
|
|
||||||
i2c::{Async, I2c},
|
|
||||||
peripherals::I2C1,
|
|
||||||
};
|
|
||||||
use embassy_sync::{
|
|
||||||
blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex},
|
|
||||||
channel::Sender,
|
|
||||||
};
|
|
||||||
|
|
||||||
const REG_ID_KEY: u8 = 0x04;
|
|
||||||
const REG_ID_FIF: u8 = 0x09;
|
|
||||||
|
|
||||||
const KEY_CAPSLOCK: u8 = 1 << 5;
|
|
||||||
const KEY_NUMLOCK: u8 = 1 << 6;
|
|
||||||
const KEY_COUNT_MASK: u8 = 0x1F; // 0x1F == 31
|
|
||||||
|
|
||||||
pub async fn read_keyboard_fifo(
|
|
||||||
i2c: &mut I2c<'static, I2C1, Async>,
|
|
||||||
channel: &mut Sender<'static, NoopRawMutex, KeyEvent, 10>,
|
|
||||||
) {
|
|
||||||
let mut key_status = [0_u8; 1];
|
|
||||||
|
|
||||||
if i2c
|
|
||||||
.write_read_async(super::MCU_ADDR, [REG_ID_KEY], &mut key_status)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
// TODO: use caps & num lock
|
|
||||||
let caps = key_status[0] & KEY_CAPSLOCK == KEY_CAPSLOCK;
|
|
||||||
let num = key_status[0] & KEY_NUMLOCK == KEY_NUMLOCK;
|
|
||||||
let fifo_count = key_status[0] & KEY_COUNT_MASK;
|
|
||||||
|
|
||||||
if fifo_count >= 1 {
|
|
||||||
let mut event = [0_u8; 2];
|
|
||||||
|
|
||||||
if i2c
|
|
||||||
.write_read_async(super::MCU_ADDR, [REG_ID_FIF], &mut event)
|
|
||||||
.await
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
if let Ok(state) = KeyState::try_from(event[0]) {
|
|
||||||
if let Ok(key) = KeyCode::try_from(event[1]) {
|
|
||||||
let _ = channel.try_send(KeyEvent { key, state });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct KeyEvent {
|
|
||||||
pub key: KeyCode,
|
|
||||||
pub state: KeyState,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum KeyState {
|
|
||||||
Idle = 0,
|
|
||||||
Pressed,
|
|
||||||
Hold,
|
|
||||||
Released,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<u8> for KeyState {
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
|
||||||
match value {
|
|
||||||
0 => Ok(KeyState::Idle),
|
|
||||||
1 => Ok(KeyState::Pressed),
|
|
||||||
2 => Ok(KeyState::Hold),
|
|
||||||
3 => Ok(KeyState::Released),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum KeyCode {
|
|
||||||
// Joystick
|
|
||||||
JoyUp = 0x01,
|
|
||||||
JoyDown = 0x02,
|
|
||||||
JoyLeft = 0x03,
|
|
||||||
JoyRight = 0x04,
|
|
||||||
JoyCenter = 0x05,
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
BtnLeft1 = 0x06,
|
|
||||||
BtnRight1 = 0x07,
|
|
||||||
BtnLeft2 = 0x11,
|
|
||||||
BtnRight2 = 0x12,
|
|
||||||
|
|
||||||
// Basic Keys
|
|
||||||
Backspace = 0x08,
|
|
||||||
Tab = 0x09,
|
|
||||||
Enter = 0x0A,
|
|
||||||
|
|
||||||
// Modifiers
|
|
||||||
ModAlt = 0xA1,
|
|
||||||
ModShiftLeft = 0xA2,
|
|
||||||
ModShiftRight = 0xA3,
|
|
||||||
ModSym = 0xA4,
|
|
||||||
ModCtrl = 0xA5,
|
|
||||||
|
|
||||||
// Navigation
|
|
||||||
Esc = 0xB1,
|
|
||||||
Left = 0xB4,
|
|
||||||
Up = 0xB5,
|
|
||||||
Down = 0xB6,
|
|
||||||
Right = 0xB7,
|
|
||||||
|
|
||||||
// Specials
|
|
||||||
Break = 0xD0,
|
|
||||||
Insert = 0xD1,
|
|
||||||
Home = 0xD2,
|
|
||||||
Del = 0xD4,
|
|
||||||
End = 0xD5,
|
|
||||||
PageUp = 0xD6,
|
|
||||||
PageDown = 0xD7,
|
|
||||||
|
|
||||||
// Locks
|
|
||||||
CapsLock = 0xC1,
|
|
||||||
|
|
||||||
// Function keys
|
|
||||||
F1 = 0x81,
|
|
||||||
F2 = 0x82,
|
|
||||||
F3 = 0x83,
|
|
||||||
F4 = 0x84,
|
|
||||||
F5 = 0x85,
|
|
||||||
F6 = 0x86,
|
|
||||||
F7 = 0x87,
|
|
||||||
F8 = 0x88,
|
|
||||||
F9 = 0x89,
|
|
||||||
F10 = 0x90,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<u8> for KeyCode {
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
|
||||||
use KeyCode::*;
|
|
||||||
match value {
|
|
||||||
0x01 => Ok(JoyUp),
|
|
||||||
0x02 => Ok(JoyDown),
|
|
||||||
0x03 => Ok(JoyLeft),
|
|
||||||
0x04 => Ok(JoyRight),
|
|
||||||
0x05 => Ok(JoyCenter),
|
|
||||||
0x06 => Ok(BtnLeft1),
|
|
||||||
0x07 => Ok(BtnRight1),
|
|
||||||
0x08 => Ok(Backspace),
|
|
||||||
0x09 => Ok(Tab),
|
|
||||||
0x0A => Ok(Enter),
|
|
||||||
0x11 => Ok(BtnLeft2),
|
|
||||||
0x12 => Ok(BtnRight2),
|
|
||||||
0xA1 => Ok(ModAlt),
|
|
||||||
0xA2 => Ok(ModShiftLeft),
|
|
||||||
0xA3 => Ok(ModShiftRight),
|
|
||||||
0xA4 => Ok(ModSym),
|
|
||||||
0xA5 => Ok(ModCtrl),
|
|
||||||
0xB1 => Ok(Esc),
|
|
||||||
0xB4 => Ok(Left),
|
|
||||||
0xB5 => Ok(Up),
|
|
||||||
0xB6 => Ok(Down),
|
|
||||||
0xB7 => Ok(Right),
|
|
||||||
0xC1 => Ok(CapsLock),
|
|
||||||
0xD0 => Ok(Break),
|
|
||||||
0xD1 => Ok(Insert),
|
|
||||||
0xD2 => Ok(Home),
|
|
||||||
0xD4 => Ok(Del),
|
|
||||||
0xD5 => Ok(End),
|
|
||||||
0xD6 => Ok(PageUp),
|
|
||||||
0xD7 => Ok(PageDown),
|
|
||||||
0x81 => Ok(F1),
|
|
||||||
0x82 => Ok(F2),
|
|
||||||
0x83 => Ok(F3),
|
|
||||||
0x84 => Ok(F4),
|
|
||||||
0x85 => Ok(F5),
|
|
||||||
0x86 => Ok(F6),
|
|
||||||
0x87 => Ok(F7),
|
|
||||||
0x88 => Ok(F8),
|
|
||||||
0x89 => Ok(F9),
|
|
||||||
0x90 => Ok(F10),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
//! handles all the peripherals exposed by mcu through i2c (keyboard & battery registers)
|
|
||||||
//!
|
|
||||||
|
|
||||||
use embassy_futures::join::join;
|
|
||||||
use embassy_rp::{
|
|
||||||
i2c::{Async, I2c},
|
|
||||||
peripherals::I2C1,
|
|
||||||
};
|
|
||||||
use embassy_sync::{blocking_mutex::raw::NoopRawMutex, channel::Sender, mutex::Mutex};
|
|
||||||
use embassy_time::{Duration, Timer};
|
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
use defmt::info;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
const MCU_ADDR: u8 = 0x1F;
|
|
||||||
|
|
||||||
const REG_ID_VER: u8 = 0x01;
|
|
||||||
const REG_ID_CFG: u8 = 0x02;
|
|
||||||
const REG_ID_INT: u8 = 0x03;
|
|
||||||
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]
|
|
||||||
pub async fn peripherals_task(
|
|
||||||
mut i2c: I2c<'static, I2C1, Async>,
|
|
||||||
mut keyboard_channel: Sender<'static, NoopRawMutex, KeyEvent, 10>,
|
|
||||||
) {
|
|
||||||
Timer::after(embassy_time::Duration::from_millis(100)).await;
|
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
join(
|
|
||||||
async {
|
|
||||||
loop {
|
|
||||||
Timer::after(Duration::from_secs(10)).await;
|
|
||||||
let mut guard = i2c.lock().await;
|
|
||||||
read_battery(&mut guard).await;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async {
|
|
||||||
loop {
|
|
||||||
Timer::after(Duration::from_millis(50)).await;
|
|
||||||
let mut guard = i2c.lock().await;
|
|
||||||
read_keyboard_fifo(&mut guard, &mut keyboard_channel).await;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user