aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <np@npry.dev>2024-10-23 08:57:35 -0400
committerNathan Perry <np@npry.dev>2024-10-23 08:57:35 -0400
commitf2fc1133d5ddf507d92192310f3f3c71fb1c0ba7 (patch)
tree07841b294e84024157fffe7d29aa656e22ec1c2a
parentaa9b8b4a282e72feb7e3f8d59d2626cb43080e8b (diff)
set up for net test
-rw-r--r--Cargo.lock562
-rw-r--r--Cargo.toml18
-rw-r--r--host/Cargo.toml4
-rw-r--r--src/main.rs96
4 files changed, 607 insertions, 73 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b8404ac..3582899 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,6 +28,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
+name = "aead"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
+dependencies = [
+ "crypto-common",
+ "generic-array 0.14.7",
+]
+
+[[package]]
+name = "aes"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
+dependencies = [
+ "cfg-if",
+ "cipher",
+ "cpufeatures",
+]
+
+[[package]]
+name = "aes-gcm"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"
+dependencies = [
+ "aead",
+ "aes",
+ "cipher",
+ "ctr",
+ "ghash",
+ "subtle",
+]
+
+[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -54,7 +89,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923"
dependencies = [
- "as-slice",
+ "as-slice 0.2.1",
]
[[package]]
@@ -156,6 +191,18 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "as-slice"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0"
+dependencies = [
+ "generic-array 0.12.4",
+ "generic-array 0.13.3",
+ "generic-array 0.14.7",
+ "stable_deref_trait",
+]
+
+[[package]]
+name = "as-slice"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
@@ -262,12 +309,24 @@ dependencies = [
]
[[package]]
+name = "base16ct"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
+
+[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
+name = "base64"
+version = "0.21.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+
+[[package]]
name = "basic-toml"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -328,6 +387,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
+name = "block-buffer"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
+dependencies = [
+ "generic-array 0.14.7",
+]
+
+[[package]]
name = "block-device-driver"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -348,6 +416,16 @@ dependencies = [
]
[[package]]
+name = "buffered-io"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5698b2eda4613b62f3aa3119805df1ca6739e00167a2600b3a234ac49b14803"
+dependencies = [
+ "embedded-io 0.6.1",
+ "embedded-io-async",
+]
+
+[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -434,6 +512,16 @@ dependencies = [
]
[[package]]
+name = "cipher"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
+dependencies = [
+ "crypto-common",
+ "inout",
+]
+
+[[package]]
name = "clap"
version = "4.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -508,6 +596,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa"
[[package]]
+name = "const-oid"
+version = "0.9.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
+[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -546,6 +640,15 @@ dependencies = [
]
[[package]]
+name = "cpufeatures"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "crc-any"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -601,6 +704,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
+name = "crypto-bigint"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
+dependencies = [
+ "generic-array 0.14.7",
+ "rand_core",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array 0.14.7",
+ "typenum",
+]
+
+[[package]]
+name = "ctr"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"
+dependencies = [
+ "cipher",
+]
+
+[[package]]
name = "darling"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -719,6 +853,16 @@ dependencies = [
]
[[package]]
+name = "der"
+version = "0.7.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
+dependencies = [
+ "const-oid",
+ "zeroize",
+]
+
+[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -765,6 +909,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
+name = "digest"
+version = "0.10.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
name = "dirs-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -818,13 +973,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
+name = "elliptic-curve"
+version = "0.13.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
+dependencies = [
+ "base16ct",
+ "crypto-bigint",
+ "digest",
+ "ff",
+ "generic-array 0.14.7",
+ "group",
+ "hkdf",
+ "rand_core",
+ "sec1",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
name = "embassy-embedded-hal"
version = "0.2.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-time",
"embedded-hal 0.2.7",
"embedded-hal 1.0.0",
@@ -836,8 +1010,8 @@ dependencies = [
[[package]]
name = "embassy-executor"
-version = "0.6.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+version = "0.6.1"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"cortex-m",
"critical-section",
@@ -850,8 +1024,8 @@ dependencies = [
[[package]]
name = "embassy-executor-macros"
-version = "0.5.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+version = "0.6.1"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"darling 0.20.10",
"proc-macro2",
@@ -868,7 +1042,7 @@ checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067"
[[package]]
name = "embassy-futures"
version = "0.1.1"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
]
@@ -876,7 +1050,7 @@ dependencies = [
[[package]]
name = "embassy-hal-internal"
version = "0.2.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"cortex-m",
"critical-section",
@@ -887,12 +1061,12 @@ dependencies = [
[[package]]
name = "embassy-net"
version = "0.4.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
"document-features",
"embassy-net-driver",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-time",
"embedded-io-async",
"embedded-nal-async",
@@ -904,7 +1078,7 @@ dependencies = [
[[package]]
name = "embassy-net-driver"
version = "0.2.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
]
@@ -912,17 +1086,17 @@ dependencies = [
[[package]]
name = "embassy-net-driver-channel"
version = "0.3.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
"embassy-net-driver",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
]
[[package]]
name = "embassy-nrf"
version = "0.2.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"bitflags 2.6.0",
"cfg-if",
@@ -933,7 +1107,7 @@ dependencies = [
"document-features",
"embassy-embedded-hal",
"embassy-hal-internal",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-usb-driver",
"embedded-hal 0.2.7",
"embedded-hal 1.0.0",
@@ -961,7 +1135,7 @@ dependencies = [
[[package]]
name = "embassy-rp"
version = "0.2.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"atomic-polyfill",
"cfg-if",
@@ -972,9 +1146,9 @@ dependencies = [
"defmt",
"document-features",
"embassy-embedded-hal",
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
"embassy-hal-internal",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-time",
"embassy-time-driver",
"embassy-usb-driver",
@@ -994,12 +1168,13 @@ dependencies = [
"rp-pac",
"rp2040-boot2",
"sha2-const-stable",
+ "smart-leds",
]
[[package]]
name = "embassy-stm32"
version = "0.1.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"aligned",
"bit_field",
@@ -1013,10 +1188,10 @@ dependencies = [
"defmt",
"document-features",
"embassy-embedded-hal",
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
"embassy-hal-internal",
"embassy-net-driver",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-time",
"embassy-usb-driver",
"embassy-usb-synopsys-otg",
@@ -1058,7 +1233,7 @@ dependencies = [
[[package]]
name = "embassy-sync"
version = "0.6.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"cfg-if",
"critical-section",
@@ -1072,7 +1247,7 @@ dependencies = [
[[package]]
name = "embassy-time"
version = "0.3.2"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"cfg-if",
"critical-section",
@@ -1090,7 +1265,7 @@ dependencies = [
[[package]]
name = "embassy-time-driver"
version = "0.1.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"document-features",
]
@@ -1098,17 +1273,17 @@ dependencies = [
[[package]]
name = "embassy-time-queue-driver"
version = "0.1.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
[[package]]
name = "embassy-usb"
version = "0.3.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
"embassy-net-driver-channel",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-usb-driver",
"heapless 0.8.0",
"ssmarshal",
@@ -1118,7 +1293,7 @@ dependencies = [
[[package]]
name = "embassy-usb-driver"
version = "0.1.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"defmt",
]
@@ -1126,10 +1301,10 @@ dependencies = [
[[package]]
name = "embassy-usb-synopsys-otg"
version = "0.1.0"
-source = "git+https://github.com/mammothbane/embassy#89bad07e817dec482d385f765da5be3b6d2d0e4c"
+source = "git+https://pub.npry.dev/embassy#379a59329158febc8edce1d62f62c07d71f22105"
dependencies = [
"critical-section",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-usb-driver",
]
@@ -1227,23 +1402,21 @@ dependencies = [
[[package]]
name = "embedded-nal"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8a943fad5ed3d3f8a00f1e80f6bba371f1e7f0df28ec38477535eb318dc19cc"
+checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77"
dependencies = [
"nb 1.1.0",
- "no-std-net",
]
[[package]]
name = "embedded-nal-async"
-version = "0.7.1"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72229137a4fc12d239b0b7f50f04b30790678da6d782a0f3f1909bf57ec4b759"
+checksum = "76959917cd2b86f40a98c28dd5624eddd1fa69d746241c8257eac428d83cb211"
dependencies = [
"embedded-io-async",
"embedded-nal",
- "no-std-net",
]
[[package]]
@@ -1271,6 +1444,29 @@ dependencies = [
]
[[package]]
+name = "embedded-tls"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6efb76fdd004a4ef787640177237b83449e6c5847765ea50bf15900061fd601"
+dependencies = [
+ "aes-gcm",
+ "atomic-polyfill",
+ "defmt",
+ "digest",
+ "embedded-io 0.6.1",
+ "embedded-io-async",
+ "generic-array 0.14.7",
+ "heapless 0.6.1",
+ "heapless 0.8.0",
+ "hkdf",
+ "hmac",
+ "p256",
+ "rand_core",
+ "sha2",
+ "typenum",
+]
+
+[[package]]
name = "embedded_sdmmc_async"
version = "0.8.0-alpha0"
source = "git+https://pub.npry.dev/embedded_sdmmc_async#3eef0d36c7600f9b52101d7ba85055e53c0eb6d4"
@@ -1278,7 +1474,7 @@ dependencies = [
"byteorder",
"cfg-if",
"defmt",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embedded-hal-async",
"embedded-io-async",
"heapless 0.8.0",
@@ -1338,6 +1534,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
[[package]]
+name = "ff"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
+dependencies = [
+ "rand_core",
+ "subtle",
+]
+
+[[package]]
name = "filetime"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1484,9 +1690,38 @@ dependencies = [
]
[[package]]
+name = "generic-array"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
+dependencies = [
+ "typenum",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309"
+dependencies = [
+ "typenum",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+dependencies = [
+ "typenum",
+ "version_check",
+ "zeroize",
+]
+
+[[package]]
name = "genlog"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"cfg-if",
"defmt",
@@ -1506,6 +1741,16 @@ dependencies = [
]
[[package]]
+name = "ghash"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1"
+dependencies = [
+ "opaque-debug",
+ "polyval",
+]
+
+[[package]]
name = "gimli"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2006,6 +2251,17 @@ dependencies = [
]
[[package]]
+name = "group"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
+dependencies = [
+ "ff",
+ "rand_core",
+ "subtle",
+]
+
+[[package]]
name = "half"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2017,6 +2273,15 @@ dependencies = [
[[package]]
name = "hash32"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc"
+dependencies = [
+ "byteorder",
+]
+
+[[package]]
+name = "hash32"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
@@ -2054,6 +2319,18 @@ dependencies = [
[[package]]
name = "heapless"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "634bd4d29cbf24424d0a4bfcbf80c6960129dc24424752a7d1d1390607023422"
+dependencies = [
+ "as-slice 0.1.5",
+ "generic-array 0.14.7",
+ "hash32 0.1.1",
+ "stable_deref_trait",
+]
+
+[[package]]
+name = "heapless"
version = "0.7.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
@@ -2103,6 +2380,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
+name = "hkdf"
+version = "0.12.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
+dependencies = [
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+dependencies = [
+ "digest",
+]
+
+[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2118,6 +2413,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
+name = "httparse"
+version = "1.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
+
+[[package]]
name = "humansize"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2182,6 +2483,15 @@ dependencies = [
]
[[package]]
+name = "inout"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
+dependencies = [
+ "generic-array 0.14.7",
+]
+
+[[package]]
name = "io-kit-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2497,7 +2807,7 @@ dependencies = [
[[package]]
name = "molybdos"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"defmt-rtt",
"embassy-executor",
@@ -2510,7 +2820,7 @@ dependencies = [
[[package]]
name = "molybdos_build"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"anyhow",
"askama",
@@ -2521,16 +2831,16 @@ dependencies = [
[[package]]
name = "molybdos_lib"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"anyhow",
"cfg-if",
"chrono",
"embassy-embedded-hal",
"embassy-executor",
- "embassy-futures 0.1.1 (git+https://github.com/mammothbane/embassy)",
+ "embassy-futures 0.1.1 (git+https://pub.npry.dev/embassy)",
"embassy-net",
- "embassy-sync 0.6.0 (git+https://github.com/mammothbane/embassy)",
+ "embassy-sync 0.6.0 (git+https://pub.npry.dev/embassy)",
"embassy-time",
"embassy-usb",
"embedded-hal 1.0.0",
@@ -2564,7 +2874,7 @@ dependencies = [
[[package]]
name = "molybdos_pal"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"cfg-if",
"cortex-m",
@@ -2583,7 +2893,7 @@ dependencies = [
[[package]]
name = "molybdos_rt"
version = "0.1.0-alpha0"
-source = "git+https://pub.npry.dev/molybdos#a4ab89a0811de9217295e63968fe0be6cb4d6309"
+source = "git+https://pub.npry.dev/molybdos#7b5bfcab030a5d4dfe1377cc01199c4a73dafffc"
dependencies = [
"cfg-if",
"embassy-executor",
@@ -2644,12 +2954,6 @@ dependencies = [
]
[[package]]
-name = "no-std-net"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65"
-
-[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2660,6 +2964,15 @@ dependencies = [
]
[[package]]
+name = "nourl"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3c12edfda65fe16901d81d3bd93fd18ac07078b5007875a1c3b0d35f7725269"
+dependencies = [
+ "defmt",
+]
+
+[[package]]
name = "nrf-softdevice"
version = "0.1.0"
source = "git+https://github.com/embassy-rs/nrf-softdevice#991d28e3c61687908acc53e748191eb59d00e27a"
@@ -2997,11 +3310,13 @@ dependencies = [
"cortex-m-rt",
"drogue_bme680_async",
"embassy-executor",
+ "embassy-net",
"lsm6dsm",
"molybdos",
"molybdos_build",
"ocularium_common",
"pio",
+ "reqwless",
"serde",
"veml7700_async",
]
@@ -3040,6 +3355,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
+name = "opaque-debug"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
+
+[[package]]
+name = "p256"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
+dependencies = [
+ "elliptic-curve",
+ "primeorder",
+]
+
+[[package]]
name = "panic-probe"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3155,6 +3486,18 @@ dependencies = [
]
[[package]]
+name = "polyval"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "opaque-debug",
+ "universal-hash",
+]
+
+[[package]]
name = "portable-atomic"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3200,6 +3543,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
+name = "primeorder"
+version = "0.13.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
+dependencies = [
+ "elliptic-curve",
+]
+
+[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3359,6 +3711,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
+name = "reqwless"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb1be74cb817fa6dbda417110f575d9b9ad5488817f1eb65f2f6468fe6d5d663"
+dependencies = [
+ "base64 0.21.7",
+ "buffered-io",
+ "defmt",
+ "embedded-io 0.6.1",
+ "embedded-io-async",
+ "embedded-nal-async",
+ "embedded-tls",
+ "heapless 0.8.0",
+ "hex",
+ "httparse",
+ "nourl",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rgb"
+version = "0.8.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
+dependencies = [
+ "bytemuck",
+]
+
+[[package]]
name = "rlsf"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3468,6 +3850,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a"
[[package]]
+name = "sec1"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
+dependencies = [
+ "base16ct",
+ "der",
+ "generic-array 0.14.7",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3547,6 +3942,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]
+name = "sha2"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
name = "sha2-const-stable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3612,9 +4018,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
+name = "smart-leds"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "66df34e571fa9993fa6f99131a374d58ca3d694b75f9baac93458fe0d6057bf0"
+dependencies = [
+ "smart-leds-trait",
+]
+
+[[package]]
+name = "smart-leds-trait"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bc64ee02bbbf469603016df746c0ed224f263280b6ebb49b7ebadbff375c572"
+dependencies = [
+ "rgb",
+]
+
+[[package]]
name = "smoltcp"
version = "0.11.0"
-source = "git+https://github.com/smoltcp-rs/smoltcp?rev=dd43c8f189178b0ab3bda798ed8578b5b0a6f094#dd43c8f189178b0ab3bda798ed8578b5b0a6f094"
+source = "git+https://github.com/smoltcp-rs/smoltcp?rev=fe0b4d102253465850cd1cf39cd33d4721a4a8d5#fe0b4d102253465850cd1cf39cd33d4721a4a8d5"
dependencies = [
"bitflags 1.3.2",
"byteorder",
@@ -3687,7 +4111,7 @@ dependencies = [
[[package]]
name = "stm32-metapac"
version = "15.0.0"
-source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-ad00827345b4b758b2453082809d6e3b634b5364#e442835159a7a311410cd4a2879da52c6f57af52"
+source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-9b7414490b10ffbd5beb1b0dcf14adb018cbe37f#dc782d51865ba6a0a8dd79a4d6972864b33b6f00"
dependencies = [
"cortex-m",
"cortex-m-rt",
@@ -3719,12 +4143,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
name = "svgbobdoc"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50"
dependencies = [
- "base64",
+ "base64 0.13.1",
"proc-macro2",
"quote",
"syn 1.0.109",
@@ -4008,6 +4438,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
+name = "universal-hash"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
+dependencies = [
+ "crypto-common",
+ "subtle",
+]
+
+[[package]]
name = "url"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4507,3 +4947,9 @@ dependencies = [
"quote",
"syn 2.0.77",
]
+
+[[package]]
+name = "zeroize"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
diff --git a/Cargo.toml b/Cargo.toml
index 2ac0bea..30a881e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,11 +43,14 @@ lsm6dsm = { git = "https://pub.npry.dev/lsm6dsm" }
serde = { workspace = true, default-features = false, features = ["derive", "alloc"] }
-embassy-executor = { git = "https://github.com/embassy-rs/embassy", features = ["executor-interrupt", "executor-thread", "arch-cortex-m", "nightly"] }
+embassy-net = { git = "https://pub.npry.dev/embassy", features = ["medium-ethernet", "tcp", "proto-ipv4", "dns"] }
+embassy-executor = { git = "https://pub.npry.dev/embassy", features = ["executor-interrupt", "executor-thread", "arch-cortex-m", "nightly"] }
cortex-m-rt = { version = "0.7", default-features = false }
ocularium_common = { path = "common" }
+reqwless = { version = "0.13", default-features = false, features = ["alloc", "embedded-tls", "defmt"] }
+
pio = "0.2"
[dependencies.molybdos]
@@ -76,12 +79,13 @@ molybdos_build = { git = "https://pub.npry.dev/molybdos", features = ["defmt", "
#"https://pub.npry.dev/lsm6dsm".lsm6dsm = { path = "../lsm6dsm" }
[patch."https://github.com/embassy-rs/embassy"]
-embassy-sync = { git = "https://github.com/mammothbane/embassy" }
-embassy-executor = { git = "https://github.com/mammothbane/embassy" }
-embassy-time = { git = "https://github.com/mammothbane/embassy" }
-embassy-time-driver = { git = "https://github.com/mammothbane/embassy" }
-embassy-usb = { git = "https://github.com/mammothbane/embassy" }
-embassy-rp = { git = "https://github.com/mammothbane/embassy" }
+embassy-sync = { git = "https://pub.npry.dev/embassy" }
+embassy-executor = { git = "https://pub.npry.dev/embassy" }
+embassy-time = { git = "https://pub.npry.dev/embassy" }
+embassy-time-driver = { git = "https://pub.npry.dev/embassy" }
+embassy-usb = { git = "https://pub.npry.dev/embassy" }
+embassy-rp = { git = "https://pub.npry.dev/embassy" }
+embassy-net = { git = "https://pub.npry.dev/embassy" }
[profile.dev]
codegen-units = 1
diff --git a/host/Cargo.toml b/host/Cargo.toml
index 2b8dd7f..c3156b4 100644
--- a/host/Cargo.toml
+++ b/host/Cargo.toml
@@ -18,8 +18,8 @@ eyre = "0.6"
serde = "1.0"
ssmarshal = { version = "1.0", features = ["std"] }
-embassy-executor = { git = "https://github.com/embassy-rs/embassy", features = ["arch-std"] }
-embassy-time = { git = "https://github.com/embassy-rs/embassy", features = ["std", "generic-queue"] }
+embassy-executor = { git = "https://pub.npry.dev/embassy", features = ["arch-std"] }
+embassy-time = { git = "https://pub.npry.dev/embassy", features = ["std", "generic-queue"] }
molybdos_lib = { git = "https://pub.npry.dev/molybdos", features = ["postcard", "serde", "std"], default-features = false }
diff --git a/src/main.rs b/src/main.rs
index 86f4975..2b839d7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,15 +1,21 @@
#![no_std]
#![no_main]
#![feature(impl_trait_in_assoc_type)]
+#![feature(try_blocks)]
extern crate alloc;
+use core::net::{
+ IpAddr,
+ Ipv4Addr,
+};
+use embassy_net::tcp::client::TcpClientState;
use molybdos::{
embassy_embedded_hal::shared_bus::asynch::{
i2c::I2cDevice,
spi::SpiDevice,
},
- embassy_executor,
+ embassy_net::StackResources,
embassy_rp,
embassy_rp::{
i2c::{
@@ -37,24 +43,39 @@ use molybdos::{
pubsub,
pubsub::PubSubBehavior,
},
+ embassy_time,
+ embassy_usb,
+ embassy_usb::class::{
+ cdc_ncm,
+ cdc_ncm::embassy_net::Device,
+ },
embedded_hal_async,
embedded_hal_async::spi::{
Operation,
SpiDevice as _,
},
+ embedded_io_async::Write,
embedded_sdmmc_async::{
VolumeIdx,
VolumeManager,
},
genlog,
- genlog::defmt,
+ genlog::{
+ defmt,
+ defmt::unwrap,
+ },
heapless,
pal::StaticOutput,
+ static_cell::{
+ ConstStaticCell,
+ StaticCell,
+ },
};
use ocularium_common::{
Downlink,
Sensor,
};
+use reqwless::request::Method;
use crate::usb::COBS_DOWNLINK;
@@ -71,7 +92,12 @@ pub type SensorI2c = I2c<'static, I2C1, i2c::Async>;
pub static I2S_PIPE: Pipe<ThreadModeRawMutex, 1024> = Pipe::new();
#[::embassy_executor::main]
+#[inline]
async fn main(spawner: embassy_executor::Spawner) {
+ _main(spawner).await
+}
+
+async fn _main(spawner: embassy_executor::Spawner) {
molybdos::pal::heap::init();
defmt::info!("boot");
@@ -92,18 +118,58 @@ async fn main(spawner: embassy_executor::Spawner) {
// spawner.must_spawn(molybdos::pal::watchdog(wdt));
- let (acm,) = molybdos::lib::usb::bringup!(
+ const MTU: usize = 1514;
+ const MAC: [u8; 6] = [0, 0, 0, 0, 0, 0];
+
+ let (acm, ncm) = molybdos::lib::usb::bringup!(
spawn,
usb,
molybdos::pal::UsbDriver,
molybdos::lib::usb::config("npry", "ocularium", 0x8888, 0x0011),
endpoints = {
acm => |builder| molybdos::lib::usb::acm!(builder),
+ ncm => |builder| {
+ static STATE: StaticCell<cdc_ncm::State> = StaticCell::new();
+ let state =
+ StaticCell::init(&STATE, cdc_ncm::State::new());
+ cdc_ncm::CdcNcmClass::new(builder, state, MAC, 64)
+ },
}
);
+ #[embassy_executor::task]
+ async fn ncm_task(
+ runner: cdc_ncm::embassy_net::Runner<
+ 'static,
+ embassy_rp::usb::Driver<'static, embassy_rp::peripherals::USB>,
+ MTU,
+ >,
+ ) -> ! {
+ runner.run().await
+ }
+
molybdos::lib::usb::start!(molybdos::pal::UsbDriver, acm, &usb::UPLINK, &usb::DOWNLINK);
+ static NET_STATE: ConstStaticCell<cdc_ncm::embassy_net::State<MTU, 4, 4>> =
+ ConstStaticCell::new(cdc_ncm::embassy_net::State::new());
+ let (runner, dev) = ncm.into_embassy_net_device::<MTU, 4, 4>(NET_STATE.take(), MAC);
+
+ spawner.must_spawn(ncm_task(runner));
+
+ let config = molybdos::embassy_net::Config::dhcpv4(Default::default());
+ static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
+ let (stack, runner) =
+ molybdos::embassy_net::new(dev, config, RESOURCES.init(StackResources::new()), 0);
+
+ #[embassy_executor::task]
+ async fn net_task(
+ mut runner: molybdos::embassy_net::Runner<'static, Device<'static, MTU>>,
+ ) -> ! {
+ runner.run().await
+ }
+
+ spawner.must_spawn(net_task(runner));
+
molybdos::lib::util::cobs::start!(
ocularium_common::Uplink,
&usb::UPLINK,
@@ -161,11 +227,29 @@ async fn main(spawner: embassy_executor::Spawner) {
spawner.must_spawn(run_i2s(i2s, i2s_dma));
}
+ let target_addr = core::net::SocketAddrV4::new(Ipv4Addr::from([1, 1, 1, 1]), 80);
+
+ let state = TcpClientState::new();
+ let client = embassy_net::tcp::client::TcpClient::<1>::new(stack, &state);
+
+ let dns = embassy_net::dns::DnsSocket::new(stack);
+
+ let mut client = reqwless::client::HttpClient::new(&client, &dns);
+
+ let mut headers_buf = [0; 512];
+
loop {
- molybdos::embassy_time::Timer::after(molybdos::embassy_time::Duration::from_secs(1)).await;
+ let _result: Result<(), reqwless::Error> = try {
+ let mut req = client.request(Method::GET, "http://httpbin.org/anything").await?;
+ let resp = req.send(&mut headers_buf).await?;
+
+ let body = resp.body().read_to_end().await?;
+ let body_str = core::str::from_utf8(&body).unwrap();
+
+ defmt::info!("got response: {}", body_str);
+ };
- let meas = bme.measure_default().await.unwrap().unwrap();
- defmt::info!("got bme measurement: {}", defmt::Debug2Format(&meas));
+ embassy_time::Timer::after(embassy_time::Duration::from_secs(1)).await;
}
}