probe + defmt + advance chat
This commit is contained in:
parent
785671d8cd
commit
01fc28e1e7
271
Cargo.lock
generated
271
Cargo.lock
generated
@ -2,18 +2,6 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ahash"
|
|
||||||
version = "0.8.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"once_cell",
|
|
||||||
"version_check",
|
|
||||||
"zerocopy",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.3"
|
version = "1.1.3"
|
||||||
@ -95,12 +83,6 @@ version = "0.13.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitfield"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
@ -122,6 +104,20 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bt-hci"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa7f7c19df9648c1da4f5356c4256533e38bd65633b6a41654922475a1c6d777"
|
||||||
|
dependencies = [
|
||||||
|
"defmt 1.0.1",
|
||||||
|
"embassy-sync 0.7.1",
|
||||||
|
"embedded-io",
|
||||||
|
"embedded-io-async",
|
||||||
|
"futures-intrusive",
|
||||||
|
"heapless",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck"
|
name = "bytemuck"
|
||||||
version = "1.23.2"
|
version = "1.23.2"
|
||||||
@ -157,7 +153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
|
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bare-metal",
|
"bare-metal",
|
||||||
"bitfield 0.13.2",
|
"bitfield",
|
||||||
"embedded-hal 0.2.7",
|
"embedded-hal 0.2.7",
|
||||||
"volatile-register",
|
"volatile-register",
|
||||||
]
|
]
|
||||||
@ -234,13 +230,16 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "154c5dd2b077718c534593c50f90e854aa143a19191b9be9c41afc21a5045d83"
|
checksum = "154c5dd2b077718c534593c50f90e854aa143a19191b9be9c41afc21a5045d83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bt-hci",
|
||||||
"cortex-m",
|
"cortex-m",
|
||||||
"cortex-m-rt",
|
"cortex-m-rt",
|
||||||
|
"defmt 1.0.1",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
"embassy-net-driver-channel",
|
"embassy-net-driver-channel",
|
||||||
"embassy-sync 0.7.1",
|
"embassy-sync 0.7.1",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
|
"embedded-io-async",
|
||||||
"futures",
|
"futures",
|
||||||
"heapless",
|
"heapless",
|
||||||
"num_enum 0.5.11",
|
"num_enum 0.5.11",
|
||||||
@ -253,6 +252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "689597733e607ed9e2b6b41c2c3a0be88420d98eef09f254de3e1c71e22a4b1f"
|
checksum = "689597733e607ed9e2b6b41c2c3a0be88420d98eef09f254de3e1c71e22a4b1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cyw43",
|
"cyw43",
|
||||||
|
"defmt 1.0.1",
|
||||||
"embassy-rp",
|
"embassy-rp",
|
||||||
"fixed",
|
"fixed",
|
||||||
]
|
]
|
||||||
@ -298,6 +298,57 @@ version = "0.3.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e"
|
checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt"
|
||||||
|
version = "0.3.100"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad"
|
||||||
|
dependencies = [
|
||||||
|
"defmt 1.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"defmt-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt-macros"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e"
|
||||||
|
dependencies = [
|
||||||
|
"defmt-parser",
|
||||||
|
"proc-macro-error2",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.105",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt-parser"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt-rtt"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1"
|
||||||
|
dependencies = [
|
||||||
|
"critical-section",
|
||||||
|
"defmt 1.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dhcparse"
|
name = "dhcparse"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -366,6 +417,7 @@ checksum = "f102d5e04befe3ea74b6f41a0e26218740124636eb2f59e1cc215b5839b96df2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cortex-m",
|
"cortex-m",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"defmt 1.0.1",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-executor-macros",
|
"embassy-executor-macros",
|
||||||
]
|
]
|
||||||
@ -396,6 +448,7 @@ checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cortex-m",
|
"cortex-m",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"defmt 1.0.1",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -405,6 +458,7 @@ 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 = "940c4b9fe5c1375b09a0c6722c0100d6b2ed46a717a34f632f26e8d7327c4383"
|
checksum = "940c4b9fe5c1375b09a0c6722c0100d6b2ed46a717a34f632f26e8d7327c4383"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"defmt 0.3.100",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-net-driver",
|
"embassy-net-driver",
|
||||||
"embassy-sync 0.6.2",
|
"embassy-sync 0.6.2",
|
||||||
@ -421,6 +475,9 @@ name = "embassy-net-driver"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
|
checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
|
||||||
|
dependencies = [
|
||||||
|
"defmt 0.3.100",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-net-driver-channel"
|
name = "embassy-net-driver-channel"
|
||||||
@ -444,6 +501,7 @@ dependencies = [
|
|||||||
"cortex-m",
|
"cortex-m",
|
||||||
"cortex-m-rt",
|
"cortex-m-rt",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"defmt 1.0.1",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-embedded-hal",
|
"embassy-embedded-hal",
|
||||||
"embassy-futures",
|
"embassy-futures",
|
||||||
@ -494,6 +552,7 @@ checksum = "03c372c90d3525a648684fa1c131decaf7d9ff181030db09c876fad6043443b9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"defmt 1.0.1",
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
@ -508,6 +567,7 @@ checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
|
"defmt 0.3.100",
|
||||||
"document-features",
|
"document-features",
|
||||||
"embassy-time-driver",
|
"embassy-time-driver",
|
||||||
"embedded-hal 0.2.7",
|
"embedded-hal 0.2.7",
|
||||||
@ -535,43 +595,16 @@ dependencies = [
|
|||||||
"heapless",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "embassy-usb"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eb69c7ca7fa90b9ae590e3dea985ef80df06d900a350f9cc9d3f3c8113fc4370"
|
|
||||||
dependencies = [
|
|
||||||
"embassy-futures",
|
|
||||||
"embassy-net-driver-channel",
|
|
||||||
"embassy-sync 0.7.1",
|
|
||||||
"embassy-usb-driver",
|
|
||||||
"embedded-io-async",
|
|
||||||
"heapless",
|
|
||||||
"ssmarshal",
|
|
||||||
"usbd-hid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embassy-usb-driver"
|
name = "embassy-usb-driver"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a"
|
checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"defmt 1.0.1",
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "embassy-usb-logger"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "de76d58c51b4d49bfc9401f756aa391988a7d1c099dfc4fd0c42f1f281b04b5f"
|
|
||||||
dependencies = [
|
|
||||||
"embassy-futures",
|
|
||||||
"embassy-sync 0.7.1",
|
|
||||||
"embassy-usb",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-hal"
|
name = "embedded-hal"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
@ -612,6 +645,9 @@ name = "embedded-io"
|
|||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
||||||
|
dependencies = [
|
||||||
|
"defmt 0.3.100",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embedded-io-async"
|
name = "embedded-io-async"
|
||||||
@ -619,6 +655,7 @@ version = "0.6.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
|
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"defmt 0.3.100",
|
||||||
"embedded-io",
|
"embedded-io",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -665,12 +702,6 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encode_unicode"
|
|
||||||
version = "0.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@ -731,6 +762,16 @@ version = "0.3.31"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-intrusive"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"lock_api",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@ -803,15 +844,6 @@ dependencies = [
|
|||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.13.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
|
||||||
dependencies = [
|
|
||||||
"ahash",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.5"
|
version = "0.15.5"
|
||||||
@ -824,6 +856,7 @@ version = "0.8.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"defmt 0.3.100",
|
||||||
"hash32",
|
"hash32",
|
||||||
"serde",
|
"serde",
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
@ -842,7 +875,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.15.5",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1007,10 +1040,14 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "panic-probe"
|
||||||
version = "1.21.3"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a"
|
||||||
|
dependencies = [
|
||||||
|
"cortex-m",
|
||||||
|
"defmt 1.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
@ -1081,6 +1118,8 @@ dependencies = [
|
|||||||
"cortex-m-rt",
|
"cortex-m-rt",
|
||||||
"cyw43",
|
"cyw43",
|
||||||
"cyw43-pio",
|
"cyw43-pio",
|
||||||
|
"defmt 1.0.1",
|
||||||
|
"defmt-rtt",
|
||||||
"dhcparse",
|
"dhcparse",
|
||||||
"dnsparse",
|
"dnsparse",
|
||||||
"embassy-executor",
|
"embassy-executor",
|
||||||
@ -1088,10 +1127,10 @@ dependencies = [
|
|||||||
"embassy-rp",
|
"embassy-rp",
|
||||||
"embassy-sync 0.7.1",
|
"embassy-sync 0.7.1",
|
||||||
"embassy-time",
|
"embassy-time",
|
||||||
"embassy-usb-logger",
|
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"heapless",
|
"heapless",
|
||||||
"log",
|
"log",
|
||||||
|
"panic-probe",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.3",
|
||||||
@ -1483,20 +1522,11 @@ dependencies = [
|
|||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"defmt 0.3.100",
|
||||||
"heapless",
|
"heapless",
|
||||||
"managed",
|
"managed",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ssmarshal"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
|
|
||||||
dependencies = [
|
|
||||||
"encode_unicode",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stable_deref_trait"
|
name = "stable_deref_trait"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@ -1570,6 +1600,26 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "2.0.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "2.0.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.105",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.18.0"
|
version = "1.18.0"
|
||||||
@ -1594,53 +1644,6 @@ version = "0.2.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "usb-device"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
|
||||||
dependencies = [
|
|
||||||
"heapless",
|
|
||||||
"portable-atomic",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "usbd-hid"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"ssmarshal",
|
|
||||||
"usb-device",
|
|
||||||
"usbd-hid-macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "usbd-hid-descriptors"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed"
|
|
||||||
dependencies = [
|
|
||||||
"bitfield 0.14.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "usbd-hid-macros"
|
|
||||||
version = "0.8.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"hashbrown 0.13.2",
|
|
||||||
"log",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"syn 1.0.109",
|
|
||||||
"usbd-hid-descriptors",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcell"
|
name = "vcell"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
@ -1839,23 +1842,3 @@ name = "windows_x86_64_msvc"
|
|||||||
version = "0.53.0"
|
version = "0.53.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerocopy"
|
|
||||||
version = "0.8.26"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
|
|
||||||
dependencies = [
|
|
||||||
"zerocopy-derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zerocopy-derive"
|
|
||||||
version = "0.8.26"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.105",
|
|
||||||
]
|
|
||||||
|
|||||||
19
Cargo.toml
19
Cargo.toml
@ -13,7 +13,7 @@ dhcp = ["dep:dhcparse"]
|
|||||||
dns = ["dep:dnsparse"]
|
dns = ["dep:dnsparse"]
|
||||||
chat = ["dep:ringbuf", "json"]
|
chat = ["dep:ringbuf", "json"]
|
||||||
ttt = ["json"]
|
ttt = ["json"]
|
||||||
default = ["dhcp", "dns", "chat"]
|
default = ["dhcp", "dns", "chat", "ttt"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# git = "https://github.com/embassy-rs/embassy",
|
# git = "https://github.com/embassy-rs/embassy",
|
||||||
@ -22,24 +22,31 @@ embassy-executor = { version = "*", features = [
|
|||||||
"arch-cortex-m",
|
"arch-cortex-m",
|
||||||
"executor-thread",
|
"executor-thread",
|
||||||
"executor-interrupt",
|
"executor-interrupt",
|
||||||
|
"defmt"
|
||||||
] }
|
] }
|
||||||
embassy-rp = { version = "*", features = [
|
embassy-rp = { version = "*", features = [
|
||||||
"unstable-pac",
|
"unstable-pac",
|
||||||
"rp2040",
|
"rp2040",
|
||||||
"time-driver",
|
"time-driver",
|
||||||
"critical-section-impl",
|
"critical-section-impl",
|
||||||
|
"defmt"
|
||||||
] }
|
] }
|
||||||
embassy-time = { version = "*" }
|
embassy-time = { version = "*", features = ["defmt"] }
|
||||||
embassy-usb-logger = { version = "*" }
|
# embassy-usb-logger = { version = "*" }
|
||||||
embassy-net = { version = "*", features = [
|
embassy-net = { version = "*", features = [
|
||||||
"proto-ipv4",
|
"proto-ipv4",
|
||||||
"tcp",
|
"tcp",
|
||||||
"udp",
|
"udp",
|
||||||
"dhcpv4",
|
"dhcpv4",
|
||||||
|
"defmt"
|
||||||
] }
|
] }
|
||||||
embassy-sync = { version = "*" }
|
embassy-sync = { version = "*", features = ["defmt"] }
|
||||||
cyw43-pio = { version = "*" }
|
cyw43-pio = { version = "*", features = ["defmt"] }
|
||||||
cyw43 = { version = "*" }
|
cyw43 = { version = "*", features = ["defmt"] }
|
||||||
|
|
||||||
|
defmt = "1.0.1"
|
||||||
|
defmt-rtt = "1.0.0"
|
||||||
|
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
|
||||||
|
|
||||||
embedded-io-async = "*"
|
embedded-io-async = "*"
|
||||||
cortex-m = { version = "*", features = ["inline-asm"] }
|
cortex-m = { version = "*", features = ["inline-asm"] }
|
||||||
|
|||||||
2
build.rs
2
build.rs
@ -32,5 +32,5 @@ fn main() {
|
|||||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
||||||
// println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,9 @@ use core::sync::atomic::Ordering;
|
|||||||
use embassy_sync::{blocking_mutex::raw::ThreadModeRawMutex, mutex::Mutex};
|
use embassy_sync::{blocking_mutex::raw::ThreadModeRawMutex, mutex::Mutex};
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use log::{info, warn};
|
// use log::{info, warn};
|
||||||
use pico_website::unimplemented;
|
// use pico_website::unimplemented;
|
||||||
|
use defmt::*;
|
||||||
use portable_atomic::AtomicUsize;
|
use portable_atomic::AtomicUsize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
@ -21,7 +22,8 @@ struct Msg<'a> {
|
|||||||
content: &'a str,
|
content: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MSGS_SIZE: usize = 30;
|
const MSGS_SIZE: usize = 100000;
|
||||||
|
const _: () = core::assert!(MSGS_SIZE > MSG_MAX_SIZE);
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Msgs {
|
struct Msgs {
|
||||||
/// * Memory layout with sizes in bytes : ...|content: len|len: 2|author+1: 1|...
|
/// * Memory layout with sizes in bytes : ...|content: len|len: 2|author+1: 1|...
|
||||||
@ -186,6 +188,8 @@ impl App for ChatApp {
|
|||||||
_path: &str,
|
_path: &str,
|
||||||
mut ws: crate::socket::ws::Ws<'_, BUF_SIZE>,
|
mut ws: crate::socket::ws::Ws<'_, BUF_SIZE>,
|
||||||
) {
|
) {
|
||||||
|
self.usernames_version = 0;
|
||||||
|
self.next_msg = 0;
|
||||||
Timer::after_millis(500).await;
|
Timer::after_millis(500).await;
|
||||||
let r: Result<(), ()> = try {
|
let r: Result<(), ()> = try {
|
||||||
loop {
|
loop {
|
||||||
@ -195,6 +199,7 @@ impl App for ChatApp {
|
|||||||
if self.usernames_version < uv {
|
if self.usernames_version < uv {
|
||||||
ws.send_json(&(*USERNAMES.lock().await)).await?;
|
ws.send_json(&(*USERNAMES.lock().await)).await?;
|
||||||
}
|
}
|
||||||
|
self.usernames_version = uv;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let msgs = MSGS.lock().await;
|
let msgs = MSGS.lock().await;
|
||||||
@ -253,6 +258,6 @@ pub async fn id_to_static_str(id: u8) -> &'static str {
|
|||||||
13 => "13",
|
13 => "13",
|
||||||
14 => "14",
|
14 => "14",
|
||||||
15 => "15",
|
15 => "15",
|
||||||
_ => unimplemented().await,
|
_ => defmt::unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
use pico_website::unwrap;
|
// use pico_website::unwrap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
apps::{self, Content, chat::id_to_static_str},
|
apps::{self, Content, chat::id_to_static_str},
|
||||||
socket::{HttpRequestType, HttpResCode},
|
socket::{HttpRequestType, HttpResCode},
|
||||||
};
|
};
|
||||||
|
use defmt::*;
|
||||||
|
|
||||||
use super::App;
|
use super::App;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ impl App for IndexApp {
|
|||||||
content.push(team)?;
|
content.push(team)?;
|
||||||
content.push(html2)?;
|
content.push(html2)?;
|
||||||
};
|
};
|
||||||
unwrap(r).await;
|
unwrap!(r);
|
||||||
(HttpResCode::Ok, "html", Some(Content(content)))
|
(HttpResCode::Ok, "html", Some(Content(content)))
|
||||||
}
|
}
|
||||||
"/ttt.js" => {
|
"/ttt.js" => {
|
||||||
@ -97,7 +97,7 @@ impl App for IndexApp {
|
|||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
content.push(include_str!("../../static/ttt.min.js"))?;
|
content.push(include_str!("../../static/ttt.min.js"))?;
|
||||||
};
|
};
|
||||||
unwrap(r).await;
|
unwrap!(r);
|
||||||
(HttpResCode::Ok, "javascript", Some(Content(content)))
|
(HttpResCode::Ok, "javascript", Some(Content(content)))
|
||||||
}
|
}
|
||||||
"/chat" => {
|
"/chat" => {
|
||||||
@ -121,7 +121,7 @@ impl App for IndexApp {
|
|||||||
content.push(id_to_static_str(id).await)?;
|
content.push(id_to_static_str(id).await)?;
|
||||||
content.push(html2)?;
|
content.push(html2)?;
|
||||||
};
|
};
|
||||||
unwrap(r).await;
|
unwrap!(r);
|
||||||
(HttpResCode::Ok, "html", Some(Content(content)))
|
(HttpResCode::Ok, "html", Some(Content(content)))
|
||||||
}
|
}
|
||||||
"/chat.js" => {
|
"/chat.js" => {
|
||||||
@ -139,7 +139,7 @@ impl App for IndexApp {
|
|||||||
// #[cfg(not(debug_assertions))]
|
// #[cfg(not(debug_assertions))]
|
||||||
// content.push(include_str!("../../static/chat.min.js"))?;
|
// content.push(include_str!("../../static/chat.min.js"))?;
|
||||||
};
|
};
|
||||||
unwrap(r).await;
|
unwrap!(r);
|
||||||
(HttpResCode::Ok, "javascript", Some(Content(content)))
|
(HttpResCode::Ok, "javascript", Some(Content(content)))
|
||||||
}
|
}
|
||||||
_ => (HttpResCode::NotFound, "", None),
|
_ => (HttpResCode::NotFound, "", None),
|
||||||
|
|||||||
@ -3,8 +3,9 @@ use core::str::from_utf8_unchecked;
|
|||||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||||
use embassy_sync::mutex::Mutex;
|
use embassy_sync::mutex::Mutex;
|
||||||
use embassy_time::{Duration, Instant, Timer};
|
use embassy_time::{Duration, Instant, Timer};
|
||||||
use log::{info, warn};
|
// use log::{info, warn};
|
||||||
use pico_website::{unwrap, unwrap_opt};
|
use defmt::*;
|
||||||
|
// use pico_website::{unwrap, unwrap_opt};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::apps::Content;
|
use crate::apps::Content;
|
||||||
@ -89,11 +90,7 @@ impl App for TttApp {
|
|||||||
fn accept_ws(&self, path: &str) -> bool {
|
fn accept_ws(&self, path: &str) -> bool {
|
||||||
(self.team == Team::Zero && path == "/blue") || (self.team == Team::One && path == "/red")
|
(self.team == Team::Zero && path == "/blue") || (self.team == Team::One && path == "/red")
|
||||||
}
|
}
|
||||||
async fn handle_ws<'a, const BUF_SIZE: usize>(
|
async fn handle_ws<const BUF_SIZE: usize>(&mut self, _path: &str, mut ws: Ws<'_, BUF_SIZE>) {
|
||||||
&'a mut self,
|
|
||||||
_path: &str,
|
|
||||||
mut ws: Ws<'a, BUF_SIZE>,
|
|
||||||
) {
|
|
||||||
Timer::after_millis(500).await;
|
Timer::after_millis(500).await;
|
||||||
let r: Result<(), ()> = try {
|
let r: Result<(), ()> = try {
|
||||||
loop {
|
loop {
|
||||||
@ -103,9 +100,8 @@ impl App for TttApp {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if self.last_game != *game {
|
if self.last_game != *game {
|
||||||
let n = unwrap(serde_json_core::to_slice(&(*game), &mut self.json_buf)).await;
|
let n = serde_json_core::to_slice(&(*game), &mut self.json_buf).unwrap();
|
||||||
let json =
|
let json = unsafe { from_utf8_unchecked(&unwrap!(self.json_buf.get(..n))) };
|
||||||
unsafe { from_utf8_unchecked(&unwrap_opt(self.json_buf.get(..n)).await) };
|
|
||||||
ws.send(WsMsg::Text(json)).await?;
|
ws.send(WsMsg::Text(json)).await?;
|
||||||
self.last_game = game.clone();
|
self.last_game = game.clone();
|
||||||
}
|
}
|
||||||
|
|||||||
42
src/dhcp.rs
42
src/dhcp.rs
@ -10,8 +10,9 @@ use embassy_net::{
|
|||||||
};
|
};
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
use log::{info, warn};
|
// use log::{info, warn};
|
||||||
use pico_website::{unwrap, unwrap_opt};
|
use defmt::*;
|
||||||
|
// use pico_website::{unwrap, unwrap_opt};
|
||||||
|
|
||||||
#[embassy_executor::task(pool_size = 1)]
|
#[embassy_executor::task(pool_size = 1)]
|
||||||
pub async fn dhcp_server(stack: Stack<'static>) {
|
pub async fn dhcp_server(stack: Stack<'static>) {
|
||||||
@ -32,29 +33,33 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
&mut tx_meta,
|
&mut tx_meta,
|
||||||
&mut tx_buffer,
|
&mut tx_buffer,
|
||||||
);
|
);
|
||||||
unwrap(socket.bind(67)).await;
|
unwrap!(socket.bind(67));
|
||||||
|
|
||||||
info!("Starting DHCP server");
|
info!("Starting DHCP server");
|
||||||
loop {
|
loop {
|
||||||
Timer::after_secs(0).await;
|
Timer::after_secs(0).await;
|
||||||
let (n, _) = unwrap(socket.recv_from(&mut buf).await).await;
|
let (n, _) = unwrap!(socket.recv_from(&mut buf).await);
|
||||||
|
|
||||||
let msg = unwrap_opt(buf.get(..n)).await;
|
let msg = unwrap!(buf.get(..n));
|
||||||
let msg = unwrap(dhcpv4::Message::new(&msg)).await;
|
let msg = dhcpv4::Message::new(&msg).unwrap();
|
||||||
|
|
||||||
let msg_type = unwrap(v4_options!(msg; MessageType required)).await;
|
let msg_type = v4_options!(msg; MessageType required).unwrap();
|
||||||
let mut rapid_commit = false;
|
let mut rapid_commit = false;
|
||||||
if unwrap(msg.options())
|
if msg
|
||||||
.await
|
.options()
|
||||||
|
.unwrap()
|
||||||
.any(|opt| matches!(opt, Ok((DhcpOption::Unknown(80, _), _))))
|
.any(|opt| matches!(opt, Ok((DhcpOption::Unknown(80, _), _))))
|
||||||
{
|
{
|
||||||
if msg_type != DhcpMsgType::DISCOVER {
|
if msg_type != DhcpMsgType::DISCOVER {
|
||||||
warn!("WARN : dhcp rapid commit option on {:?} message", msg_type);
|
warn!(
|
||||||
|
"WARN : dhcp rapid commit option on {:?} message",
|
||||||
|
Debug2Format(&msg_type)
|
||||||
|
);
|
||||||
continue 'listen;
|
continue 'listen;
|
||||||
}
|
}
|
||||||
rapid_commit = true;
|
rapid_commit = true;
|
||||||
}
|
}
|
||||||
info!("Dhcp: received {:?} message", msg_type);
|
info!("Dhcp: received {:?} message", Debug2Format(&msg_type));
|
||||||
|
|
||||||
match msg_type {
|
match msg_type {
|
||||||
DhcpMsgType::DISCOVER | DhcpMsgType::REQUEST => {
|
DhcpMsgType::DISCOVER | DhcpMsgType::REQUEST => {
|
||||||
@ -89,8 +94,8 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
|
|
||||||
opts.clear();
|
opts.clear();
|
||||||
opts.extend_from_slice(
|
opts.extend_from_slice(
|
||||||
unwrap(v4_options!(msg; ParameterRequestList))
|
v4_options!(msg; ParameterRequestList)
|
||||||
.await
|
.unwrap()
|
||||||
.unwrap_or(&[]),
|
.unwrap_or(&[]),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -99,7 +104,7 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
(DhcpMsgType::DISCOVER, false) => &[54],
|
(DhcpMsgType::DISCOVER, false) => &[54],
|
||||||
(DhcpMsgType::DISCOVER, true) => &[54, 80],
|
(DhcpMsgType::DISCOVER, true) => &[54, 80],
|
||||||
(DhcpMsgType::REQUEST, false) => &[1, 3, 51, 6, 54],
|
(DhcpMsgType::REQUEST, false) => &[1, 3, 51, 6, 54],
|
||||||
_ => unreachable!(),
|
_ => defmt::unreachable!(),
|
||||||
};
|
};
|
||||||
for o in default_opts {
|
for o in default_opts {
|
||||||
if !opts.contains(o) {
|
if !opts.contains(o) {
|
||||||
@ -107,10 +112,10 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unwrap(write_dhcp_opts(&mut res_buf, &opts).await).await;
|
unwrap!(write_dhcp_opts(&mut res_buf, &opts));
|
||||||
res_buf.push(255).unwrap(); // end option
|
res_buf.push(255).unwrap(); // end option
|
||||||
|
|
||||||
unwrap(
|
unwrap!(
|
||||||
socket
|
socket
|
||||||
.send_to(
|
.send_to(
|
||||||
&res_buf,
|
&res_buf,
|
||||||
@ -124,8 +129,7 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await,
|
.await,
|
||||||
)
|
);
|
||||||
.await;
|
|
||||||
info!("Dhcp: offer/ack sent for ip 192.254.0.{}", current_ip);
|
info!("Dhcp: offer/ack sent for ip 192.254.0.{}", current_ip);
|
||||||
|
|
||||||
if msg_type == DhcpMsgType::REQUEST || rapid_commit {
|
if msg_type == DhcpMsgType::REQUEST || rapid_commit {
|
||||||
@ -143,7 +147,7 @@ pub async fn dhcp_server(stack: Stack<'static>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn write_dhcp_opts<const N: usize>(buf: &mut Vec<u8, N>, op_codes: &[u8]) -> Result<(), ()> {
|
fn write_dhcp_opts<const N: usize>(buf: &mut Vec<u8, N>, op_codes: &[u8]) -> Result<(), ()> {
|
||||||
for o in op_codes {
|
for o in op_codes {
|
||||||
let (opt_len, opt): (u8, &[u8]) = match o {
|
let (opt_len, opt): (u8, &[u8]) = match o {
|
||||||
1 => (4, &[255, 255, 255, 0]), // DhcpOption::SubnetMask(&dhcpv4::Addr([255, 255, 255, 0])),
|
1 => (4, &[255, 255, 255, 0]), // DhcpOption::SubnetMask(&dhcpv4::Addr([255, 255, 255, 0])),
|
||||||
|
|||||||
22
src/dns.rs
22
src/dns.rs
@ -4,8 +4,9 @@ use embassy_net::{
|
|||||||
udp::{PacketMetadata, UdpSocket},
|
udp::{PacketMetadata, UdpSocket},
|
||||||
};
|
};
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use log::{info, warn};
|
// use log::{info, warn};
|
||||||
use pico_website::{unwrap, unwrap_opt};
|
use defmt::*;
|
||||||
|
// use pico_website::{unwrap, unwrap_opt};
|
||||||
|
|
||||||
#[embassy_executor::task(pool_size = 1)]
|
#[embassy_executor::task(pool_size = 1)]
|
||||||
pub async fn dns_server(stack: Stack<'static>) {
|
pub async fn dns_server(stack: Stack<'static>) {
|
||||||
@ -23,18 +24,21 @@ pub async fn dns_server(stack: Stack<'static>) {
|
|||||||
&mut tx_meta,
|
&mut tx_meta,
|
||||||
&mut tx_buffer,
|
&mut tx_buffer,
|
||||||
);
|
);
|
||||||
unwrap(socket.bind(53)).await;
|
unwrap!(socket.bind(53));
|
||||||
|
|
||||||
info!("Starting DNS server");
|
info!("Starting DNS server");
|
||||||
loop {
|
loop {
|
||||||
Timer::after_secs(0).await;
|
Timer::after_secs(0).await;
|
||||||
let (n, meta) = unwrap(socket.recv_from(&mut buf).await).await;
|
let (n, meta) = unwrap!(socket.recv_from(&mut buf).await);
|
||||||
|
|
||||||
let msg = unwrap_opt(buf.get_mut(..n)).await;
|
let msg = unwrap!(buf.get_mut(..n));
|
||||||
let msg = match dnsparse::Message::parse(msg) {
|
let msg = match dnsparse::Message::parse(msg) {
|
||||||
Ok(msg) => msg,
|
Ok(msg) => msg,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Dns: Error while parsing DNS message : {:#?}", e);
|
warn!(
|
||||||
|
"Dns: Error while parsing DNS message : {}",
|
||||||
|
Display2Format(&e)
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -42,7 +46,7 @@ pub async fn dns_server(stack: Stack<'static>) {
|
|||||||
if msg.header().opcode() != OpCode::Query {
|
if msg.header().opcode() != OpCode::Query {
|
||||||
info!(
|
info!(
|
||||||
"Dns: Received unknown dns opcode ({:?}), ignoring",
|
"Dns: Received unknown dns opcode ({:?}), ignoring",
|
||||||
msg.header().opcode()
|
Debug2Format(&msg.header().opcode())
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -69,9 +73,9 @@ pub async fn dns_server(stack: Stack<'static>) {
|
|||||||
ttl: 600,
|
ttl: 600,
|
||||||
rdata: &[192, 254, 0, 2],
|
rdata: &[192, 254, 0, 2],
|
||||||
});
|
});
|
||||||
info!("Dns: Giving {}", q.name());
|
info!("Dns: Giving {}", Display2Format(&q.name()));
|
||||||
} else {
|
} else {
|
||||||
info!("Dns: Unknown uri, ignoring ({})", q.name());
|
info!("Dns: Unknown uri, ignoring ({})", Display2Format(&q.name()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
16
src/lib.rs
16
src/lib.rs
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
use core::{fmt::Debug, panic::PanicInfo};
|
use core::{fmt::Debug, panic::PanicInfo};
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use log::error;
|
// use log::error;
|
||||||
|
|
||||||
pub async fn unwrap<T, E: Debug>(res: Result<T, E>) -> T {
|
pub async fn unwrap<T, E: Debug>(res: Result<T, E>) -> T {
|
||||||
match res {
|
match res {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => loop {
|
Err(e) => loop {
|
||||||
error!("FATAL ERROR : {:?}", e);
|
// error!("FATAL ERROR : {:?}", e);
|
||||||
Timer::after_secs(5).await;
|
Timer::after_secs(5).await;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -34,9 +34,9 @@ pub async fn unimplemented() -> ! {
|
|||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make this log work
|
// // TODO: make this log work
|
||||||
#[panic_handler]
|
// #[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
// fn panic(info: &PanicInfo) -> ! {
|
||||||
error!("PANIC: {}", info);
|
// // error!("PANIC: {}", info);
|
||||||
loop {}
|
// loop {}
|
||||||
}
|
// }
|
||||||
|
|||||||
36
src/main.rs
36
src/main.rs
@ -13,6 +13,7 @@
|
|||||||
use core::net::Ipv4Addr;
|
use core::net::Ipv4Addr;
|
||||||
|
|
||||||
use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
|
use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi};
|
||||||
|
use defmt::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_net::{Config, StackResources};
|
use embassy_net::{Config, StackResources};
|
||||||
use embassy_rp::bind_interrupts;
|
use embassy_rp::bind_interrupts;
|
||||||
@ -22,10 +23,11 @@ use embassy_rp::peripherals::USB;
|
|||||||
use embassy_rp::peripherals::{DMA_CH0, PIO0};
|
use embassy_rp::peripherals::{DMA_CH0, PIO0};
|
||||||
use embassy_rp::pio::{InterruptHandler as PioInterruptHandler, Pio};
|
use embassy_rp::pio::{InterruptHandler as PioInterruptHandler, Pio};
|
||||||
use embassy_rp::usb::{Driver, InterruptHandler as UsbInterruptHandler};
|
use embassy_rp::usb::{Driver, InterruptHandler as UsbInterruptHandler};
|
||||||
use log::info;
|
// use log::info;
|
||||||
use pico_website::unwrap;
|
// use pico_website::unwrap;
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[cfg(feature = "dhcp")]
|
#[cfg(feature = "dhcp")]
|
||||||
mod dhcp;
|
mod dhcp;
|
||||||
@ -41,10 +43,10 @@ bind_interrupts!(struct Irqs {
|
|||||||
PIO0_IRQ_0 => PioInterruptHandler<PIO0>;
|
PIO0_IRQ_0 => PioInterruptHandler<PIO0>;
|
||||||
});
|
});
|
||||||
|
|
||||||
#[embassy_executor::task]
|
// #[embassy_executor::task]
|
||||||
async fn logger_task(driver: Driver<'static, USB>) {
|
// async fn logger_task(driver: Driver<'static, USB>) {
|
||||||
embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver);
|
// embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn cyw43_task(
|
async fn cyw43_task(
|
||||||
@ -62,7 +64,7 @@ async fn net_task(mut runner: embassy_net::Runner<'static, cyw43::NetDriver<'sta
|
|||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
let p = embassy_rp::init(Default::default());
|
let p = embassy_rp::init(Default::default());
|
||||||
let driver = Driver::new(p.USB, Irqs);
|
let driver = Driver::new(p.USB, Irqs);
|
||||||
spawner.spawn(logger_task(driver)).unwrap();
|
// spawner.spawn(logger_task(driver)).unwrap();
|
||||||
let mut rng = RoscRng;
|
let mut rng = RoscRng;
|
||||||
|
|
||||||
let fw = include_bytes!("../cyw43-firmware/43439A0.bin");
|
let fw = include_bytes!("../cyw43-firmware/43439A0.bin");
|
||||||
@ -84,7 +86,7 @@ async fn main(spawner: Spawner) {
|
|||||||
static STATE: StaticCell<cyw43::State> = StaticCell::new();
|
static STATE: StaticCell<cyw43::State> = StaticCell::new();
|
||||||
let state = STATE.init(cyw43::State::new());
|
let state = STATE.init(cyw43::State::new());
|
||||||
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
|
||||||
unwrap(spawner.spawn(cyw43_task(runner))).await;
|
unwrap!(spawner.spawn(cyw43_task(runner)));
|
||||||
|
|
||||||
control.init(clm).await;
|
control.init(clm).await;
|
||||||
control
|
control
|
||||||
@ -131,7 +133,7 @@ async fn main(spawner: Spawner) {
|
|||||||
seed,
|
seed,
|
||||||
);
|
);
|
||||||
|
|
||||||
unwrap(spawner.spawn(net_task(runner))).await;
|
unwrap!(spawner.spawn(net_task(runner)));
|
||||||
|
|
||||||
#[cfg(not(feature = "wifi-connect"))]
|
#[cfg(not(feature = "wifi-connect"))]
|
||||||
control.start_ap_open("pico", 5).await;
|
control.start_ap_open("pico", 5).await;
|
||||||
@ -162,27 +164,25 @@ async fn main(spawner: Spawner) {
|
|||||||
info!("DHCP is now up!");
|
info!("DHCP is now up!");
|
||||||
info!(
|
info!(
|
||||||
"ip : {}",
|
"ip : {}",
|
||||||
unwrap(stack.config_v4().ok_or("no dhcp config"))
|
unwrap!(stack.config_v4().ok_or("no dhcp config")).address
|
||||||
.await
|
|
||||||
.address
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "dhcp")]
|
#[cfg(feature = "dhcp")]
|
||||||
unwrap(spawner.spawn(dhcp::dhcp_server(stack))).await;
|
unwrap!(spawner.spawn(dhcp::dhcp_server(stack)));
|
||||||
|
|
||||||
#[cfg(feature = "dns")]
|
#[cfg(feature = "dns")]
|
||||||
unwrap(spawner.spawn(dns::dns_server(stack))).await;
|
unwrap!(spawner.spawn(dns::dns_server(stack)));
|
||||||
|
|
||||||
unwrap(spawner.spawn(socket::index_listen_task(stack, 80))).await;
|
unwrap!(spawner.spawn(socket::index_listen_task(stack, 80)));
|
||||||
#[cfg(feature = "ttt")]
|
#[cfg(feature = "ttt")]
|
||||||
{
|
{
|
||||||
unwrap(spawner.spawn(socket::ttt_listen_task(stack, apps::ttt::Team::Zero, 8080))).await;
|
unwrap!(spawner.spawn(socket::ttt_listen_task(stack, apps::ttt::Team::Zero, 8080)));
|
||||||
unwrap(spawner.spawn(socket::ttt_listen_task(stack, apps::ttt::Team::One, 8081))).await;
|
unwrap!(spawner.spawn(socket::ttt_listen_task(stack, apps::ttt::Team::One, 8081)));
|
||||||
}
|
}
|
||||||
#[cfg(feature = "chat")]
|
#[cfg(feature = "chat")]
|
||||||
for i in 0..4 {
|
for i in 0..4 {
|
||||||
unwrap(spawner.spawn(socket::chat_listen_task(stack, i, 9000 + i as u16))).await;
|
unwrap!(spawner.spawn(socket::chat_listen_task(stack, i, 9000 + i as u16)));
|
||||||
}
|
}
|
||||||
info!("All apps lauched!");
|
info!("All apps lauched!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
use base64::prelude::*;
|
use base64::prelude::*;
|
||||||
|
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use core::str::from_utf8;
|
use core::str::from_utf8;
|
||||||
|
use core::write;
|
||||||
|
use defmt::*;
|
||||||
use embassy_net::tcp::TcpSocket;
|
use embassy_net::tcp::TcpSocket;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use embedded_io_async::Write as _;
|
use embedded_io_async::Write as _;
|
||||||
use heapless::{String, Vec};
|
use heapless::{String, Vec};
|
||||||
use log::{info, warn};
|
// use log::{info, warn};
|
||||||
use pico_website::unwrap;
|
|
||||||
|
// use pico_website::unwrap;
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
|
|
||||||
use crate::apps::Content;
|
use crate::apps::Content;
|
||||||
@ -47,7 +51,7 @@ pub async fn listen_task<
|
|||||||
loop {
|
loop {
|
||||||
Timer::after_secs(0).await;
|
Timer::after_secs(0).await;
|
||||||
let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer);
|
let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer);
|
||||||
socket.set_timeout(Some(Duration::from_secs(30)));
|
socket.set_timeout(Some(Duration::from_secs(10)));
|
||||||
|
|
||||||
info!("Socket {}: Listening on TCP:{}...", app.socket_name(), port);
|
info!("Socket {}: Listening on TCP:{}...", app.socket_name(), port);
|
||||||
if let Err(e) = socket.accept(port).await {
|
if let Err(e) = socket.accept(port).await {
|
||||||
@ -190,9 +194,7 @@ pub async fn listen_task<
|
|||||||
)?;
|
)?;
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let Ok(accept) = compute_ws_accept(&buf) else {
|
let accept = compute_ws_accept(&buf);
|
||||||
break;
|
|
||||||
};
|
|
||||||
write!(
|
write!(
|
||||||
&mut head_buf,
|
&mut head_buf,
|
||||||
"{}\r\n\
|
"{}\r\n\
|
||||||
@ -227,7 +229,7 @@ pub async fn listen_task<
|
|||||||
let res_content = match res_content {
|
let res_content = match res_content {
|
||||||
Ok(rc) => rc,
|
Ok(rc) => rc,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("res buffer write error: {:?}", e);
|
warn!("res buffer write error : {}", Debug2Format(&e));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -252,12 +254,12 @@ pub async fn listen_task<
|
|||||||
}
|
}
|
||||||
if is_ws {
|
if is_ws {
|
||||||
let mut buf = buf.into_bytes();
|
let mut buf = buf.into_bytes();
|
||||||
unwrap(buf.resize_default(BUF_LEN)).await;
|
unwrap!(buf.resize_default(BUF_LEN));
|
||||||
app.handle_ws::<BUF_LEN>(
|
app.handle_ws::<BUF_LEN>(
|
||||||
&path,
|
&path,
|
||||||
Ws::new(
|
Ws::new(
|
||||||
&mut socket,
|
&mut socket,
|
||||||
&mut unwrap(buf.into_array()).await,
|
&mut unwrap!(buf.into_array()),
|
||||||
app.socket_name(),
|
app.socket_name(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -266,7 +268,7 @@ pub async fn listen_task<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Format)]
|
||||||
pub enum HttpRequestType {
|
pub enum HttpRequestType {
|
||||||
Get,
|
Get,
|
||||||
Post,
|
Post,
|
||||||
@ -302,22 +304,13 @@ impl Into<&str> for HttpResCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_ws_accept(key: &str) -> Result<String<28>, ()> {
|
fn compute_ws_accept(key: &str) -> String<28> {
|
||||||
let mut res = Vec::<u8, 28>::new();
|
let mut res = Vec::<u8, 28>::new();
|
||||||
res.resize_default(28)?;
|
res.resize_default(28).unwrap();
|
||||||
let mut hasher = Sha1::new();
|
let mut hasher = Sha1::new();
|
||||||
hasher.update(key.as_bytes());
|
hasher.update(key.as_bytes());
|
||||||
hasher.update(b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
|
hasher.update(b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
|
||||||
let hash = hasher.finalize();
|
let hash = hasher.finalize();
|
||||||
if let Err(e) = BASE64_STANDARD.encode_slice(hash, &mut res) {
|
BASE64_STANDARD.encode_slice(hash, &mut res).unwrap();
|
||||||
warn!("Error while base64 encoding : {}\nkey: {}", e, key);
|
String::from_utf8(res).unwrap()
|
||||||
return Err(());
|
|
||||||
};
|
|
||||||
match String::from_utf8(res) {
|
|
||||||
Ok(r) => Ok(r),
|
|
||||||
Err(e) => {
|
|
||||||
warn!("Ws accept is not utf8! ({})", e);
|
|
||||||
Err(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,11 @@ use core::str::from_utf8;
|
|||||||
use embassy_net::tcp::{TcpReader, TcpSocket, TcpWriter};
|
use embassy_net::tcp::{TcpReader, TcpSocket, TcpWriter};
|
||||||
use embassy_time::Instant;
|
use embassy_time::Instant;
|
||||||
use embedded_io_async::ReadReady;
|
use embedded_io_async::ReadReady;
|
||||||
use log::warn;
|
// use log::warn;
|
||||||
use pico_website::{assert, unwrap, unwrap_opt};
|
use defmt::*;
|
||||||
|
// use pico_website::{assert, unwrap, unwrap_opt};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Format)]
|
||||||
pub enum WsMsg<'a> {
|
pub enum WsMsg<'a> {
|
||||||
Ping(&'a [u8]),
|
Ping(&'a [u8]),
|
||||||
Pong(&'a [u8]),
|
Pong(&'a [u8]),
|
||||||
@ -130,9 +131,9 @@ impl<'a, const BUF_SIZE: usize> Ws<'a, BUF_SIZE> {
|
|||||||
pub async fn rcv(&mut self) -> Result<Option<WsMsg>, ()> {
|
pub async fn rcv(&mut self) -> Result<Option<WsMsg>, ()> {
|
||||||
let n = match self.rx.msg_in_buf.take() {
|
let n = match self.rx.msg_in_buf.take() {
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
assert(n.0 + n.1 <= self.rx.buf.len()).await;
|
defmt::assert!(n.0 + n.1 <= self.rx.buf.len());
|
||||||
self.rx.buf.copy_within(n.0..n.0 + n.1, 0);
|
self.rx.buf.copy_within(n.0..n.0 + n.1, 0);
|
||||||
if unwrap(self.rx.socket.read_ready()).await {
|
if unwrap!(self.rx.socket.read_ready()) {
|
||||||
let n_rcv = match self.rx.socket.read(&mut self.rx.buf[n.1..]).await {
|
let n_rcv = match self.rx.socket.read(&mut self.rx.buf[n.1..]).await {
|
||||||
Ok(0) => {
|
Ok(0) => {
|
||||||
warn!("read EOF");
|
warn!("read EOF");
|
||||||
@ -150,7 +151,7 @@ impl<'a, const BUF_SIZE: usize> Ws<'a, BUF_SIZE> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
if unwrap(self.rx.socket.read_ready()).await {
|
if unwrap!(self.rx.socket.read_ready()) {
|
||||||
match self.rx.socket.read(self.rx.buf).await {
|
match self.rx.socket.read(self.rx.buf).await {
|
||||||
Ok(0) => {
|
Ok(0) => {
|
||||||
warn!("read EOF");
|
warn!("read EOF");
|
||||||
@ -208,7 +209,7 @@ impl<'a, const BUF_SIZE: usize> Ws<'a, BUF_SIZE> {
|
|||||||
.iter_mut()
|
.iter_mut()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
*x ^= unwrap_opt(mask_key.get(i % 4)).await;
|
*x ^= unwrap!(mask_key.get(i % 4));
|
||||||
}
|
}
|
||||||
if n_after_length + 4 + (length as usize) < n {
|
if n_after_length + 4 + (length as usize) < n {
|
||||||
self.rx.msg_in_buf = Some((
|
self.rx.msg_in_buf = Some((
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user