diff --git a/.gitignore b/.gitignore index 4713399..3bf03d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -/*/output.log \ No newline at end of file +/*/output.log +*.bin \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 67e6a78..8eb3a32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,27 +1,62 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] -name = "addr2line" -version = "0.22.0" +name = "anstream" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ - "gimli", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", ] [[package]] -name = "adler" -version = "1.0.2" +name = "anstyle" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "as5048a" @@ -31,17 +66,6 @@ dependencies = [ "embedded-hal 0.2.7", ] -[[package]] -name = "async-trait" -version = "0.1.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - [[package]] name = "atomic-polyfill" version = "1.0.3" @@ -52,21 +76,27 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.3.0" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axum" -version = "0.7.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ - "async-trait", "axum-core", "axum-macros", "bytes", + "form_urlencoded", "futures-util", "http", "http-body", @@ -79,12 +109,11 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rustversion", - "serde", + "serde_core", "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", "tokio", "tower", "tower-layer", @@ -94,20 +123,18 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ - "async-trait", "bytes", - "futures-util", + "futures-core", "http", "http-body", "http-body-util", "mime", "pin-project-lite", - "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -115,29 +142,13 @@ dependencies = [ [[package]] name = "axum-macros" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" +checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ - "heck", "proc-macro2", "quote", - "syn 2.0.72", -] - -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", + "syn 2.0.111", ] [[package]] @@ -146,7 +157,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" dependencies = [ - "rustc_version", + "rustc_version 0.2.3", ] [[package]] @@ -169,39 +180,144 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "cc" -version = "1.1.6" +version = "1.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +dependencies = [ + "find-msvc-tools", + "shlex", +] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.17", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "colored" -version = "1.9.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ - "is-terminal", "lazy_static", - "winapi", + "windows-sys 0.59.0", ] +[[package]] +name = "console" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e45a4a8926227e4197636ba97a9fc9b00477e9f4bd711395687c5f0734bec4" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.61.2", +] + +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cortex-m" version = "0.7.7" @@ -217,35 +333,44 @@ dependencies = [ [[package]] name = "cortex-m-rt" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" +checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" dependencies = [ "cortex-m-rt-macros", ] [[package]] name = "cortex-m-rt-macros" -version = "0.7.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.111", ] [[package]] name = "critical-section" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "defmt" -version = "0.3.8" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0" +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", @@ -258,55 +383,90 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2f0ac3635d0c89d12b8101fcb44a7625f5f030a1c0491124b74467eb5a58a78" dependencies = [ "critical-section", - "defmt", + "defmt 0.3.100", ] [[package]] name = "defmt-macros" -version = "0.3.9" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" dependencies = [ "defmt-parser", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", ] [[package]] name = "defmt-parser" -version = "0.3.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ - "thiserror", + "thiserror 2.0.17", ] [[package]] name = "defmt-rtt" -version = "0.4.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e" dependencies = [ "critical-section", - "defmt", + "defmt 1.0.1", ] [[package]] name = "deranged" -version = "0.3.11" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] [[package]] -name = "document-features" -version = "0.2.10" +name = "dfu-core" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "d0fff68a4cf37c95054fc71faac1d30beefece378b1a7b204f82d6a267218ec4" +dependencies = [ + "bytes", + "displaydoc", + "log", + "pretty-hex", + "thiserror 1.0.69", +] + +[[package]] +name = "dfu-libusb" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fdcc0466c461fba888e62cda3e27a2413b56e99712cea36ddc1353c1cc67fd" +dependencies = [ + "dfu-core", + "rusb", + "thiserror 1.0.69", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" dependencies = [ "litrs", ] @@ -355,6 +515,18 @@ dependencies = [ "nb 1.1.0", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "embedded-storage" version = "0.3.1" @@ -362,61 +534,77 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" [[package]] -name = "enumflags2" -version = "0.7.10" +name = "encode_unicode" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.10" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] [[package]] name = "fern" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" +checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29" dependencies = [ "colored", "log", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "find-msvc-tools" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] name = "fugit" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +checksum = "4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6" dependencies = [ "gcd", ] @@ -432,42 +620,92 @@ dependencies = [ ] [[package]] -name = "futures-channel" -version = "0.3.30" +name = "futures" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] -name = "futures-sink" -version = "0.3.30" +name = "futures-executor" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -477,37 +715,78 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" [[package]] -name = "gimli" -version = "0.29.0" +name = "hash32" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32 0.2.1", + "rustc_version 0.4.1", + "serde", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32 0.3.1", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" +dependencies = [ + "defmt 1.0.1", + "hash32 0.3.1", + "serde_core", + "stable_deref_trait", +] [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "http" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -523,12 +802,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -536,15 +815,15 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" [[package]] name = "httparse" -version = "1.9.4" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -554,70 +833,101 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "hyper" -version = "1.4.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", + "futures-core", "http", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", ] [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "hyper", "pin-project-lite", "tokio", + "tower-service", ] [[package]] name = "indexmap" -version = "2.2.6" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown", ] [[package]] -name = "is-terminal" -version = "0.4.12" +name = "indicatif" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +checksum = "9375e112e4b463ec1b1c6c011953545c65a30164fbab5b581df32b3abf0dcb88" dependencies = [ - "hermit-abi", - "libc", - "windows-sys", + "console", + "portable-atomic", + "unicode-width", + "unit-prefix", + "web-time", ] [[package]] -name = "itoa" -version = "1.0.11" +name = "io-kit-sys" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" +dependencies = [ + "core-foundation-sys", + "mach2", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "js-sys" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +dependencies = [ + "once_cell", + "wasm-bindgen", +] [[package]] name = "lazy_static" @@ -627,49 +937,89 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libudev" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "libusb1-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da050ade7ac4ff1ba5379af847a10a10a8e284181e060105bf8d86960ce9ce0f" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "litrs" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.22" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "mime" @@ -688,30 +1038,28 @@ dependencies = [ ] [[package]] -name = "minimal-lexical" -version = "0.2.1" +name = "mio" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ - "adler", + "libc", + "log", + "wasi", + "windows-sys 0.61.2", ] [[package]] -name = "mio" -version = "1.0.1" +name = "mio-serial" +version = "5.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "029e1f407e261176a983a6599c084efd322d9301028055c87174beac71397ba3" dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys", + "log", + "mio", + "nix 0.29.0", + "serialport", + "winapi", ] [[package]] @@ -730,23 +1078,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] -name = "nom" -version = "7.1.3" +name = "nix" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" dependencies = [ "memchr", - "minimal-lexical", +] + +[[package]] +name = "nom-language" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2de2bc5b451bfedaef92c90b8939a8fff5770bdcc1fafd6239d086aab8fa6b29" +dependencies = [ + "nom", ] [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys 0.61.2", ] [[package]] @@ -817,42 +1195,33 @@ dependencies = [ "libm", ] -[[package]] -name = "object" -version = "0.36.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "overload" -version = "0.1.1" +name = "once_cell_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "panic-probe" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", ] [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -860,48 +1229,28 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-link", ] [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -910,10 +1259,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "portable-atomic" -version = "1.7.0" +name = "pkg-config" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "defmt 1.0.1", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "heapless 0.7.17", + "serde", +] [[package]] name = "powerfmt" @@ -922,34 +1291,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "pretty-hex" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" dependencies = [ - "proc-macro-error-attr", "proc-macro2", "quote", - "syn 1.0.109", - "version_check", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-error2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" dependencies = [ + "proc-macro-error-attr2", "proc-macro2", "quote", - "version_check", + "syn 2.0.111", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" dependencies = [ "unicode-ident", ] @@ -957,17 +1330,16 @@ dependencies = [ [[package]] name = "qmc5883l" version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c1eccef44c00b214bee71a965c661b1460867983f6dace5e8d506154a3cef2" +source = "git+https://github.com/patrickelectric/qmc5883l?rev=62b8a64b54e0f843ddf0c5942f8ed218b5f3e492#62b8a64b54e0f843ddf0c5942f8ed218b5f3e492" dependencies = [ - "embedded-hal 0.2.7", + "embedded-hal 1.0.0", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -978,35 +1350,59 @@ version = "0.1.0" dependencies = [ "as5048a", "cortex-m", - "defmt", + "defmt 1.0.1", "defmt-brtt", "defmt-rtt", "embedded-hal 1.0.0", + "heapless 0.9.2", "nb 1.1.0", "num", "num-traits", "panic-probe", + "postcard", "qmc5883l", + "radomctl-protocol", "rtic", "rtic-monotonics", "stm32f4xx-hal", "ufmt", + "usb-device", + "usbd-serial", "xca9548a", ] +[[package]] +name = "radomctl-protocol" +version = "0.1.0" +dependencies = [ + "heapless 0.9.2", + "serde", +] + [[package]] name = "radomctld" version = "0.1.0" dependencies = [ "anyhow", "axum", + "bytes", + "clap", + "dfu-libusb", "fern", + "futures", "humantime", + "indicatif", "log", "nom", + "nom-language", + "postcard", + "radomctl-protocol", + "rusb", "serde_json", + "serialport", "tokio", - "tokio-macros 0.2.6", + "tokio-serial", + "tokio-util", "tower-http", "tracing", "tracing-subscriber", @@ -1019,35 +1415,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] -name = "redox_syscall" -version = "0.5.3" +name = "rand_core" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.10.0", ] [[package]] name = "rtic" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c443db16326376bdd64377da268f6616d5f804aba8ce799bac7d1f7f244e9d51" +checksum = "6bc68b1fa2eefbb7ad6747b299b79c8fca92163dfa46f0e279f39109cf272186" dependencies = [ - "atomic-polyfill", "bare-metal 1.0.0", "cortex-m", "critical-section", + "portable-atomic", "rtic-core", "rtic-macros", ] [[package]] name = "rtic-common" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0786b50b81ef9d2a944a000f60405bb28bf30cd45da2d182f3fe636b2321f35c" +checksum = "67caeecca87cb20e1101eb104b0f05604633b7ab1035cce777417c6fb7c8f9a0" dependencies = [ "critical-section", + "portable-atomic", ] [[package]] @@ -1058,22 +1461,22 @@ checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" [[package]] name = "rtic-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54053598ea24b1b74937724e366558412a1777eb2680b91ef646db540982789a" +checksum = "f387b12bd6c01d2c9d4776dddeefaf0ae51b9497c83c0186b1693f6821ff3c4a" dependencies = [ "indexmap", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", ] [[package]] name = "rtic-monotonics" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e17f88319061d17d3b99997263397b176e3260177e2b4ff4ffed0078d97894c" +checksum = "99f9923ce32637ee40c0cb28fbbc2fad880d8aebea2d545918c6971ae9be3d17" dependencies = [ "cfg-if", "cortex-m", @@ -1084,9 +1487,9 @@ dependencies = [ [[package]] name = "rtic-time" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b1d853fa50dc125695414ce4510567a0d420221e455b1568cfa8c9aece9614" +checksum = "61485474f5a23247ae1d4875f2bfe860be9b3030dbf87c232e50799e021429a1" dependencies = [ "critical-section", "embedded-hal 1.0.0", @@ -1097,10 +1500,14 @@ dependencies = [ ] [[package]] -name = "rustc-demangle" -version = "0.1.24" +name = "rusb" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "ab9f9ff05b63a786553a4c02943b74b34a988448671001e9a27e2f0565cc05a4" +dependencies = [ + "libc", + "libusb1-sys", +] [[package]] name = "rustc_version" @@ -1108,20 +1515,29 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.27", ] [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" [[package]] name = "scopeguard" @@ -1138,6 +1554,12 @@ dependencies = [ "semver-parser", ] +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "semver-parser" version = "0.7.0" @@ -1146,43 +1568,56 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" dependencies = [ "itoa", - "ryu", + "memchr", "serde", + "serde_core", + "zmij", ] [[package]] name = "serde_path_to_error" -version = "0.1.16" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" dependencies = [ "itoa", "serde", + "serde_core", ] [[package]] @@ -1197,6 +1632,26 @@ dependencies = [ "serde", ] +[[package]] +name = "serialport" +version = "4.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21f60a586160667241d7702c420fc223939fb3c0bb8d3fac84f78768e8970dee" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "core-foundation", + "core-foundation-sys", + "io-kit-sys", + "libudev", + "mach2", + "nix 0.26.4", + "quote", + "scopeguard", + "unescaper", + "windows-sys 0.52.0", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -1207,53 +1662,76 @@ dependencies = [ ] [[package]] -name = "signal-hook-registry" -version = "1.4.2" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] [[package]] -name = "smallvec" -version = "1.13.2" +name = "slab" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.5.7" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.60.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", ] [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stm32f4" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb94729242cd1aebe6dab42a2ca0131985ae93bc3ab2751b680df724bb35528d" +checksum = "c41bd8922df364cb7054cae71a95dcbb32cffd25b5c0f9c00272ef8c82279a65" dependencies = [ - "bare-metal 1.0.0", "cortex-m", "cortex-m-rt", + "critical-section", + "portable-atomic", "vcell", ] [[package]] name = "stm32f4xx-hal" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed60591531f4da636d828701c74861a3d100e5c4e36677cadbd2eb6f46eb67" +checksum = "4b5b520616b1ebd18b3ac2d809b8ae47851b14efc63aea7c85d8a45c1daa6fbb" dependencies = [ "bare-metal 1.0.0", "cortex-m", @@ -1263,18 +1741,26 @@ dependencies = [ "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-nb", + "embedded-io 0.6.1", "embedded-storage", "enumflags2", "fugit", "fugit-timer", "nb 1.1.0", - "rand_core", + "rand_core 0.6.4", + "rand_core 0.9.3", "stm32f4", + "synopsys-usb-otg", "time", - "vcell", "void", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "syn" version = "1.0.109" @@ -1288,9 +1774,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -1299,51 +1785,76 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] -name = "sync_wrapper" -version = "1.0.1" +name = "synopsys-usb-otg" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "e948d523b316939545d8b21a48c27aef150ce25321b9f95ff7978647a806a6fe" +dependencies = [ + "cortex-m", + "embedded-hal 0.2.7", + "usb-device", + "vcell", +] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[package]] name = "time" -version = "0.3.36" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "num-conv", @@ -1353,17 +1864,16 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "tokio" -version = "1.39.2" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", @@ -1371,55 +1881,61 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2", - "tokio-macros 2.4.0", - "windows-sys", + "tokio-macros", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "0.2.6" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.111", ] [[package]] -name = "tokio-macros" -version = "2.4.0" +name = "tokio-serial" +version = "5.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "aa1d5427f11ba7c5e6384521cfd76f2d64572ff29f3f4f7aa0f496282923fdc8" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", + "bytes", + "cfg-if", + "futures", + "log", + "mio-serial", + "serialport", + "tokio", + "tokio-util", ] [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", "futures-sink", + "futures-util", "pin-project-lite", "tokio", ] [[package]] name = "tower" -version = "0.4.13" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "pin-project", "pin-project-lite", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -1428,12 +1944,13 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.5.2" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.10.0", "bytes", + "futures-core", "futures-util", "http", "http-body", @@ -1453,21 +1970,21 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", @@ -1477,20 +1994,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -1509,9 +2026,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "nu-ansi-term", "sharded-slab", @@ -1549,25 +2066,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" [[package]] -name = "unicase" -version = "2.7.0" +name = "unescaper" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +checksum = "4064ed685c487dbc25bd3f0e9548f2e34bab9d18cefc700f9ec2dba74ba1138e" dependencies = [ - "version_check", + "thiserror 2.0.17", ] [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "unicase" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + +[[package]] +name = "usb-device" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless 0.8.0", + "portable-atomic", +] + +[[package]] +name = "usbd-serial" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065e4eaf93db81d5adac82d9cef8f8da314cb640fa7f89534b972383f1cf80fc" +dependencies = [ + "embedded-hal 0.2.7", + "embedded-io 0.6.1", + "nb 1.1.0", + "usb-device", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcell" @@ -1576,10 +2139,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" [[package]] -name = "version_check" -version = "0.9.5" +name = "vcpkg" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "void" @@ -1598,9 +2161,64 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.111", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "winapi" @@ -1624,13 +2242,46 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", ] [[package]] @@ -1639,14 +2290,31 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -1655,42 +2323,84 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -1698,10 +2408,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "xca9548a" -version = "0.2.1" +name = "windows_x86_64_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c56ce64000e6ecc101bedb2786273b8fc39f6f4e261097cf8200f89936ce108" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "xca9548a" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94495e7f28d551b72b2bf5304267fbb0075d78b182b49fbfb74f8910d63fec" dependencies = [ - "embedded-hal 0.2.7", + "embedded-hal 1.0.0", ] + +[[package]] +name = "zmij" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" diff --git a/Cargo.toml b/Cargo.toml index fe5402c..ed7d23d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ resolver = "2" members = [ "daemon", "firmware", + "protocol", ] diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 8f34f13..79b7d20 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -5,14 +5,26 @@ edition = "2021" [dependencies] anyhow = "1.0.83" -axum = { version = "0.7.5", features = ["macros"] } -fern = { version = "0.6.2", features = ["colored"] } +axum = { version = "0.8.8", features = ["macros"] } +fern = { version = "0.7.1", features = ["colored"] } humantime = "2.1.0" log = "0.4.21" -nom = "7.1.3" +nom = "8.0.0" serde_json = "1.0.118" +serialport = "4.5.1" tokio = {version = "1.37.0", features = ["full"]} -tokio-macros = { version = "0.2.0-alpha.6" } -tower-http = { version = "0.5.2", features = ["fs", "trace"] } +tower-http = { version = "0.6.8", features = ["fs", "trace"] } +dfu-libusb = "0.5.5" +rusb = "0.9" +clap = { version = "4.5.19", features = ["derive"] } +indicatif = "0.18.3" +tokio-serial = {version = "5.4.4", features = ["codec", "rt"] } +tokio-util = { version = "0.7.13", features = ["codec", "rt"] } +bytes = "1.9.0" +futures = "0.3.31" +nom-language = "0.1.0" tracing = "0.1.40" tracing-subscriber = "0.3.18" +radomctl-protocol = { path = "../protocol" } +postcard = {version = "1.0.10", features = ["use-std"]} + diff --git a/daemon/src/bin/flash-dfu.rs b/daemon/src/bin/flash-dfu.rs new file mode 100644 index 0000000..16f7677 --- /dev/null +++ b/daemon/src/bin/flash-dfu.rs @@ -0,0 +1,111 @@ +use std::{ + io::{self, Seek}, + thread, + time::{self, Duration}, +}; + +use anyhow::{anyhow, Context}; +use clap::Parser; +use dfu_libusb::{Dfu, DfuLibusb}; +use postcard::to_stdvec_cobs; +use radomctl_protocol::*; + +#[derive(Parser)] +struct Cli { + /// The usb serial number of the radom-controller + #[arg(short, long)] + serialnumber: String, + + /// The firmware file to flash + #[arg(short, long)] + firmware: std::path::PathBuf, +} + +pub fn main() -> anyhow::Result<()> { + let args = Cli::parse(); + + let ports = serialport::available_ports().unwrap_or(Vec::::new()); + + let mut radom_port: Option = None; + for port in ports { + match port.port_type { + serialport::SerialPortType::UsbPort(usb_port_info) => { + match usb_port_info.serial_number { + Some(serial) => { + if serial == args.serialnumber { + radom_port = Some(port.port_name.to_owned()); + println!("Found radom-controller as {}", port.port_name) + } + } + None => continue, + } + } + _ => continue, + } + } + + let radom_port = match radom_port { + Some(port) => port, + _ => { + return Err(anyhow!("No matching port found.")); + } + }; + + println!("Setting radom-controller to dfu boot..."); + + let mut port = serialport::new(radom_port, 115_200) + .timeout(Duration::from_millis(10)) + .open() + .expect("Failed to open port"); + + let host_msg = HostMessage::TriggerDFUBootloader; + let msg_bytes = to_stdvec_cobs(&host_msg).unwrap(); + port.write_all(&msg_bytes).unwrap(); + drop(port); + + let context = rusb::Context::new()?; + let mut file = std::fs::File::open(args.firmware).context("firmware file not found")?; + + thread::sleep(time::Duration::from_millis(2000)); + + let file_size = + u32::try_from(file.seek(io::SeekFrom::End(0))?).context("the firmware file is too big")?; + file.seek(io::SeekFrom::Start(0))?; + + let vid = 0x0483; + let pid = 0xdf11; + let intf = 0; + let alt = 0; + let mut device: Dfu = + DfuLibusb::open(&context, vid, pid, intf, alt).context("could not open device")?; + + println!("Flashing radom-controller ..."); + + let bar = indicatif::ProgressBar::new(file_size as u64); + bar.set_style( + indicatif::ProgressStyle::default_bar() + .template( + "{spinner:.green} [{elapsed_precise}] [{bar}] \ + {bytes}/{total_bytes} ({bytes_per_sec}) ({eta}) {msg:10}", + )? + .progress_chars("=>-"), + ); + + device.with_progress({ + let bar = bar.clone(); + move |count| { + bar.inc(count as u64); + if bar.position() == file_size as u64 { + bar.finish(); + } + } + }); + + device + .download(file, file_size) + .context("could not write firmware to the device")?; + + println!("Done!"); + + Ok(()) +} diff --git a/daemon/src/bin/trigger-dfu.rs b/daemon/src/bin/trigger-dfu.rs new file mode 100644 index 0000000..472f081 --- /dev/null +++ b/daemon/src/bin/trigger-dfu.rs @@ -0,0 +1,16 @@ +use std::time::Duration; + +use postcard::{from_bytes_cobs, to_stdvec_cobs}; +use radomctl_protocol::*; +use radomctld::logger::setup_logger; + +pub fn main() -> () { + let mut port = serialport::new("/dev/ttyACM0", 115_200) + .timeout(Duration::from_millis(10)) + .open() + .expect("Failed to open port"); + + let host_msg = HostMessage::TriggerDFUBootloader; + let msg_bytes = to_stdvec_cobs(&host_msg).unwrap(); + port.write_all(&msg_bytes).unwrap(); +} diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs new file mode 100644 index 0000000..85f9e01 --- /dev/null +++ b/daemon/src/lib.rs @@ -0,0 +1,3 @@ +pub mod logger; +pub mod rotctlprotocol; +pub mod rotor; diff --git a/daemon/src/logger.rs b/daemon/src/logger.rs index 204e75e..f1fb34d 100644 --- a/daemon/src/logger.rs +++ b/daemon/src/logger.rs @@ -1,7 +1,5 @@ use anyhow::Result; use fern::colors::{Color, ColoredLevelConfig}; -use log::{debug, error, info, warn}; -use std::io; pub fn setup_logger() -> Result<()> { let colors = ColoredLevelConfig::new() diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 5698a6c..c4aad25 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -1,12 +1,9 @@ -mod logger; -mod rotctlprotocol; -mod rotor; - +use anyhow::anyhow; use anyhow::Result; -use fern::colors::{Color, ColoredLevelConfig}; -use log::{debug, error, info, warn, Level}; +use axum::{extract::State, routing::get, Json, Router}; +use clap::Parser; +use log::{debug, error, info}; use serde_json::{json, Value}; -use std::{borrow::Borrow, io}; use tokio::{ self, io::{AsyncBufReadExt, AsyncWriteExt, BufStream}, @@ -14,27 +11,23 @@ use tokio::{ sync::{mpsc, watch}, task::JoinSet, }; +use tokio_serial; -use axum::{ - extract::State, - http::StatusCode, - routing::{get, post}, - Json, Router, +use radomctld::{ + logger::setup_logger, + rotctlprotocol::{parse_command, Command}, + rotor::control_rotor, }; use tower_http::{ services::{ServeDir, ServeFile}, trace::TraceLayer, }; -use logger::setup_logger; -use rotor::control_rotor; - -use rotctlprotocol::{parse_command, Command}; async fn process_socket( socket: TcpStream, cmd_tx: mpsc::Sender, - mut pos_rx: watch::Receiver<(f32, f32)>, + pos_rx: watch::Receiver<(f32, f32)>, ) { let mut stream = BufStream::new(socket); @@ -89,16 +82,61 @@ struct AxumAppState { pos_rx: watch::Receiver<(f32, f32)>, } +#[derive(Parser)] +struct Cli { + /// The usb serial number of the radom-controller + #[arg(short, long)] + serialnumber: String, + + /// Listen address for the webserver + #[arg(short, long, default_value = "0.0.0.0:8000")] + web_listen_address: String, + + /// Listen address for rotctl + #[arg(short, long, default_value = "0.0.0.0:1337")] + rotctl_listen_address: String, +} + #[tokio::main] async fn main() -> Result<()> { setup_logger()?; + let args = Cli::parse(); + + let ports = tokio_serial::available_ports().unwrap_or(Vec::::new()); + + let mut radom_port: Option = None; + for port in ports { + match port.port_type { + serialport::SerialPortType::UsbPort(usb_port_info) => { + match usb_port_info.serial_number { + Some(serial) => { + debug!("Found a serial port with: {}", serial); + if serial == args.serialnumber { + radom_port = Some(port.port_name.to_owned()); + info!("Found radom-controller as {}", port.port_name) + } + } + None => continue, + } + } + _ => continue, + } + } + + let radom_port = match radom_port { + Some(port) => port, + _ => { + return Err(anyhow!("No matching port found.")); + } + }; + let (cmd_tx, cmd_rx) = mpsc::channel::(16); let (pos_tx, pos_rx) = watch::channel::<(f32, f32)>((0.0, 0.0)); let mut tasks = JoinSet::new(); - tasks.spawn(async move { control_rotor(cmd_rx, pos_tx).await }); + tasks.spawn(async move { control_rotor(cmd_rx, pos_tx, radom_port).await }); let state = AxumAppState { pos_rx: pos_rx.clone(), @@ -111,14 +149,14 @@ async fn main() -> Result<()> { .with_state(state) .layer(TraceLayer::new_for_http()); - let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await?; + let listener = tokio::net::TcpListener::bind(args.web_listen_address).await?; axum::serve(listener, app).await?; Ok(()) }); tasks.spawn(async move { - let listener = TcpListener::bind("127.0.0.1:1337").await?; + let listener = TcpListener::bind(args.rotctl_listen_address).await?; loop { let (socket, _) = listener.accept().await?; diff --git a/daemon/src/rotctlprotocol.rs b/daemon/src/rotctlprotocol.rs index fc70ab3..c788810 100644 --- a/daemon/src/rotctlprotocol.rs +++ b/daemon/src/rotctlprotocol.rs @@ -4,13 +4,14 @@ use nom::{ character::complete::{ alphanumeric1, i8, multispace0, multispace1, newline, none_of, not_line_ending, space1, }, - combinator::{all_consuming, map, opt, recognize, rest}, - error::{context, convert_error, VerboseError}, - multi::{many0, many1}, + combinator::{all_consuming, map, opt, recognize}, + error::context, + multi::many1, number::complete::float, sequence::{preceded, separated_pair, terminated}, Err as NomErr, IResult, Parser, }; +use nom_language::error::{convert_error, VerboseError}; #[derive(PartialEq, Debug)] pub enum Command { diff --git a/daemon/src/rotor.rs b/daemon/src/rotor.rs index 3c9b769..f5eb29b 100644 --- a/daemon/src/rotor.rs +++ b/daemon/src/rotor.rs @@ -1,52 +1,91 @@ use anyhow::Result; -use log::{debug, error, info, warn}; +use bytes::{BufMut, BytesMut}; +use futures::{stream::StreamExt, SinkExt}; +use postcard::{from_bytes_cobs, to_stdvec_cobs}; +use radomctl_protocol::{HostMessage, PositionTarget, RadomMessage}; +use std::{io, time::Duration}; use tokio::{ self, - io::{AsyncBufReadExt, AsyncWriteExt, BufStream}, - net::{TcpListener, TcpStream}, - sync::{self, mpsc, watch}, + io::AsyncBufReadExt, + sync::{mpsc, watch}, time, }; +use tokio_serial::SerialPortBuilderExt; +use tokio_util::codec::{Decoder, Encoder}; -use crate::rotctlprotocol::{parse_command, Command}; +use crate::rotctlprotocol::Command; + +struct ProtocolCodec; + +impl Decoder for ProtocolCodec { + type Item = RadomMessage; + type Error = io::Error; + + fn decode(&mut self, src: &mut BytesMut) -> Result, Self::Error> { + let frame_end = src.as_ref().iter().position(|b| *b == 0); + if let Some(n) = frame_end { + let mut frame = src.split_to(n + 1); + let host_msg = from_bytes_cobs::(&mut frame).unwrap(); + return Ok(Some(host_msg)); + } + Ok(None) + } +} + +impl Encoder for ProtocolCodec { + type Error = io::Error; + + fn encode(&mut self, item: HostMessage, dst: &mut BytesMut) -> Result<(), Self::Error> { + let msg_bytes = to_stdvec_cobs(&item).unwrap(); + dst.put(msg_bytes.as_slice()); + dst.put_u8(0); + Ok(()) + } +} pub async fn control_rotor( mut rx_cmd: mpsc::Receiver, pos_tx: watch::Sender<(f32, f32)>, + radom_port: String, ) -> Result<()> { - let mut actual_az = 0.0; - let mut actual_el = 0.0; + let port = tokio_serial::new(radom_port, 115_200) + .timeout(Duration::from_millis(10)) + .open_native_async() + .expect("Failed to open port"); - let mut target_az = 0.0; - let mut target_el = 0.0; + let (mut port_writer, mut port_reader) = ProtocolCodec.framed(port).split(); loop { tokio::select! { Some(command) = rx_cmd.recv() => { match command { Command::SetPos(az, el) => { - info!("Received set pos {} {}", az, el); - target_az = az; - target_el = el; + //info!("Received set pos {} {}", az, el); + port_writer.send(HostMessage::SetTarget(PositionTarget { az, el })).await?; } _ => {} } }, + _ = time::sleep(time::Duration::from_millis(100)) => { - if target_az < actual_az { - actual_az -= 1.0; - } else if target_az > actual_az { - actual_az += 1.0; - } - - if target_el < actual_el { - actual_el -= 1.0; - } else if target_el > actual_el { - actual_el += 1.0; - } - - pos_tx.send((actual_az, actual_el)).unwrap(); + //info!("Requesting status"); + port_writer.send(HostMessage::RequestStatus).await?; }, + + msg = port_reader.next() => { + match msg { + Some(Ok(msg)) => { + match msg { + RadomMessage::Status(status) => { + //info!("Received status {:?}", status); + pos_tx.send((status.position.az, status.position.el)).unwrap(); + } + _ => {} + } + } + _ => {} + } + } else => return Ok(()) }; } diff --git a/firmware/.cargo/config.toml b/firmware/.cargo/config.toml index d190172..c543591 100644 --- a/firmware/.cargo/config.toml +++ b/firmware/.cargo/config.toml @@ -1,6 +1,6 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] # TODO(2) replace `$CHIP` with your chip's name (see `probe-run --list-chips` output) -runner = "probe-run --chip STM32F401CCU6" +runner = "probe-rs run --chip STM32F401CCUx" rustflags = [ "-C", "linker=flip-link", "-C", "link-arg=-Tlink.x", @@ -18,4 +18,45 @@ rb = "run --bin" rrb = "run --release --bin" [env] -DEFMT_LOG = "debug" \ No newline at end of file +DEFMT_LOG = "debug" + + + +# cargo build/run +[profile.dev] +codegen-units = 1 +debug = 2 +debug-assertions = true # <- +incremental = false +opt-level = 'z' # <- +overflow-checks = true # <- + +# cargo test +[profile.test] +codegen-units = 1 +debug = 2 +debug-assertions = true # <- +incremental = false +opt-level = 3 # <- +overflow-checks = true # <- + +# cargo build/run --release +[profile.release] +codegen-units = 1 +debug = 2 +debug-assertions = false # <- +incremental = false +lto = 'fat' +opt-level = 3 # <- +overflow-checks = false # <- + +# cargo test --release +[profile.bench] +codegen-units = 1 +debug = 2 +debug-assertions = false # <- +incremental = false +lto = 'fat' +opt-level = 3 # <- +overflow-checks = false # <- + diff --git a/firmware/Cargo.toml b/firmware/Cargo.toml index ff5f101..06b0e1b 100644 --- a/firmware/Cargo.toml +++ b/firmware/Cargo.toml @@ -5,21 +5,27 @@ version = "0.1.0" [dependencies] cortex-m = { version = "0.7", features = ["critical-section-single-core"] } -defmt = { version = "0.3", features = ["encoding-rzcobs"] } +defmt = { version = "1.0", features = ["encoding-rzcobs"] } defmt-brtt = { version = "0.1", default-features = false, features = ["rtt"] } -panic-probe = { version = "0.3", features = ["print-defmt"] } +panic-probe = { version = "1.0", features = ["print-defmt"] } rtic = { version = "2.0.1", features = [ "thumbv7-backend" ] } -defmt-rtt = "0.4" -stm32f4xx-hal = { version = "0.21.0", features = ["stm32f401"] } +defmt-rtt = "1.1" +stm32f4xx-hal = { version = "0.23.0", features = ["stm32f401", "usb_fs"] } embedded-hal = {version = "1.0.0"} nb = "1.0.0" num-traits = { version = "0.2", default-features = false, features = ["libm"] } num = {version = "0.4", default-features = false} ufmt = "0.2.0" -qmc5883l = "0.0.1" +qmc5883l = {version = "0.0.1", git="https://github.com/patrickelectric/qmc5883l", rev="62b8a64b54e0f843ddf0c5942f8ed218b5f3e492"} rtic-monotonics = {version = "2.0.2", features = ["cortex-m-systick"]} -xca9548a = "0.2.1" +xca9548a = "1.0.0" as5048a = { git = "https://github.com/LongHairedHacker/as5048a", rev="b15d716bf47ce4975a6cefebf82006c9b09e8fea"} +usb-device = "0.3.2" +usbd-serial = "0.2.2" +postcard = {version = "1.0.10", features = ["use-defmt"]} +heapless = {version = "0.9.2", features = ["defmt"]} +radomctl-protocol = { path = "../protocol" } + [features] # set logging levels here @@ -32,50 +38,3 @@ defmt-debug = [] defmt-info = [] defmt-warn = [] defmt-error = [] - -# cargo build/run -[profile.dev] -codegen-units = 1 -debug = 2 -debug-assertions = true # <- -incremental = false -opt-level = 'z' # <- -overflow-checks = true # <- - -# cargo test -[profile.test] -codegen-units = 1 -debug = 2 -debug-assertions = true # <- -incremental = false -opt-level = 3 # <- -overflow-checks = true # <- - -# cargo build/run --release -[profile.release] -codegen-units = 1 -debug = 2 -debug-assertions = false # <- -incremental = false -lto = 'fat' -opt-level = 3 # <- -overflow-checks = false # <- - -# cargo test --release -[profile.bench] -codegen-units = 1 -debug = 2 -debug-assertions = false # <- -incremental = false -lto = 'fat' -opt-level = 3 # <- -overflow-checks = false # <- - - -# uncomment this to switch from the crates.io version of defmt to its git version -# check app-template's README for instructions -# [patch.crates-io] -# defmt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version supported by probe-rs (see changelog)" } -# defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version supported by probe-rs (see changelog)" } -# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version supported by probe-rs (see changelog)" } -# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version supported by probe-rs (see changelog)" } diff --git a/firmware/flash-dfu.sh b/firmware/flash-dfu.sh new file mode 100755 index 0000000..9f1f583 --- /dev/null +++ b/firmware/flash-dfu.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cargo build --release && \ +arm-none-eabi-objcopy -O binary ../target/thumbv7em-none-eabihf/release/radomctl-firmware radomctl-firmware.bin && \ +dfu-util --alt 0 -s 0x08000000:leave -D radomctl-firmware.bin \ No newline at end of file diff --git a/firmware/src/bootloader.rs b/firmware/src/bootloader.rs new file mode 100644 index 0000000..0c87fe3 --- /dev/null +++ b/firmware/src/bootloader.rs @@ -0,0 +1,60 @@ +use core::mem::MaybeUninit; +use core::ptr::addr_of_mut; +use stm32f4xx_hal::pac; + +fn jump_to_bootloader() { + unsafe { + cortex_m::interrupt::disable(); + + let address: u32 = 0x1FFF0000; + + let device = pac::Peripherals::steal(); + device.SYSCFG.memrmp().modify(|_, w| w.bits(0x01)); + + let mut p = cortex_m::Peripherals::steal(); + p.SCB.invalidate_icache(); + p.SCB.vtor.write(address as u32); + + cortex_m::interrupt::enable(); + + cortex_m::asm::bootload(address as *const u32); + } +} + +const BOOTLOADER_REQUESTED: u32 = 0xdecafbad; + +fn magic_mut_ptr() -> *mut u32 { + extern "C" { + #[link_name = "_dfu_magic"] + static mut magic: u32; + } + + unsafe { addr_of_mut!(magic) } +} + +fn get_bootloader_flag() -> u32 { + unsafe { magic_mut_ptr().read_volatile() } +} + +fn set_bootloader_flag() { + unsafe { magic_mut_ptr().write_volatile(BOOTLOADER_REQUESTED) }; +} + +fn clear_bootloader_flag() { + unsafe { magic_mut_ptr().write_volatile(BOOTLOADER_REQUESTED) }; +} + +pub fn init() { + let requested = get_bootloader_flag() == BOOTLOADER_REQUESTED; + if requested { + jump_to_bootloader(); + } + + clear_bootloader_flag(); +} + +pub fn reboot_to_bootloader() -> ! { + defmt::info!("Rebooting into the bootloader"); + set_bootloader_flag(); + cortex_m::peripheral::SCB::sys_reset(); +} diff --git a/firmware/src/main.rs b/firmware/src/main.rs index ac5a199..a651168 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -6,6 +6,8 @@ use defmt_brtt as _; // global logger use panic_probe as _; use stm32f4xx_hal as _; +mod bootloader; + // same panicking *behavior* as `panic-probe` but doesn't print a panic message // this prevents the panic message being printed *twice* when `defmt::panic` is invoked #[defmt::panic_handler] @@ -13,39 +15,50 @@ fn panic() -> ! { cortex_m::asm::udf() } - #[rtic::app( device = stm32f4xx_hal::pac, dispatchers = [SPI3] )] mod app { - - use as5048a::AS5048A; - + + use crate::bootloader; + use core::fmt::Write; + use heapless::{String, Vec}; + use num_traits::{Float, FloatConst}; + use postcard::{from_bytes_cobs, to_vec_cobs}; + use qmc5883l::{self, QMC5883L}; + use radomctl_protocol::*; + use radomctl_protocol::{HostMessage, *}; + use rtic_monotonics::systick::prelude::*; use stm32f4xx_hal::{ gpio::{gpioa, gpiob, gpioc, Output, PushPull}, i2c, + otg_fs::{UsbBus, UsbBusType, USB}, pac::{I2C1, SPI1}, prelude::*, - spi, + rcc::Config, + signature, spi, }; - - use num_traits::{Float, FloatConst}; - + use usb_device::prelude::*; + use usb_device::{class_prelude::UsbBusAllocator, device}; + use usbd_serial::SerialPort; use xca9548a::{SlaveAddr, Xca9548a}; - use qmc5883l::{self, QMC5883L}; - - use rtic_monotonics::systick::prelude::*; - systick_monotonic!(Mono, 1000); + const USB_BUFFER_SIZE: usize = 64; + // Shared resources go here #[shared] struct Shared { az_angle: i32, + az_compass: i32, + az_target: i32, + + el_angle: i32, + el_target: i32, } // Local resources go here @@ -60,46 +73,80 @@ mod app { spi_cs3: gpiob::PB15>, spi1: spi::Spi, - az_enable: gpioa::PA12>, + az_enable: gpiob::PB8>, az_dir: gpioa::PA15>, az_step: gpiob::PB3>, el_enable: gpiob::PB4>, el_dir: gpioa::PA8>, el_step: gpioa::PA9>, + + usb_dev: UsbDevice<'static, UsbBusType>, + usb_serial: SerialPort<'static, UsbBusType>, + usb_buffer: Vec, } #[init] fn init(cx: init::Context) -> (Shared, Local) { + bootloader::init(); + defmt::info!("init"); + let mut rcc = cx + .device + .RCC + .freeze(Config::hse(25.MHz()).sysclk(84.MHz()).require_pll48clk()); - let rcc = cx.device.RCC.constrain(); - - // Freeze the configuration of all the clocks in the system and store the frozen frequencies in - // `clocks` - let clocks = rcc - .cfgr - .use_hse(25.MHz()) - .require_pll48clk() - .sysclk(84.MHz()) - .hclk(84.MHz()) - .pclk1(42.MHz()) - .pclk2(84.MHz()) - .freeze(); - - Mono::start(cx.core.SYST, clocks.sysclk().to_Hz()); - - defmt::info!("Clock Setup done"); + Mono::start(cx.core.SYST, rcc.clocks.sysclk().to_Hz()); defmt::info!("Clock Setup done"); // Acquire the GPIO peripherials - let gpioa = cx.device.GPIOA.split(); - let gpiob = cx.device.GPIOB.split(); - let gpioc = cx.device.GPIOC.split(); + let gpioa = cx.device.GPIOA.split(&mut rcc); + let gpiob = cx.device.GPIOB.split(&mut rcc); + let gpioc = cx.device.GPIOC.split(&mut rcc); let board_led = gpioc.pc13.into_push_pull_output(); + defmt::info!("Basic gpio setup done"); + + static mut EP_MEMORY: [u32; 1024] = [0; 1024]; + static mut USB_BUS: Option> = None; + + let usb = USB::new( + ( + cx.device.OTG_FS_GLOBAL, + cx.device.OTG_FS_DEVICE, + cx.device.OTG_FS_PWRCLK, + ), + (gpioa.pa11, gpioa.pa12), + &rcc.clocks, + ); + + unsafe { + USB_BUS.replace(UsbBus::new(usb, &mut EP_MEMORY)); + } + + let usb_serial = usbd_serial::SerialPort::new(unsafe { USB_BUS.as_ref().unwrap() }); + + let uid = signature::Uid::get(); + + static mut SERIAL: String<16> = String::new(); + unsafe { + write!(SERIAL, "{}{:x}{:x}", uid.lot_num(), uid.x(), uid.y()).unwrap(); + } + + let usb_dev = unsafe { + UsbDeviceBuilder::new(USB_BUS.as_ref().unwrap(), UsbVidPid(0x16c0, 0x27dd)) + .device_class(usbd_serial::USB_CLASS_CDC) + .strings(&[StringDescriptors::default() + .manufacturer("Amteurfunk Forschungs Gruppe") + .product("Radom Controler") + .serial_number(SERIAL.as_ref())]) + .unwrap() + .build() + }; + defmt::info!("USB Setup done"); + // Todo: Check if internal pullups work here let scl = gpiob.pb6.into_alternate_open_drain(); let sda = gpiob.pb7.into_alternate_open_drain(); @@ -109,13 +156,13 @@ mod app { i2c::Mode::Standard { frequency: 400.kHz(), }, - &clocks, + &mut rcc, ); defmt::info!("I2C Setup done"); let mut i2cmux = Xca9548a::new(i2c, SlaveAddr::default()); - i2cmux.select_channels(0b0000_0001).unwrap(); + //i2cmux.select_channels(0b0000_0001).unwrap(); defmt::info!("I2C MUX Setup done"); @@ -133,22 +180,24 @@ mod app { let pico = gpioa.pa7.into_push_pull_output(); let spi1 = spi::Spi::new( cx.device.SPI1, - (sck, poci, pico), + (Some(sck), Some(poci), Some(pico)), spi::Mode { polarity: spi::Polarity::IdleLow, - phase: spi::Phase::CaptureOnFirstTransition, + phase: spi::Phase::CaptureOnSecondTransition, }, 8.MHz(), - &clocks, + &mut rcc, ); defmt::info!("SPI Setup done"); - let az_enable = gpioa.pa12.into_push_pull_output(); + let mut az_enable = gpiob.pb8.into_push_pull_output(); + az_enable.set_high(); let az_dir = gpioa.pa15.into_push_pull_output(); let az_step = gpiob.pb3.into_push_pull_output(); - let el_enable = gpiob.pb4.into_push_pull_output(); + let mut el_enable = gpiob.pb4.into_push_pull_output(); + el_enable.set_high(); let el_dir = gpioa.pa8.into_push_pull_output(); let el_step = gpioa.pa9.into_push_pull_output(); @@ -156,9 +205,17 @@ mod app { poll_i2c::spawn().ok(); poll_spi::spawn().ok(); + move_az::spawn().ok(); + move_el::spawn().ok(); ( - Shared { az_angle: 0 }, + Shared { + az_angle: 0, + az_target: 0, + el_angle: 0, + el_target: 0, + az_compass: 0, + }, Local { i2cmux, board_led, @@ -175,12 +232,16 @@ mod app { el_enable, el_dir, el_step, + + usb_dev, + usb_serial, + usb_buffer: Vec::new(), }, ) } - #[task(local = [i2cmux, board_led])] - async fn poll_i2c(cx: poll_i2c::Context) { + #[task(local = [i2cmux, board_led], shared = [az_compass])] + async fn poll_i2c(mut cx: poll_i2c::Context) { let i2cmux = cx.local.i2cmux; let board_led = cx.local.board_led; @@ -212,6 +273,11 @@ mod app { heading -= 2.0 * f32::PI(); } let heading_degrees = heading * 180.0 / f32::PI(); + + cx.shared.az_compass.lock(|az_compass| { + *az_compass = heading_degrees as i32 * 10; + }); + defmt::info!("Heading1 {}", heading_degrees); break; } @@ -253,16 +319,18 @@ mod app { } } - #[task(local = [spi1, encoder_az, encoder_el, spi_cs2, spi_cs3], shared = [az_angle])] + #[task(local = [spi1, encoder_az, encoder_el, spi_cs2, spi_cs3], shared = [az_angle, el_angle])] async fn poll_spi(mut cx: poll_spi::Context) { let spi1 = cx.local.spi1; let encoder_az = cx.local.encoder_az; + let encoder_el = cx.local.encoder_el; loop { + /* let (diag, gain) = encoder_az.diag_gain(spi1).unwrap(); defmt::info!("diag: {:08b} gain: {}", diag, gain); defmt::info!("magnitude: {:?}", encoder_az.magnitude(spi1).unwrap()); - + */ let raw_angle = encoder_az.angle(spi1).unwrap(); let angle_deg = raw_angle as i32 * 3600 / 16384; @@ -270,39 +338,173 @@ mod app { *az_angle = angle_deg; }); - defmt::info!("angle: {:?}", angle_deg); + defmt::info!("az angle: {:?}", angle_deg); - Mono::delay(50.millis()).await; + let raw_angle = encoder_el.angle(spi1).unwrap(); + let angle_deg = raw_angle as i32 * 3600 / 16384; + + cx.shared.el_angle.lock(|el_angle| { + *el_angle = angle_deg; + }); + + defmt::info!("el angle: {:?}", angle_deg); + + Mono::delay(1.millis()).await; } } - #[task(local = [az_enable, az_dir, az_step], shared = [az_angle])] + #[task(local = [az_enable, az_dir, az_step], shared = [az_angle, az_target])] async fn move_az(mut cx: move_az::Context) { let az_enable = cx.local.az_enable; let az_dir = cx.local.az_dir; let az_step = cx.local.az_step; - let az_target = 42i32; - loop { + let az_target = cx.shared.az_target.lock(|az_target| *az_target); let az_angle = cx.shared.az_angle.lock(|az_angle| *az_angle); let diff = az_angle - az_target; - if diff.abs() > 2 { - az_enable.set_high(); - if diff > 0 { + defmt::info!( + "angle diff/target/actual: {:?}/{:?}/{:?}", + diff, + az_target, + az_angle + ); + + let delay = if diff.abs() < 10 { + 10.millis() + } else if diff < 100 { + 5.millis() + } else { + 1.millis() + }; + + if diff.abs() > 50 { + az_enable.set_low(); + if diff < 0 { az_dir.set_high(); } else { az_dir.set_low(); } - az_step.set_high(); - Mono::delay(250.micros()).await; az_step.set_low(); - Mono::delay(250.micros()).await; + Mono::delay(delay / 2).await; + az_step.set_high(); + Mono::delay(delay / 2).await; } else { - az_enable.set_low(); - Mono::delay(500.micros()).await; + az_enable.set_high(); + Mono::delay(delay).await; + } + } + } + + #[task(local = [el_enable, el_dir, el_step], shared = [el_angle, el_target])] + async fn move_el(mut cx: move_el::Context) { + let el_enable = cx.local.el_enable; + let el_dir = cx.local.el_dir; + let el_step = cx.local.el_step; + + loop { + let el_target = cx.shared.el_target.lock(|el_target| *el_target); + let el_angle = cx.shared.el_angle.lock(|el_angle| *el_angle); + let diff = el_angle - el_target; + + defmt::info!( + "angle diff/target/actual: {:?}/{:?}/{:?}", + diff, + el_target, + el_angle + ); + + let delay = if diff.abs() < 10 { + 10.millis() + } else if diff < 100 { + 5.millis() + } else { + 1.millis() + }; + + if diff.abs() > 50 { + el_enable.set_low(); + if diff < 0 { + el_dir.set_high(); + } else { + el_dir.set_low(); + } + + el_step.set_low(); + Mono::delay(delay / 2).await; + el_step.set_high(); + Mono::delay(delay / 2).await; + } else { + el_enable.set_high(); + Mono::delay(delay).await; + } + } + } + + #[task(binds=OTG_FS, local=[usb_dev, usb_serial, usb_buffer], shared=[az_target, el_target, az_angle, el_angle])] + fn usb_fs(mut cx: usb_fs::Context) { + let usb_dev = cx.local.usb_dev; + let serial = cx.local.usb_serial; + let buffer = cx.local.usb_buffer; + + if !usb_dev.poll(&mut [serial]) { + return; + } + + let mut tmp = [0u8; 16]; + match serial.read(&mut tmp) { + Ok(count) if count > 0 => { + if buffer.extend_from_slice(&tmp[0..count]).is_err() { + buffer.clear(); + defmt::error!("Buffer overflow while waiting for the end of the packet"); + } + } + _ => {} + } + + loop { + if let Some(idx) = buffer.iter().position(|&x| x == 0) { + let (msg, rest) = buffer.split_at(idx + 1); + + let mut message = [0u8; 128]; + message[0..msg.len()].clone_from_slice(msg); + let host_msg = from_bytes_cobs::(&mut message); + + match host_msg { + Ok(host_msg) => match host_msg { + HostMessage::RequestStatus => { + let status = StatusMessage { + position: Position { + az: cx.shared.az_angle.lock(|az| (*az / 10) as f32), + el: cx.shared.el_angle.lock(|el| (*el / 10) as f32), + az_endcoder: 0.0, + el_encoder: 0.0, + az_magnetic: 0.0, + el_magnetic: 0.0, + }, + alarms: Vec::new(), + }; + let device_msg = RadomMessage::Status(status); + let bytes = + to_vec_cobs::(&device_msg).unwrap(); + serial.write(bytes.as_slice()).unwrap(); + } + HostMessage::SetTarget(pos) => { + cx.shared.az_target.lock(|az| *az = (pos.az * 10.0) as i32); + cx.shared.el_target.lock(|el| *el = (pos.el * 10.0) as i32); + } + HostMessage::TriggerDFUBootloader => { + bootloader::reboot_to_bootloader(); + } + }, + Err(err) => defmt::error!("Unable to parse host message"), + }; + + *buffer = Vec::::from_slice(rest).unwrap(); + } else { + break; } } } diff --git a/memory.x b/memory.x index dfe3ff3..33fd2a3 100644 --- a/memory.x +++ b/memory.x @@ -1,10 +1,23 @@ MEMORY { - /* NOTE K = KiBi = 1024 bytes */ FLASH : ORIGIN = 0x08000000, LENGTH = 256K - RAM : ORIGIN = 0x20000000, LENGTH = 64K + UNINIT : ORIGIN = 0x20000000, LENGTH = 0x10 + RAM : ORIGIN = 0x20000010, LENGTH = 64K - LENGTH(UNINIT) } +SECTIONS { + .uninit_flags (NOLOAD) : ALIGN(4) + { + . = ALIGN(4); + __suninit_flags = .; + _dfu_magic = .; . += 4; + *(.uninit_flags .uninit_flags.*) + . = ALIGN(4); + __euninit_flags = .; + } > UNINIT +} + + /* This is where the call stack will be allocated. */ /* The stack is of the full descending type. */ /* NOTE Do NOT modify `_stack_start` unless you know what you are doing */ diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml new file mode 100644 index 0000000..26161a1 --- /dev/null +++ b/protocol/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "radomctl-protocol" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde = {version = "1.0.193", default-features = false, features = ["derive"]} +heapless = {version = "0.9.2", features = ["serde"]} diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs new file mode 100644 index 0000000..1da7752 --- /dev/null +++ b/protocol/src/lib.rs @@ -0,0 +1,44 @@ +#![no_std] +use heapless::Vec; + +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum RadomMessage { + Status(StatusMessage), +} + +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub enum HostMessage { + RequestStatus, + SetTarget(PositionTarget), + TriggerDFUBootloader, +} + +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +pub struct StatusMessage { + pub position: Position, + pub alarms: Vec, +} + +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +pub struct Position { + pub az: f32, + pub el: f32, + pub az_endcoder: f32, + pub el_encoder: f32, + pub az_magnetic: f32, + pub el_magnetic: f32, +} + +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] +pub enum Alarm { + AZEncoderFault, + ELEncoderFault, +} + +#[derive(Serialize, Deserialize, Debug, PartialEq)] +pub struct PositionTarget { + pub az: f32, + pub el: f32, +}