From ccd5bdf4da3ea5ba5123952a7bcfecf6ed0953d0 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Mon, 19 Aug 2024 13:57:13 +0200 Subject: [PATCH 01/95] build(deps): bump embassy, esp-hal, rtt-target, bare-metal --- Cargo.lock | 801 +++++++++++++--------- Cargo.toml | 50 +- examples/blinky/src/main.rs | 1 + examples/coap/src/main.rs | 1 + examples/embassy-http-server/src/main.rs | 1 + examples/embassy-net-tcp/src/main.rs | 1 + examples/embassy-net-udp/src/main.rs | 1 + examples/embassy-usb-keyboard/Cargo.toml | 2 +- examples/embassy-usb-keyboard/src/main.rs | 1 + examples/embassy/src/main.rs | 1 + examples/gpio/src/main.rs | 1 + examples/hello-world-async/src/main.rs | 1 + examples/log/src/main.rs | 1 + examples/usb-serial/src/main.rs | 1 + src/riot-rs-chips/stm32f4xx/Cargo.toml | 6 +- src/riot-rs-embassy/Cargo.toml | 9 +- src/riot-rs-embassy/src/arch/esp/mod.rs | 7 +- src/riot-rs-embassy/src/lib.rs | 2 +- src/riot-rs-macros/Cargo.toml | 2 +- src/riot-rs-rt/Cargo.toml | 2 +- tests/gpio-interrupt-nrf/src/main.rs | 1 + tests/gpio-interrupt-stm32/src/main.rs | 1 + tests/gpio/src/main.rs | 1 + 23 files changed, 546 insertions(+), 349 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6341c55f6..b688e5f8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,6 +78,55 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483" +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.86" @@ -86,9 +135,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii-canvas" @@ -197,7 +246,7 @@ dependencies = [ "clang-sys", "lazy_static", "lazycell", - "log 0.4.21", + "log 0.4.22", "peeking_take_while", "proc-macro2", "quote", @@ -255,9 +304,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blinky" @@ -280,9 +329,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" [[package]] name = "byteorder" @@ -290,22 +339,16 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - [[package]] name = "cbindgen" version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" dependencies = [ - "clap", + "clap 3.2.25", "heck 0.4.1", "indexmap 1.9.3", - "log 0.4.21", + "log 0.4.22", "proc-macro2", "quote", "serde", @@ -317,9 +360,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.100" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +dependencies = [ + "shlex", +] [[package]] name = "ccm" @@ -372,15 +418,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "num-traits", -] - [[package]] name = "ciborium-io" version = "0.2.2" @@ -417,13 +454,47 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags 1.3.2", - "clap_lex", + "clap_lex 0.2.4", "indexmap 1.9.3", "strsim 0.10.0", "termcolor", "textwrap", ] +[[package]] +name = "clap" +version = "4.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.7.2", + "strsim 0.11.1", +] + +[[package]] +name = "clap_derive" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -433,6 +504,12 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + [[package]] name = "clist" version = "0.1.1" @@ -527,9 +604,9 @@ dependencies = [ [[package]] name = "coap-message-implementations" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7f9fd99aceb4846110ce9ca6f1bf35ad36af9664c54e5249ff8c37ef3f4f71" +checksum = "3042f71e9b8079d8db92a8383dcad6e584451878d307cdbbc4f8595e07bd0a4b" dependencies = [ "coap-message", "coap-message-utils", @@ -620,6 +697,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "const-oid" version = "0.9.6" @@ -703,9 +786,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -794,8 +877,8 @@ dependencies = [ [[package]] name = "cyw43" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "cortex-m", "cortex-m-rt", @@ -811,8 +894,8 @@ dependencies = [ [[package]] name = "cyw43-pio" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "cyw43", "embassy-rp", @@ -823,9 +906,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -833,27 +916,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] name = "darling_macro" -version = "0.20.9" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -888,7 +971,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -908,7 +991,7 @@ dependencies = [ "cortex-m", "critical-section", "defmt", - "rtt-target 0.5.0", + "rtt-target", ] [[package]] @@ -919,7 +1002,7 @@ checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -933,14 +1016,12 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.18" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", + "powerfmt", ] [[package]] @@ -983,9 +1064,9 @@ dependencies = [ [[package]] name = "document-features" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" dependencies = [ "litrs", ] @@ -1003,9 +1084,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -1039,13 +1120,13 @@ dependencies = [ [[package]] name = "embassy-embedded-hal" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d" +checksum = "5794414bc20e0d750f145bc0e82366b19dd078e9e075e8331fb8dd069a1cb6a2" dependencies = [ "defmt", "embassy-futures", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-time", "embedded-hal 0.2.7", "embedded-hal 1.0.0", @@ -1057,8 +1138,8 @@ dependencies = [ [[package]] name = "embassy-executor" -version = "0.5.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.6.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "cortex-m", "critical-section", @@ -1070,14 +1151,14 @@ dependencies = [ [[package]] name = "embassy-executor-macros" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad454accf80050e9cf7a51e994132ba0e56286b31f9317b68703897c328c59b5" +checksum = "d4d4c0c34b32c2c653c9eecce1cefaf8539dd9a54e61deb5499254f01e2fcac2" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -1091,8 +1172,8 @@ dependencies = [ [[package]] name = "embassy-hal-internal" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "cortex-m", "critical-section", @@ -1122,7 +1203,7 @@ dependencies = [ [[package]] name = "embassy-net" version = "0.4.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "defmt", "document-features", @@ -1139,15 +1220,15 @@ dependencies = [ [[package]] name = "embassy-net-driver" version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "defmt", ] [[package]] name = "embassy-net-driver-channel" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.3.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "embassy-futures", "embassy-net-driver", @@ -1182,10 +1263,10 @@ dependencies = [ [[package]] name = "embassy-nrf" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", @@ -1216,14 +1297,15 @@ dependencies = [ "nrf52840-pac", "nrf5340-app-pac", "nrf5340-net-pac", + "nrf9120-pac", "nrf9160-pac", "rand_core", ] [[package]] name = "embassy-rp" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "atomic-polyfill", "cfg-if", @@ -1254,15 +1336,16 @@ dependencies = [ "rand_core", "rp-pac", "rp2040-boot2", + "sha2-const-stable", ] [[package]] name = "embassy-stm32" version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "bit_field", - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "cortex-m", "cortex-m-rt", @@ -1328,7 +1411,7 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "cfg-if", "critical-section", @@ -1340,9 +1423,9 @@ dependencies = [ [[package]] name = "embassy-time" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "274c019608a9004aed3cafc871e2a3c87ce9351d537dcaab4cc5db184d4a04b1" +checksum = "158080d48f824fad101d7b2fae2d83ac39e3f7a6fa01811034f7ab8ffc6e7309" dependencies = [ "cfg-if", "critical-section", @@ -1360,7 +1443,7 @@ dependencies = [ [[package]] name = "embassy-time-driver" version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "document-features", ] @@ -1368,18 +1451,18 @@ dependencies = [ [[package]] name = "embassy-time-queue-driver" version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" [[package]] name = "embassy-usb" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1587e58ed8f7e0215246e6bb8d7ef4837db682e209e5ef7410a81c500dc949e5" +checksum = "8d0b882133fa684b9d4652351cd7aac5afe8a2c2bf4a7da59f442ff61087cda2" dependencies = [ "defmt", "embassy-futures", "embassy-net-driver-channel", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-usb-driver", "heapless 0.8.0", "ssmarshal", @@ -1389,7 +1472,7 @@ dependencies = [ [[package]] name = "embassy-usb-driver" version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" dependencies = [ "defmt", ] @@ -1429,15 +1512,6 @@ dependencies = [ "nb 1.1.0", ] -[[package]] -name = "embedded-dma" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c8c02e4347a0267ca60813c952017f4c5948c232474c6010a381a337f1bda4" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "embedded-dma" version = "0.2.0" @@ -1533,9 +1607,9 @@ dependencies = [ [[package]] name = "embedded-nal-coap" -version = "0.1.0-alpha.2" +version = "0.1.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1954b4c5d15dd2db0267ae813883dc679ba9e135d3c16c335e13af0b7d5335e2" +checksum = "4e9b7bb02659ab86bce6bc58d586535b161887b5d8f44619439da9269c2f21db" dependencies = [ "coap-handler", "coap-message", @@ -1570,7 +1644,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" dependencies = [ - "log 0.4.21", + "log 0.4.22", ] [[package]] @@ -1593,9 +1667,9 @@ dependencies = [ [[package]] name = "enum-iterator" -version = "1.5.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" +checksum = "c280b9e6b3ae19e152d8e31cf47f18389781e119d4013a2a2bb0180e5facc635" dependencies = [ "enum-iterator-derive", ] @@ -1608,28 +1682,48 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", +] + +[[package]] +name = "enumflags2" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] name = "enumset" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +checksum = "d07a4b049558765cef5f0c1a273c3fc57084d768b44d2f98127aef4cceb17293" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -1645,27 +1739,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "esp-build" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94a4b8d74e7cc7baabcca5b2277b41877e039ad9cd49959d48ef94dac7eab4b" +dependencies = [ + "quote", + "syn 2.0.75", + "termcolor", ] [[package]] name = "esp-build" version = "0.1.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.75", "termcolor", ] [[package]] name = "esp-hal" -version = "0.18.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.19.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "basic-toml", "bitfield 0.15.0", - "bitflags 2.5.0", + "bitflags 2.6.0", + "bytemuck", "cfg-if", "critical-section", "defmt", @@ -1676,14 +1782,13 @@ dependencies = [ "embassy-usb-driver", "embassy-usb-synopsys-otg", "embedded-can", - "embedded-dma 0.2.0", "embedded-hal 1.0.0", "embedded-hal-async", "embedded-hal-nb", "embedded-io 0.6.1", "embedded-io-async", "enumset", - "esp-build", + "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", "esp-hal-procmacros", "esp-metadata", "esp-riscv-rt", @@ -1708,24 +1813,26 @@ dependencies = [ [[package]] name = "esp-hal-embassy" -version = "0.1.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.2.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "cfg-if", "critical-section", "document-features", "embassy-executor", "embassy-time-driver", - "esp-build", + "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", "esp-hal", + "esp-hal-procmacros", "esp-metadata", "portable-atomic", + "static_cell", ] [[package]] name = "esp-hal-procmacros" -version = "0.11.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.12.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "darling", "document-features", @@ -1735,15 +1842,17 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] name = "esp-metadata" -version = "0.1.1" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.2.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ + "anyhow", "basic-toml", + "clap 4.5.16", "lazy_static", "serde", "strum 0.26.3", @@ -1751,19 +1860,21 @@ dependencies = [ [[package]] name = "esp-println" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98f0f58453dd2ce08d99228fc8757fad39d05dfd26643665d1093b8844f42cc" +checksum = "58cd4fa834980ba64aad00a5c2c1a630020af984eadef65a125cb99085f6f54c" dependencies = [ "critical-section", "defmt", - "log 0.4.21", + "esp-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.22", + "portable-atomic", ] [[package]] name = "esp-riscv-rt" -version = "0.8.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.9.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "document-features", "riscv", @@ -1772,8 +1883,8 @@ dependencies = [ [[package]] name = "esp-wifi" -version = "0.6.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +version = "0.7.1" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" dependencies = [ "atomic-waker", "cfg-if", @@ -1785,9 +1896,10 @@ dependencies = [ "embedded-io 0.6.1", "embedded-io-async", "enumset", - "esp-build", + "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", "esp-hal", "esp-hal-embassy", + "esp-metadata", "esp-wifi-sys", "fugit", "futures-util", @@ -1805,17 +1917,17 @@ dependencies = [ [[package]] name = "esp-wifi-sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551b510b3944844675fcefa1301b3610fe56faa419bcc05dd0dd0056745c6654" +checksum = "1829bd8c63b22a6d8a5485203a6e6bdc008897d9ee687aa6df8b57d2103a48d2" dependencies = [ "anyhow", ] [[package]] name = "esp32" -version = "0.31.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.32.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1825,8 +1937,8 @@ dependencies = [ [[package]] name = "esp32c2" -version = "0.20.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.21.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1835,8 +1947,8 @@ dependencies = [ [[package]] name = "esp32c3" -version = "0.23.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.24.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1845,8 +1957,8 @@ dependencies = [ [[package]] name = "esp32c6" -version = "0.14.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.15.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1855,8 +1967,8 @@ dependencies = [ [[package]] name = "esp32h2" -version = "0.10.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.11.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1865,8 +1977,8 @@ dependencies = [ [[package]] name = "esp32s2" -version = "0.22.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.23.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1876,8 +1988,8 @@ dependencies = [ [[package]] name = "esp32s3" -version = "0.26.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +version = "0.27.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" dependencies = [ "critical-section", "defmt", @@ -1920,9 +2032,9 @@ dependencies = [ [[package]] name = "fixed" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" dependencies = [ "az", "bytemuck", @@ -1938,9 +2050,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -1961,6 +2073,16 @@ dependencies = [ "gcd", ] +[[package]] +name = "fugit-timer" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9607bfc4c388f9d629704f56ede4a007546cad417b3bcd6fc7c87dc7edce04a" +dependencies = [ + "fugit", + "nb 1.1.0", +] + [[package]] name = "futures" version = "0.3.30" @@ -2008,7 +2130,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -2245,9 +2367,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hexlit" @@ -2279,7 +2401,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2306,9 +2428,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2325,15 +2447,21 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi 0.4.0", "libc", - "windows-sys", + "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -2376,7 +2504,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64eb682691d02609ff036a7416373edbc7cc769b0908bf2489af79461453669e" dependencies = [ "lakers-shared", - "log 0.4.21", + "log 0.4.22", ] [[package]] @@ -2401,7 +2529,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcdc5a0e1a5ea0387ab3e334f2061c633001db79e04d40af65bc68b41b13ef3a" dependencies = [ - "log 0.4.21", + "log 0.4.22", ] [[package]] @@ -2461,15 +2589,15 @@ checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets", @@ -2531,7 +2659,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] @@ -2543,22 +2671,22 @@ checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" [[package]] name = "linkme" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb76662d78edc9f9bf56360d6919bdacc8b7761227727e5082f128eeb90bbf5" +checksum = "3c943daedff228392b791b33bba32e75737756e80a613e32e246c6ce9cbab20a" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dccda732e04fa3baf2e17cf835bfe2601c7c2edafd64417c627dabae3a8cda" +checksum = "cb26336e6dc7cc76e7927d2c9e7e3bb376d7af65a6f56a0b16c47d18a9b1abc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -2597,9 +2725,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "managed" @@ -2912,6 +3040,17 @@ dependencies = [ "riot-rs-debug", ] +[[package]] +name = "nrf9120-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c012f18dc278aa33741722d374bc84e3d2d7694e29745f0bb83e56b2d6faf9b" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + [[package]] name = "nrf9160-pac" version = "0.12.2" @@ -2923,6 +3062,12 @@ dependencies = [ "vcell", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" version = "0.4.2" @@ -2931,7 +3076,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -2965,9 +3110,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.0" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "flate2", "memchr", @@ -3069,7 +3214,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.4.0", ] [[package]] @@ -3095,7 +3240,7 @@ dependencies = [ "futures-util", "heapless 0.8.0", "lhash", - "log 0.4.21", + "log 0.4.22", "ryu", "serde", ] @@ -3177,9 +3322,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" dependencies = [ "critical-section", ] @@ -3202,14 +3347,23 @@ checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "precomputed-hash" @@ -3329,11 +3483,11 @@ version = "0.1.1" [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -3349,9 +3503,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -3464,8 +3618,8 @@ dependencies = [ "defmt", "defmt-rtt-target", "esp-println", - "log 0.4.21", - "rtt-target 0.5.0", + "log 0.4.22", + "rtt-target", ] [[package]] @@ -3515,7 +3669,7 @@ dependencies = [ "proc-macro2", "quote", "riot-rs", - "syn 2.0.68", + "syn 2.0.75", "trybuild", ] @@ -3543,7 +3697,7 @@ dependencies = [ "riot-rs-debug", "riot-rs-threads", "riot-rs-utils", - "rtt-target 0.4.0", + "rtt-target", ] [[package]] @@ -3603,8 +3757,7 @@ dependencies = [ [[package]] name = "rp-pac" version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30f6c4c846269293db805e9c77864ff7b923395b480550df44f0868e3765337" +source = "git+https://github.com/embassy-rs/rp-pac.git?rev=a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c#a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c" dependencies = [ "cortex-m", "cortex-m-rt", @@ -3637,25 +3790,6 @@ dependencies = [ "rp2040", ] -[[package]] -name = "rtcc" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef35f9dcbf434a34dcc99b3ebba1c1945d49c70832958e932e83dc63a5273994" -dependencies = [ - "chrono", -] - -[[package]] -name = "rtt-target" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afa12c77ba1b9bf560e4039a9b9a08bb9cde0e9e6923955eeb917dd8d5cf303" -dependencies = [ - "critical-section", - "ufmt-write", -] - [[package]] name = "rtt-target" version = "0.5.0" @@ -3696,11 +3830,11 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -3711,12 +3845,11 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ruzstd" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5174a470eeb535a721ae9fdd6e291c2411a906b96592182d05217591d5c5cf7b" +checksum = "5022b253619b1ba797f243056276bed8ed1a73b0f5a7ce7225d524067644bf8f" dependencies = [ "byteorder", - "derive_more", "twox-hash", ] @@ -3784,9 +3917,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -3803,31 +3936,32 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -3843,6 +3977,12 @@ dependencies = [ "digest", ] +[[package]] +name = "sha2-const-stable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" + [[package]] name = "shlex" version = "1.3.0" @@ -3963,9 +4103,9 @@ dependencies = [ [[package]] name = "stm32-fmc" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830ed60f33e6194ecb377f5d6ab765dc0e37e7b65e765f1fa87df13336658d63" +checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c" dependencies = [ "embedded-hal 0.2.7", ] @@ -3973,7 +4113,7 @@ dependencies = [ [[package]] name = "stm32-metapac" version = "15.0.0" -source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-59b1f65bd109c3ef35782e6c44062208d0ef3d0e#2ad339796e0f40bd6fa784dbfe30a071d93cc886" +source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-5ef354f3e49f790e47f5c818f243459742c9b83b#d94c7ea2bd05428ba9fd2b5a39edb8ed99f65daa" dependencies = [ "cortex-m", "cortex-m-rt", @@ -3981,9 +4121,9 @@ dependencies = [ [[package]] name = "stm32f4" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379f030a0586d0aa3574cb6497392142ddf125c8146b7b580b4b6b46db9d7dc9" +checksum = "fb94729242cd1aebe6dab42a2ca0131985ae93bc3ab2751b680df724bb35528d" dependencies = [ "bare-metal 1.0.0", "cortex-m", @@ -3995,28 +4135,34 @@ dependencies = [ name = "stm32f4xx" version = "0.1.0" dependencies = [ - "bare-metal 0.2.5", + "bare-metal 1.0.0", "cortex-m", "stm32f4xx-hal", ] [[package]] name = "stm32f4xx-hal" -version = "0.11.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e687d08bd5a2d188109b8c325cb09f1c9f231b2c45e46bcbb1270bf5e912a3" +checksum = "ceed60591531f4da636d828701c74861a3d100e5c4e36677cadbd2eb6f46eb67" dependencies = [ "bare-metal 1.0.0", - "cast", "cortex-m", "cortex-m-rt", - "embedded-dma 0.1.2", + "document-features", + "embedded-dma", "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-nb", + "embedded-storage", + "enumflags2", "fugit", + "fugit-timer", "nb 1.1.0", "rand_core", - "rtcc", "stm32f4", + "time", + "vcell", "void", ] @@ -4083,14 +4229,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] name = "subtle" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0208408ba0c3df17ed26eb06992cb1a1268d41b2c0e12e65203fbe3972cee5" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -4105,9 +4251,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -4116,14 +4262,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -4163,22 +4310,22 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] @@ -4197,6 +4344,24 @@ dependencies = [ "riot-rs-boards", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -4217,14 +4382,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.14", + "toml_edit 0.22.20", ] [[package]] @@ -4237,15 +4402,15 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.68", - "toml 0.8.14", + "syn 2.0.75", + "toml 0.8.19", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -4256,22 +4421,22 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.4.0", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.14" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.18", ] [[package]] @@ -4282,16 +4447,16 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.96" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a5f13f11071020bb12de7a16b925d2d58636175c20c11dc5f96cb64bb6c9b3" +checksum = "207aa50d36c4be8d8c6ea829478be44a372c6a77669937bb39c698e52f1491e8" dependencies = [ "glob", "serde", "serde_derive", "serde_json", "termcolor", - "toml 0.8.14", + "toml 0.8.19", ] [[package]] @@ -4361,9 +4526,13 @@ dependencies = [ [[package]] name = "usb-device" -version = "0.2.9" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless 0.8.0", + "portable-atomic", +] [[package]] name = "usb-serial" @@ -4377,9 +4546,9 @@ dependencies = [ [[package]] name = "usbd-hid" -version = "0.6.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975bd411f4a939986751ea09992a24fa47c4d25c6ed108d04b4c2999a4fd0132" +checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" dependencies = [ "serde", "ssmarshal", @@ -4389,20 +4558,22 @@ dependencies = [ [[package]] name = "usbd-hid-descriptors" -version = "0.1.2" -source = "git+https://github.com/twitchyliquid64/usbd-hid?rev=76bea16537e1a347df2ebced5b9e1d48f71c9859#76bea16537e1a347df2ebced5b9e1d48f71c9859" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed" dependencies = [ "bitfield 0.14.0", ] [[package]] name = "usbd-hid-macros" -version = "0.6.0" -source = "git+https://github.com/twitchyliquid64/usbd-hid?rev=76bea16537e1a347df2ebced5b9e1d48f71c9859#76bea16537e1a347df2ebced5b9e1d48f71c9859" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38" dependencies = [ "byteorder", "hashbrown 0.13.2", - "log 0.4.21", + "log 0.4.22", "proc-macro2", "quote", "serde", @@ -4410,6 +4581,12 @@ dependencies = [ "usbd-hid-descriptors", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "vcell" version = "0.1.3" @@ -4418,9 +4595,9 @@ checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "void" @@ -4473,11 +4650,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -4510,11 +4687,20 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -4528,51 +4714,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -4585,9 +4771,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -4625,27 +4811,28 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.75", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 21be2bd67..6403a003a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,25 +46,25 @@ portable-atomic = { version = "1.6.0", default-features = false, features = [ "require-cas", ] } -embassy-executor = { version = "0.5", default-features = false } +embassy-executor = { version = "0.6", default-features = false } embassy-futures = { version = "0.1.1", default-features = false } -embassy-hal-internal = { version = "0.1.0", default-features = false } +embassy-hal-internal = { version = "0.2.0", default-features = false } embassy-net = { version = "0.4", default-features = false } -embassy-net-driver-channel = { version = "0.2.0", default-features = false } -embassy-nrf = { version = "0.1", default-features = false } -embassy-rp = { version = "0.1", default-features = false } +embassy-net-driver-channel = { version = "0.3.0", default-features = false } +embassy-nrf = { version = "0.2", default-features = false } +embassy-rp = { version = "0.2", default-features = false } embassy-stm32 = { version = "0.1", default-features = false } embassy-sync = { version = "0.6", default-features = false } embassy-time = { version = "0.3", default-features = false } -embassy-usb = { version = "0.1", default-features = false } +embassy-usb = { version = "0.3", default-features = false } embedded-hal = { version = "1.0.0", default-features = false } embedded-hal-async = { version = "1.0.0", default-features = false } -esp-hal = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-06-14", default-features = false } -esp-hal-embassy = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-06-14", default-features = false } -esp-println = { version = "0.9.0" } -esp-wifi = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-06-14", default-features = false } +esp-hal = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-08-19", default-features = false } +esp-hal-embassy = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-08-19", default-features = false } +esp-println = "0.10.0" +esp-wifi = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs-2024-08-19", default-features = false } linkme = { version = "0.3.21", features = ["used_linker"] } @@ -105,22 +105,20 @@ opt-level = 3 [patch.crates-io] # riot-rs embassy fork -embassy-executor = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-hal-internal = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-nrf = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-net = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-rp = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-net-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-net-driver-channel = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-stm32 = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-sync = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-time-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-time-queue-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -embassy-usb-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -cyw43 = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } -cyw43-pio = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-240605" } - -usbd-hid-macros = { git = "https://github.com/twitchyliquid64/usbd-hid", rev = "76bea16537e1a347df2ebced5b9e1d48f71c9859" } +embassy-executor = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-hal-internal = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-nrf = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-net = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-rp = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-net-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-net-driver-channel = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-stm32 = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-sync = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-time-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-time-queue-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +embassy-usb-driver = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +cyw43 = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } +cyw43-pio = { git = "https://github.com/kaspar030/embassy", branch = "for-riot-rs-2024-08-18" } # version 0.12-to-be smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "125773e282bc2e0c914a49e9c75573926e26e558" } diff --git a/examples/blinky/src/main.rs b/examples/blinky/src/main.rs index a43026e46..443b17a30 100644 --- a/examples/blinky/src/main.rs +++ b/examples/blinky/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/coap/src/main.rs b/examples/coap/src/main.rs index 1d4c42620..b531a7ef9 100644 --- a/examples/coap/src/main.rs +++ b/examples/coap/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/embassy-http-server/src/main.rs b/examples/embassy-http-server/src/main.rs index b150b4c04..c3101d926 100644 --- a/examples/embassy-http-server/src/main.rs +++ b/examples/embassy-http-server/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/embassy-net-tcp/src/main.rs b/examples/embassy-net-tcp/src/main.rs index c9a4ab925..a8aa17148 100644 --- a/examples/embassy-net-tcp/src/main.rs +++ b/examples/embassy-net-tcp/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/embassy-net-udp/src/main.rs b/examples/embassy-net-udp/src/main.rs index 512d7324a..1375d992f 100644 --- a/examples/embassy-net-udp/src/main.rs +++ b/examples/embassy-net-udp/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/embassy-usb-keyboard/Cargo.toml b/examples/embassy-usb-keyboard/Cargo.toml index 477eae258..070b7e253 100644 --- a/examples/embassy-usb-keyboard/Cargo.toml +++ b/examples/embassy-usb-keyboard/Cargo.toml @@ -22,4 +22,4 @@ riot-rs = { path = "../../src/riot-rs", features = [ ] } riot-rs-boards = { path = "../../src/riot-rs-boards" } static_cell = { workspace = true } -usbd-hid = { version = "0.6.1" } +usbd-hid = "0.8.2" diff --git a/examples/embassy-usb-keyboard/src/main.rs b/examples/embassy-usb-keyboard/src/main.rs index a0382d4ca..57082c37b 100644 --- a/examples/embassy-usb-keyboard/src/main.rs +++ b/examples/embassy-usb-keyboard/src/main.rs @@ -1,5 +1,6 @@ #![no_std] #![no_main] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/embassy/src/main.rs b/examples/embassy/src/main.rs index 049105d03..999971323 100644 --- a/examples/embassy/src/main.rs +++ b/examples/embassy/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/gpio/src/main.rs b/examples/gpio/src/main.rs index 8bd9973ec..c98f1674f 100644 --- a/examples/gpio/src/main.rs +++ b/examples/gpio/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/hello-world-async/src/main.rs b/examples/hello-world-async/src/main.rs index 74e1e55ae..c380dbfbc 100644 --- a/examples/hello-world-async/src/main.rs +++ b/examples/hello-world-async/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/log/src/main.rs b/examples/log/src/main.rs index 335b9e0a9..27cf99f1c 100644 --- a/examples/log/src/main.rs +++ b/examples/log/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/examples/usb-serial/src/main.rs b/examples/usb-serial/src/main.rs index 888525e60..7a9a78607 100644 --- a/examples/usb-serial/src/main.rs +++ b/examples/usb-serial/src/main.rs @@ -1,5 +1,6 @@ #![no_std] #![no_main] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/src/riot-rs-chips/stm32f4xx/Cargo.toml b/src/riot-rs-chips/stm32f4xx/Cargo.toml index de2dbebd8..a2665815e 100644 --- a/src/riot-rs-chips/stm32f4xx/Cargo.toml +++ b/src/riot-rs-chips/stm32f4xx/Cargo.toml @@ -6,11 +6,9 @@ license.workspace = true edition = "2021" [dependencies] -bare-metal = "0.2.5" +bare-metal = "1.0.0" cortex-m.workspace = true - -[dependencies.stm32f4xx-hal] -version = "0.11" +stm32f4xx-hal= "0.21" #features = [ "rt" ] [features] diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 5fe769e15..e8aa2302e 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -42,8 +42,8 @@ once_cell = { version = "1.19.0", default-features = false, features = [ ] } # rpi-pico-w cyw43 -cyw43 = { version = "0.1.0", features = ["firmware-logs"], optional = true } -cyw43-pio = { version = "0.1.0", features = ["overclock"], optional = true } +cyw43 = { version = "0.2.0", features = ["firmware-logs"], optional = true } +cyw43-pio = { version = "0.2.0", features = ["overclock"], optional = true } # listed here for conditional feature selection embassy-nrf = { workspace = true, default-features = false, optional = true } @@ -77,6 +77,7 @@ embassy-nrf = { workspace = true, features = ["nrf5340-app-s"] } [target.'cfg(context = "rp2040")'.dependencies] embassy-rp = { workspace = true, features = [ + "rp2040", "rt", "time-driver", "unstable-pac", @@ -85,9 +86,7 @@ embassy-rp = { workspace = true, features = [ [target.'cfg(context = "esp")'.dependencies] esp-hal = { workspace = true, features = ["async", "embedded-hal"] } -esp-hal-embassy = { workspace = true, default-features = false, features = [ - "time-timg0", -] } +esp-hal-embassy = { workspace = true, default-features = false, features = [] } esp-wifi = { workspace = true, default-features = false, features = [ "async", "embassy-net", diff --git a/src/riot-rs-embassy/src/arch/esp/mod.rs b/src/riot-rs-embassy/src/arch/esp/mod.rs index d2ff17b57..50fc0c8bd 100644 --- a/src/riot-rs-embassy/src/arch/esp/mod.rs +++ b/src/riot-rs-embassy/src/arch/esp/mod.rs @@ -65,7 +65,8 @@ pub fn init() -> OptionalPeripherals { riot_rs_debug::log::debug!("riot-rs-embassy::arch::esp::init(): wifi"); - let timer = SystemTimer::new(peripherals.SYSTIMER.take().unwrap()); + let timer = SystemTimer::new(peripherals.SYSTIMER.take().unwrap()) + .split::(); #[cfg(target_arch = "riscv32")] let init = initialize( @@ -80,8 +81,8 @@ pub fn init() -> OptionalPeripherals { crate::wifi::esp_wifi::WIFI_INIT.set(init).unwrap(); } - let timer_group0 = TimerGroup::new_async(peripherals.TIMG0.take().unwrap(), &clocks); - esp_hal_embassy::init(&clocks, timer_group0); + let timer_group0 = TimerGroup::new(peripherals.TIMG0.take().unwrap(), &clocks); + esp_hal_embassy::init(&clocks, timer_group0.timer0); peripherals } diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 82e907423..ca124c3c9 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -2,6 +2,7 @@ #![no_std] #![feature(type_alias_impl_trait)] +#![feature(impl_trait_in_assoc_type)] #![feature(used_with_arg)] #![feature(lint_reasons)] #![feature(trait_alias)] @@ -193,7 +194,6 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) { usb_config, &mut make_static!([0; 256])[..], &mut make_static!([0; 256])[..], - &mut make_static!([0; 256])[..], &mut make_static!([0; 128])[..], &mut make_static!([0; 128])[..], ); diff --git a/src/riot-rs-macros/Cargo.toml b/src/riot-rs-macros/Cargo.toml index 74f877ef6..9bfd250be 100644 --- a/src/riot-rs-macros/Cargo.toml +++ b/src/riot-rs-macros/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true workspace = true [dependencies] -enum-iterator = "1.5.0" +enum-iterator = "2.1.0" proc-macro-crate = "3.1.0" proc-macro2 = "1.0.78" quote = "1.0.35" diff --git a/src/riot-rs-rt/Cargo.toml b/src/riot-rs-rt/Cargo.toml index c51ddea22..5c94b30c2 100644 --- a/src/riot-rs-rt/Cargo.toml +++ b/src/riot-rs-rt/Cargo.toml @@ -14,7 +14,7 @@ linkme.workspace = true riot-rs-debug.workspace = true riot-rs-threads = { path = "../riot-rs-threads", optional = true } riot-rs-utils = { workspace = true } -rtt-target = { version = "0.4.0", optional = true } +rtt-target = { version = "0.5.0", optional = true } [target.'cfg(context = "cortex-m")'.dependencies] cortex-m = { workspace = true, features = ["critical-section-single-core"] } diff --git a/tests/gpio-interrupt-nrf/src/main.rs b/tests/gpio-interrupt-nrf/src/main.rs index 439a8f616..383bbb939 100644 --- a/tests/gpio-interrupt-nrf/src/main.rs +++ b/tests/gpio-interrupt-nrf/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/tests/gpio-interrupt-stm32/src/main.rs b/tests/gpio-interrupt-stm32/src/main.rs index ac6e6eaf1..29d399eca 100644 --- a/tests/gpio-interrupt-stm32/src/main.rs +++ b/tests/gpio-interrupt-stm32/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] diff --git a/tests/gpio/src/main.rs b/tests/gpio/src/main.rs index 3078e3222..3b6a71bd9 100644 --- a/tests/gpio/src/main.rs +++ b/tests/gpio/src/main.rs @@ -1,5 +1,6 @@ #![no_main] #![no_std] +#![feature(impl_trait_in_assoc_type)] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] From 206054a6fe7127b5d7c371307282aa5f95eb49b8 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 11 Jun 2024 13:35:26 +0200 Subject: [PATCH 02/95] feat(embassy-arch): support sharing I2C and SPI buses This leverages embassy-embedded-hal to provide buses instantiated once and then shared between tasks. This currently only support the RP2040, nRF52840, and the nRF5340. It is however trivial add support for other nRF MCUs. --- Cargo.lock | 4842 -------------------- Cargo.toml | 1 + src/riot-rs-embassy/Cargo.toml | 10 + src/riot-rs-embassy/src/arch/nrf/i2c.rs | 102 + src/riot-rs-embassy/src/arch/nrf/mod.rs | 2 + src/riot-rs-embassy/src/arch/nrf/spi.rs | 140 + src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 93 + src/riot-rs-embassy/src/arch/rp2040/mod.rs | 2 + src/riot-rs-embassy/src/arch/rp2040/spi.rs | 123 + src/riot-rs-embassy/src/i2c.rs | 39 + src/riot-rs-embassy/src/lib.rs | 3 + src/riot-rs-embassy/src/spi.rs | 37 + 12 files changed, 552 insertions(+), 4842 deletions(-) delete mode 100644 Cargo.lock create mode 100644 src/riot-rs-embassy/src/arch/nrf/i2c.rs create mode 100644 src/riot-rs-embassy/src/arch/nrf/spi.rs create mode 100644 src/riot-rs-embassy/src/arch/rp2040/i2c.rs create mode 100644 src/riot-rs-embassy/src/arch/rp2040/spi.rs create mode 100644 src/riot-rs-embassy/src/i2c.rs create mode 100644 src/riot-rs-embassy/src/spi.rs diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index b688e5f8f..000000000 --- a/Cargo.lock +++ /dev/null @@ -1,4842 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "ai-c3" -version = "0.1.0" -dependencies = [ - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "alloc-traits" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483" - -[[package]] -name = "anstream" -version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" - -[[package]] -name = "anstyle-parse" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - -[[package]] -name = "atomic-polyfill" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" -dependencies = [ - "critical-section", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "az" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version 0.2.3", -] - -[[package]] -name = "bare-metal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "basic-toml" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" -dependencies = [ - "serde", -] - -[[package]] -name = "bench_sched_yield" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "benchmark" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "bindgen" -version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "log 0.4.22", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 1.0.109", - "which", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bit_field" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - -[[package]] -name = "bitfield" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" - -[[package]] -name = "bitfield" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c821a6e124197eb56d907ccc2188eab1038fb919c914f47976e64dd8dbc855d1" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "blinky" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bytemuck" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cbindgen" -version = "0.24.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" -dependencies = [ - "clap 3.2.25", - "heck 0.4.1", - "indexmap 1.9.3", - "log 0.4.22", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 1.0.109", - "tempfile", - "toml 0.5.11", -] - -[[package]] -name = "cc" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" -dependencies = [ - "shlex", -] - -[[package]] -name = "ccm" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" -dependencies = [ - "aead", - "cipher", - "ctr", - "subtle", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "ciborium-io" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex 0.2.4", - "indexmap 1.9.3", - "strsim 0.10.0", - "termcolor", - "textwrap", -] - -[[package]] -name = "clap" -version = "4.5.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" -dependencies = [ - "anstream", - "anstyle", - "clap_lex 0.7.2", - "strsim 0.11.1", -] - -[[package]] -name = "clap_derive" -version = "4.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "clap_lex" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" - -[[package]] -name = "clist" -version = "0.1.1" -dependencies = [ - "memoffset", -] - -[[package]] -name = "coap" -version = "0.1.0" -dependencies = [ - "coap-handler", - "coap-handler-implementations", - "coap-message", - "coap-message-demos", - "coap-request", - "coap-request-implementations", - "coap-scroll-ring-server", - "coapcore", - "embassy-executor", - "embassy-futures", - "embassy-net", - "embassy-time", - "embedded-io-async", - "embedded-nal-async", - "embedded-nal-coap", - "heapless 0.8.0", - "hexlit", - "lakers", - "lakers-crypto-rustcrypto", - "riot-rs", - "riot-rs-boards", - "scroll-ring", - "smoltcp", - "static-alloc", -] - -[[package]] -name = "coap-handler" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8600ae8e54c9be6e0c5273fad0503e12f827742e4e3fea5a521412478d603b72" -dependencies = [ - "coap-message", - "coap-numbers", -] - -[[package]] -name = "coap-handler-implementations" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2735f53da500caae442466ba2126d62458e86116ec1e273919880410f7e187b" -dependencies = [ - "ciborium-io", - "coap-handler", - "coap-message", - "coap-message-utils", - "coap-numbers", - "crc", - "document-features", - "embedded-io 0.4.0", - "minicbor 0.19.1", - "serde", - "serde_cbor", - "windowed-infinity", -] - -[[package]] -name = "coap-message" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e126d86a35f4c5dfcf454da6c9c58a6e703150989e536945ef3813f2bc60565" -dependencies = [ - "num-traits", -] - -[[package]] -name = "coap-message-demos" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c49342f485367852eb9d5acb6545d0107b5565752c70a9600cf7e58f00482c9a" -dependencies = [ - "coap-handler", - "coap-handler-implementations", - "coap-message", - "coap-message-utils", - "coap-numbers", - "coap-request", - "heapless 0.7.17", - "serde", -] - -[[package]] -name = "coap-message-implementations" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3042f71e9b8079d8db92a8383dcad6e584451878d307cdbbc4f8595e07bd0a4b" -dependencies = [ - "coap-message", - "coap-message-utils", - "coap-numbers", - "document-features", - "heapless 0.8.0", -] - -[[package]] -name = "coap-message-utils" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc625b0d10d99c012e83dfc68265231c2a9ae4f2e02e1a72dfef266133e9a09" -dependencies = [ - "coap-message", - "coap-numbers", - "document-features", - "minicbor 0.19.1", -] - -[[package]] -name = "coap-numbers" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d78a5634393ab2c11d173d66107200a730e200a3b3ca063c344d4459c90a5f9" - -[[package]] -name = "coap-request" -version = "0.2.0-alpha.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58d76d947d49b867e8f0268cbd690156fe506335247b538284551fe404d2d16c" -dependencies = [ - "coap-message", -] - -[[package]] -name = "coap-request-implementations" -version = "0.1.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc15c3be00d32fe7c2b58a7546eff18fb1f3e7d2dea74d91eaacd4346960851f" -dependencies = [ - "coap-message", - "coap-message-utils", - "coap-numbers", - "coap-request", -] - -[[package]] -name = "coap-scroll-ring-server" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54221724caa364079527fcd8be89bc401f25921f0927e6574c934a8ecb9778a0" -dependencies = [ - "coap-handler", - "coap-handler-implementations", - "coap-message", - "coap-message-utils", - "coap-numbers", - "scroll-ring", -] - -[[package]] -name = "coapcore" -version = "0.0.1" -dependencies = [ - "arrayvec", - "coap-handler", - "coap-message", - "coap-message-implementations", - "coap-message-utils", - "coap-numbers", - "heapless 0.8.0", - "hexlit", - "lakers", - "lakers-crypto-rustcrypto", - "liboscore", - "liboscore-msgbackend", - "minicbor 0.23.0", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "colorchoice" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const-sha1" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" - -[[package]] -name = "const_panic" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" - -[[package]] -name = "core-isa-parser" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ec98e54b735872e54b2335c2e5a5c7fa7d9c3bfd45500f75280f84089a0083" -dependencies = [ - "anyhow", - "enum-as-inner", - "regex", - "strum 0.24.1", - "strum_macros 0.24.3", -] - -[[package]] -name = "core-sizes" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "cortex-m" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" -dependencies = [ - "bare-metal 0.2.5", - "bitfield 0.13.2", - "critical-section", - "embedded-hal 0.2.7", - "volatile-register", -] - -[[package]] -name = "cortex-m-rt" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" -dependencies = [ - "cortex-m-rt-macros", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cortex-m-semihosting" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0" -dependencies = [ - "cortex-m", -] - -[[package]] -name = "cpufeatures" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" -dependencies = [ - "libc", -] - -[[package]] -name = "crc" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-any" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" -dependencies = [ - "debug-helper", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "cyw43" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "embassy-futures", - "embassy-net-driver-channel", - "embassy-sync 0.6.0", - "embassy-time", - "embedded-hal 1.0.0", - "futures", - "heapless 0.8.0", - "num_enum", -] - -[[package]] -name = "cyw43-pio" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "cyw43", - "embassy-rp", - "fixed", - "pio", - "pio-proc", -] - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.11.1", - "syn 2.0.75", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "debug-helper" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" - -[[package]] -name = "defmt" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0" -dependencies = [ - "bitflags 1.3.2", - "defmt-macros", -] - -[[package]] -name = "defmt-macros" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb" -dependencies = [ - "defmt-parser", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "defmt-parser" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f" -dependencies = [ - "thiserror", -] - -[[package]] -name = "defmt-rtt-target" -version = "0.3.0" -source = "git+https://github.com/kaspar030/defmt-rtt-target?rev=5668c92ac5a0689b165a6a07bb14e173fc47cd34#5668c92ac5a0689b165a6a07bb14e173fc47cd34" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "rtt-target", -] - -[[package]] -name = "delegate" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "document-features" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" -dependencies = [ - "litrs", -] - -[[package]] -name = "dwm1001" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "hkdf", - "rand_core", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "embassy" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-sync 0.6.0", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "embassy-embedded-hal" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5794414bc20e0d750f145bc0e82366b19dd078e9e075e8331fb8dd069a1cb6a2" -dependencies = [ - "defmt", - "embassy-futures", - "embassy-sync 0.6.0", - "embassy-time", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-storage", - "embedded-storage-async", - "nb 1.1.0", -] - -[[package]] -name = "embassy-executor" -version = "0.6.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "cortex-m", - "critical-section", - "document-features", - "embassy-executor-macros", - "embassy-time-driver", - "embassy-time-queue-driver", -] - -[[package]] -name = "embassy-executor-macros" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d4c0c34b32c2c653c9eecce1cefaf8539dd9a54e61deb5499254f01e2fcac2" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "embassy-futures" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-hal-internal" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "cortex-m", - "critical-section", - "defmt", - "num-traits", -] - -[[package]] -name = "embassy-http-server" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-net", - "embassy-nrf", - "embassy-sync 0.6.0", - "embassy-time", - "embedded-io-async", - "heapless 0.8.0", - "httparse", - "picoserve", - "riot-rs", - "riot-rs-boards", - "serde", - "static_cell", -] - -[[package]] -name = "embassy-net" -version = "0.4.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "defmt", - "document-features", - "embassy-net-driver", - "embassy-sync 0.6.0", - "embassy-time", - "embedded-io-async", - "embedded-nal-async", - "heapless 0.8.0", - "managed", - "smoltcp", -] - -[[package]] -name = "embassy-net-driver" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-net-driver-channel" -version = "0.3.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "embassy-futures", - "embassy-net-driver", - "embassy-sync 0.6.0", -] - -[[package]] -name = "embassy-net-tcp" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-net", - "embassy-time", - "embedded-io-async", - "heapless 0.8.0", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "embassy-net-udp" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-net", - "embassy-time", - "embedded-io-async", - "heapless 0.8.0", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "embassy-nrf" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-hal-internal", - "embassy-sync 0.6.0", - "embassy-time", - "embassy-time-driver", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-io 0.6.1", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nrf51-pac", - "nrf52805-pac", - "nrf52810-pac", - "nrf52811-pac", - "nrf52820-pac", - "nrf52832-pac", - "nrf52833-pac", - "nrf52840-pac", - "nrf5340-app-pac", - "nrf5340-net-pac", - "nrf9120-pac", - "nrf9160-pac", - "rand_core", -] - -[[package]] -name = "embassy-rp" -version = "0.2.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "atomic-polyfill", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-futures", - "embassy-hal-internal", - "embassy-sync 0.6.0", - "embassy-time", - "embassy-time-driver", - "embassy-usb-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-hal-nb", - "embedded-io 0.6.1", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "fixed", - "nb 1.1.0", - "pio", - "pio-proc", - "rand_core", - "rp-pac", - "rp2040-boot2", - "sha2-const-stable", -] - -[[package]] -name = "embassy-stm32" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "bit_field", - "bitflags 2.6.0", - "cfg-if", - "cortex-m", - "cortex-m-rt", - "critical-section", - "defmt", - "document-features", - "embassy-embedded-hal", - "embassy-futures", - "embassy-hal-internal", - "embassy-net-driver", - "embassy-sync 0.6.0", - "embassy-time", - "embassy-time-driver", - "embassy-usb-driver", - "embassy-usb-synopsys-otg", - "embedded-can", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-hal-nb", - "embedded-io 0.6.1", - "embedded-io-async", - "embedded-storage", - "embedded-storage-async", - "futures-util", - "nb 1.1.0", - "proc-macro2", - "quote", - "rand_core", - "sdio-host", - "static_assertions", - "stm32-fmc", - "stm32-metapac", - "vcell", - "volatile-register", -] - -[[package]] -name = "embassy-sync" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0" -dependencies = [ - "cfg-if", - "critical-section", - "futures-util", - "heapless 0.7.17", -] - -[[package]] -name = "embassy-sync" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd938f25c0798db4280fcd8026bf4c2f48789aebf8f77b6e5cf8a7693ba114ec" -dependencies = [ - "cfg-if", - "critical-section", - "embedded-io-async", - "futures-util", - "heapless 0.8.0", -] - -[[package]] -name = "embassy-sync" -version = "0.6.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "cfg-if", - "critical-section", - "defmt", - "embedded-io-async", - "futures-util", - "heapless 0.8.0", -] - -[[package]] -name = "embassy-time" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "158080d48f824fad101d7b2fae2d83ac39e3f7a6fa01811034f7ab8ffc6e7309" -dependencies = [ - "cfg-if", - "critical-section", - "defmt", - "document-features", - "embassy-time-driver", - "embassy-time-queue-driver", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-async", - "futures-util", - "heapless 0.8.0", -] - -[[package]] -name = "embassy-time-driver" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "document-features", -] - -[[package]] -name = "embassy-time-queue-driver" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" - -[[package]] -name = "embassy-usb" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d0b882133fa684b9d4652351cd7aac5afe8a2c2bf4a7da59f442ff61087cda2" -dependencies = [ - "defmt", - "embassy-futures", - "embassy-net-driver-channel", - "embassy-sync 0.6.0", - "embassy-usb-driver", - "heapless 0.8.0", - "ssmarshal", - "usbd-hid", -] - -[[package]] -name = "embassy-usb-driver" -version = "0.1.0" -source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-2024-08-18#164b3a99efbeccc442971b63dc1b90f03db637ea" -dependencies = [ - "defmt", -] - -[[package]] -name = "embassy-usb-keyboard" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-nrf", - "embassy-sync 0.6.0", - "embassy-time", - "embassy-usb", - "riot-rs", - "riot-rs-boards", - "static_cell", - "usbd-hid", -] - -[[package]] -name = "embassy-usb-synopsys-otg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46be92e72bcf39e623ff74d739a8ab29b02f4909a9b05986ca81c2157ac254a" -dependencies = [ - "critical-section", - "embassy-sync 0.5.0", - "embassy-usb-driver", -] - -[[package]] -name = "embedded-can" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "embedded-dma" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "embedded-hal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" -dependencies = [ - "defmt", -] - -[[package]] -name = "embedded-hal-async" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "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" -dependencies = [ - "defmt", -] - -[[package]] -name = "embedded-io-async" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" -dependencies = [ - "defmt", - "embedded-io 0.6.1", -] - -[[package]] -name = "embedded-nal" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a943fad5ed3d3f8a00f1e80f6bba371f1e7f0df28ec38477535eb318dc19cc" -dependencies = [ - "nb 1.1.0", - "no-std-net", -] - -[[package]] -name = "embedded-nal-async" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72229137a4fc12d239b0b7f50f04b30790678da6d782a0f3f1909bf57ec4b759" -dependencies = [ - "embedded-io-async", - "embedded-nal", - "no-std-net", -] - -[[package]] -name = "embedded-nal-coap" -version = "0.1.0-alpha.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9b7bb02659ab86bce6bc58d586535b161887b5d8f44619439da9269c2f21db" -dependencies = [ - "coap-handler", - "coap-message", - "coap-message-implementations", - "coap-numbers", - "coap-request", - "embassy-futures", - "embassy-sync 0.3.0", - "embedded-nal-async", - "heapless 0.7.17", - "rand_core", -] - -[[package]] -name = "embedded-storage" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" - -[[package]] -name = "embedded-storage-async" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" -dependencies = [ - "embedded-storage", -] - -[[package]] -name = "ena" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" -dependencies = [ - "log 0.4.22", -] - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "enum-as-inner" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "enum-iterator" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c280b9e6b3ae19e152d8e31cf47f18389781e119d4013a2a2bb0180e5facc635" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "enumflags2" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" -dependencies = [ - "enumflags2_derive", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "enumset" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a4b049558765cef5f0c1a273c3fc57084d768b44d2f98127aef4cceb17293" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "esp-build" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94a4b8d74e7cc7baabcca5b2277b41877e039ad9cd49959d48ef94dac7eab4b" -dependencies = [ - "quote", - "syn 2.0.75", - "termcolor", -] - -[[package]] -name = "esp-build" -version = "0.1.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "quote", - "syn 2.0.75", - "termcolor", -] - -[[package]] -name = "esp-hal" -version = "0.19.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "basic-toml", - "bitfield 0.15.0", - "bitflags 2.6.0", - "bytemuck", - "cfg-if", - "critical-section", - "defmt", - "delegate", - "document-features", - "embassy-futures", - "embassy-sync 0.6.0", - "embassy-usb-driver", - "embassy-usb-synopsys-otg", - "embedded-can", - "embedded-hal 1.0.0", - "embedded-hal-async", - "embedded-hal-nb", - "embedded-io 0.6.1", - "embedded-io-async", - "enumset", - "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", - "esp-hal-procmacros", - "esp-metadata", - "esp-riscv-rt", - "esp32", - "esp32c2", - "esp32c3", - "esp32c6", - "esp32h2", - "esp32s2", - "esp32s3", - "fugit", - "nb 1.1.0", - "paste", - "portable-atomic", - "rand_core", - "riscv", - "serde", - "strum 0.26.3", - "void", - "xtensa-lx-rt", -] - -[[package]] -name = "esp-hal-embassy" -version = "0.2.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "cfg-if", - "critical-section", - "document-features", - "embassy-executor", - "embassy-time-driver", - "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", - "esp-hal", - "esp-hal-procmacros", - "esp-metadata", - "portable-atomic", - "static_cell", -] - -[[package]] -name = "esp-hal-procmacros" -version = "0.12.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "darling", - "document-features", - "litrs", - "object", - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "esp-metadata" -version = "0.2.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "anyhow", - "basic-toml", - "clap 4.5.16", - "lazy_static", - "serde", - "strum 0.26.3", -] - -[[package]] -name = "esp-println" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd4fa834980ba64aad00a5c2c1a630020af984eadef65a125cb99085f6f54c" -dependencies = [ - "critical-section", - "defmt", - "esp-build 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.22", - "portable-atomic", -] - -[[package]] -name = "esp-riscv-rt" -version = "0.9.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "document-features", - "riscv", - "riscv-rt-macros", -] - -[[package]] -name = "esp-wifi" -version = "0.7.1" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19#88ab36c4c5aa60f2bf070c732be48867d5dcec86" -dependencies = [ - "atomic-waker", - "cfg-if", - "critical-section", - "defmt", - "embassy-futures", - "embassy-net-driver", - "embassy-sync 0.6.0", - "embedded-io 0.6.1", - "embedded-io-async", - "enumset", - "esp-build 0.1.0 (git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-08-19)", - "esp-hal", - "esp-hal-embassy", - "esp-metadata", - "esp-wifi-sys", - "fugit", - "futures-util", - "heapless 0.8.0", - "libm", - "linked_list_allocator", - "no-std-net", - "num-derive", - "num-traits", - "portable-atomic", - "portable_atomic_enum", - "smoltcp", - "toml-cfg", -] - -[[package]] -name = "esp-wifi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1829bd8c63b22a6d8a5485203a6e6bdc008897d9ee687aa6df8b57d2103a48d2" -dependencies = [ - "anyhow", -] - -[[package]] -name = "esp32" -version = "0.32.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", - "xtensa-lx", -] - -[[package]] -name = "esp32c2" -version = "0.21.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", -] - -[[package]] -name = "esp32c3" -version = "0.24.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", -] - -[[package]] -name = "esp32c6" -version = "0.15.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", -] - -[[package]] -name = "esp32h2" -version = "0.11.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", -] - -[[package]] -name = "esp32s2" -version = "0.23.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", - "xtensa-lx", -] - -[[package]] -name = "esp32s3" -version = "0.27.0" -source = "git+https://github.com/esp-rs/esp-pacs?rev=e3741e6#e3741e6e047a59a96050288439db6ef91c5904e6" -dependencies = [ - "critical-section", - "defmt", - "vcell", - "xtensa-lx", -] - -[[package]] -name = "espressif-esp32-c6-devkitc-1" -version = "0.1.0" -dependencies = [ - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "example-random" -version = "0.1.0" -dependencies = [ - "rand", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - -[[package]] -name = "fixed" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" -dependencies = [ - "az", - "bytemuck", - "half 2.4.1", - "typenum", -] - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "flate2" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fugit" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" -dependencies = [ - "gcd", -] - -[[package]] -name = "fugit-timer" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9607bfc4c388f9d629704f56ede4a007546cad417b3bcd6fc7c87dc7edce04a" -dependencies = [ - "fugit", - "nb 1.1.0", -] - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -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" -dependencies = [ - "futures-core", - "futures-macro", - "futures-sink", - "futures-task", - "pin-project-lite", - "pin-utils", -] - -[[package]] -name = "gcd" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gpio" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-futures", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "gpio-interrupt-nrf" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "gpio-interrupt-stm32" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - -[[package]] -name = "half" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" - -[[package]] -name = "half" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -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.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[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.0", - "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 = [ - "defmt", - "hash32 0.3.1", - "portable-atomic", - "serde", - "stable_deref_trait", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hello-world" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "hello-world-async" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "hexlit" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6e75c860d4216ac53f9ac88b25c99eaedba075b3a7b2ed31f2adc51a74fffd" - -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "httparse" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" -dependencies = [ - "equivalent", - "hashbrown 0.14.5", -] - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "is-terminal" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "konst" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50a0ba6de5f7af397afff922f22c149ff605c766cd3269cf6c1cd5e466dbe3b9" -dependencies = [ - "const_panic", - "konst_kernel", - "typewit", -] - -[[package]] -name = "konst_kernel" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0a455a1719220fd6adf756088e1c69a85bf14b6a9e24537a5cc04f503edb2b" -dependencies = [ - "typewit", -] - -[[package]] -name = "lakers" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64eb682691d02609ff036a7416373edbc7cc769b0908bf2489af79461453669e" -dependencies = [ - "lakers-shared", - "log 0.4.22", -] - -[[package]] -name = "lakers-crypto-rustcrypto" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "964a5ea4c01f13129088c784b41928b93f6fd67b9a956314a899c677182c301c" -dependencies = [ - "aead", - "aes", - "ccm", - "hkdf", - "lakers-shared", - "p256", - "rand_core", - "sha2", -] - -[[package]] -name = "lakers-shared" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcdc5a0e1a5ea0387ab3e334f2061c633001db79e04d40af65bc68b41b13ef3a" -dependencies = [ - "log 0.4.22", -] - -[[package]] -name = "lalrpop" -version = "0.19.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1cbf952127589f2851ab2046af368fd20645491bb4b376f04b7f94d7a9837b" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax 0.6.29", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.19.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c48237b9604c5a4702de6b824e02006c3214327564636aef27c1028a8fa0ed" -dependencies = [ - "regex", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "ld-memory" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16187c4751af0c33941a689f3e922132b165729cfaa73f592fe5cce7393e9f0c" - -[[package]] -name = "lhash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libloading" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" -dependencies = [ - "cfg-if", - "windows-targets", -] - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "liboscore" -version = "0.1.0" -source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" -dependencies = [ - "bindgen", - "cbindgen", - "cc", - "coap-message", - "coap-message-implementations", - "coap-numbers", - "liboscore-cryptobackend", - "liboscore-msgbackend", - "pretty-hex", -] - -[[package]] -name = "liboscore-cryptobackend" -version = "0.1.0" -source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" -dependencies = [ - "aead", - "aes", - "aes-gcm", - "ccm", - "chacha20poly1305", - "crypto-common", - "heapless 0.7.17", - "hkdf", - "hmac", - "sha2", - "typenum", -] - -[[package]] -name = "liboscore-msgbackend" -version = "0.1.0" -source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" -dependencies = [ - "coap-message", - "coap-message-implementations", - "coap-numbers", -] - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - -[[package]] -name = "linked_list_allocator" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" - -[[package]] -name = "linkme" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c943daedff228392b791b33bba32e75737756e80a613e32e246c6ce9cbab20a" -dependencies = [ - "linkme-impl", -] - -[[package]] -name = "linkme-impl" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb26336e6dc7cc76e7927d2c9e7e3bb376d7af65a6f56a0b16c47d18a9b1abc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "litrs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "managed" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "microbit" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf51", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "microbit-v2" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "minicbor" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7005aaf257a59ff4de471a9d5538ec868a21586534fff7f85dd97d4043a6139" - -[[package]] -name = "minicbor" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ded7eb446d01ad767689ff97ac883a548f6e0d266f20a8cb593b67c9d2590b3" - -[[package]] -name = "minijinja" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e" -dependencies = [ - "serde", -] - -[[package]] -name = "minimal" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.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" -dependencies = [ - "adler", -] - -[[package]] -name = "mutex-trait" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4bb1638d419e12f8b1c43d9e639abd0d1424285bdea2f76aa231e233c63cd3a" - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "no-std-net" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nrf51" -version = "0.1.0" -dependencies = [ - "nrf51-pac", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "nrf51-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "137f187dc6ee482e27312086bd3c3a83e1c273512782cf131a61957f72fc4219" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52" -version = "0.1.0" -dependencies = [ - "ld-memory", - "nrf52832-pac", - "nrf52840-pac", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "nrf52805-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2da657648039d59f4de6bc31b948dd3a5d03b32529a4d5d19d9e2dd9d4bfa6c" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52810-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26b12d5af17a9f4bb9a06ca9a1f814bca3d67bc8715b23f8dc230b09a227666" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52811-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4179b2a7ed0b2fd5e109d0fab9b4fc55b3936b2a4916a9306d22e5bc8dc1fd8f" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52820-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4791cff995e6419a5ad1aebc3b3c9539d79125ca85eb5bfd2cff9b470b81071" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52832-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0242b685c9c15648fb803e155628f42ace457478b2cb930868f40cae2db925e0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52833-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10e1358255b360cdc816dd7b6ef81be8c8499c0998277e5249bed222bd0f5241" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52840-mdk" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "nrf52840-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30713f36f1be02e5bc9abefa30eae4a1f943d810f199d4923d3ad062d1be1b3d" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf52840dk" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "nrf52dk" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "nrf5340" -version = "0.1.0" -dependencies = [ - "ld-memory", - "riot-rs-debug", -] - -[[package]] -name = "nrf5340-app-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c88824573cd150fe9f27c1a48cea31a8cb24d3322df488875775143618c087a" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf5340-net-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c03e44df22fe5888109fe42e523162c7059adf4d30860f4f73ecc8b1fc16fe" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf5340dk" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf5340", - "riot-rs-debug", -] - -[[package]] -name = "nrf9120-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c012f18dc278aa33741722d374bc84e3d2d7694e29745f0bb83e56b2d6faf9b" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "nrf9160-pac" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7344d74afb5684e00c48d175cad9619f36d629cfb0687d33b4d1bb86fba688f4" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "object" -version = "0.36.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" -dependencies = [ - "flate2", - "memchr", - "ruzstd", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -dependencies = [ - "critical-section", - "portable-atomic", -] - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "elliptic-curve", - "primeorder", -] - -[[package]] -name = "panic-semihosting" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8a3e1233d9073d76a870223512ce4eeea43c067a94a445c13bd6d792d7b1ab" -dependencies = [ - "cortex-m", - "cortex-m-semihosting", -] - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "particle-xenon" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-rt", - "nrf52", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "petgraph" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" -dependencies = [ - "fixedbitset", - "indexmap 2.4.0", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "picoserve" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e6e8713f815d30bb77fa052cc8036a2b6429dc436969311fad47705fe0f2a" -dependencies = [ - "const-sha1", - "data-encoding", - "embassy-net", - "embassy-time", - "embedded-io-async", - "futures-util", - "heapless 0.8.0", - "lhash", - "log 0.4.22", - "ryu", - "serde", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pio" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" -dependencies = [ - "arrayvec", - "num_enum", - "paste", -] - -[[package]] -name = "pio-parser" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77532c2b8279aef98dfc7207ef15298a5a3d6b6cc76ccc8b65913d69f3a8dd6b" -dependencies = [ - "lalrpop", - "lalrpop-util", - "pio", - "regex-syntax 0.6.29", -] - -[[package]] -name = "pio-proc" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b04dc870fb3a4fd8b3e4ca8c61b53bc8ac4eb78b66805d2b3c2e5c4829e0d7a" -dependencies = [ - "codespan-reporting", - "lalrpop-util", - "pio", - "pio-parser", - "proc-macro-error", - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 1.0.109", -] - -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "portable-atomic" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" -dependencies = [ - "critical-section", -] - -[[package]] -name = "portable_atomic_enum" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" -dependencies = [ - "portable-atomic", - "portable_atomic_enum_macros", -] - -[[package]] -name = "portable_atomic_enum_macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "pretty-hex" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" - -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit 0.21.1", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r0" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] -name = "rand_pcg" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rbi" -version = "0.1.1" - -[[package]] -name = "redox_syscall" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "redox_users" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.4", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "ringbuf" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79abed428d1fd2a128201cec72c5f6938e2da607c6f3745f769fabea399d950a" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "ringbuffer" -version = "0.1.0" -dependencies = [ - "rbi", -] - -[[package]] -name = "riot-rs" -version = "0.1.0" -dependencies = [ - "document-features", - "linkme", - "riot-rs-bench", - "riot-rs-boards", - "riot-rs-debug", - "riot-rs-embassy", - "riot-rs-macros", - "riot-rs-random", - "riot-rs-rt", - "riot-rs-threads", - "riot-rs-utils", - "static_cell", -] - -[[package]] -name = "riot-rs-bench" -version = "0.1.0" -dependencies = [ - "cfg-if", - "cortex-m", - "defmt", -] - -[[package]] -name = "riot-rs-boards" -version = "0.1.0" -dependencies = [ - "ai-c3", - "cfg-if", - "dwm1001", - "espressif-esp32-c6-devkitc-1", - "linkme", - "microbit", - "microbit-v2", - "nrf52840-mdk", - "nrf52840dk", - "nrf52dk", - "nrf5340dk", - "particle-xenon", - "riot-rs-rt", - "rpi-pico", - "st-nucleo-f401re", - "st-nucleo-h755zi-q", - "st-nucleo-wb55", -] - -[[package]] -name = "riot-rs-chips" -version = "0.1.0" -dependencies = [ - "stm32f4xx", -] - -[[package]] -name = "riot-rs-debug" -version = "0.1.0" -dependencies = [ - "cortex-m", - "cortex-m-semihosting", - "defmt", - "defmt-rtt-target", - "esp-println", - "log 0.4.22", - "rtt-target", -] - -[[package]] -name = "riot-rs-embassy" -version = "0.1.0" -dependencies = [ - "cfg-if", - "critical-section", - "cyw43", - "cyw43-pio", - "embassy-executor", - "embassy-hal-internal", - "embassy-net", - "embassy-net-driver-channel", - "embassy-nrf", - "embassy-rp", - "embassy-stm32", - "embassy-sync 0.6.0", - "embassy-time", - "embassy-usb", - "embedded-hal 1.0.0", - "embedded-hal-async", - "esp-hal", - "esp-hal-embassy", - "esp-wifi", - "heapless 0.8.0", - "linkme", - "once_cell", - "portable-atomic", - "riot-rs-debug", - "riot-rs-macros", - "riot-rs-random", - "riot-rs-rt", - "riot-rs-threads", - "riot-rs-utils", - "static_cell", -] - -[[package]] -name = "riot-rs-macros" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "enum-iterator", - "heapless 0.8.0", - "proc-macro-crate", - "proc-macro2", - "quote", - "riot-rs", - "syn 2.0.75", - "trybuild", -] - -[[package]] -name = "riot-rs-random" -version = "0.1.0" -dependencies = [ - "embassy-sync 0.6.0", - "rand_chacha", - "rand_core", - "rand_pcg", -] - -[[package]] -name = "riot-rs-rt" -version = "0.1.0" -dependencies = [ - "cfg-if", - "cortex-m", - "cortex-m-rt", - "esp-hal", - "linkme", - "portable-atomic", - "riot-rs-boards", - "riot-rs-debug", - "riot-rs-threads", - "riot-rs-utils", - "rtt-target", -] - -[[package]] -name = "riot-rs-runqueue" -version = "0.1.2" -dependencies = [ - "defmt", -] - -[[package]] -name = "riot-rs-threads" -version = "0.1.0" -dependencies = [ - "cfg-if", - "cortex-m", - "cortex-m-rt", - "cortex-m-semihosting", - "critical-section", - "defmt", - "esp-hal", - "linkme", - "panic-semihosting", - "paste", - "riot-rs-runqueue", - "static_cell", -] - -[[package]] -name = "riot-rs-utils" -version = "0.1.0" -dependencies = [ - "const_panic", - "konst", -] - -[[package]] -name = "riscv" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9" -dependencies = [ - "critical-section", - "embedded-hal 1.0.0", -] - -[[package]] -name = "riscv-rt-macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d100d466dbb76681ef6a9386f3da9abc570d57394e86da0ba5af8c4408486d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "rp-pac" -version = "6.0.0" -source = "git+https://github.com/embassy-rs/rp-pac.git?rev=a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c#a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "rp2040" -version = "0.1.0" -dependencies = [ - "riot-rs-debug", - "riot-rs-embassy", - "riot-rs-rt", -] - -[[package]] -name = "rp2040-boot2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c92f344f63f950ee36cf4080050e4dce850839b9175da38f9d2ffb69b4dbb21" -dependencies = [ - "crc-any", -] - -[[package]] -name = "rpi-pico" -version = "0.1.0" -dependencies = [ - "riot-rs-debug", - "riot-rs-rt", - "rp2040", -] - -[[package]] -name = "rtt-target" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b34c9e6832388e45f3c01f1bb60a016384a0a4ad80cdd7d34913bed25037f0" -dependencies = [ - "critical-section", - "ufmt-write", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.23", -] - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "ruzstd" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5022b253619b1ba797f243056276bed8ed1a73b0f5a7ce7225d524067644bf8f" -dependencies = [ - "byteorder", - "twox-hash", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "scroll-ring" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eda0dff67036ba3b032aa68eb47ceb9b53b6e848445f53d10bf93e033b17df2" -dependencies = [ - "ringbuf", - "try-lock", -] - -[[package]] -name = "sdio-host" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "subtle", - "zeroize", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.208" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_cbor" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" -dependencies = [ - "half 1.8.3", - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.208" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "serde_json" -version = "1.0.125" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2-const-stable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "smoltcp" -version = "0.11.0" -source = "git+https://github.com/smoltcp-rs/smoltcp.git?rev=125773e282bc2e0c914a49e9c75573926e26e558#125773e282bc2e0c914a49e9c75573926e26e558" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "cfg-if", - "defmt", - "heapless 0.8.0", - "managed", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - -[[package]] -name = "ssmarshal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" -dependencies = [ - "encode_unicode", - "serde", -] - -[[package]] -name = "st-nucleo-f401re" -version = "0.1.0" -dependencies = [ - "embassy-stm32", - "riot-rs-debug", - "riot-rs-rt", -] - -[[package]] -name = "st-nucleo-h755zi-q" -version = "0.1.0" -dependencies = [ - "embassy-stm32", - "riot-rs-debug", - "riot-rs-embassy", - "riot-rs-rt", - "stm32", -] - -[[package]] -name = "st-nucleo-wb55" -version = "0.1.0" -dependencies = [ - "embassy-stm32", - "riot-rs-debug", - "riot-rs-embassy", - "riot-rs-rt", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static-alloc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2975e035ce16539eecee08d7c6e5626ca26f299c6e90af343b302c6dd2e61e" -dependencies = [ - "alloc-traits", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "static_cell" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "stm32" -version = "0.1.0" -dependencies = [ - "riot-rs-embassy", - "riot-rs-rt", -] - -[[package]] -name = "stm32-fmc" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c" -dependencies = [ - "embedded-hal 0.2.7", -] - -[[package]] -name = "stm32-metapac" -version = "15.0.0" -source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-5ef354f3e49f790e47f5c818f243459742c9b83b#d94c7ea2bd05428ba9fd2b5a39edb8ed99f65daa" -dependencies = [ - "cortex-m", - "cortex-m-rt", -] - -[[package]] -name = "stm32f4" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb94729242cd1aebe6dab42a2ca0131985ae93bc3ab2751b680df724bb35528d" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "vcell", -] - -[[package]] -name = "stm32f4xx" -version = "0.1.0" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "stm32f4xx-hal", -] - -[[package]] -name = "stm32f4xx-hal" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed60591531f4da636d828701c74861a3d100e5c4e36677cadbd2eb6f46eb67" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "document-features", - "embedded-dma", - "embedded-hal 0.2.7", - "embedded-hal 1.0.0", - "embedded-hal-nb", - "embedded-storage", - "enumflags2", - "fugit", - "fugit-timer", - "nb 1.1.0", - "rand_core", - "stm32f4", - "time", - "vcell", - "void", -] - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared", - "precomputed-hash", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros 0.26.4", -] - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.75", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "tests_gpio" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" - -[[package]] -name = "thiserror" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "threading" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "threading-channel" -version = "0.1.0" -dependencies = [ - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.20", -] - -[[package]] -name = "toml-cfg" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68c587298ddd135c156e92e8c3eae69614d6eecea8e2d8a09daab011e5e6a21d" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "serde", - "syn 2.0.75", - "toml 0.8.19", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.4.0", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap 2.4.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.18", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "trybuild" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "207aa50d36c4be8d8c6ea829478be44a372c6a77669937bb39c698e52f1491e8" -dependencies = [ - "glob", - "serde", - "serde_derive", - "serde_json", - "termcolor", - "toml 0.8.19", -] - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "typewit" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" -dependencies = [ - "typewit_proc_macros", -] - -[[package]] -name = "typewit_proc_macros" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" - -[[package]] -name = "ufmt-write" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "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 = "usb-serial" -version = "0.1.0" -dependencies = [ - "embassy-executor", - "embassy-time", - "riot-rs", - "riot-rs-boards", -] - -[[package]] -name = "usbd-hid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" -dependencies = [ - "serde", - "ssmarshal", - "usb-device", - "usbd-hid-macros", -] - -[[package]] -name = "usbd-hid-descriptors" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed" -dependencies = [ - "bitfield 0.14.0", -] - -[[package]] -name = "usbd-hid-macros" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38" -dependencies = [ - "byteorder", - "hashbrown 0.13.2", - "log 0.4.22", - "proc-macro2", - "quote", - "serde", - "syn 1.0.109", - "usbd-hid-descriptors", -] - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" -dependencies = [ - "vcell", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windowed-infinity" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9487d1d565a9db59e1fd0b3c2d3f0c277bc375d348a6c46ff2b322917fbc035" -dependencies = [ - "ciborium-io", - "crc", - "digest", - "embedded-io 0.4.0", - "minicbor 0.19.1", - "serde", - "serde_cbor", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -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", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[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_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[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_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "xtensa-lx" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e758f94e1a1f71758f94052a2766dcb12604998eb372b8b2e30576e3ab1ba1e6" -dependencies = [ - "bare-metal 1.0.0", - "mutex-trait", - "spin", -] - -[[package]] -name = "xtensa-lx-rt" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904102108b780c9a5e3275c5f3c63dc348ec43ae5da5237868515498b447d51a" -dependencies = [ - "bare-metal 1.0.0", - "core-isa-parser", - "minijinja", - "r0", - "xtensa-lx-rt-proc-macros", -] - -[[package]] -name = "xtensa-lx-rt-proc-macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "082cdede098bbec9af15b0e74085e5f3d16f2923597de7aed7b8112003af2da7" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 6403a003a..6fa249131 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ portable-atomic = { version = "1.6.0", default-features = false, features = [ "require-cas", ] } +embassy-embedded-hal = { version = "0.1.0", default-features = false } embassy-executor = { version = "0.6", default-features = false } embassy-futures = { version = "0.1.1", default-features = false } embassy-hal-internal = { version = "0.2.0", default-features = false } diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index e8aa2302e..4e4c8c114 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -12,8 +12,14 @@ critical-section.workspace = true linkme.workspace = true static_cell.workspace = true cfg-if.workspace = true +<<<<<<< HEAD portable-atomic.workspace = true +||||||| parent of 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) +======= +paste.workspace = true +>>>>>>> 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) +embassy-embedded-hal = { workspace = true } embassy-executor = { workspace = true, features = ["nightly"] } embassy-hal-internal = { workspace = true } @@ -26,7 +32,11 @@ embassy-sync = { workspace = true } embassy-time = { workspace = true, optional = true } embassy-usb = { workspace = true, optional = true } +<<<<<<< HEAD embedded-hal = { workspace = true } +||||||| parent of 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) +======= +>>>>>>> 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) embedded-hal-async = { workspace = true } riot-rs-threads = { path = "../riot-rs-threads", optional = true } diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs new file mode 100644 index 000000000..69fddd6af --- /dev/null +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -0,0 +1,102 @@ +use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; +use embassy_nrf::{ + bind_interrupts, + gpio::Pin as GpioPin, + peripherals, + twim::{InterruptHandler, Twim}, +}; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embedded_hal_async::i2c::Operation; + +use crate::i2c::impl_async_i2c_for_driver_enum; + +pub use embassy_nrf::twim::Frequency; + +// TODO: factor this out (across archs)? +// TODO: do we need a CriticalSectionRawMutex here? +pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, I2c>; + +#[non_exhaustive] +#[derive(Clone)] +pub struct Config { + pub frequency: Frequency, + pub sda_pullup: bool, + pub scl_pullup: bool, + pub sda_high_drive: bool, + pub scl_high_drive: bool, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::K100, + sda_pullup: false, + scl_pullup: false, + sda_high_drive: false, + scl_high_drive: false, + } + } +} + +macro_rules! define_i2c_drivers { + ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + pub struct [] { + twim: Twim<'static, peripherals::$peripheral>, + } + + impl [] { + #[must_use] + pub fn new( + twim_peripheral: peripherals::$peripheral, + sda_pin: impl GpioPin, + scl_pin: impl GpioPin, + config: Config, + ) -> Self { + let mut twim_config = embassy_nrf::twim::Config::default(); + twim_config.frequency = config.frequency; + twim_config.sda_pullup = config.sda_pullup; + twim_config.scl_pullup = config.scl_pullup; + twim_config.sda_high_drive = config.sda_high_drive; + twim_config.scl_high_drive = config.scl_high_drive; + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); + + let twim = Twim::new(twim_peripheral, Irqs, sda_pin, scl_pin, twim_config); + + Self { twim } + } + } + )* + + pub enum I2c { + $( $peripheral([]), )* + } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_nrf::twim::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + } + } +} + +// FIXME: support other nRF archs +// Define a driver per peripheral +#[cfg(context = "nrf52840")] +define_i2c_drivers!( + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => TWISPI0, + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 => TWISPI1, +); +#[cfg(context = "nrf5340")] +define_i2c_drivers!( + SERIAL0 => SERIAL0, + SERIAL1 => SERIAL1, +); diff --git a/src/riot-rs-embassy/src/arch/nrf/mod.rs b/src/riot-rs-embassy/src/arch/nrf/mod.rs index 8098b9e50..730b7684d 100644 --- a/src/riot-rs-embassy/src/arch/nrf/mod.rs +++ b/src/riot-rs-embassy/src/arch/nrf/mod.rs @@ -1,4 +1,6 @@ pub mod gpio; +pub mod i2c; +pub mod spi; pub mod peripheral { pub use embassy_nrf::Peripheral; diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs new file mode 100644 index 000000000..d176d3d50 --- /dev/null +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -0,0 +1,140 @@ +use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; +use embassy_nrf::{ + bind_interrupts, + gpio::{self, Pin as GpioPin}, + peripherals, + spim::{InterruptHandler, Spim, MODE_0, MODE_1, MODE_2, MODE_3}, +}; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; + +use crate::spi::impl_async_spibus_for_driver_enum; + +pub use embassy_nrf::spim::Frequency; + +// TODO: factor this out across archs? +pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, Spi, gpio::Output<'static>>; + +#[derive(Clone)] +#[non_exhaustive] +pub struct Config { + pub frequency: Frequency, + pub mode: Mode, + pub bit_order: BitOrder, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::M1, + mode: Mode::Mode0, + bit_order: BitOrder::MsbFirst, + } + } +} + +#[derive(Copy, Clone)] +pub enum Mode { + Mode0, + Mode1, + Mode2, + Mode3, +} + +// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers +impl From for embassy_nrf::spim::Mode { + fn from(mode: Mode) -> Self { + match mode { + Mode::Mode0 => MODE_0, + Mode::Mode1 => MODE_1, + Mode::Mode2 => MODE_2, + Mode::Mode3 => MODE_3, + } + } +} + +#[derive(Copy, Clone)] +pub enum BitOrder { + MsbFirst, + LsbFirst, +} + +impl From for embassy_nrf::spim::BitOrder { + fn from(bit_order: BitOrder) -> Self { + match bit_order { + BitOrder::MsbFirst => embassy_nrf::spim::BitOrder::MSB_FIRST, + BitOrder::LsbFirst => embassy_nrf::spim::BitOrder::LSB_FIRST, + } + } +} + +macro_rules! define_spi_drivers { + ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + pub struct [] { + spim: Spim<'static, peripherals::$peripheral>, + } + + impl [] { + #[must_use] + pub fn new( + spim_peripheral: peripherals::$peripheral, + sck_pin: impl GpioPin, + miso_pin: impl GpioPin, + mosi_pin: impl GpioPin, + config: Config, + ) -> Self { + let mut spi_config = embassy_nrf::spim::Config::default(); + spi_config.frequency = config.frequency; + spi_config.mode = config.mode.into(); + spi_config.bit_order = config.bit_order.into(); + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); + + let spim = Spim::new( + spim_peripheral, + Irqs, + sck_pin, + miso_pin, + mosi_pin, + spi_config, + ); + + Self { spim } + } + } + )* + + pub enum Spi { + $( $peripheral([]), )* + } + + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_nrf::spim::Error; + } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + } + }; +} + +// FIXME: support other nRF archs +// Define a driver per peripheral +#[cfg(context = "nrf52840")] +define_spi_drivers!( + // FIXME + // SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => TWISPI0, + // SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 => TWISPI1, + SPIM2_SPIS2_SPI2 => SPI2, + SPIM3 => SPI3, +); +#[cfg(context = "nrf5340")] +define_spi_drivers!( + SERIAL2 => SERIAL2, + SERIAL3 => SERIAL3, +); diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs new file mode 100644 index 000000000..987f85032 --- /dev/null +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -0,0 +1,93 @@ +use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; +use embassy_rp::{ + bind_interrupts, + i2c::{InterruptHandler, SclPin, SdaPin}, + peripherals, +}; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embedded_hal_async::i2c::Operation; + +use crate::i2c::impl_async_i2c_for_driver_enum; + +// TODO: factor this out (across archs)? +// TODO: do we need a CriticalSectionRawMutex here? +pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, I2c>; + +// We do not provide configuration for internal pull-ups as the RP2040 datasheet mentions in +// section 4.3.1.3 that the GPIO used should have pull-ups enabled. +#[derive(Clone)] +#[non_exhaustive] +pub struct Config { + pub frequency: Frequency, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::K100, + } + } +} + +// Possible values are copied from embassy-nrf +// TODO: check how well this matches the RP2040 capabilities +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K100 = 100_000, + K250 = 250_000, + K400 = 400_000, +} + +macro_rules! define_i2c_drivers { + ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + pub struct [] { + twim: embassy_rp::i2c::I2c<'static, peripherals::$peripheral, embassy_rp::i2c::Async>, + } + + impl [] { + #[must_use] + pub fn new( + i2c_peripheral: peripherals::$peripheral, + sda_pin: impl SdaPin, + scl_pin: impl SclPin, + config: Config, + ) -> Self { + let mut i2c_config = embassy_rp::i2c::Config::default(); + i2c_config.frequency = config.frequency as u32; + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); + + let i2c = + embassy_rp::i2c::I2c::new_async(i2c_peripheral, scl_pin, sda_pin, Irqs, i2c_config); + + Self { twim: i2c } + } + } + )* + + pub enum I2c { + $( $peripheral([]), )* + } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_rp::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + } + } +} + +// Define a driver per peripheral +define_i2c_drivers!( + I2C0_IRQ => I2C0, + I2C1_IRQ => I2C1, +); diff --git a/src/riot-rs-embassy/src/arch/rp2040/mod.rs b/src/riot-rs-embassy/src/arch/rp2040/mod.rs index 7276b3d7f..9e4be8292 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/mod.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/mod.rs @@ -1,4 +1,6 @@ pub mod gpio; +pub mod i2c; +pub mod spi; pub mod peripheral { pub use embassy_rp::Peripheral; diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs new file mode 100644 index 000000000..24145258f --- /dev/null +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -0,0 +1,123 @@ +use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; +use embassy_rp::{ + dma, gpio, peripherals, + spi::{Async, ClkPin, MisoPin, MosiPin, Phase, Polarity, Spi as InnerSpi}, +}; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; + +use crate::spi::impl_async_spibus_for_driver_enum; + +// TODO: factor this out across archs? +pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, Spi, gpio::Output<'static>>; + +#[derive(Clone)] +#[non_exhaustive] +pub struct Config { + pub frequency: Frequency, + pub mode: Mode, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::M1, + mode: Mode::Mode0, + } + } +} + +// Possible values are copied from embassy-nrf +// TODO: check how well this matches the RP2040 capabilities +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K125 = 125_000, + K250 = 250_000, + K500 = 500_00, + M1 = 1_000_000, + M2 = 2_000_000, + M4 = 4_000_000, + M8 = 8_000_000, + M16 = 16_000_000, + M32 = 32_000_000, +} + +#[derive(Copy, Clone)] +pub enum Mode { + Mode0, + Mode1, + Mode2, + Mode3, +} + +// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers +impl From for (Polarity, Phase) { + fn from(mode: Mode) -> Self { + match mode { + Mode::Mode0 => (Polarity::IdleLow, Phase::CaptureOnFirstTransition), + Mode::Mode1 => (Polarity::IdleLow, Phase::CaptureOnSecondTransition), + Mode::Mode2 => (Polarity::IdleHigh, Phase::CaptureOnFirstTransition), + Mode::Mode3 => (Polarity::IdleHigh, Phase::CaptureOnSecondTransition), + } + } +} + +macro_rules! define_spi_drivers { + ($( $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + pub struct [] { + spim: InnerSpi<'static, peripherals::$peripheral, Async>, + } + + impl [] { + #[must_use] + pub fn new( + spi_peripheral: peripherals::$peripheral, + sck_pin: impl ClkPin, + miso_pin: impl MisoPin, + mosi_pin: impl MosiPin, + tx_dma: impl dma::Channel, + rx_dma: impl dma::Channel, + config: Config, + ) -> Self { + let (pol, phase) = config.mode.into(); + + let mut spi_config = embassy_rp::spi::Config::default(); + spi_config.frequency = config.frequency as u32; + spi_config.polarity = pol; + spi_config.phase = phase; + + // The order of MOSI/MISO pins is inverted. + let spi = InnerSpi::new( + spi_peripheral, + sck_pin, + mosi_pin, + miso_pin, + tx_dma, + rx_dma, + spi_config, + ); + + Self { spim: spi } + } + } + )* + + // Each enum variant is for a specific peripheral. + pub enum Spi { + $( $peripheral([]), )* + } + + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_rp::spi::Error; + } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + } + }; +} + +// Define a driver per peripheral +define_spi_drivers!(SPI0, SPI1); diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs new file mode 100644 index 000000000..09ccaad6f --- /dev/null +++ b/src/riot-rs-embassy/src/i2c.rs @@ -0,0 +1,39 @@ +macro_rules! impl_async_i2c_for_driver_enum { + ($driver_enum:ident, $( $peripheral:ident ),*) => { + impl embedded_hal_async::i2c::I2c for $driver_enum { + async fn read(&mut self, address: u8, read: &mut [u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(i2c) => i2c.twim.read(address, read).await, )* + } + } + + async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(i2c) => i2c.twim.write(address, write).await, )* + } + } + + async fn write_read( + &mut self, + address: u8, + write: &[u8], + read: &mut [u8], + ) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(i2c) => i2c.twim.write_read(address, write, read).await, )* + } + } + + async fn transaction( + &mut self, + address: u8, + operations: &mut [Operation<'_>], + ) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(i2c) => i2c.twim.transaction(address, operations).await, )* + } + } + } + } +} +pub(crate) use impl_async_i2c_for_driver_enum; diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index ca124c3c9..1bc45e96c 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -7,6 +7,9 @@ #![feature(lint_reasons)] #![feature(trait_alias)] +mod i2c; +mod spi; + pub mod define_peripherals; pub mod gpio; diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs new file mode 100644 index 000000000..fa9fc3898 --- /dev/null +++ b/src/riot-rs-embassy/src/spi.rs @@ -0,0 +1,37 @@ +macro_rules! impl_async_spibus_for_driver_enum { + ($driver_enum:ident, $( $peripheral:ident ),*) => { + impl embedded_hal_async::spi::SpiBus for $driver_enum { + async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(spi) => spi.spim.read(words).await, )* + } + } + + async fn write(&mut self, data: &[u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(spi) => spi.spim.write(data).await, )* + } + } + + async fn transfer(&mut self, rx: &mut [u8], tx: &[u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(spi) => spi.spim.transfer(rx, tx).await, )* + } + } + + async fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { + match self { + $( Self::$peripheral(spi) => spi.spim.transfer_in_place(words).await, )* + } + } + + async fn flush(&mut self) -> Result<(), Self::Error> { + use embedded_hal_async::spi::SpiBus; + match self { + $( Self::$peripheral(spi) => SpiBus::flush(&mut spi.spim).await, )* + } + } + } + } +} +pub(crate) use impl_async_spibus_for_driver_enum; From c1211fc3977a10c731fb1e047d20fb7bc0b8b615 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 11 Jun 2024 15:43:07 +0200 Subject: [PATCH 03/95] feat(example): add an example testing SPI --- Cargo.lock | 4271 ++++++++++++++++++++++++++++++++ Cargo.toml | 3 + examples/laze.yml | 1 + examples/spi-bus/Cargo.toml | 17 + examples/spi-bus/README.md | 14 + examples/spi-bus/laze.yml | 8 + examples/spi-bus/src/main.rs | 79 + src/riot-rs-embassy/Cargo.toml | 4 +- 8 files changed, 4394 insertions(+), 3 deletions(-) create mode 100644 Cargo.lock create mode 100644 examples/spi-bus/Cargo.toml create mode 100644 examples/spi-bus/README.md create mode 100644 examples/spi-bus/laze.yml create mode 100644 examples/spi-bus/src/main.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..c98962eef --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4271 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array 0.14.7", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "ai-c3" +version = "0.1.0" +dependencies = [ + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "alloc-traits" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2d54853319fd101b8dd81de382bcbf3e03410a64d8928bbee85a3e7dcde483" + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "as-slice" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0" +dependencies = [ + "generic-array 0.12.4", + "generic-array 0.13.3", + "generic-array 0.14.7", + "stable_deref_trait", +] + +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version 0.2.3", +] + +[[package]] +name = "bare-metal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "basic-toml" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +dependencies = [ + "serde", +] + +[[package]] +name = "bench_sched_yield" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "benchmark" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "bindgen" +version = "0.63.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 1.0.109", + "which", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitfield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" + +[[package]] +name = "bitfield" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c821a6e124197eb56d907ccc2188eab1038fb919c914f47976e64dd8dbc855d1" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "bytemuck" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cbindgen" +version = "0.24.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" +dependencies = [ + "clap", + "heck 0.4.1", + "indexmap 1.9.3", + "log", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 1.0.109", + "tempfile", + "toml 0.5.11", +] + +[[package]] +name = "cc" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" + +[[package]] +name = "ccm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" +dependencies = [ + "aead", + "cipher", + "ctr", + "subtle", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_lex", + "indexmap 1.9.3", + "strsim 0.10.0", + "termcolor", + "textwrap", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clist" +version = "0.1.1" +dependencies = [ + "memoffset", +] + +[[package]] +name = "coap" +version = "0.1.0" +dependencies = [ + "coap-handler", + "coap-handler-implementations", + "coap-message", + "coap-message-demos", + "coap-message-implementations", + "coap-message-utils", + "coap-numbers", + "coap-request", + "coap-request-implementations", + "embassy-executor", + "embassy-futures", + "embassy-net", + "embassy-time", + "embedded-io-async", + "embedded-nal-async", + "embedded-nal-coap", + "heapless 0.8.0", + "hexlit", + "lakers", + "lakers-crypto-rustcrypto", + "liboscore", + "liboscore-msgbackend", + "minicbor 0.23.0", + "riot-rs", + "riot-rs-boards", + "smoltcp", + "static-alloc", +] + +[[package]] +name = "coap-handler" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8600ae8e54c9be6e0c5273fad0503e12f827742e4e3fea5a521412478d603b72" +dependencies = [ + "coap-message", + "coap-numbers", +] + +[[package]] +name = "coap-handler-implementations" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2735f53da500caae442466ba2126d62458e86116ec1e273919880410f7e187b" +dependencies = [ + "ciborium-io", + "coap-handler", + "coap-message", + "coap-message-utils", + "coap-numbers", + "crc", + "document-features", + "embedded-io 0.4.0", + "minicbor 0.19.1", + "serde", + "serde_cbor", + "windowed-infinity", +] + +[[package]] +name = "coap-message" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e126d86a35f4c5dfcf454da6c9c58a6e703150989e536945ef3813f2bc60565" +dependencies = [ + "num-traits", +] + +[[package]] +name = "coap-message-demos" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c49342f485367852eb9d5acb6545d0107b5565752c70a9600cf7e58f00482c9a" +dependencies = [ + "coap-handler", + "coap-handler-implementations", + "coap-message", + "coap-message-utils", + "coap-numbers", + "coap-request", + "heapless 0.7.17", + "serde", +] + +[[package]] +name = "coap-message-implementations" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629d4712119f87dc00483b57125b6950da114e1056a47001759d04d4b43b3644" +dependencies = [ + "coap-message", + "coap-message-utils", + "coap-numbers", + "document-features", + "heapless 0.5.6", +] + +[[package]] +name = "coap-message-utils" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c96a677ba0cb9f3acd6cf6bc7c93f349cb0ce24a2bc032228404cfe96d145e7" +dependencies = [ + "coap-message", + "coap-numbers", + "document-features", + "heapless 0.5.6", + "minicbor 0.19.1", +] + +[[package]] +name = "coap-numbers" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d78a5634393ab2c11d173d66107200a730e200a3b3ca063c344d4459c90a5f9" + +[[package]] +name = "coap-request" +version = "0.2.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58d76d947d49b867e8f0268cbd690156fe506335247b538284551fe404d2d16c" +dependencies = [ + "coap-message", +] + +[[package]] +name = "coap-request-implementations" +version = "0.1.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc15c3be00d32fe7c2b58a7546eff18fb1f3e7d2dea74d91eaacd4346960851f" +dependencies = [ + "coap-message", + "coap-message-utils", + "coap-numbers", + "coap-request", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-sha1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" + +[[package]] +name = "const_panic" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" + +[[package]] +name = "core-isa-parser" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ec98e54b735872e54b2335c2e5a5c7fa7d9c3bfd45500f75280f84089a0083" +dependencies = [ + "anyhow", + "enum-as-inner", + "regex", + "strum 0.24.1", + "strum_macros 0.24.3", +] + +[[package]] +name = "core-sizes" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal 0.2.5", + "bitfield 0.13.2", + "critical-section", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cortex-m-semihosting" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0" +dependencies = [ + "cortex-m", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-any" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" +dependencies = [ + "debug-helper", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array 0.14.7", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "cyw43" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "embassy-futures", + "embassy-net-driver-channel", + "embassy-sync 0.6.0", + "embassy-time", + "embedded-hal 1.0.0", + "futures", + "heapless 0.8.0", + "num_enum", +] + +[[package]] +name = "cyw43-pio" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "cyw43", + "embassy-rp", + "fixed", + "pio", + "pio-proc", +] + +[[package]] +name = "darling" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.66", +] + +[[package]] +name = "darling_macro" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "debug-helper" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "document-features" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" +dependencies = [ + "litrs", +] + +[[package]] +name = "dwm1001" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array 0.14.7", + "group", + "hkdf", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "embassy" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-sync 0.5.0", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "embassy-embedded-hal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d" +dependencies = [ + "embassy-futures", + "embassy-sync 0.5.0", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-executor" +version = "0.5.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "cortex-m", + "critical-section", + "document-features", + "embassy-executor-macros", + "embassy-time-driver", + "embassy-time-queue-driver", +] + +[[package]] +name = "embassy-executor-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad454accf80050e9cf7a51e994132ba0e56286b31f9317b68703897c328c59b5" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "embassy-futures" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" + +[[package]] +name = "embassy-hal-internal" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "cortex-m", + "critical-section", + "num-traits", +] + +[[package]] +name = "embassy-http-server" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-net", + "embassy-nrf", + "embassy-sync 0.5.0", + "embassy-time", + "embedded-io-async", + "heapless 0.8.0", + "httparse", + "picoserve", + "riot-rs", + "riot-rs-boards", + "serde", + "static_cell", +] + +[[package]] +name = "embassy-net" +version = "0.4.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "document-features", + "embassy-net-driver", + "embassy-sync 0.6.0", + "embassy-time", + "embedded-io-async", + "embedded-nal-async", + "heapless 0.8.0", + "managed", + "smoltcp", +] + +[[package]] +name = "embassy-net-driver" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" + +[[package]] +name = "embassy-net-driver-channel" +version = "0.2.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "embassy-futures", + "embassy-net-driver", + "embassy-sync 0.6.0", +] + +[[package]] +name = "embassy-net-tcp" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-net", + "embassy-time", + "embedded-io-async", + "heapless 0.8.0", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "embassy-net-udp" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-net", + "embassy-time", + "embedded-io-async", + "heapless 0.8.0", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "embassy-nrf" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "document-features", + "embassy-embedded-hal", + "embassy-hal-internal", + "embassy-sync 0.6.0", + "embassy-time", + "embassy-time-driver", + "embassy-usb-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-io 0.6.1", + "embedded-io-async", + "embedded-storage", + "embedded-storage-async", + "fixed", + "nrf51-pac", + "nrf52805-pac", + "nrf52810-pac", + "nrf52811-pac", + "nrf52820-pac", + "nrf52832-pac", + "nrf52833-pac", + "nrf52840-pac", + "nrf5340-app-pac", + "nrf5340-net-pac", + "nrf9160-pac", + "rand_core", +] + +[[package]] +name = "embassy-rp" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "atomic-polyfill", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "document-features", + "embassy-embedded-hal", + "embassy-futures", + "embassy-hal-internal", + "embassy-sync 0.6.0", + "embassy-time", + "embassy-time-driver", + "embassy-usb-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io 0.6.1", + "embedded-io-async", + "embedded-storage", + "embedded-storage-async", + "fixed", + "nb 1.1.0", + "pio", + "pio-proc", + "rand_core", + "rp-pac", + "rp2040-boot2", +] + +[[package]] +name = "embassy-sync" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0" +dependencies = [ + "cfg-if", + "critical-section", + "futures-util", + "heapless 0.7.17", +] + +[[package]] +name = "embassy-sync" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd938f25c0798db4280fcd8026bf4c2f48789aebf8f77b6e5cf8a7693ba114ec" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-sync" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3e0c49ff02ebe324faf3a8653ba91582e2d0a7fdef5bc88f449d5aa1bfcc05c" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-time" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "274c019608a9004aed3cafc871e2a3c87ce9351d537dcaab4cc5db184d4a04b1" +dependencies = [ + "cfg-if", + "critical-section", + "document-features", + "embassy-time-driver", + "embassy-time-queue-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-time-driver" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "document-features", +] + +[[package]] +name = "embassy-time-queue-driver" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" + +[[package]] +name = "embassy-usb" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1587e58ed8f7e0215246e6bb8d7ef4837db682e209e5ef7410a81c500dc949e5" +dependencies = [ + "embassy-futures", + "embassy-net-driver-channel", + "embassy-sync 0.5.0", + "embassy-usb-driver", + "heapless 0.8.0", + "ssmarshal", + "usbd-hid", +] + +[[package]] +name = "embassy-usb-driver" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" + +[[package]] +name = "embassy-usb-keyboard" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-nrf", + "embassy-sync 0.5.0", + "embassy-time", + "embassy-usb", + "riot-rs", + "riot-rs-boards", + "static_cell", + "usbd-hid", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "embedded-dma" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c8c02e4347a0267ca60813c952017f4c5948c232474c6010a381a337f1bda4" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "embedded-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" +dependencies = [ + "embedded-hal 1.0.0", + "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-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io 0.6.1", +] + +[[package]] +name = "embedded-nal" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a943fad5ed3d3f8a00f1e80f6bba371f1e7f0df28ec38477535eb318dc19cc" +dependencies = [ + "nb 1.1.0", + "no-std-net", +] + +[[package]] +name = "embedded-nal-async" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72229137a4fc12d239b0b7f50f04b30790678da6d782a0f3f1909bf57ec4b759" +dependencies = [ + "embedded-io-async", + "embedded-nal", + "no-std-net", +] + +[[package]] +name = "embedded-nal-coap" +version = "0.1.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1954b4c5d15dd2db0267ae813883dc679ba9e135d3c16c335e13af0b7d5335e2" +dependencies = [ + "coap-handler", + "coap-message", + "coap-message-implementations", + "coap-numbers", + "coap-request", + "embassy-futures", + "embassy-sync 0.3.0", + "embedded-nal-async", + "heapless 0.7.17", + "rand_core", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", +] + +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enum-iterator" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "enumset" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "esp-build" +version = "0.1.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +dependencies = [ + "quote", + "syn 2.0.66", + "termcolor", +] + +[[package]] +name = "esp-hal" +version = "0.17.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +dependencies = [ + "basic-toml", + "bitfield 0.15.0", + "bitflags 2.5.0", + "cfg-if", + "critical-section", + "document-features", + "embassy-executor", + "embassy-futures", + "embassy-sync 0.5.0", + "embassy-time-driver", + "embedded-can", + "embedded-dma 0.2.0", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io 0.6.1", + "embedded-io-async", + "enumset", + "esp-build", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c3", + "esp32c6", + "fugit", + "log", + "nb 1.1.0", + "paste", + "portable-atomic", + "rand_core", + "riscv", + "serde", + "strum 0.26.2", + "void", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.10.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "esp-metadata" +version = "0.1.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +dependencies = [ + "basic-toml", + "lazy_static", + "serde", + "strum 0.26.2", +] + +[[package]] +name = "esp-println" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98f0f58453dd2ce08d99228fc8757fad39d05dfd26643665d1093b8844f42cc" +dependencies = [ + "critical-section", + "log", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.8.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-wifi" +version = "0.5.1" +source = "git+https://github.com/kaspar030/esp-wifi?branch=for-riot-rs-240517#27bceae1171c238c41914b4aeeed37736343cc6a" +dependencies = [ + "atomic-waker", + "cfg-if", + "critical-section", + "embassy-futures", + "embassy-net-driver", + "embassy-sync 0.5.0", + "embedded-hal 0.2.7", + "embedded-io 0.6.1", + "embedded-io-async", + "enumset", + "esp-hal", + "esp-wifi-sys", + "fugit", + "futures-util", + "heapless 0.8.0", + "libm", + "linked_list_allocator", + "log", + "no-std-net", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "toml-cfg", +] + +[[package]] +name = "esp-wifi-sys" +version = "0.3.0" +source = "git+https://github.com/kaspar030/esp-wifi?branch=for-riot-rs-240517#27bceae1171c238c41914b4aeeed37736343cc6a" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32c3" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c22d8c27e7d675ef79db212b9e41df80aef6db1a5c819e4e726735f64ee0700" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c6" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acb7fd83dcdaf1d904f789b2739b646134ec8346fdde2150b7903ef049d81d13" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "example-random" +version = "0.1.0" +dependencies = [ + "rand", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "expressif-esp32-c6-devkitc-1" +version = "0.1.0" +dependencies = [ + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fixed" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +dependencies = [ + "az", + "bytemuck", + "half 2.4.1", + "typenum", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fugit" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +dependencies = [ + "gcd", +] + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +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" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hash32" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +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.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heapless" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74911a68a1658cfcfb61bc0ccfbd536e3b6e906f8c2f7883ee50157e3e2184f1" +dependencies = [ + "as-slice", + "generic-array 0.13.3", + "hash32 0.1.1", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32 0.2.1", + "rustc_version 0.4.0", + "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", + "portable-atomic", + "serde", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hello-world" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "hello-world-async" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hexlit" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b6e75c860d4216ac53f9ac88b25c99eaedba075b3a7b2ed31f2adc51a74fffd" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "konst" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50a0ba6de5f7af397afff922f22c149ff605c766cd3269cf6c1cd5e466dbe3b9" +dependencies = [ + "const_panic", + "konst_kernel", + "typewit", +] + +[[package]] +name = "konst_kernel" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0a455a1719220fd6adf756088e1c69a85bf14b6a9e24537a5cc04f503edb2b" +dependencies = [ + "typewit", +] + +[[package]] +name = "lakers" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "905e14c2e72626a749cfe6e0b64454ac2e51de3e36cc2ba077b0abc5af5fa535" +dependencies = [ + "lakers-shared", +] + +[[package]] +name = "lakers-crypto-rustcrypto" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6523b65ffa787062edf5907ce9e8500bde82eb3880d3c5d01e2119da12c4653a" +dependencies = [ + "aead", + "aes", + "ccm", + "hkdf", + "lakers-shared", + "p256", + "rand_core", + "sha2", +] + +[[package]] +name = "lakers-shared" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ddf0b16bd9c88daa047e2ac190ff90fd685990a14ab8b47dfa6ecc28b43247" + +[[package]] +name = "lalrpop" +version = "0.19.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a1cbf952127589f2851ab2046af368fd20645491bb4b376f04b7f94d7a9837b" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.6.29", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.19.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3c48237b9604c5a4702de6b824e02006c3214327564636aef27c1028a8fa0ed" +dependencies = [ + "regex", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "ld-memory" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16187c4751af0c33941a689f3e922132b165729cfaa73f592fe5cce7393e9f0c" + +[[package]] +name = "lhash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "liboscore" +version = "0.1.0" +source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" +dependencies = [ + "bindgen", + "cbindgen", + "cc", + "coap-message", + "coap-message-implementations", + "coap-numbers", + "liboscore-cryptobackend", + "liboscore-msgbackend", + "pretty-hex", +] + +[[package]] +name = "liboscore-cryptobackend" +version = "0.1.0" +source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" +dependencies = [ + "aead", + "aes", + "aes-gcm", + "ccm", + "chacha20poly1305", + "crypto-common", + "heapless 0.7.17", + "hkdf", + "hmac", + "sha2", + "typenum", +] + +[[package]] +name = "liboscore-msgbackend" +version = "0.1.0" +source = "git+https://gitlab.com/oscore/liboscore/?rev=e7a4ecd037cbb9c7f085047fec5896f4bdc68d50#e7a4ecd037cbb9c7f085047fec5896f4bdc68d50" +dependencies = [ + "coap-message", + "coap-message-implementations", + "coap-numbers", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.5.0", + "libc", +] + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + +[[package]] +name = "linkme" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb76662d78edc9f9bf56360d6919bdacc8b7761227727e5082f128eeb90bbf5" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dccda732e04fa3baf2e17cf835bfe2601c7c2edafd64417c627dabae3a8cda" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "microbit" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf51", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "microbit-v2" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "minicbor" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7005aaf257a59ff4de471a9d5538ec868a21586534fff7f85dd97d4043a6139" + +[[package]] +name = "minicbor" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ded7eb446d01ad767689ff97ac883a548f6e0d266f20a8cb593b67c9d2590b3" + +[[package]] +name = "minijinja" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e" +dependencies = [ + "serde", +] + +[[package]] +name = "minimal" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "no-std-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nrf51" +version = "0.1.0" +dependencies = [ + "nrf51-pac", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "nrf51-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "137f187dc6ee482e27312086bd3c3a83e1c273512782cf131a61957f72fc4219" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52" +version = "0.1.0" +dependencies = [ + "ld-memory", + "nrf52832-pac", + "nrf52840-pac", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "nrf52805-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2da657648039d59f4de6bc31b948dd3a5d03b32529a4d5d19d9e2dd9d4bfa6c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52810-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c26b12d5af17a9f4bb9a06ca9a1f814bca3d67bc8715b23f8dc230b09a227666" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52811-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4179b2a7ed0b2fd5e109d0fab9b4fc55b3936b2a4916a9306d22e5bc8dc1fd8f" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52820-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4791cff995e6419a5ad1aebc3b3c9539d79125ca85eb5bfd2cff9b470b81071" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52832-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0242b685c9c15648fb803e155628f42ace457478b2cb930868f40cae2db925e0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52833-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10e1358255b360cdc816dd7b6ef81be8c8499c0998277e5249bed222bd0f5241" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52840-mdk" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "nrf52840-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30713f36f1be02e5bc9abefa30eae4a1f943d810f199d4923d3ad062d1be1b3d" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52840dk" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "nrf52dk" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "nrf5340" +version = "0.1.0" +dependencies = [ + "ld-memory", + "riot-rs-debug", +] + +[[package]] +name = "nrf5340-app-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c88824573cd150fe9f27c1a48cea31a8cb24d3322df488875775143618c087a" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf5340-net-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c03e44df22fe5888109fe42e523162c7059adf4d30860f4f73ecc8b1fc16fe" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf5340dk" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf5340", + "riot-rs-debug", +] + +[[package]] +name = "nrf9160-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7344d74afb5684e00c48d175cad9619f36d629cfb0687d33b4d1bb86fba688f4" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nucleo-f401re" +version = "0.1.0" +dependencies = [ + "stm32f4xx", +] + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "object" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "elliptic-curve", + "primeorder", +] + +[[package]] +name = "panic-semihosting" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8a3e1233d9073d76a870223512ce4eeea43c067a94a445c13bd6d792d7b1ab" +dependencies = [ + "cortex-m", + "cortex-m-semihosting", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "particle-xenon" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "nrf52", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.2.6", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "picoserve" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912e6e8713f815d30bb77fa052cc8036a2b6429dc436969311fad47705fe0f2a" +dependencies = [ + "const-sha1", + "data-encoding", + "embassy-net", + "embassy-time", + "embedded-io-async", + "futures-util", + "heapless 0.8.0", + "lhash", + "log", + "ryu", + "serde", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pio" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" +dependencies = [ + "arrayvec", + "num_enum", + "paste", +] + +[[package]] +name = "pio-parser" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77532c2b8279aef98dfc7207ef15298a5a3d6b6cc76ccc8b65913d69f3a8dd6b" +dependencies = [ + "lalrpop", + "lalrpop-util", + "pio", + "regex-syntax 0.6.29", +] + +[[package]] +name = "pio-proc" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b04dc870fb3a4fd8b3e4ca8c61b53bc8ac4eb78b66805d2b3c2e5c4829e0d7a" +dependencies = [ + "codespan-reporting", + "lalrpop-util", + "pio", + "pio-parser", + "proc-macro-error", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "syn 1.0.109", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +dependencies = [ + "critical-section", +] + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "pretty-hex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_pcg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rbi" +version = "0.1.1" + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "ringbuffer" +version = "0.1.0" +dependencies = [ + "rbi", +] + +[[package]] +name = "riot-rs" +version = "0.1.0" +dependencies = [ + "document-features", + "linkme", + "riot-rs-bench", + "riot-rs-boards", + "riot-rs-debug", + "riot-rs-embassy", + "riot-rs-macros", + "riot-rs-random", + "riot-rs-rt", + "riot-rs-threads", + "riot-rs-utils", + "static_cell", +] + +[[package]] +name = "riot-rs-bench" +version = "0.1.0" +dependencies = [ + "cfg-if", + "cortex-m", +] + +[[package]] +name = "riot-rs-boards" +version = "0.1.0" +dependencies = [ + "ai-c3", + "cfg-if", + "dwm1001", + "expressif-esp32-c6-devkitc-1", + "linkme", + "microbit", + "microbit-v2", + "nrf52840-mdk", + "nrf52840dk", + "nrf52dk", + "nrf5340dk", + "nucleo-f401re", + "particle-xenon", + "riot-rs-rt", + "rpi-pico", +] + +[[package]] +name = "riot-rs-chips" +version = "0.1.0" +dependencies = [ + "stm32f4xx", +] + +[[package]] +name = "riot-rs-debug" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-semihosting", + "esp-println", + "log", + "rtt-target", +] + +[[package]] +name = "riot-rs-embassy" +version = "0.1.0" +dependencies = [ + "cfg-if", + "critical-section", + "cyw43", + "cyw43-pio", + "embassy-embedded-hal", + "embassy-executor", + "embassy-net", + "embassy-net-driver-channel", + "embassy-nrf", + "embassy-rp", + "embassy-sync 0.5.0", + "embassy-time", + "embassy-usb", + "embedded-hal-async", + "esp-hal", + "esp-wifi", + "heapless 0.8.0", + "linkme", + "once_cell", + "paste", + "riot-rs-debug", + "riot-rs-random", + "riot-rs-rt", + "riot-rs-threads", + "riot-rs-utils", + "static_cell", +] + +[[package]] +name = "riot-rs-macros" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "enum-iterator", + "heapless 0.8.0", + "proc-macro-crate", + "proc-macro2", + "quote", + "riot-rs", + "syn 2.0.66", + "trybuild", +] + +[[package]] +name = "riot-rs-random" +version = "0.1.0" +dependencies = [ + "embassy-sync 0.5.0", + "rand_chacha", + "rand_core", + "rand_pcg", +] + +[[package]] +name = "riot-rs-rt" +version = "0.1.0" +dependencies = [ + "cfg-if", + "cortex-m", + "cortex-m-rt", + "esp-hal", + "linkme", + "portable-atomic", + "riot-rs-boards", + "riot-rs-debug", + "riot-rs-threads", + "riot-rs-utils", + "rtt-target", +] + +[[package]] +name = "riot-rs-runqueue" +version = "0.1.2" + +[[package]] +name = "riot-rs-threads" +version = "0.1.0" +dependencies = [ + "cfg-if", + "cortex-m", + "cortex-m-rt", + "cortex-m-semihosting", + "critical-section", + "esp-hal", + "linkme", + "panic-semihosting", + "paste", + "riot-rs-runqueue", + "static_cell", +] + +[[package]] +name = "riot-rs-utils" +version = "0.1.0" +dependencies = [ + "const_panic", + "konst", +] + +[[package]] +name = "riscv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9" +dependencies = [ + "critical-section", + "embedded-hal 1.0.0", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d100d466dbb76681ef6a9386f3da9abc570d57394e86da0ba5af8c4408486d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rp-pac" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30f6c4c846269293db805e9c77864ff7b923395b480550df44f0868e3765337" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + +[[package]] +name = "rp2040" +version = "0.1.0" +dependencies = [ + "riot-rs-debug", + "riot-rs-embassy", + "riot-rs-rt", +] + +[[package]] +name = "rp2040-boot2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c92f344f63f950ee36cf4080050e4dce850839b9175da38f9d2ffb69b4dbb21" +dependencies = [ + "crc-any", +] + +[[package]] +name = "rpi-pico" +version = "0.1.0" +dependencies = [ + "riot-rs-debug", + "riot-rs-rt", + "rp2040", +] + +[[package]] +name = "rtcc" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef35f9dcbf434a34dcc99b3ebba1c1945d49c70832958e932e83dc63a5273994" +dependencies = [ + "chrono", +] + +[[package]] +name = "rtt-target" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afa12c77ba1b9bf560e4039a9b9a08bb9cde0e9e6923955eeb917dd8d5cf303" +dependencies = [ + "critical-section", + "ufmt-write", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ruzstd" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5174a470eeb535a721ae9fdd6e291c2411a906b96592182d05217591d5c5cf7b" +dependencies = [ + "byteorder", + "derive_more", + "twox-hash", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array 0.14.7", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half 1.8.3", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "smoltcp" +version = "0.11.0" +source = "git+https://github.com/smoltcp-rs/smoltcp.git?rev=125773e282bc2e0c914a49e9c75573926e26e558#125773e282bc2e0c914a49e9c75573926e26e558" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "cfg-if", + "heapless 0.8.0", + "managed", +] + +[[package]] +name = "spi-bus" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-sync 0.5.0", + "embedded-hal-async", + "once_cell", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "ssmarshal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" +dependencies = [ + "encode_unicode", + "serde", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static-alloc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2975e035ce16539eecee08d7c6e5626ca26f299c6e90af343b302c6dd2e61e" +dependencies = [ + "alloc-traits", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_cell" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "stm32f4" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "379f030a0586d0aa3574cb6497392142ddf125c8146b7b580b4b6b46db9d7dc9" +dependencies = [ + "bare-metal 1.0.0", + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "stm32f4xx" +version = "0.1.0" +dependencies = [ + "bare-metal 0.2.5", + "cortex-m", + "stm32f4xx-hal", +] + +[[package]] +name = "stm32f4xx-hal" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e687d08bd5a2d188109b8c325cb09f1c9f231b2c45e46bcbb1270bf5e912a3" +dependencies = [ + "bare-metal 1.0.0", + "cast", + "cortex-m", + "cortex-m-rt", + "embedded-dma 0.1.2", + "embedded-hal 0.2.7", + "fugit", + "nb 1.1.0", + "rand_core", + "rtcc", + "stm32f4", + "void", +] + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros 0.26.4", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.66", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "threading" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "threading-channel" +version = "0.1.0" +dependencies = [ + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.14", +] + +[[package]] +name = "toml-cfg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68c587298ddd135c156e92e8c3eae69614d6eecea8e2d8a09daab011e5e6a21d" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "serde", + "syn 2.0.66", + "toml 0.8.14", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.11", +] + +[[package]] +name = "trybuild" +version = "1.0.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a5f13f11071020bb12de7a16b925d2d58636175c20c11dc5f96cb64bb6c9b3" +dependencies = [ + "glob", + "serde", + "serde_derive", + "serde_json", + "termcolor", + "toml 0.8.14", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "typewit" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fb9ae6a3cafaf0a5d14c2302ca525f9ae8e07a0f0e6949de88d882c37a6e24" +dependencies = [ + "typewit_proc_macros", +] + +[[package]] +name = "typewit_proc_macros" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" + +[[package]] +name = "ufmt-write" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "usb-device" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" + +[[package]] +name = "usbd-hid" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975bd411f4a939986751ea09992a24fa47c4d25c6ed108d04b4c2999a4fd0132" +dependencies = [ + "serde", + "ssmarshal", + "usb-device", + "usbd-hid-macros", +] + +[[package]] +name = "usbd-hid-descriptors" +version = "0.1.2" +source = "git+https://github.com/twitchyliquid64/usbd-hid?rev=76bea16537e1a347df2ebced5b9e1d48f71c9859#76bea16537e1a347df2ebced5b9e1d48f71c9859" +dependencies = [ + "bitfield 0.14.0", +] + +[[package]] +name = "usbd-hid-macros" +version = "0.6.0" +source = "git+https://github.com/twitchyliquid64/usbd-hid?rev=76bea16537e1a347df2ebced5b9e1d48f71c9859#76bea16537e1a347df2ebced5b9e1d48f71c9859" +dependencies = [ + "byteorder", + "hashbrown 0.13.2", + "log", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", + "usbd-hid-descriptors", +] + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windowed-infinity" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9487d1d565a9db59e1fd0b3c2d3f0c277bc375d348a6c46ff2b322917fbc035" +dependencies = [ + "ciborium-io", + "crc", + "digest", + "embedded-io 0.4.0", + "minicbor 0.19.1", + "serde", + "serde_cbor", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +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", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c52728401e1dc672a56e81e593e912aa54c78f40246869f78359a2bf24d29d" +dependencies = [ + "memchr", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904102108b780c9a5e3275c5f3c63dc348ec43ae5da5237868515498b447d51a" +dependencies = [ + "bare-metal 1.0.0", + "core-isa-parser", + "minijinja", + "r0", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "082cdede098bbec9af15b0e74085e5f3d16f2923597de7aed7b8112003af2da7" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 6fa249131..2656392b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,6 +84,9 @@ document-features = "0.2.8" heapless = { version = "0.8.0", default-features = false } konst = { version = "0.3.8", default-features = false } ld-memory = { version = "0.2.9" } +once_cell = { version = "1.19.0", default-features = false, features = [ + "critical-section", +] } paste = { version = "1.0" } static_cell = { version = "2.0.0", features = ["nightly"] } diff --git a/examples/laze.yml b/examples/laze.yml index a69997482..ac3135f56 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -19,6 +19,7 @@ subdirs: - log - minimal - random + - spi-bus - threading - threading-channel - usb-serial diff --git a/examples/spi-bus/Cargo.toml b/examples/spi-bus/Cargo.toml new file mode 100644 index 000000000..6333e7ad0 --- /dev/null +++ b/examples/spi-bus/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "spi-bus" +version.workspace = true +authors.workspace = true +edition.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +embassy-executor = { workspace = true } +embassy-sync = { workspace = true } +embedded-hal-async = { workspace = true } +once_cell = { workspace = true } +riot-rs = { path = "../../src/riot-rs", features = ["time"] } # FIXME: the `time` feature seems to be required by the SPI transaction +riot-rs-boards = { path = "../../src/riot-rs-boards" } diff --git a/examples/spi-bus/README.md b/examples/spi-bus/README.md new file mode 100644 index 000000000..98185d23d --- /dev/null +++ b/examples/spi-bus/README.md @@ -0,0 +1,14 @@ +# spi-bus + +## About + +This application is demonstrating raw SPI bus usage in RIOT-rs. +Please use `riot_rs::sensors` instead for a high-level sensor abstraction that is architecture-agnostic. + +## How to run + +In this folder, run + + laze build -b nrf52840dk run + +This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the example. diff --git a/examples/spi-bus/laze.yml b/examples/spi-bus/laze.yml new file mode 100644 index 000000000..482285c69 --- /dev/null +++ b/examples/spi-bus/laze.yml @@ -0,0 +1,8 @@ +apps: + - name: spi-bus + env: + global: + CARGO_ENV: + - CONFIG_ISR_STACKSIZE=16384 + selects: + - ?release diff --git a/examples/spi-bus/src/main.rs b/examples/spi-bus/src/main.rs new file mode 100644 index 000000000..f943b3130 --- /dev/null +++ b/examples/spi-bus/src/main.rs @@ -0,0 +1,79 @@ +//! This example is merely to illustrate and test raw bus usage. +//! +//! Please use [`riot_rs::sensors`] instead for a high-level sensor abstraction that is +//! architecture-agnostic. +//! +//! This example requires a LIS3DH sensor (3-axis accelerometer). +#![no_main] +#![no_std] +#![feature(type_alias_impl_trait)] +#![feature(used_with_arg)] + +use embassy_sync::mutex::Mutex; +use embedded_hal_async::spi::{Operation, SpiDevice}; +use riot_rs::{ + debug::{exit, println, EXIT_SUCCESS}, + embassy::arch::{gpio, peripherals, spi}, +}; + +// WHO_AM_I register of the LIS3DH sensor +const WHO_AM_I_REG_ADDR: u8 = 0x0f; + +#[cfg(context = "rp")] +riot_rs::define_peripherals!(Peripherals { + spi_peripheral: SPI0, + spi_sck: PIN_18, + spi_miso: PIN_16, + spi_mosi: PIN_19, + spi_cs: PIN_17, + spi_tx_dma: DMA_CH0, + spi_rx_dma: DMA_CH1, +}); + +pub static SPI_BUS: once_cell::sync::OnceCell< + Mutex, +> = once_cell::sync::OnceCell::new(); + +#[riot_rs::task(autostart, peripherals)] +async fn main(peripherals: Peripherals) { + let mut spi_config = spi::Config::default(); + spi_config.frequency = spi::Frequency::M1; + spi_config.mode = spi::Mode::Mode3; + + #[cfg(context = "rp")] + let spi_bus = spi::Spi::SPI0(spi::SpiSPI0::new( + peripherals.spi_peripheral, + peripherals.spi_sck, + peripherals.spi_miso, + peripherals.spi_mosi, + peripherals.spi_tx_dma, + peripherals.spi_rx_dma, + spi_config, + )); + + let _ = SPI_BUS.set(Mutex::new(spi_bus)); + + #[cfg(context = "rp")] + let cs_output = gpio::Output::new(peripherals.spi_cs, gpio::Level::High); + + let mut spi_device = spi::SpiDevice::new(SPI_BUS.get().unwrap(), cs_output); + + let mut id = [0]; + spi_device + .transaction(&mut [ + Operation::Write(&[get_spi_read_command(WHO_AM_I_REG_ADDR)]), + Operation::TransferInPlace(&mut id), + ]) + .await + .unwrap(); + + let who_am_i = id[0]; + println!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); + assert_eq!(who_am_i, 0x33); + + exit(EXIT_SUCCESS); +} + +fn get_spi_read_command(addr: u8) -> u8 { + addr | 0x80 +} diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 4e4c8c114..a9d022680 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -47,9 +47,7 @@ riot-rs-random = { path = "../riot-rs-random", optional = true } riot-rs-utils = { workspace = true } heapless = "0.8.0" -once_cell = { version = "1.19.0", default-features = false, features = [ - "critical-section", -] } +once_cell = { workspace = true } # rpi-pico-w cyw43 cyw43 = { version = "0.2.0", features = ["firmware-logs"], optional = true } From 244606c584059ba50294262743fc2b6270cb13fe Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 12 Jun 2024 09:07:23 +0200 Subject: [PATCH 04/95] feat(example): add an example testing I2C --- Cargo.lock | 12 +++++++ examples/i2c-bus/Cargo.toml | 17 ++++++++++ examples/i2c-bus/README.md | 14 ++++++++ examples/i2c-bus/laze.yml | 8 +++++ examples/i2c-bus/src/main.rs | 63 ++++++++++++++++++++++++++++++++++++ examples/laze.yml | 1 + 6 files changed, 115 insertions(+) create mode 100644 examples/i2c-bus/Cargo.toml create mode 100644 examples/i2c-bus/README.md create mode 100644 examples/i2c-bus/laze.yml create mode 100644 examples/i2c-bus/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index c98962eef..1cacf8889 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2045,6 +2045,18 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "i2c-bus" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-sync 0.5.0", + "embedded-hal-async", + "once_cell", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "ident_case" version = "1.0.1" diff --git a/examples/i2c-bus/Cargo.toml b/examples/i2c-bus/Cargo.toml new file mode 100644 index 000000000..b383e0645 --- /dev/null +++ b/examples/i2c-bus/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "i2c-bus" +version.workspace = true +authors.workspace = true +edition.workspace = true +repository.workspace = true + +[lints] +workspace = true + +[dependencies] +embassy-executor = { workspace = true } +embassy-sync = { workspace = true } +embedded-hal-async = { workspace = true } +once_cell = { workspace = true } +riot-rs = { path = "../../src/riot-rs", features = [] } +riot-rs-boards = { path = "../../src/riot-rs-boards" } diff --git a/examples/i2c-bus/README.md b/examples/i2c-bus/README.md new file mode 100644 index 000000000..bd48d11de --- /dev/null +++ b/examples/i2c-bus/README.md @@ -0,0 +1,14 @@ +# i2c-bus + +## About + +This application is demonstrating raw I2C bus usage in RIOT-rs. +Please use `riot_rs::sensors` instead for a high-level sensor abstraction that is architecture-agnostic. + +## How to run + +In this folder, run + + laze build -b nrf52840dk run + +This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the example. diff --git a/examples/i2c-bus/laze.yml b/examples/i2c-bus/laze.yml new file mode 100644 index 000000000..4a429ccfa --- /dev/null +++ b/examples/i2c-bus/laze.yml @@ -0,0 +1,8 @@ +apps: + - name: i2c-bus + env: + global: + CARGO_ENV: + - CONFIG_ISR_STACKSIZE=16384 + selects: + - ?release diff --git a/examples/i2c-bus/src/main.rs b/examples/i2c-bus/src/main.rs new file mode 100644 index 000000000..605787d97 --- /dev/null +++ b/examples/i2c-bus/src/main.rs @@ -0,0 +1,63 @@ +//! This example is merely to illustrate and test raw bus usage. +//! +//! Please use [`riot_rs::sensors`] instead for a high-level sensor abstraction that is +//! architecture-agnostic. +//! +//! This example requires a LIS3DH sensor (3-axis accelerometer). +#![no_main] +#![no_std] +#![feature(type_alias_impl_trait)] +#![feature(used_with_arg)] + +use embassy_sync::mutex::Mutex; +use embedded_hal_async::i2c::I2c as I2cDevice; +use riot_rs::{ + debug::{exit, println, EXIT_SUCCESS}, + embassy::arch::{i2c, peripherals}, +}; + +const LIS3DH_I2C_ADDR: u8 = 0x19; + +// WHO_AM_I register of the LIS3DH sensor +const WHO_AM_I_REG_ADDR: u8 = 0x0f; + +#[cfg(context = "rp")] +riot_rs::define_peripherals!(Peripherals { + i2c_peripheral: I2C1, + i2c_sda: PIN_18, + i2c_scl: PIN_19, +}); + +pub static I2C_BUS: once_cell::sync::OnceCell< + Mutex, +> = once_cell::sync::OnceCell::new(); + +#[riot_rs::task(autostart, peripherals)] +async fn main(peripherals: Peripherals) { + let mut i2c_config = i2c::Config::default(); + i2c_config.frequency = i2c::Frequency::K100; + + #[cfg(context = "rp")] + let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( + peripherals.i2c_peripheral, + peripherals.i2c_sda, + peripherals.i2c_scl, + i2c_config, + )); + + let _ = I2C_BUS.set(Mutex::new(i2c_bus)); + + let mut i2c_device = i2c::I2cDevice::new(I2C_BUS.get().unwrap()); + + let mut id = [0]; + i2c_device + .write_read(LIS3DH_I2C_ADDR, &[WHO_AM_I_REG_ADDR], &mut id) + .await + .unwrap(); + + let who_am_i = id[0]; + println!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); + assert_eq!(who_am_i, 0x33); + + exit(EXIT_SUCCESS); +} diff --git a/examples/laze.yml b/examples/laze.yml index ac3135f56..6d44f304c 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -16,6 +16,7 @@ subdirs: - gpio - hello-world - hello-world-async + - i2c-bus - log - minimal - random From ea812b8f6c7076046e64e7e5e01ee7c74a1fdcb5 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 12 Jun 2024 09:26:46 +0200 Subject: [PATCH 05/95] fixup! feat(example): add an example testing SPI --- examples/spi-bus/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/spi-bus/Cargo.toml b/examples/spi-bus/Cargo.toml index 6333e7ad0..1238e273d 100644 --- a/examples/spi-bus/Cargo.toml +++ b/examples/spi-bus/Cargo.toml @@ -13,5 +13,7 @@ embassy-executor = { workspace = true } embassy-sync = { workspace = true } embedded-hal-async = { workspace = true } once_cell = { workspace = true } -riot-rs = { path = "../../src/riot-rs", features = ["time"] } # FIXME: the `time` feature seems to be required by the SPI transaction +riot-rs = { path = "../../src/riot-rs", features = [ + "time", +] } # FIXME: the `time` feature seems to be required by the SPI transaction riot-rs-boards = { path = "../../src/riot-rs-boards" } From 7f19db04d2eb72e511dd39d6253cbb957329479b Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 12 Jun 2024 10:39:27 +0200 Subject: [PATCH 06/95] refactor(buses): share I2cDevice and SpiDevice across archs --- Cargo.lock | 604 ++++++++++++++++++--- examples/i2c-bus/src/main.rs | 9 +- examples/spi-bus/src/main.rs | 9 +- src/riot-rs-embassy/Cargo.toml | 9 - src/riot-rs-embassy/src/arch/dummy/i2c.rs | 1 + src/riot-rs-embassy/src/arch/dummy/mod.rs | 2 + src/riot-rs-embassy/src/arch/dummy/spi.rs | 1 + src/riot-rs-embassy/src/arch/nrf/i2c.rs | 6 - src/riot-rs-embassy/src/arch/nrf/spi.rs | 5 - src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 6 - src/riot-rs-embassy/src/arch/rp2040/spi.rs | 7 +- src/riot-rs-embassy/src/i2c.rs | 8 + src/riot-rs-embassy/src/lib.rs | 2 + src/riot-rs-embassy/src/spi.rs | 9 + 14 files changed, 557 insertions(+), 121 deletions(-) create mode 100644 src/riot-rs-embassy/src/arch/dummy/i2c.rs create mode 100644 src/riot-rs-embassy/src/arch/dummy/spi.rs diff --git a/Cargo.lock b/Cargo.lock index 1cacf8889..578e66d4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,7 +209,7 @@ dependencies = [ "clang-sys", "lazy_static", "lazycell", - "log", + "log 0.4.21", "peeking_take_while", "proc-macro2", "quote", @@ -235,6 +235,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + [[package]] name = "bitfield" version = "0.13.2" @@ -265,6 +271,16 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +[[package]] +name = "blinky" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -301,7 +317,7 @@ dependencies = [ "clap", "heck 0.4.1", "indexmap 1.9.3", - "log", + "log 0.4.21", "proc-macro2", "quote", "serde", @@ -444,11 +460,10 @@ dependencies = [ "coap-handler-implementations", "coap-message", "coap-message-demos", - "coap-message-implementations", - "coap-message-utils", - "coap-numbers", "coap-request", "coap-request-implementations", + "coap-scroll-ring-server", + "coapcore", "embassy-executor", "embassy-futures", "embassy-net", @@ -460,11 +475,9 @@ dependencies = [ "hexlit", "lakers", "lakers-crypto-rustcrypto", - "liboscore", - "liboscore-msgbackend", - "minicbor 0.23.0", "riot-rs", "riot-rs-boards", + "scroll-ring", "smoltcp", "static-alloc", ] @@ -577,6 +590,39 @@ dependencies = [ "coap-request", ] +[[package]] +name = "coap-scroll-ring-server" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54221724caa364079527fcd8be89bc401f25921f0927e6574c934a8ecb9778a0" +dependencies = [ + "coap-handler", + "coap-handler-implementations", + "coap-message", + "coap-message-utils", + "coap-numbers", + "scroll-ring", +] + +[[package]] +name = "coapcore" +version = "0.0.1" +dependencies = [ + "arrayvec", + "coap-handler", + "coap-message", + "coap-message-implementations", + "coap-message-utils", + "coap-numbers", + "heapless 0.8.0", + "hexlit", + "lakers", + "lakers-crypto-rustcrypto", + "liboscore", + "liboscore-msgbackend", + "minicbor 0.23.0", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -716,6 +762,12 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crunchy" version = "0.2.2" @@ -830,24 +882,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] -name = "der" -version = "0.7.9" +name = "defmt" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0" dependencies = [ - "const-oid", - "zeroize", + "bitflags 1.3.2", + "defmt-macros", ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "defmt-macros" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb" dependencies = [ + "defmt-parser", + "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", +] + +[[package]] +name = "defmt-parser" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f" +dependencies = [ + "thiserror", +] + +[[package]] +name = "defmt-rtt-target" +version = "0.3.0" +source = "git+https://github.com/kaspar030/defmt-rtt-target?rev=5668c92ac5a0689b165a6a07bb14e173fc47cd34#5668c92ac5a0689b165a6a07bb14e173fc47cd34" +dependencies = [ + "cortex-m", + "critical-section", + "defmt", + "rtt-target 0.5.0", +] + +[[package]] +name = "delegate" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -938,7 +1033,7 @@ name = "embassy" version = "0.1.0" dependencies = [ "embassy-executor", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-time", "riot-rs", "riot-rs-boards", @@ -950,6 +1045,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d" dependencies = [ + "defmt", "embassy-futures", "embassy-sync 0.5.0", "embassy-time", @@ -991,6 +1087,9 @@ name = "embassy-futures" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" +dependencies = [ + "defmt", +] [[package]] name = "embassy-hal-internal" @@ -999,6 +1098,7 @@ source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584 dependencies = [ "cortex-m", "critical-section", + "defmt", "num-traits", ] @@ -1009,7 +1109,7 @@ dependencies = [ "embassy-executor", "embassy-net", "embassy-nrf", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-time", "embedded-io-async", "heapless 0.8.0", @@ -1026,6 +1126,7 @@ name = "embassy-net" version = "0.4.0" source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" dependencies = [ + "defmt", "document-features", "embassy-net-driver", "embassy-sync 0.6.0", @@ -1041,6 +1142,9 @@ dependencies = [ name = "embassy-net-driver" version = "0.2.0" source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "defmt", +] [[package]] name = "embassy-net-driver-channel" @@ -1088,6 +1192,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", + "defmt", "document-features", "embassy-embedded-hal", "embassy-hal-internal", @@ -1127,6 +1232,7 @@ dependencies = [ "cortex-m", "cortex-m-rt", "critical-section", + "defmt", "document-features", "embassy-embedded-hal", "embassy-futures", @@ -1152,6 +1258,50 @@ dependencies = [ "rp2040-boot2", ] +[[package]] +name = "embassy-stm32" +version = "0.1.0" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "bit_field", + "bitflags 2.5.0", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "defmt", + "document-features", + "embassy-embedded-hal", + "embassy-futures", + "embassy-hal-internal", + "embassy-net-driver", + "embassy-sync 0.6.0", + "embassy-time", + "embassy-time-driver", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", + "embedded-can", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io 0.6.1", + "embedded-io-async", + "embedded-storage", + "embedded-storage-async", + "futures-util", + "nb 1.1.0", + "proc-macro2", + "quote", + "rand_core", + "sdio-host", + "static_assertions", + "stm32-fmc", + "stm32-metapac", + "vcell", + "volatile-register", +] + [[package]] name = "embassy-sync" version = "0.3.0" @@ -1180,11 +1330,11 @@ dependencies = [ [[package]] name = "embassy-sync" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e0c49ff02ebe324faf3a8653ba91582e2d0a7fdef5bc88f449d5aa1bfcc05c" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" dependencies = [ "cfg-if", "critical-section", + "defmt", "embedded-io-async", "futures-util", "heapless 0.8.0", @@ -1198,6 +1348,7 @@ checksum = "274c019608a9004aed3cafc871e2a3c87ce9351d537dcaab4cc5db184d4a04b1" dependencies = [ "cfg-if", "critical-section", + "defmt", "document-features", "embassy-time-driver", "embassy-time-queue-driver", @@ -1227,6 +1378,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1587e58ed8f7e0215246e6bb8d7ef4837db682e209e5ef7410a81c500dc949e5" dependencies = [ + "defmt", "embassy-futures", "embassy-net-driver-channel", "embassy-sync 0.5.0", @@ -1240,6 +1392,9 @@ dependencies = [ name = "embassy-usb-driver" version = "0.1.0" source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" +dependencies = [ + "defmt", +] [[package]] name = "embassy-usb-keyboard" @@ -1247,7 +1402,7 @@ version = "0.1.0" dependencies = [ "embassy-executor", "embassy-nrf", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-time", "embassy-usb", "riot-rs", @@ -1256,6 +1411,17 @@ dependencies = [ "usbd-hid", ] +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d46be92e72bcf39e623ff74d739a8ab29b02f4909a9b05986ca81c2157ac254a" +dependencies = [ + "critical-section", + "embassy-sync 0.5.0", + "embassy-usb-driver", +] + [[package]] name = "embedded-can" version = "0.4.1" @@ -1298,6 +1464,9 @@ name = "embedded-hal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" +dependencies = [ + "defmt", +] [[package]] name = "embedded-hal-async" @@ -1329,6 +1498,9 @@ name = "embedded-io" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" +dependencies = [ + "defmt", +] [[package]] name = "embedded-io-async" @@ -1336,6 +1508,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" dependencies = [ + "defmt", "embedded-io 0.6.1", ] @@ -1399,7 +1572,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" dependencies = [ - "log", + "log 0.4.21", ] [[package]] @@ -1480,7 +1653,7 @@ dependencies = [ [[package]] name = "esp-build" version = "0.1.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "quote", "syn 2.0.66", @@ -1489,19 +1662,21 @@ dependencies = [ [[package]] name = "esp-hal" -version = "0.17.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +version = "0.18.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "basic-toml", "bitfield 0.15.0", "bitflags 2.5.0", "cfg-if", "critical-section", + "defmt", + "delegate", "document-features", - "embassy-executor", "embassy-futures", - "embassy-sync 0.5.0", - "embassy-time-driver", + "embassy-sync 0.6.0", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", "embedded-can", "embedded-dma 0.2.0", "embedded-hal 1.0.0", @@ -1514,10 +1689,14 @@ dependencies = [ "esp-hal-procmacros", "esp-metadata", "esp-riscv-rt", + "esp32", + "esp32c2", "esp32c3", "esp32c6", + "esp32h2", + "esp32s2", + "esp32s3", "fugit", - "log", "nb 1.1.0", "paste", "portable-atomic", @@ -1529,10 +1708,26 @@ dependencies = [ "xtensa-lx-rt", ] +[[package]] +name = "esp-hal-embassy" +version = "0.1.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" +dependencies = [ + "cfg-if", + "critical-section", + "document-features", + "embassy-executor", + "embassy-time-driver", + "esp-build", + "esp-hal", + "esp-metadata", + "portable-atomic", +] + [[package]] name = "esp-hal-procmacros" -version = "0.10.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +version = "0.11.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "darling", "document-features", @@ -1547,8 +1742,8 @@ dependencies = [ [[package]] name = "esp-metadata" -version = "0.1.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +version = "0.1.1" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "basic-toml", "lazy_static", @@ -1563,13 +1758,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e98f0f58453dd2ce08d99228fc8757fad39d05dfd26643665d1093b8844f42cc" dependencies = [ "critical-section", - "log", + "defmt", + "log 0.4.21", ] [[package]] name = "esp-riscv-rt" version = "0.8.0" -source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-240517#9f358c89c695829504543cce4b8ed838c6a82aef" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "document-features", "riscv", @@ -1578,80 +1774,136 @@ dependencies = [ [[package]] name = "esp-wifi" -version = "0.5.1" -source = "git+https://github.com/kaspar030/esp-wifi?branch=for-riot-rs-240517#27bceae1171c238c41914b4aeeed37736343cc6a" +version = "0.6.0" +source = "git+https://github.com/kaspar030/esp-hal?branch=for-riot-rs-2024-06-14#307718f69421d80d00cdccfa3247d402b8f32822" dependencies = [ "atomic-waker", "cfg-if", "critical-section", + "defmt", "embassy-futures", "embassy-net-driver", - "embassy-sync 0.5.0", - "embedded-hal 0.2.7", + "embassy-sync 0.6.0", "embedded-io 0.6.1", "embedded-io-async", "enumset", + "esp-build", "esp-hal", + "esp-hal-embassy", "esp-wifi-sys", "fugit", "futures-util", "heapless 0.8.0", "libm", "linked_list_allocator", - "log", "no-std-net", "num-derive", "num-traits", "portable-atomic", "portable_atomic_enum", + "smoltcp", "toml-cfg", ] [[package]] name = "esp-wifi-sys" version = "0.3.0" -source = "git+https://github.com/kaspar030/esp-wifi?branch=for-riot-rs-240517#27bceae1171c238c41914b4aeeed37736343cc6a" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551b510b3944844675fcefa1301b3610fe56faa419bcc05dd0dd0056745c6654" dependencies = [ "anyhow", ] +[[package]] +name = "esp32" +version = "0.31.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +dependencies = [ + "critical-section", + "defmt", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "esp32c2" +version = "0.20.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +dependencies = [ + "critical-section", + "defmt", + "vcell", +] + [[package]] name = "esp32c3" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c22d8c27e7d675ef79db212b9e41df80aef6db1a5c819e4e726735f64ee0700" +version = "0.23.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" dependencies = [ "critical-section", + "defmt", "vcell", ] [[package]] name = "esp32c6" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb7fd83dcdaf1d904f789b2739b646134ec8346fdde2150b7903ef049d81d13" +version = "0.14.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" dependencies = [ "critical-section", + "defmt", "vcell", ] [[package]] -name = "example-random" -version = "0.1.0" +name = "esp32h2" +version = "0.10.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" dependencies = [ - "rand", - "riot-rs", - "riot-rs-boards", + "critical-section", + "defmt", + "vcell", ] [[package]] -name = "expressif-esp32-c6-devkitc-1" +name = "esp32s2" +version = "0.22.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +dependencies = [ + "critical-section", + "defmt", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "esp32s3" +version = "0.26.0" +source = "git+https://github.com/esp-rs/esp-pacs?rev=a7c72f7#a7c72f72c4cc50d1595a0d5a395250306d741fed" +dependencies = [ + "critical-section", + "defmt", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "espressif-esp32-c6-devkitc-1" version = "0.1.0" dependencies = [ "riot-rs-debug", "riot-rs-rt", ] +[[package]] +name = "example-random" +version = "0.1.0" +dependencies = [ + "rand", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "fastrand" version = "2.1.0" @@ -1849,6 +2101,37 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gpio" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-futures", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "gpio-interrupt-nrf" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + +[[package]] +name = "gpio-interrupt-stm32" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "group" version = "0.13.0" @@ -1956,6 +2239,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" dependencies = [ + "defmt", "hash32 0.3.1", "portable-atomic", "serde", @@ -2050,7 +2334,7 @@ name = "i2c-bus" version = "0.1.0" dependencies = [ "embassy-executor", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embedded-hal-async", "once_cell", "riot-rs", @@ -2140,18 +2424,19 @@ dependencies = [ [[package]] name = "lakers" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "905e14c2e72626a749cfe6e0b64454ac2e51de3e36cc2ba077b0abc5af5fa535" +checksum = "64eb682691d02609ff036a7416373edbc7cc769b0908bf2489af79461453669e" dependencies = [ "lakers-shared", + "log 0.4.21", ] [[package]] name = "lakers-crypto-rustcrypto" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6523b65ffa787062edf5907ce9e8500bde82eb3880d3c5d01e2119da12c4653a" +checksum = "964a5ea4c01f13129088c784b41928b93f6fd67b9a956314a899c677182c301c" dependencies = [ "aead", "aes", @@ -2165,9 +2450,12 @@ dependencies = [ [[package]] name = "lakers-shared" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ddf0b16bd9c88daa047e2ac190ff90fd685990a14ab8b47dfa6ecc28b43247" +checksum = "dcdc5a0e1a5ea0387ab3e334f2061c633001db79e04d40af65bc68b41b13ef3a" +dependencies = [ + "log 0.4.21", +] [[package]] name = "lalrpop" @@ -2351,6 +2639,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "log" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "log" version = "0.4.21" @@ -2444,6 +2741,12 @@ dependencies = [ "adler", ] +[[package]] +name = "mutex-trait" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4bb1638d419e12f8b1c43d9e639abd0d1424285bdea2f76aa231e233c63cd3a" + [[package]] name = "nb" version = "0.1.3" @@ -2673,13 +2976,6 @@ dependencies = [ "vcell", ] -[[package]] -name = "nucleo-f401re" -version = "0.1.0" -dependencies = [ - "stm32f4xx", -] - [[package]] name = "num-derive" version = "0.4.2" @@ -2722,9 +3018,9 @@ dependencies = [ [[package]] name = "object" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "flate2", "memchr", @@ -2852,7 +3148,7 @@ dependencies = [ "futures-util", "heapless 0.8.0", "lhash", - "log", + "log 0.4.21", "ryu", "serde", ] @@ -3139,6 +3435,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +[[package]] +name = "ringbuf" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79abed428d1fd2a128201cec72c5f6938e2da607c6f3745f769fabea399d950a" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "ringbuffer" version = "0.1.0" @@ -3170,6 +3475,7 @@ version = "0.1.0" dependencies = [ "cfg-if", "cortex-m", + "defmt", ] [[package]] @@ -3179,7 +3485,7 @@ dependencies = [ "ai-c3", "cfg-if", "dwm1001", - "expressif-esp32-c6-devkitc-1", + "espressif-esp32-c6-devkitc-1", "linkme", "microbit", "microbit-v2", @@ -3187,10 +3493,12 @@ dependencies = [ "nrf52840dk", "nrf52dk", "nrf5340dk", - "nucleo-f401re", "particle-xenon", "riot-rs-rt", "rpi-pico", + "st-nucleo-f401re", + "st-nucleo-h755zi-q", + "st-nucleo-wb55", ] [[package]] @@ -3206,9 +3514,11 @@ version = "0.1.0" dependencies = [ "cortex-m", "cortex-m-semihosting", + "defmt", + "defmt-rtt-target", "esp-println", - "log", - "rtt-target", + "log 0.4.21", + "rtt-target 0.5.0", ] [[package]] @@ -3221,21 +3531,27 @@ dependencies = [ "cyw43-pio", "embassy-embedded-hal", "embassy-executor", + "embassy-hal-internal", "embassy-net", "embassy-net-driver-channel", "embassy-nrf", "embassy-rp", - "embassy-sync 0.5.0", + "embassy-stm32", + "embassy-sync 0.6.0", "embassy-time", "embassy-usb", + "embedded-hal 1.0.0", "embedded-hal-async", "esp-hal", + "esp-hal-embassy", "esp-wifi", "heapless 0.8.0", "linkme", "once_cell", "paste", + "portable-atomic", "riot-rs-debug", + "riot-rs-macros", "riot-rs-random", "riot-rs-rt", "riot-rs-threads", @@ -3262,7 +3578,7 @@ dependencies = [ name = "riot-rs-random" version = "0.1.0" dependencies = [ - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "rand_chacha", "rand_core", "rand_pcg", @@ -3282,12 +3598,15 @@ dependencies = [ "riot-rs-debug", "riot-rs-threads", "riot-rs-utils", - "rtt-target", + "rtt-target 0.4.0", ] [[package]] name = "riot-rs-runqueue" version = "0.1.2" +dependencies = [ + "defmt", +] [[package]] name = "riot-rs-threads" @@ -3298,6 +3617,7 @@ dependencies = [ "cortex-m-rt", "cortex-m-semihosting", "critical-section", + "defmt", "esp-hal", "linkme", "panic-semihosting", @@ -3391,6 +3711,16 @@ dependencies = [ "ufmt-write", ] +[[package]] +name = "rtt-target" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10b34c9e6832388e45f3c01f1bb60a016384a0a4ad80cdd7d34913bed25037f0" +dependencies = [ + "critical-section", + "ufmt-write", +] + [[package]] name = "rustc-hash" version = "1.1.0" @@ -3436,12 +3766,11 @@ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ruzstd" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5174a470eeb535a721ae9fdd6e291c2411a906b96592182d05217591d5c5cf7b" +checksum = "5022b253619b1ba797f243056276bed8ed1a73b0f5a7ce7225d524067644bf8f" dependencies = [ "byteorder", - "derive_more", "twox-hash", ] @@ -3457,6 +3786,22 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scroll-ring" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eda0dff67036ba3b032aa68eb47ceb9b53b6e848445f53d10bf93e033b17df2" +dependencies = [ + "ringbuf", + "try-lock", +] + +[[package]] +name = "sdio-host" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a" + [[package]] name = "sec1" version = "0.7.3" @@ -3578,6 +3923,7 @@ dependencies = [ "bitflags 1.3.2", "byteorder", "cfg-if", + "defmt", "heapless 0.8.0", "managed", ] @@ -3587,7 +3933,7 @@ name = "spi-bus" version = "0.1.0" dependencies = [ "embassy-executor", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embedded-hal-async", "once_cell", "riot-rs", @@ -3613,6 +3959,36 @@ dependencies = [ "serde", ] +[[package]] +name = "st-nucleo-f401re" +version = "0.1.0" +dependencies = [ + "embassy-stm32", + "riot-rs-debug", + "riot-rs-rt", +] + +[[package]] +name = "st-nucleo-h755zi-q" +version = "0.1.0" +dependencies = [ + "embassy-stm32", + "riot-rs-debug", + "riot-rs-embassy", + "riot-rs-rt", + "stm32", +] + +[[package]] +name = "st-nucleo-wb55" +version = "0.1.0" +dependencies = [ + "embassy-stm32", + "riot-rs-debug", + "riot-rs-embassy", + "riot-rs-rt", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3643,6 +4019,32 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "stm32" +version = "0.1.0" +dependencies = [ + "riot-rs-embassy", + "riot-rs-rt", +] + +[[package]] +name = "stm32-fmc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830ed60f33e6194ecb377f5d6ab765dc0e37e7b65e765f1fa87df13336658d63" +dependencies = [ + "embedded-hal 0.2.7", +] + +[[package]] +name = "stm32-metapac" +version = "15.0.0" +source = "git+https://github.com/embassy-rs/stm32-data-generated?tag=stm32-data-59b1f65bd109c3ef35782e6c44062208d0ef3d0e#2ad339796e0f40bd6fa784dbfe30a071d93cc886" +dependencies = [ + "cortex-m", + "cortex-m-rt", +] + [[package]] name = "stm32f4" version = "0.14.0" @@ -3810,6 +4212,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "tests_gpio" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -3929,6 +4340,12 @@ dependencies = [ "winnow 0.6.11", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "trybuild" version = "1.0.96" @@ -4014,6 +4431,16 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" +[[package]] +name = "usb-serial" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-time", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "usbd-hid" version = "0.6.1" @@ -4041,7 +4468,7 @@ source = "git+https://github.com/twitchyliquid64/usbd-hid?rev=76bea16537e1a347df dependencies = [ "byteorder", "hashbrown 0.13.2", - "log", + "log 0.4.21", "proc-macro2", "quote", "serde", @@ -4231,6 +4658,17 @@ dependencies = [ "memchr", ] +[[package]] +name = "xtensa-lx" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e758f94e1a1f71758f94052a2766dcb12604998eb372b8b2e30576e3ab1ba1e6" +dependencies = [ + "bare-metal 1.0.0", + "mutex-trait", + "spin", +] + [[package]] name = "xtensa-lx-rt" version = "0.16.0" diff --git a/examples/i2c-bus/src/main.rs b/examples/i2c-bus/src/main.rs index 605787d97..d2588c838 100644 --- a/examples/i2c-bus/src/main.rs +++ b/examples/i2c-bus/src/main.rs @@ -10,10 +10,13 @@ #![feature(used_with_arg)] use embassy_sync::mutex::Mutex; -use embedded_hal_async::i2c::I2c as I2cDevice; +use embedded_hal_async::i2c::I2c as _; use riot_rs::{ debug::{exit, println, EXIT_SUCCESS}, - embassy::arch::{i2c, peripherals}, + embassy::{ + arch::{i2c, peripherals}, + i2c::I2cDevice, + }, }; const LIS3DH_I2C_ADDR: u8 = 0x19; @@ -47,7 +50,7 @@ async fn main(peripherals: Peripherals) { let _ = I2C_BUS.set(Mutex::new(i2c_bus)); - let mut i2c_device = i2c::I2cDevice::new(I2C_BUS.get().unwrap()); + let mut i2c_device = I2cDevice::new(I2C_BUS.get().unwrap()); let mut id = [0]; i2c_device diff --git a/examples/spi-bus/src/main.rs b/examples/spi-bus/src/main.rs index f943b3130..0e1beb41a 100644 --- a/examples/spi-bus/src/main.rs +++ b/examples/spi-bus/src/main.rs @@ -10,10 +10,13 @@ #![feature(used_with_arg)] use embassy_sync::mutex::Mutex; -use embedded_hal_async::spi::{Operation, SpiDevice}; +use embedded_hal_async::spi::{Operation, SpiDevice as _}; use riot_rs::{ debug::{exit, println, EXIT_SUCCESS}, - embassy::arch::{gpio, peripherals, spi}, + embassy::{ + arch::{gpio, peripherals, spi}, + spi::SpiDevice, + }, }; // WHO_AM_I register of the LIS3DH sensor @@ -56,7 +59,7 @@ async fn main(peripherals: Peripherals) { #[cfg(context = "rp")] let cs_output = gpio::Output::new(peripherals.spi_cs, gpio::Level::High); - let mut spi_device = spi::SpiDevice::new(SPI_BUS.get().unwrap(), cs_output); + let mut spi_device = SpiDevice::new(SPI_BUS.get().unwrap(), cs_output); let mut id = [0]; spi_device diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index a9d022680..38bb148dc 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -12,16 +12,11 @@ critical-section.workspace = true linkme.workspace = true static_cell.workspace = true cfg-if.workspace = true -<<<<<<< HEAD portable-atomic.workspace = true -||||||| parent of 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) -======= paste.workspace = true ->>>>>>> 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) embassy-embedded-hal = { workspace = true } embassy-executor = { workspace = true, features = ["nightly"] } - embassy-hal-internal = { workspace = true } embassy-net = { workspace = true, optional = true, features = [ "dhcpv4", @@ -32,11 +27,7 @@ embassy-sync = { workspace = true } embassy-time = { workspace = true, optional = true } embassy-usb = { workspace = true, optional = true } -<<<<<<< HEAD embedded-hal = { workspace = true } -||||||| parent of 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) -======= ->>>>>>> 6f11c8fa (feat(embassy-arch): support sharing I2C and SPI buses) embedded-hal-async = { workspace = true } riot-rs-threads = { path = "../riot-rs-threads", optional = true } diff --git a/src/riot-rs-embassy/src/arch/dummy/i2c.rs b/src/riot-rs-embassy/src/arch/dummy/i2c.rs new file mode 100644 index 000000000..714b1681f --- /dev/null +++ b/src/riot-rs-embassy/src/arch/dummy/i2c.rs @@ -0,0 +1 @@ +pub enum I2c {} diff --git a/src/riot-rs-embassy/src/arch/dummy/mod.rs b/src/riot-rs-embassy/src/arch/dummy/mod.rs index dd0720e92..fcc2e84d5 100644 --- a/src/riot-rs-embassy/src/arch/dummy/mod.rs +++ b/src/riot-rs-embassy/src/arch/dummy/mod.rs @@ -2,6 +2,8 @@ mod executor; pub mod gpio; +pub mod i2c; +pub mod spi; pub mod peripheral { pub use embassy_hal_internal::Peripheral; diff --git a/src/riot-rs-embassy/src/arch/dummy/spi.rs b/src/riot-rs-embassy/src/arch/dummy/spi.rs new file mode 100644 index 000000000..7a7cef2ad --- /dev/null +++ b/src/riot-rs-embassy/src/arch/dummy/spi.rs @@ -0,0 +1 @@ +pub enum Spi {} diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index 69fddd6af..92fd6c723 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -1,21 +1,15 @@ -use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; use embassy_nrf::{ bind_interrupts, gpio::Pin as GpioPin, peripherals, twim::{InterruptHandler, Twim}, }; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embedded_hal_async::i2c::Operation; use crate::i2c::impl_async_i2c_for_driver_enum; pub use embassy_nrf::twim::Frequency; -// TODO: factor this out (across archs)? -// TODO: do we need a CriticalSectionRawMutex here? -pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, I2c>; - #[non_exhaustive] #[derive(Clone)] pub struct Config { diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index d176d3d50..509474144 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -1,19 +1,14 @@ -use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; use embassy_nrf::{ bind_interrupts, gpio::{self, Pin as GpioPin}, peripherals, spim::{InterruptHandler, Spim, MODE_0, MODE_1, MODE_2, MODE_3}, }; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use crate::spi::impl_async_spibus_for_driver_enum; pub use embassy_nrf::spim::Frequency; -// TODO: factor this out across archs? -pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, Spi, gpio::Output<'static>>; - #[derive(Clone)] #[non_exhaustive] pub struct Config { diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 987f85032..2fde4ee82 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -1,18 +1,12 @@ -use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; use embassy_rp::{ bind_interrupts, i2c::{InterruptHandler, SclPin, SdaPin}, peripherals, }; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embedded_hal_async::i2c::Operation; use crate::i2c::impl_async_i2c_for_driver_enum; -// TODO: factor this out (across archs)? -// TODO: do we need a CriticalSectionRawMutex here? -pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, I2c>; - // We do not provide configuration for internal pull-ups as the RP2040 datasheet mentions in // section 4.3.1.3 that the GPIO used should have pull-ups enabled. #[derive(Clone)] diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index 24145258f..aa845dd36 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -1,15 +1,10 @@ -use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; use embassy_rp::{ - dma, gpio, peripherals, + dma, peripherals, spi::{Async, ClkPin, MisoPin, MosiPin, Phase, Polarity, Spi as InnerSpi}, }; -use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use crate::spi::impl_async_spibus_for_driver_enum; -// TODO: factor this out across archs? -pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, Spi, gpio::Output<'static>>; - #[derive(Clone)] #[non_exhaustive] pub struct Config { diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 09ccaad6f..40ca01473 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -1,3 +1,11 @@ +use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; + +use crate::arch; + +// TODO: do we actually need a CriticalSectionRawMutex here? +pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, arch::i2c::I2c>; + macro_rules! impl_async_i2c_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { impl embedded_hal_async::i2c::I2c for $driver_enum { diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 1bc45e96c..3ac0ac27c 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -10,6 +10,8 @@ mod i2c; mod spi; +pub mod define_peripherals; + pub mod define_peripherals; pub mod gpio; diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index fa9fc3898..9c36ee60e 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -1,3 +1,12 @@ +use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; +use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; + +use crate::arch; + +// TODO: do we actually need a CriticalSectionRawMutex here? +pub type SpiDevice = + InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi::Spi, arch::gpio::Output<'static>>; + macro_rules! impl_async_spibus_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { impl embedded_hal_async::spi::SpiBus for $driver_enum { From 451c7ab0e63e14ad51a4242bc19f766f4f036cbf Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 17 Jun 2024 13:28:52 +0200 Subject: [PATCH 07/95] fixup! feat(example): add an example testing I2C --- Cargo.toml | 1 + {examples => tests}/i2c-bus/Cargo.toml | 0 {examples => tests}/i2c-bus/README.md | 0 {examples => tests}/i2c-bus/laze.yml | 0 {examples => tests}/i2c-bus/src/main.rs | 0 tests/laze.yml | 1 + 6 files changed, 2 insertions(+) rename {examples => tests}/i2c-bus/Cargo.toml (100%) rename {examples => tests}/i2c-bus/README.md (100%) rename {examples => tests}/i2c-bus/laze.yml (100%) rename {examples => tests}/i2c-bus/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 2656392b9..fdf30d86d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ members = [ "tests/gpio", "tests/gpio-interrupt-nrf", "tests/gpio-interrupt-stm32", + "tests/i2c-bus", ] exclude = ["src/lib"] diff --git a/examples/i2c-bus/Cargo.toml b/tests/i2c-bus/Cargo.toml similarity index 100% rename from examples/i2c-bus/Cargo.toml rename to tests/i2c-bus/Cargo.toml diff --git a/examples/i2c-bus/README.md b/tests/i2c-bus/README.md similarity index 100% rename from examples/i2c-bus/README.md rename to tests/i2c-bus/README.md diff --git a/examples/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml similarity index 100% rename from examples/i2c-bus/laze.yml rename to tests/i2c-bus/laze.yml diff --git a/examples/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs similarity index 100% rename from examples/i2c-bus/src/main.rs rename to tests/i2c-bus/src/main.rs diff --git a/tests/laze.yml b/tests/laze.yml index 881af4c9e..5843b8c9d 100644 --- a/tests/laze.yml +++ b/tests/laze.yml @@ -3,3 +3,4 @@ subdirs: - gpio - gpio-interrupt-nrf - gpio-interrupt-stm32 + - i2c-bus From 2bf14fdaf499f81e72043b75df8dc30c91905b05 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 17 Jun 2024 13:29:20 +0200 Subject: [PATCH 08/95] fixup! fixup! feat(example): add an example testing SPI --- Cargo.toml | 1 + tests/laze.yml | 1 + {examples => tests}/spi-bus/Cargo.toml | 0 {examples => tests}/spi-bus/README.md | 0 {examples => tests}/spi-bus/laze.yml | 0 {examples => tests}/spi-bus/src/main.rs | 0 6 files changed, 2 insertions(+) rename {examples => tests}/spi-bus/Cargo.toml (100%) rename {examples => tests}/spi-bus/README.md (100%) rename {examples => tests}/spi-bus/laze.yml (100%) rename {examples => tests}/spi-bus/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index fdf30d86d..7de791ee2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ members = [ "tests/gpio-interrupt-nrf", "tests/gpio-interrupt-stm32", "tests/i2c-bus", + "tests/spi-bus", ] exclude = ["src/lib"] diff --git a/tests/laze.yml b/tests/laze.yml index 5843b8c9d..2d90eabad 100644 --- a/tests/laze.yml +++ b/tests/laze.yml @@ -4,3 +4,4 @@ subdirs: - gpio-interrupt-nrf - gpio-interrupt-stm32 - i2c-bus + - spi-bus diff --git a/examples/spi-bus/Cargo.toml b/tests/spi-bus/Cargo.toml similarity index 100% rename from examples/spi-bus/Cargo.toml rename to tests/spi-bus/Cargo.toml diff --git a/examples/spi-bus/README.md b/tests/spi-bus/README.md similarity index 100% rename from examples/spi-bus/README.md rename to tests/spi-bus/README.md diff --git a/examples/spi-bus/laze.yml b/tests/spi-bus/laze.yml similarity index 100% rename from examples/spi-bus/laze.yml rename to tests/spi-bus/laze.yml diff --git a/examples/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs similarity index 100% rename from examples/spi-bus/src/main.rs rename to tests/spi-bus/src/main.rs From 876b37bfb2b1469707aa94da20815b00b39e0713 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 17 Jun 2024 14:24:12 +0200 Subject: [PATCH 09/95] fixup! fixup! feat(example): add an example testing I2C --- tests/i2c-bus/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/README.md b/tests/i2c-bus/README.md index bd48d11de..40e011f4f 100644 --- a/tests/i2c-bus/README.md +++ b/tests/i2c-bus/README.md @@ -2,7 +2,7 @@ ## About -This application is demonstrating raw I2C bus usage in RIOT-rs. +This application is testing raw I2C bus usage in RIOT-rs. Please use `riot_rs::sensors` instead for a high-level sensor abstraction that is architecture-agnostic. ## How to run From e2ab4ffc37649388b206f2d275ba6b3c27cd222c Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 17 Jun 2024 14:24:31 +0200 Subject: [PATCH 10/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spi-bus/README.md b/tests/spi-bus/README.md index 98185d23d..d78e2681b 100644 --- a/tests/spi-bus/README.md +++ b/tests/spi-bus/README.md @@ -2,7 +2,7 @@ ## About -This application is demonstrating raw SPI bus usage in RIOT-rs. +This application is testing raw SPI bus usage in RIOT-rs. Please use `riot_rs::sensors` instead for a high-level sensor abstraction that is architecture-agnostic. ## How to run From d1bf5c32165fe6dd8a4d52ee1165107bbd0b878d Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 17 Jun 2024 15:22:42 +0200 Subject: [PATCH 11/95] docs(buses): provide additional documentation on drivers --- src/riot-rs-embassy/src/arch/dummy/i2c.rs | 13 +++++++++++++ src/riot-rs-embassy/src/arch/dummy/spi.rs | 13 +++++++++++++ src/riot-rs-embassy/src/arch/nrf/i2c.rs | 2 ++ src/riot-rs-embassy/src/arch/nrf/spi.rs | 2 ++ src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 11 +++++++++-- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 3 ++- 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/dummy/i2c.rs b/src/riot-rs-embassy/src/arch/dummy/i2c.rs index 714b1681f..d38919cfa 100644 --- a/src/riot-rs-embassy/src/arch/dummy/i2c.rs +++ b/src/riot-rs-embassy/src/arch/dummy/i2c.rs @@ -1 +1,14 @@ +/// Peripheral-agnostic I2C driver implementing [`embedded_hal_async::i2c::I2c`]. +/// +/// The driver instance is meant to be shared between tasks using +/// [`I2cDevice`](crate::i2c::I2cDevice). +/// +/// This driver is not architecture-agnostic however, and has as many variants as the MCU has +/// I2C peripherals, each variant's name being the name of that peripheral. +/// Each enum variant has an associated value, which is the associated peripheral-specific driver +/// instance. +/// The names of peripheral-specific I2C drivers are `I2c$peripheral`, where `$peripheral` is the +/// name of the I2C peripheral (e.g, driver names can be `I2cI2C0`, `I2cTWISPI0`, or `I2cSERIAL0`). +/// The constructors of these peripheral-specific drivers depend on the architecture, please see +/// the examples and tests for reference. pub enum I2c {} diff --git a/src/riot-rs-embassy/src/arch/dummy/spi.rs b/src/riot-rs-embassy/src/arch/dummy/spi.rs index 7a7cef2ad..8c088f38d 100644 --- a/src/riot-rs-embassy/src/arch/dummy/spi.rs +++ b/src/riot-rs-embassy/src/arch/dummy/spi.rs @@ -1 +1,14 @@ +/// Peripheral-agnostic SPI driver implementing [`embedded_hal_async::spi::SpiBus`]. +/// +/// The driver instance is meant to be shared between tasks using +/// [`SpiDevice`](crate::spi::SpiDevice). +/// +/// This driver is not architecture-agnostic however, and has as many variants as the MCU has +/// SPI peripherals, each variant's name being the name of that peripheral. +/// Each enum variant has an associated value, which is the associated peripheral-specific driver +/// instance. +/// The names of peripheral-specific SPI drivers are `Spi$peripheral`, where `$peripheral` is the +/// name of the SPI peripheral (e.g, driver names can be `SpiSPI2`, `SpiSPI0`, or `SpiSERIAL2`). +/// The constructors of these peripheral-specific drivers depend on the architecture, please see +/// the examples and tests for reference. pub enum Spi {} diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index 92fd6c723..f084b7c57 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -37,6 +37,7 @@ macro_rules! define_i2c_drivers { // paste allows to create new identifiers by concatenation using `[]`. paste::paste! { $( + /// Peripheral-specific I2C driver. pub struct [] { twim: Twim<'static, peripherals::$peripheral>, } @@ -69,6 +70,7 @@ macro_rules! define_i2c_drivers { } )* + /// Peripheral-agnostic driver. pub enum I2c { $( $peripheral([]), )* } diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index 509474144..daaf94c48 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -67,6 +67,7 @@ macro_rules! define_spi_drivers { // paste allows to create new identifiers by concatenation using `[]`. paste::paste! { $( + /// Peripheral-specific SPI driver. pub struct [] { spim: Spim<'static, peripherals::$peripheral>, } @@ -105,6 +106,7 @@ macro_rules! define_spi_drivers { } )* + /// Peripheral-agnostic driver. pub enum Spi { $( $peripheral([]), )* } diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 2fde4ee82..646c32bfa 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -38,6 +38,7 @@ macro_rules! define_i2c_drivers { // paste allows to create new identifiers by concatenation using `[]`. paste::paste! { $( + /// Peripheral-specific I2C driver. pub struct [] { twim: embassy_rp::i2c::I2c<'static, peripherals::$peripheral, embassy_rp::i2c::Async>, } @@ -59,14 +60,20 @@ macro_rules! define_i2c_drivers { } ); - let i2c = - embassy_rp::i2c::I2c::new_async(i2c_peripheral, scl_pin, sda_pin, Irqs, i2c_config); + let i2c = embassy_rp::i2c::I2c::new_async( + i2c_peripheral, + scl_pin, + sda_pin, + Irqs, + i2c_config, + ); Self { twim: i2c } } } )* + /// Peripheral-agnostic driver. pub enum I2c { $( $peripheral([]), )* } diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index aa845dd36..592b37eac 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -62,6 +62,7 @@ macro_rules! define_spi_drivers { // paste allows to create new identifiers by concatenation using `[]`. paste::paste! { $( + /// Peripheral-specific SPI driver. pub struct [] { spim: InnerSpi<'static, peripherals::$peripheral, Async>, } @@ -100,7 +101,7 @@ macro_rules! define_spi_drivers { } )* - // Each enum variant is for a specific peripheral. + /// Peripheral-agnostic driver. pub enum Spi { $( $peripheral([]), )* } From 256f4c1e56adaa1a3c5b61e5a85f20e1d30aebaa Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 18 Jun 2024 09:50:44 +0200 Subject: [PATCH 12/95] chore: add allow lints on macros by arch modules --- src/riot-rs-embassy/src/i2c.rs | 2 ++ src/riot-rs-embassy/src/lib.rs | 1 + src/riot-rs-embassy/src/spi.rs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 40ca01473..01d19a8d0 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -6,6 +6,7 @@ use crate::arch; // TODO: do we actually need a CriticalSectionRawMutex here? pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, arch::i2c::I2c>; +#[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_i2c_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { impl embedded_hal_async::i2c::I2c for $driver_enum { @@ -44,4 +45,5 @@ macro_rules! impl_async_i2c_for_driver_enum { } } } +#[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_i2c_for_driver_enum; diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 3ac0ac27c..9d2af84b4 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -5,6 +5,7 @@ #![feature(impl_trait_in_assoc_type)] #![feature(used_with_arg)] #![feature(lint_reasons)] +<<<<<<< HEAD #![feature(trait_alias)] mod i2c; diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 9c36ee60e..fd0218e37 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -7,6 +7,7 @@ use crate::arch; pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi::Spi, arch::gpio::Output<'static>>; +#[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_spibus_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { impl embedded_hal_async::spi::SpiBus for $driver_enum { @@ -43,4 +44,5 @@ macro_rules! impl_async_spibus_for_driver_enum { } } } +#[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_spibus_for_driver_enum; From 8bc7799736c44045821a0a57741f0c0f34f1f315 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:50:43 +0200 Subject: [PATCH 13/95] fixup! feat(example): add an example testing I2C --- examples/laze.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/laze.yml b/examples/laze.yml index 6d44f304c..ac3135f56 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -16,7 +16,6 @@ subdirs: - gpio - hello-world - hello-world-async - - i2c-bus - log - minimal - random From 0b2f35b063b19d28992a61768f1383cd26784985 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:50:43 +0200 Subject: [PATCH 14/95] fixup! feat(example): add an example testing SPI --- examples/laze.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/laze.yml b/examples/laze.yml index ac3135f56..a69997482 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -19,7 +19,6 @@ subdirs: - log - minimal - random - - spi-bus - threading - threading-channel - usb-serial From dcd3f414864ce2a32abbed80044bb41c8fb8771c Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:52:52 +0200 Subject: [PATCH 15/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/laze.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml index 4a429ccfa..0941606da 100644 --- a/tests/i2c-bus/laze.yml +++ b/tests/i2c-bus/laze.yml @@ -4,5 +4,9 @@ apps: global: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 + contexts: + - nrf52840 + - nrf5340 + - rp2040 selects: - ?release From ff9c00e0b81ea1791a2585f66993532285036fbb Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:52:52 +0200 Subject: [PATCH 16/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/laze.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/spi-bus/laze.yml b/tests/spi-bus/laze.yml index 482285c69..570018b6d 100644 --- a/tests/spi-bus/laze.yml +++ b/tests/spi-bus/laze.yml @@ -4,5 +4,9 @@ apps: global: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 + contexts: + - nrf52840 + - nrf5340 + - rp2040 selects: - ?release From 81ab7ef3dc828e9c71da068fce22980ce3322949 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:56:21 +0200 Subject: [PATCH 17/95] fixup! fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/laze.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml index 0941606da..9d87633f1 100644 --- a/tests/i2c-bus/laze.yml +++ b/tests/i2c-bus/laze.yml @@ -4,7 +4,7 @@ apps: global: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 - contexts: + context: - nrf52840 - nrf5340 - rp2040 From e0867a2a5cf00b9db72ddc7478e3ba1b2cbdcdd1 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 16:56:21 +0200 Subject: [PATCH 18/95] fixup! 5f2085817ae66449f4c1781e4f0d61ee2f2172a4 --- tests/spi-bus/laze.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spi-bus/laze.yml b/tests/spi-bus/laze.yml index 570018b6d..2dcc860cb 100644 --- a/tests/spi-bus/laze.yml +++ b/tests/spi-bus/laze.yml @@ -4,7 +4,7 @@ apps: global: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 - contexts: + context: - nrf52840 - nrf5340 - rp2040 From 77bddabd84d56e5c80e1ed736bf20c7420472b19 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:00:32 +0200 Subject: [PATCH 19/95] fixup! chore: add allow lints on macros by arch modules --- src/riot-rs-embassy/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 9d2af84b4..3ac0ac27c 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -5,7 +5,6 @@ #![feature(impl_trait_in_assoc_type)] #![feature(used_with_arg)] #![feature(lint_reasons)] -<<<<<<< HEAD #![feature(trait_alias)] mod i2c; From 9fe1d06acbb3207f535e309b46abccf1e8dde2fe Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:05:40 +0200 Subject: [PATCH 20/95] fixup! refactor(buses): share I2cDevice and SpiDevice across archs --- src/riot-rs-embassy/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 3ac0ac27c..1bc45e96c 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -10,8 +10,6 @@ mod i2c; mod spi; -pub mod define_peripherals; - pub mod define_peripherals; pub mod gpio; From 7fd9470008ffbdc0f7eee206d89277a698a953e3 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:15:18 +0200 Subject: [PATCH 21/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 1bc45e96c..ca124c3c9 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -7,9 +7,6 @@ #![feature(lint_reasons)] #![feature(trait_alias)] -mod i2c; -mod spi; - pub mod define_peripherals; pub mod gpio; From 687d02db6067beb142f4af73b1afc5870deda54d Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:15:18 +0200 Subject: [PATCH 22/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 0e1beb41a..e0b7e1be8 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -14,7 +14,8 @@ use embedded_hal_async::spi::{Operation, SpiDevice as _}; use riot_rs::{ debug::{exit, println, EXIT_SUCCESS}, embassy::{ - arch::{gpio, peripherals, spi}, + arch::{peripherals, spi}, + gpio, spi::SpiDevice, }, }; From b18dd5823915aeaee7f78c0a581660532f052310 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:15:18 +0200 Subject: [PATCH 23/95] fixup! refactor(buses): share I2cDevice and SpiDevice across archs --- src/riot-rs-embassy/src/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index fd0218e37..820ba79eb 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -1,7 +1,7 @@ use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; -use crate::arch; +use crate::{arch, gpio}; // TODO: do we actually need a CriticalSectionRawMutex here? pub type SpiDevice = From 9e0604a68b3b822c80bb15f9c8d7cca26daa19e1 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 17 Jul 2024 17:15:18 +0200 Subject: [PATCH 24/95] fixup! refactor(buses): share I2cDevice and SpiDevice across archs --- src/riot-rs-embassy/src/spi.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 820ba79eb..49b977cea 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -4,8 +4,7 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use crate::{arch, gpio}; // TODO: do we actually need a CriticalSectionRawMutex here? -pub type SpiDevice = - InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi::Spi, arch::gpio::Output<'static>>; +pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi::Spi, gpio::Output>; #[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_spibus_for_driver_enum { From 64aef5c764da3461bebf88d0b4e370b8568a2921 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 09:46:25 +0200 Subject: [PATCH 25/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- Cargo.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 578e66d4f..01088c954 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1042,12 +1042,11 @@ dependencies = [ [[package]] name = "embassy-embedded-hal" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d" +source = "git+https://github.com/kaspar030/embassy?branch=for-riot-rs-240605#584940fc7ea02fe184f3ae346ecaa3d00008c95e" dependencies = [ "defmt", "embassy-futures", - "embassy-sync 0.5.0", + "embassy-sync 0.6.0", "embassy-time", "embedded-hal 0.2.7", "embedded-hal 1.0.0", From e28e811ace5e36b03f7d99879764a0b5879fa3a9 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 09:47:24 +0200 Subject: [PATCH 26/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index ca124c3c9..61dbcf569 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -9,6 +9,8 @@ pub mod define_peripherals; pub mod gpio; +pub mod i2c; +pub mod spi; #[cfg(feature = "external-interrupts")] mod extint_registry; From 341f609ee1476809361cb4765d577a1c4530d358 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 09:47:40 +0200 Subject: [PATCH 27/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/spi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 49b977cea..c87094462 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -9,6 +9,7 @@ pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi: #[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_spibus_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { + // The `SpiBus` represent exclusive ownership over the whole bus. impl embedded_hal_async::spi::SpiBus for $driver_enum { async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { match self { From dfd0e1117d83bb97cdeef4b857b959c279a0f793 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 10:06:44 +0200 Subject: [PATCH 28/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index d2588c838..67912c8dd 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -26,9 +26,9 @@ const WHO_AM_I_REG_ADDR: u8 = 0x0f; #[cfg(context = "rp")] riot_rs::define_peripherals!(Peripherals { - i2c_peripheral: I2C1, - i2c_sda: PIN_18, - i2c_scl: PIN_19, + i2c_peripheral: I2C0, + i2c_sda: PIN_12, + i2c_scl: PIN_13, }); pub static I2C_BUS: once_cell::sync::OnceCell< From e389b92bb236f8482b268b7ea36e47798246167e Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 10:06:44 +0200 Subject: [PATCH 29/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 67912c8dd..803bbf8d1 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -41,7 +41,7 @@ async fn main(peripherals: Peripherals) { i2c_config.frequency = i2c::Frequency::K100; #[cfg(context = "rp")] - let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( + let i2c_bus = i2c::I2c::I2C0(i2c::I2cI2C0::new( peripherals.i2c_peripheral, peripherals.i2c_sda, peripherals.i2c_scl, From 912e7fc00a0ae23f5ff6d5e0d8b6dd43cc13e75f Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 10:14:45 +0200 Subject: [PATCH 30/95] fixup! a60a9b9ac0b1ac8f6d88515eda8d03de354e2dc3 --- src/riot-rs-embassy/src/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index c87094462..99e33e197 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -9,7 +9,7 @@ pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi: #[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_spibus_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { - // The `SpiBus` represent exclusive ownership over the whole bus. + // The `SpiBus` trait represents exclusive ownership over the whole bus. impl embedded_hal_async::spi::SpiBus for $driver_enum { async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error> { match self { From 7fd709549418b850248af295b974178c69c3c7c8 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 18 Jul 2024 16:14:53 +0200 Subject: [PATCH 31/95] feat(i2c): add support for I2C on STM32WB55RGVX --- src/riot-rs-embassy/src/arch/stm32/i2c.rs | 127 ++++++++++++++++++++++ src/riot-rs-embassy/src/arch/stm32/mod.rs | 1 + tests/i2c-bus/Cargo.toml | 4 +- tests/i2c-bus/laze.yml | 1 + tests/i2c-bus/src/main.rs | 19 ++++ 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 src/riot-rs-embassy/src/arch/stm32/i2c.rs diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs new file mode 100644 index 000000000..c787af114 --- /dev/null +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -0,0 +1,127 @@ +use embassy_stm32::{ + bind_interrupts, + i2c::{ + ErrorInterruptHandler, EventInterruptHandler, I2c as InnerI2c, RxDma, SclPin, SdaPin, TxDma, + }, + mode::Async, + peripherals, + time::Hertz, + Peripheral, +}; +use embedded_hal_async::i2c::Operation; + +use crate::i2c::impl_async_i2c_for_driver_enum; + +#[non_exhaustive] +#[derive(Clone)] +pub struct Config { + pub frequency: Frequency, + pub sda_pullup: bool, + pub scl_pullup: bool, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::K100, + sda_pullup: false, + scl_pullup: false, + } + } +} + +// FIXME: check how well this matches the STM32 capabilities +// TODO: allow more free-from values? +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K100 = 100_000, + K250 = 250_000, + K400 = 400_000, + M1 = 1_000_000, +} + +impl From for Hertz { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::K100 => Hertz::khz(100), + Frequency::K250 => Hertz::khz(250), + Frequency::K400 => Hertz::khz(400), + Frequency::M1 => Hertz::mhz(1), + } + } +} + +macro_rules! define_i2c_drivers { + ($( $ev_interrupt:ident, $er_interrupt:ident => $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + /// Peripheral-specific I2C driver. + // NOTE(arch): this is not required on this architecture, as the inner I2C type is + // not generic over the I2C peripheral, and is only done for consistency with + // other architectures. + pub struct [] { + twim: InnerI2c<'static, Async> + } + + impl [] { + #[must_use] + pub fn new( + twim_peripheral: impl Peripheral

+ 'static, + sda_pin: impl Peripheral> + 'static, + scl_pin: impl Peripheral> + 'static, + tx_dma: impl Peripheral> + 'static, + rx_dma: impl Peripheral> + 'static, + config: Config, + ) -> Self { + let mut i2c_config = embassy_stm32::i2c::Config::default(); + i2c_config.sda_pullup = config.sda_pullup; + i2c_config.scl_pullup = config.scl_pullup; + + bind_interrupts!( + struct Irqs { + $ev_interrupt => EventInterruptHandler; + $er_interrupt => ErrorInterruptHandler; + } + ); + + let frequency = config.frequency; + let i2c = InnerI2c::new( + twim_peripheral, + scl_pin, + sda_pin, + Irqs, + tx_dma, + rx_dma, + frequency.into(), + i2c_config, + ); + + Self { twim: i2c } + } + } + )* + + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral([]), )* + } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_stm32::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + } + } +} + +// FIXME: support other STM32 archs +// Define a driver per peripheral +#[cfg(context = "stm32wb55rgvx")] +define_i2c_drivers!( + I2C1_EV, I2C1_ER => I2C1, + // There is no I2C2 peripheral. + I2C3_EV, I2C3_ER => I2C3, +); diff --git a/src/riot-rs-embassy/src/arch/stm32/mod.rs b/src/riot-rs-embassy/src/arch/stm32/mod.rs index 406577f63..c7c8ee7a1 100644 --- a/src/riot-rs-embassy/src/arch/stm32/mod.rs +++ b/src/riot-rs-embassy/src/arch/stm32/mod.rs @@ -1,4 +1,5 @@ pub mod gpio; +pub mod i2c; pub mod peripheral { pub use embassy_stm32::Peripheral; diff --git a/tests/i2c-bus/Cargo.toml b/tests/i2c-bus/Cargo.toml index b383e0645..39cd73c48 100644 --- a/tests/i2c-bus/Cargo.toml +++ b/tests/i2c-bus/Cargo.toml @@ -13,5 +13,7 @@ embassy-executor = { workspace = true } embassy-sync = { workspace = true } embedded-hal-async = { workspace = true } once_cell = { workspace = true } -riot-rs = { path = "../../src/riot-rs", features = [] } +riot-rs = { path = "../../src/riot-rs", features = [ + "time", # FIXME: seems to be required on STM32 +] } riot-rs-boards = { path = "../../src/riot-rs-boards" } diff --git a/tests/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml index 9d87633f1..a382b29ba 100644 --- a/tests/i2c-bus/laze.yml +++ b/tests/i2c-bus/laze.yml @@ -8,5 +8,6 @@ apps: - nrf52840 - nrf5340 - rp2040 + - st-nucleo-wb55 selects: - ?release diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 803bbf8d1..75c1e481b 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -31,6 +31,15 @@ riot_rs::define_peripherals!(Peripherals { i2c_scl: PIN_13, }); +#[cfg(context = "st-nucleo-wb55")] +riot_rs::define_peripherals!(Peripherals { + i2c_peripheral: I2C1, + i2c_sda: PB9, + i2c_scl: PB8, + i2c_tx_dma: DMA1_CH1, + i2c_rx_dma: DMA1_CH2, +}); + pub static I2C_BUS: once_cell::sync::OnceCell< Mutex, > = once_cell::sync::OnceCell::new(); @@ -48,6 +57,16 @@ async fn main(peripherals: Peripherals) { i2c_config, )); + #[cfg(context = "stm32wb55rgvx")] + let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( + peripherals.i2c_peripheral, + peripherals.i2c_sda, + peripherals.i2c_scl, + peripherals.i2c_tx_dma, + peripherals.i2c_rx_dma, + i2c_config, + )); + let _ = I2C_BUS.set(Mutex::new(i2c_bus)); let mut i2c_device = I2cDevice::new(I2C_BUS.get().unwrap()); From b8967e9c4da976d0576dbd2d30a9aa04a25a16ef Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 19 Jul 2024 09:18:04 +0200 Subject: [PATCH 32/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index e0b7e1be8..463e70946 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -57,7 +57,6 @@ async fn main(peripherals: Peripherals) { let _ = SPI_BUS.set(Mutex::new(spi_bus)); - #[cfg(context = "rp")] let cs_output = gpio::Output::new(peripherals.spi_cs, gpio::Level::High); let mut spi_device = SpiDevice::new(SPI_BUS.get().unwrap(), cs_output); From 53b8ccd0dadb9f4ab377448dc2d6d88b68912e07 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 19 Jul 2024 11:42:25 +0200 Subject: [PATCH 33/95] feat(spi): add support for SPI on STM32WB55RGVX --- src/riot-rs-embassy/src/arch/nrf/spi.rs | 10 +- src/riot-rs-embassy/src/arch/stm32/mod.rs | 1 + src/riot-rs-embassy/src/arch/stm32/spi.rs | 160 ++++++++++++++++++++++ src/riot-rs-embassy/src/spi.rs | 2 +- tests/spi-bus/laze.yml | 1 + tests/spi-bus/src/main.rs | 22 +++ 6 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 src/riot-rs-embassy/src/arch/stm32/spi.rs diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index daaf94c48..d02cd1f42 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -2,7 +2,7 @@ use embassy_nrf::{ bind_interrupts, gpio::{self, Pin as GpioPin}, peripherals, - spim::{InterruptHandler, Spim, MODE_0, MODE_1, MODE_2, MODE_3}, + spim::{InterruptHandler, Spim}, }; use crate::spi::impl_async_spibus_for_driver_enum; @@ -39,10 +39,10 @@ pub enum Mode { impl From for embassy_nrf::spim::Mode { fn from(mode: Mode) -> Self { match mode { - Mode::Mode0 => MODE_0, - Mode::Mode1 => MODE_1, - Mode::Mode2 => MODE_2, - Mode::Mode3 => MODE_3, + Mode::Mode0 => embassy_nrf::spim::MODE_0, + Mode::Mode1 => embassy_nrf::spim::MODE_1, + Mode::Mode2 => embassy_nrf::spim::MODE_2, + Mode::Mode3 => embassy_nrf::spim::MODE_3, } } } diff --git a/src/riot-rs-embassy/src/arch/stm32/mod.rs b/src/riot-rs-embassy/src/arch/stm32/mod.rs index c7c8ee7a1..6b1d7afaa 100644 --- a/src/riot-rs-embassy/src/arch/stm32/mod.rs +++ b/src/riot-rs-embassy/src/arch/stm32/mod.rs @@ -1,5 +1,6 @@ pub mod gpio; pub mod i2c; +pub mod spi; pub mod peripheral { pub use embassy_stm32::Peripheral; diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs new file mode 100644 index 000000000..ef4537c7f --- /dev/null +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -0,0 +1,160 @@ +use embassy_stm32::{ + gpio, + mode::Async, + peripherals, + spi::{MisoPin, MosiPin, RxDma, SckPin, Spi as InnerSpi, TxDma}, + time::Hertz, + Peripheral, +}; + +use crate::spi::impl_async_spibus_for_driver_enum; + +#[derive(Clone)] +#[non_exhaustive] +pub struct Config { + pub frequency: Frequency, + pub mode: Mode, + pub bit_order: BitOrder, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::M1, + mode: Mode::Mode0, + bit_order: BitOrder::MsbFirst, + } + } +} + +// Possible values are copied from embassy-nrf +// TODO: check how well this matches the STM32 capabilities +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K125 = 125_000, + K250 = 250_000, + K500 = 500_00, + M1 = 1_000_000, + M2 = 2_000_000, + M4 = 4_000_000, + M8 = 8_000_000, + M16 = 16_000_000, + M32 = 32_000_000, +} + +impl From for Hertz { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::K125 => Hertz::khz(125), + Frequency::K250 => Hertz::khz(250), + Frequency::K500 => Hertz::khz(500), + Frequency::M1 => Hertz::mhz(1), + Frequency::M2 => Hertz::mhz(2), + Frequency::M4 => Hertz::mhz(4), + Frequency::M8 => Hertz::mhz(8), + Frequency::M16 => Hertz::mhz(16), + Frequency::M32 => Hertz::mhz(32), + } + } +} + +#[derive(Copy, Clone)] +pub enum Mode { + Mode0, + Mode1, + Mode2, + Mode3, +} + +// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers +impl From for embassy_stm32::spi::Mode { + fn from(mode: Mode) -> Self { + match mode { + Mode::Mode0 => embassy_stm32::spi::MODE_0, + Mode::Mode1 => embassy_stm32::spi::MODE_1, + Mode::Mode2 => embassy_stm32::spi::MODE_2, + Mode::Mode3 => embassy_stm32::spi::MODE_3, + } + } +} + +#[derive(Copy, Clone)] +pub enum BitOrder { + MsbFirst, + LsbFirst, +} + +impl From for embassy_stm32::spi::BitOrder { + fn from(bit_order: BitOrder) -> Self { + match bit_order { + BitOrder::MsbFirst => embassy_stm32::spi::BitOrder::MsbFirst, + BitOrder::LsbFirst => embassy_stm32::spi::BitOrder::LsbFirst, + } + } +} + +macro_rules! define_spi_drivers { + ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + /// Peripheral-specific SPI driver. + pub struct [] { + spim: InnerSpi<'static, Async>, + } + + impl [] { + #[must_use] + pub fn new( + spim_peripheral:impl Peripheral

+ 'static, + sck_pin: impl Peripheral> + 'static, + miso_pin: impl Peripheral> + 'static, + mosi_pin: impl Peripheral> + 'static, + tx_dma: impl Peripheral> + 'static, + rx_dma: impl Peripheral> + 'static, + config: Config, + ) -> Self { + let mut spi_config = embassy_stm32::spi::Config::default(); + spi_config.frequency = config.frequency.into(); + spi_config.mode = config.mode.into(); + spi_config.bit_order = config.bit_order.into(); + spi_config.miso_pull = gpio::Pull::None; // FIXME: ? + + // The order of MOSI/MISO pins is inverted. + let spim = InnerSpi::new( + spim_peripheral, + sck_pin, + mosi_pin, + miso_pin, + tx_dma, + rx_dma, + spi_config, + ); + + Self { spim } + } + } + )* + + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral([]), )* + } + + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_stm32::spi::Error; + } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + } + }; +} + +// FIXME: support other STM32 archs +// Define a driver per peripheral +#[cfg(context = "stm32wb55rgvx")] +define_spi_drivers!( + SPI1 => SPI1, + SPI2 => SPI2, +); diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 99e33e197..b5f55ae1b 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -38,7 +38,7 @@ macro_rules! impl_async_spibus_for_driver_enum { async fn flush(&mut self) -> Result<(), Self::Error> { use embedded_hal_async::spi::SpiBus; match self { - $( Self::$peripheral(spi) => SpiBus::flush(&mut spi.spim).await, )* + $( Self::$peripheral(spi) => SpiBus::::flush(&mut spi.spim).await, )* } } } diff --git a/tests/spi-bus/laze.yml b/tests/spi-bus/laze.yml index 2dcc860cb..9733c6902 100644 --- a/tests/spi-bus/laze.yml +++ b/tests/spi-bus/laze.yml @@ -8,5 +8,6 @@ apps: - nrf52840 - nrf5340 - rp2040 + - st-nucleo-wb55 selects: - ?release diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 463e70946..c83fd8d4e 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -34,6 +34,17 @@ riot_rs::define_peripherals!(Peripherals { spi_rx_dma: DMA_CH1, }); +#[cfg(context = "stm32wb55rgvx")] +riot_rs::define_peripherals!(Peripherals { + spi_peripheral: SPI2, + spi_sck: PA9, + spi_miso: PC2, + spi_mosi: PC1, + spi_cs: PC0, + spi_tx_dma: DMA1_CH1, + spi_rx_dma: DMA1_CH2, +}); + pub static SPI_BUS: once_cell::sync::OnceCell< Mutex, > = once_cell::sync::OnceCell::new(); @@ -55,6 +66,17 @@ async fn main(peripherals: Peripherals) { spi_config, )); + #[cfg(context = "stm32wb55rgvx")] + let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( + peripherals.spi_peripheral, + peripherals.spi_sck, + peripherals.spi_miso, + peripherals.spi_mosi, + peripherals.spi_tx_dma, + peripherals.spi_rx_dma, + spi_config, + )); + let _ = SPI_BUS.set(Mutex::new(spi_bus)); let cs_output = gpio::Output::new(peripherals.spi_cs, gpio::Level::High); From 9f1edc899036deb2f0f6d925ff0e3693ed648a5e Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 19 Jul 2024 16:19:54 +0200 Subject: [PATCH 34/95] WIP: add support for SPI on ESP32 --- Cargo.lock | 1 + Cargo.toml | 1 + src/riot-rs-embassy/Cargo.toml | 1 + src/riot-rs-embassy/src/arch/esp/mod.rs | 10 +- src/riot-rs-embassy/src/arch/esp/spi.rs | 169 ++++++++++++++++++++++++ tests/spi-bus/laze.yml | 1 + 6 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 src/riot-rs-embassy/src/arch/esp/spi.rs diff --git a/Cargo.lock b/Cargo.lock index 01088c954..1e8d4190c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3544,6 +3544,7 @@ dependencies = [ "esp-hal", "esp-hal-embassy", "esp-wifi", + "fugit", "heapless 0.8.0", "linkme", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 7de791ee2..1f947a7fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ cortex-m = { version = "0.7", default-features = false, features = [ cortex-m-rt = { version = "=0.7.3" } cortex-m-semihosting = { version = "0.5" } critical-section = { version = "1.1.2" } +fugit = { version = "0.3.7", default-features = false } # TODO: enable defmt? # Disabling default features may reduce the code size by not providing atomics # for types larger than the pointer width, which we do not use. portable-atomic = { version = "1.6.0", default-features = false, features = [ diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 38bb148dc..aa6ef2789 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -13,6 +13,7 @@ linkme.workspace = true static_cell.workspace = true cfg-if.workspace = true portable-atomic.workspace = true +fugit.workspace = true paste.workspace = true embassy-embedded-hal = { workspace = true } diff --git a/src/riot-rs-embassy/src/arch/esp/mod.rs b/src/riot-rs-embassy/src/arch/esp/mod.rs index 50fc0c8bd..f7609632c 100644 --- a/src/riot-rs-embassy/src/arch/esp/mod.rs +++ b/src/riot-rs-embassy/src/arch/esp/mod.rs @@ -1,4 +1,5 @@ pub mod gpio; +pub mod spi; pub mod peripheral { pub use esp_hal::peripheral::Peripheral; @@ -46,13 +47,18 @@ pub mod peripherals { } } -use esp_hal::{clock::ClockControl, system::SystemControl, timer::timg::TimerGroup}; +use esp_hal::{clock::{ClockControl, Clocks}, system::SystemControl, timer::timg::TimerGroup}; +use once_cell::sync::OnceCell; pub use esp_hal::peripherals::OptionalPeripherals; #[cfg(feature = "executor-single-thread")] pub use esp_hal_embassy::Executor; +// NOTE(once-cell): using a `once_cell::OnceCell` here for critical-section support, just to be +// sure. +pub static CLOCKS: OnceCell = OnceCell::new(); + pub fn init() -> OptionalPeripherals { let mut peripherals = OptionalPeripherals::from(peripherals::Peripherals::take()); let system = SystemControl::new(peripherals.SYSTEM.take().unwrap()); @@ -84,5 +90,7 @@ pub fn init() -> OptionalPeripherals { let timer_group0 = TimerGroup::new(peripherals.TIMG0.take().unwrap(), &clocks); esp_hal_embassy::init(&clocks, timer_group0.timer0); + let _ = CLOCKS.set(clocks); + peripherals } diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs new file mode 100644 index 000000000..7bc06a4e5 --- /dev/null +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -0,0 +1,169 @@ +use esp_hal::{ + dma::{self, DmaPriority}, + gpio::{self, InputPin, OutputPin}, + peripheral::Peripheral, + peripherals, + spi::{ + master::dma::{SpiDma as InnerSpi, WithDmaSpi2}, + FullDuplexMode, + }, + Async, +}; + +use crate::{arch, spi::impl_async_spibus_for_driver_enum}; + +#[derive(Clone)] +#[non_exhaustive] +pub struct Config { + pub frequency: Frequency, // FIXME + pub mode: Mode, + pub bit_order: BitOrder, // FIXME +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::M1, // FIXME + mode: Mode::Mode0, + bit_order: BitOrder::MsbFirst, + } + } +} + +// Possible values are copied from embassy-nrf +// TODO: check how well this matches the ESP32 capabilities +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K125 = 125_000, + K250 = 250_000, + K500 = 500_00, + M1 = 1_000_000, + M2 = 2_000_000, + M4 = 4_000_000, + M8 = 8_000_000, + M16 = 16_000_000, + M32 = 32_000_000, +} + +impl From for fugit::Rate { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::K125 => fugit::Rate::::kHz(125), + Frequency::K250 => fugit::Rate::::kHz(250), + Frequency::K500 => fugit::Rate::::kHz(500), + Frequency::M1 => fugit::Rate::::MHz(1), + Frequency::M2 => fugit::Rate::::MHz(2), + Frequency::M4 => fugit::Rate::::MHz(4), + Frequency::M8 => fugit::Rate::::MHz(8), + Frequency::M16 => fugit::Rate::::MHz(16), + Frequency::M32 => fugit::Rate::::MHz(32), + } + } +} + +#[derive(Copy, Clone)] +pub enum Mode { + Mode0, + Mode1, + Mode2, + Mode3, +} + +// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers +impl From for esp_hal::spi::SpiMode { + fn from(mode: Mode) -> Self { + match mode { + Mode::Mode0 => esp_hal::spi::SpiMode::Mode0, + Mode::Mode1 => esp_hal::spi::SpiMode::Mode1, + Mode::Mode2 => esp_hal::spi::SpiMode::Mode2, + Mode::Mode3 => esp_hal::spi::SpiMode::Mode3, + } + } +} + +#[derive(Copy, Clone)] +pub enum BitOrder { + MsbFirst, + LsbFirst, +} + +impl From for esp_hal::spi::SpiBitOrder { + fn from(bit_order: BitOrder) -> Self { + match bit_order { + BitOrder::MsbFirst => esp_hal::spi::SpiBitOrder::MSBFirst, + BitOrder::LsbFirst => esp_hal::spi::SpiBitOrder::LSBFirst, + } + } +} + +macro_rules! define_spi_drivers { + ($( $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + /// Peripheral-specific SPI driver. + pub struct [] { + // FIXME: do we want full- or half-duplex? + spim: InnerSpi<'static, peripherals::$peripheral, dma::Channel1, FullDuplexMode, Async>, + } + + impl [] { + #[must_use] + pub fn new( + spi_peripheral: impl Peripheral

, + sck_pin: impl Peripheral, + miso_pin: impl Peripheral, + mosi_pin: impl Peripheral, + dma_ch: dma::Channel1, + config: Config, + ) -> Self + where C: dma::ChannelTypes, + C::P: dma::SpiPeripheral + dma::Spi2Peripheral + { + let clocks = arch::CLOCKS.get().unwrap(); + let spi = esp_hal::spi::master::Spi::new( + spi_peripheral, + config.frequency.into(), + config.mode.into(), + clocks, // FIXME: how to obtain this from the esp init()? + ); + let spi = spi.with_bit_order( + config.bit_order.into(), // Read order + config.bit_order.into(), // Write order + ); + // The order of MOSI/MISO pins is inverted. + let spi = spi.with_pins( + Some(sck_pin), + Some(mosi_pin), + Some(miso_pin), + gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? + ); + let dma_channel = dma_ch.configure_for_async(false, DmaPriority::Priority0); + let spi = spi.with_dma( + dma_channel, + // tx_dma_descriptors, // FIXME: need to rebase to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 + // rx_dma_descriptors, + ); + + Self { spim: spi } + } + } + )* + + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral([]), )* + } + + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = esp_hal::spi::Error; + } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + } + }; +} + +// Define a driver per peripheral +define_spi_drivers!(SPI2); diff --git a/tests/spi-bus/laze.yml b/tests/spi-bus/laze.yml index 9733c6902..41cdfe074 100644 --- a/tests/spi-bus/laze.yml +++ b/tests/spi-bus/laze.yml @@ -5,6 +5,7 @@ apps: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 context: + - espressif-esp32-c6-devkitc-1 - nrf52840 - nrf5340 - rp2040 From a8ebc653d073a5f54cf270fce7e460e6d01b5a71 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 35/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 75c1e481b..4af72a717 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -12,7 +12,7 @@ use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c::I2c as _; use riot_rs::{ - debug::{exit, println, EXIT_SUCCESS}, + debug::{exit, log::info, EXIT_SUCCESS}, embassy::{ arch::{i2c, peripherals}, i2c::I2cDevice, From 735e8077c5d48a26b43616106ce5b202c5546444 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 36/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 4af72a717..003d73ad6 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -78,7 +78,7 @@ async fn main(peripherals: Peripherals) { .unwrap(); let who_am_i = id[0]; - println!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); + info!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); assert_eq!(who_am_i, 0x33); exit(EXIT_SUCCESS); From 37496816eb7e48fd1cd27031d7f8df3947862fa0 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 37/95] fixup! 75f4a41f2996e452b865b138c1e3888fa148c163 --- tests/i2c-bus/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 003d73ad6..9b1739bb0 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -81,5 +81,7 @@ async fn main(peripherals: Peripherals) { info!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); assert_eq!(who_am_i, 0x33); + info!("Test passed!"); + exit(EXIT_SUCCESS); } From 7e32d535dc38983a83b219b8df3914cdc6b8446a Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 38/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index c83fd8d4e..41454842d 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -12,7 +12,7 @@ use embassy_sync::mutex::Mutex; use embedded_hal_async::spi::{Operation, SpiDevice as _}; use riot_rs::{ - debug::{exit, println, EXIT_SUCCESS}, + debug::{exit, log::info, EXIT_SUCCESS}, embassy::{ arch::{peripherals, spi}, gpio, From e1ba58fbeede232a095e252018df383ee0857501 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 39/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 41454842d..1f691c311 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -93,7 +93,7 @@ async fn main(peripherals: Peripherals) { .unwrap(); let who_am_i = id[0]; - println!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); + info!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); assert_eq!(who_am_i, 0x33); exit(EXIT_SUCCESS); From e06cdee520f8cf08819c29a34ec9f3809d5213c0 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 6 Aug 2024 14:10:09 +0200 Subject: [PATCH 40/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 1f691c311..19cd47f65 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -96,6 +96,8 @@ async fn main(peripherals: Peripherals) { info!("LIS3DH WHO_AM_I_COMMAND register value: 0x{:x}", who_am_i); assert_eq!(who_am_i, 0x33); + info!("Test passed!"); + exit(EXIT_SUCCESS); } From 71ab77f5992deec246a13bd552052cbd5db0cbf6 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 7 Aug 2024 15:10:30 +0200 Subject: [PATCH 41/95] feat: codegen the STM32 definitions of SPI and I2C drivers This relies on machine-readable data provided by Embassy to automatically codegen the "lists" of peripherals and their associated interrupts. --- Cargo.lock | 17 ++ laze-project.yml | 4 + src/riot-rs-embassy/src/arch/stm32/i2c.rs | 8 +- src/riot-rs-embassy/src/arch/stm32/spi.rs | 7 +- src/riot-rs-macros/Cargo.toml | 4 + .../src/define_stm32_drivers.rs | 179 ++++++++++++++++++ src/riot-rs-macros/src/lib.rs | 1 + 7 files changed, 207 insertions(+), 13 deletions(-) create mode 100644 src/riot-rs-macros/src/define_stm32_drivers.rs diff --git a/Cargo.lock b/Cargo.lock index 1e8d4190c..a79449e40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3399,6 +3399,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ref_thread_local" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d51660a68078997855ba5602f73ab3a5031bd7ad480a9d4c90fbbf04e1fff0" + [[package]] name = "regex" version = "1.10.4" @@ -3570,6 +3576,8 @@ dependencies = [ "proc-macro2", "quote", "riot-rs", + "serde_json", + "stm32-data-serde", "syn 2.0.66", "trybuild", ] @@ -4027,6 +4035,15 @@ dependencies = [ "riot-rs-rt", ] +[[package]] +name = "stm32-data-serde" +version = "0.1.0" +dependencies = [ + "ref_thread_local", + "regex", + "serde", +] + [[package]] name = "stm32-fmc" version = "0.3.0" diff --git a/laze-project.yml b/laze-project.yml index 1f80770fb..48c177b10 100644 --- a/laze-project.yml +++ b/laze-project.yml @@ -29,6 +29,7 @@ contexts: OPENOCD_ARGS="${OPENOCD_ARGS}" SCRIPTS=${SCRIPTS} CONFIG_BOARD=${builder} + EMBASSY_CHIP=${EMBASSY_CHIP} CARGO_BUILD_TARGET=${RUSTC_TARGET} ${CARGO_TARGET_PREFIX}_RUNNER=${CARGO_RUNNER} ${CARGO_TARGET_PREFIX}_RUSTFLAGS="${RUSTFLAGS}" @@ -317,6 +318,7 @@ contexts: selects: - thumbv7em-none-eabi # actually eabihf, but riot-rs doesn't support hard float yet env: + EMBASSY_CHIP: STM32F401RE PROBE_RS_CHIP: STM32F401RETx PROBE_RS_PROTOCOL: swd RUSTFLAGS: @@ -330,6 +332,7 @@ contexts: selects: - thumbv7em-none-eabi # actually eabihf, but riot-rs doesn't support hard float yet env: + EMBASSY_CHIP: STM32WB55RG PROBE_RS_CHIP: STM32WB55RGVx PROBE_RS_PROTOCOL: swd RUSTFLAGS: @@ -343,6 +346,7 @@ contexts: selects: - thumbv7em-none-eabi # actually eabihf, but riot-rs doesn't support hard float yet env: + EMBASSY_CHIP: STM32H755ZI PROBE_RS_CHIP: STM32H755ZITx PROBE_RS_PROTOCOL: swd RUSTFLAGS: diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index c787af114..b4966932e 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -117,11 +117,5 @@ macro_rules! define_i2c_drivers { } } -// FIXME: support other STM32 archs // Define a driver per peripheral -#[cfg(context = "stm32wb55rgvx")] -define_i2c_drivers!( - I2C1_EV, I2C1_ER => I2C1, - // There is no I2C2 peripheral. - I2C3_EV, I2C3_ER => I2C3, -); +riot_rs_macros::define_stm32_drivers!(I2c); diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index ef4537c7f..de2a1d7aa 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -151,10 +151,5 @@ macro_rules! define_spi_drivers { }; } -// FIXME: support other STM32 archs // Define a driver per peripheral -#[cfg(context = "stm32wb55rgvx")] -define_spi_drivers!( - SPI1 => SPI1, - SPI2 => SPI2, -); +riot_rs_macros::define_stm32_drivers!(Spi); diff --git a/src/riot-rs-macros/Cargo.toml b/src/riot-rs-macros/Cargo.toml index 9bfd250be..c7ce798c4 100644 --- a/src/riot-rs-macros/Cargo.toml +++ b/src/riot-rs-macros/Cargo.toml @@ -15,6 +15,10 @@ enum-iterator = "2.1.0" proc-macro-crate = "3.1.0" proc-macro2 = "1.0.78" quote = "1.0.35" +serde_json = "1.0" +# TODO: this must be up-to-date with the JSON file +# stm32-data-serde = { git = "https://github.com/embassy-rs/stm32-data", rev = "stm32-metapac-v15" } +stm32-data-serde = { path = "../../../stm32-data/stm32-data-serde" } syn = { version = "2.0.47", features = ["full"] } [dev-dependencies] diff --git a/src/riot-rs-macros/src/define_stm32_drivers.rs b/src/riot-rs-macros/src/define_stm32_drivers.rs new file mode 100644 index 000000000..e3c1cdd06 --- /dev/null +++ b/src/riot-rs-macros/src/define_stm32_drivers.rs @@ -0,0 +1,179 @@ +/// Generates a call to the macro defined in arch-specific driver modules, which needs to be +/// provided with a "list" of peripherals and their association interrupt(s). +/// +/// This "list" is automatically generated from machine-readable data provided by +/// [`stm32-data-generated`](https://github.com/embassy-rs/stm32-data-generated). +/// Its schema is given by +/// [`stm32-data-serde`](https://github.com/embassy-rs/stm32-data/tree/main/stm32-data-serde) +/// (currently not published on crates.io). +// FIXME: rename this macro +#[proc_macro] +pub fn define_stm32_drivers(item: TokenStream) -> TokenStream { + use std::fs; + + use quote::{format_ident, quote}; + use stm32_data_serde::Chip; + + #[allow(clippy::wildcard_imports)] + use define_stm32_drivers::*; + + let input = syn::parse_macro_input!(item as Input); + + let chip_embassy_name = std::env::var("EMBASSY_CHIP").unwrap(); + // FIXME: how to obtain/distribute these files? + let json_file_path = format!("../stm32-data-generated/data/chips/{chip_embassy_name}.json"); + let json = fs::read_to_string(json_file_path).unwrap(); + let chip: Chip = serde_json::from_str(&json).unwrap(); + + let cores = chip.cores.iter(); + let mut peripherals = cores.flat_map(|c| c.peripherals.iter()).collect::>(); + // Sort to make deduplication possible and make the generated "list" sorted by peripheral name. + peripherals.sort_unstable_by_key(|p| &p.name); + // This assumes that every core can access every peripheral. + peripherals.dedup_by_key(|p| &p.name); + + // Keep only the peripherals of the relevant kind. + let relevant_peripherals = peripherals.into_iter().filter(|p| { + if let Some(registers) = &p.registers { + registers.kind == input.peripheral_kind.to_embassy_kind() + } else { + false + } + }); + + // TODO: factor out the branches even more if possible + // Collecting in each branch is required for type-erasure. + let peripheral_definitions: Vec<_> = match input.peripheral_kind { + PeripheralKind::Spi => { + let peripheral_interrupts = relevant_peripherals.map(SpiPeripheral::from_peripheral); + peripheral_interrupts + .map(|p| { + let interrupt = format_ident!("{}", p.interrupt); + let name = format_ident!("{}", p.name); + quote! { #interrupt => #name } + }) + .collect() + } + PeripheralKind::I2c => { + let peripheral_interrupts = relevant_peripherals.map(I2cPeripheral::from_peripheral); + peripheral_interrupts + .map(|p| { + let ev_interrupt = format_ident!("{}", p.ev_interrupt); + let er_interrupt = format_ident!("{}", p.er_interrupt); + let name = format_ident!("{}", p.name); + quote! { #ev_interrupt, #er_interrupt => #name } + }) + .collect() + } + }; + + let peripheral_definition_macro = match input.peripheral_kind { + PeripheralKind::Spi => format_ident!("define_spi_drivers"), + PeripheralKind::I2c => format_ident!("define_i2c_drivers"), + }; + + // Some peripherals may not be usable at the same time because they rely on the same + // interrupt. We do not currently handle these in this macro, they will however be detected + // later in the compilation as peripherals attempt to move out the same interrupt. + // TODO: we could either generate all driver definitions, individually gated on laze + // `context`s, or only generate the definition needed for the current context/chip + let expanded = quote! { + #peripheral_definition_macro!( + #( #peripheral_definitions ),* + ); + }; + + TokenStream::from(expanded) +} + +mod define_stm32_drivers { + use stm32_data_serde::chip::core; + use syn::parse::{Parse, ParseStream}; + + #[derive(Debug)] + pub struct Input { + pub peripheral_kind: PeripheralKind, + } + + impl Parse for Input { + fn parse(input: ParseStream) -> Result { + let peripheral_kind = syn::Ident::parse(input)?; + let peripheral_kind = PeripheralKind::try_from_ident(&peripheral_kind).unwrap(); + Ok(Self { peripheral_kind }) + } + } + + #[derive(Debug, Copy, Clone, PartialEq, Eq)] + pub enum PeripheralKind { + I2c, + Spi, + } + + impl PeripheralKind { + pub fn to_embassy_kind(self) -> &'static str { + match self { + Self::Spi => "spi", + Self::I2c => "i2c", + } + } + + pub fn try_from_ident(ident: &syn::Ident) -> Option { + match ident.to_string().as_ref() { + "Spi" => Some(Self::Spi), + "I2c" => Some(Self::I2c), + _ => None, + } + } + } + + #[derive(Debug, Clone, PartialEq, Eq)] + pub struct SpiPeripheral { + pub name: String, + pub interrupt: String, + } + + impl SpiPeripheral { + /// Extracts data from the `stm32-data-serde` schema. + pub fn from_peripheral(peripheral: &core::Peripheral) -> Self { + let mut interrupts = peripheral.interrupts.as_ref().unwrap().iter(); + + Self { + name: peripheral.name.clone(), + interrupt: interrupts + .find(|int| int.signal == "GLOBAL") + .unwrap() + .interrupt + .clone(), + } + } + } + + #[derive(Debug, Clone, PartialEq, Eq)] + pub struct I2cPeripheral { + pub name: String, + pub ev_interrupt: String, + pub er_interrupt: String, + } + + impl I2cPeripheral { + /// Extracts data from the `stm32-data-serde` schema. + pub fn from_peripheral(peripheral: &core::Peripheral) -> Self { + let mut interrupts = peripheral.interrupts.as_ref().unwrap().iter(); + + I2cPeripheral { + name: peripheral.name.clone(), + ev_interrupt: interrupts + .clone() + .find(|int| int.signal == "EV") + .unwrap() + .interrupt + .clone(), + er_interrupt: interrupts + .find(|int| int.signal == "ER") + .unwrap() + .interrupt + .clone(), + } + } + } +} diff --git a/src/riot-rs-macros/src/lib.rs b/src/riot-rs-macros/src/lib.rs index d1a72394c..cc295ae61 100644 --- a/src/riot-rs-macros/src/lib.rs +++ b/src/riot-rs-macros/src/lib.rs @@ -5,6 +5,7 @@ mod utils; use proc_macro::TokenStream; include!("config.rs"); +include!("define_stm32_drivers.rs"); include!("spawner.rs"); include!("task.rs"); include!("thread.rs"); From 9defa444af010a7d6492e5eb97519c7148b9e23d Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 8 Aug 2024 15:12:14 +0200 Subject: [PATCH 42/95] fix(stm32): make SPI work on STM32H755ZI and port the test --- src/riot-rs-embassy/src/arch/stm32/mod.rs | 6 +++++- tests/spi-bus/laze.yml | 1 + tests/spi-bus/src/main.rs | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/stm32/mod.rs b/src/riot-rs-embassy/src/arch/stm32/mod.rs index 6b1d7afaa..b16afbad8 100644 --- a/src/riot-rs-embassy/src/arch/stm32/mod.rs +++ b/src/riot-rs-embassy/src/arch/stm32/mod.rs @@ -77,7 +77,8 @@ fn board_config(config: &mut Config) { prediv: PllPreDiv::DIV4, mul: PllMul::MUL50, divp: Some(PllDiv::DIV2), - divq: None, + // Required for SPI (configured by `spi123sel`) + divq: Some(PllDiv::DIV16), // FIXME: adjust this divider divr: None, }); config.rcc.sys = Sysclk::PLL1_P; // 400 Mhz @@ -90,6 +91,9 @@ fn board_config(config: &mut Config) { // Set SMPS power config otherwise MCU will not powered after next power-off config.rcc.supply_config = SupplyConfig::DirectSMPS; config.rcc.mux.usbsel = mux::Usbsel::HSI48; + // Select the clock signal used for SPI1, SPI2, and SPI3. + config.rcc.mux.spi123sel = mux::Saisel::PLL1_Q; // Reset value + // FIXME: what to do about SPI4, SPI5, and SPI6? } // mark used diff --git a/tests/spi-bus/laze.yml b/tests/spi-bus/laze.yml index 41cdfe074..2cf237860 100644 --- a/tests/spi-bus/laze.yml +++ b/tests/spi-bus/laze.yml @@ -9,6 +9,7 @@ apps: - nrf52840 - nrf5340 - rp2040 + - st-nucleo-h755zi-q - st-nucleo-wb55 selects: - ?release diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 19cd47f65..834c9802e 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -34,6 +34,17 @@ riot_rs::define_peripherals!(Peripherals { spi_rx_dma: DMA_CH1, }); +#[cfg(context = "stm32h755zitx")] +riot_rs::define_peripherals!(Peripherals { + spi_peripheral: SPI2, + spi_sck: PB10, + spi_miso: PC2, + spi_mosi: PC3, + spi_cs: PB12, + spi_tx_dma: DMA1_CH1, + spi_rx_dma: DMA1_CH2, +}); + #[cfg(context = "stm32wb55rgvx")] riot_rs::define_peripherals!(Peripherals { spi_peripheral: SPI2, @@ -66,6 +77,17 @@ async fn main(peripherals: Peripherals) { spi_config, )); + #[cfg(context = "stm32h755zitx")] + let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( + peripherals.spi_peripheral, + peripherals.spi_sck, + peripherals.spi_miso, + peripherals.spi_mosi, + peripherals.spi_tx_dma, + peripherals.spi_rx_dma, + spi_config, + )); + #[cfg(context = "stm32wb55rgvx")] let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( peripherals.spi_peripheral, From 12a5f4243e1211da05525ced1b66e7dd3a63a863 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 8 Aug 2024 15:13:10 +0200 Subject: [PATCH 43/95] test(spi): port the test to STM32H755ZI --- tests/i2c-bus/laze.yml | 1 + tests/i2c-bus/src/main.rs | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml index a382b29ba..9bd4b4fc7 100644 --- a/tests/i2c-bus/laze.yml +++ b/tests/i2c-bus/laze.yml @@ -8,6 +8,7 @@ apps: - nrf52840 - nrf5340 - rp2040 + - st-nucleo-h755zi-q - st-nucleo-wb55 selects: - ?release diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 9b1739bb0..af1f91036 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -31,7 +31,16 @@ riot_rs::define_peripherals!(Peripherals { i2c_scl: PIN_13, }); -#[cfg(context = "st-nucleo-wb55")] +#[cfg(context = "stm32h755zitx")] +riot_rs::define_peripherals!(Peripherals { + i2c_peripheral: I2C1, + i2c_sda: PB9, + i2c_scl: PB8, + i2c_tx_dma: DMA1_CH1, + i2c_rx_dma: DMA1_CH2, +}); + +#[cfg(context = "stm32wb55rgvx")] riot_rs::define_peripherals!(Peripherals { i2c_peripheral: I2C1, i2c_sda: PB9, @@ -57,6 +66,16 @@ async fn main(peripherals: Peripherals) { i2c_config, )); + #[cfg(context = "stm32h755zitx")] + let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( + peripherals.i2c_peripheral, + peripherals.i2c_sda, + peripherals.i2c_scl, + peripherals.i2c_tx_dma, + peripherals.i2c_rx_dma, + i2c_config, + )); + #[cfg(context = "stm32wb55rgvx")] let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( peripherals.i2c_peripheral, From 35e9edfedc08843e9cac1d7895233533203881b2 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 8 Aug 2024 16:20:31 +0200 Subject: [PATCH 44/95] test(macros): unit test the helper `define_stm32_drivers!` macro --- .../src/define_stm32_drivers.rs | 192 ++++++++++++------ 1 file changed, 127 insertions(+), 65 deletions(-) diff --git a/src/riot-rs-macros/src/define_stm32_drivers.rs b/src/riot-rs-macros/src/define_stm32_drivers.rs index e3c1cdd06..b5205fa5f 100644 --- a/src/riot-rs-macros/src/define_stm32_drivers.rs +++ b/src/riot-rs-macros/src/define_stm32_drivers.rs @@ -11,9 +11,6 @@ pub fn define_stm32_drivers(item: TokenStream) -> TokenStream { use std::fs; - use quote::{format_ident, quote}; - use stm32_data_serde::Chip; - #[allow(clippy::wildcard_imports)] use define_stm32_drivers::*; @@ -23,73 +20,87 @@ pub fn define_stm32_drivers(item: TokenStream) -> TokenStream { // FIXME: how to obtain/distribute these files? let json_file_path = format!("../stm32-data-generated/data/chips/{chip_embassy_name}.json"); let json = fs::read_to_string(json_file_path).unwrap(); - let chip: Chip = serde_json::from_str(&json).unwrap(); - - let cores = chip.cores.iter(); - let mut peripherals = cores.flat_map(|c| c.peripherals.iter()).collect::>(); - // Sort to make deduplication possible and make the generated "list" sorted by peripheral name. - peripherals.sort_unstable_by_key(|p| &p.name); - // This assumes that every core can access every peripheral. - peripherals.dedup_by_key(|p| &p.name); - - // Keep only the peripherals of the relevant kind. - let relevant_peripherals = peripherals.into_iter().filter(|p| { - if let Some(registers) = &p.registers { - registers.kind == input.peripheral_kind.to_embassy_kind() - } else { - false - } - }); - - // TODO: factor out the branches even more if possible - // Collecting in each branch is required for type-erasure. - let peripheral_definitions: Vec<_> = match input.peripheral_kind { - PeripheralKind::Spi => { - let peripheral_interrupts = relevant_peripherals.map(SpiPeripheral::from_peripheral); - peripheral_interrupts - .map(|p| { - let interrupt = format_ident!("{}", p.interrupt); - let name = format_ident!("{}", p.name); - quote! { #interrupt => #name } - }) - .collect() - } - PeripheralKind::I2c => { - let peripheral_interrupts = relevant_peripherals.map(I2cPeripheral::from_peripheral); - peripheral_interrupts - .map(|p| { - let ev_interrupt = format_ident!("{}", p.ev_interrupt); - let er_interrupt = format_ident!("{}", p.er_interrupt); - let name = format_ident!("{}", p.name); - quote! { #ev_interrupt, #er_interrupt => #name } - }) - .collect() - } - }; - - let peripheral_definition_macro = match input.peripheral_kind { - PeripheralKind::Spi => format_ident!("define_spi_drivers"), - PeripheralKind::I2c => format_ident!("define_i2c_drivers"), - }; - - // Some peripherals may not be usable at the same time because they rely on the same - // interrupt. We do not currently handle these in this macro, they will however be detected - // later in the compilation as peripherals attempt to move out the same interrupt. - // TODO: we could either generate all driver definitions, individually gated on laze - // `context`s, or only generate the definition needed for the current context/chip - let expanded = quote! { - #peripheral_definition_macro!( - #( #peripheral_definitions ),* - ); - }; - - TokenStream::from(expanded) + + generate_stm32_driver_definition(&json, &chip_embassy_name, &input).into() } mod define_stm32_drivers { - use stm32_data_serde::chip::core; + use proc_macro2::TokenStream; + use quote::{format_ident, quote}; + use stm32_data_serde::{chip::core, Chip}; use syn::parse::{Parse, ParseStream}; + pub fn generate_stm32_driver_definition( + json: &str, + chip_embassy_name: &str, + input: &Input, + ) -> TokenStream { + let chip: Chip = serde_json::from_str(json).unwrap(); + assert_eq!(chip.name, chip_embassy_name); + + let cores = chip.cores.iter(); + let mut peripherals = cores.flat_map(|c| c.peripherals.iter()).collect::>(); + // Sort to make deduplication possible and make the generated "list" sorted by peripheral name. + peripherals.sort_unstable_by_key(|p| &p.name); + // FIXME: maybe add an assert to check this (check that every core has the same number of + // peripherals)? + // This assumes that every core can access every peripheral. + peripherals.dedup_by_key(|p| &p.name); + + // Keep only the peripherals of the relevant kind. + let relevant_peripherals = peripherals.into_iter().filter(|p| { + if let Some(registers) = &p.registers { + registers.kind == input.peripheral_kind.to_embassy_kind() + } else { + false + } + }); + + // TODO: factor out the branches even more if possible + // Collecting in each branch is required for type-erasure. + let peripheral_definitions: Vec<_> = match input.peripheral_kind { + PeripheralKind::Spi => { + let peripheral_interrupts = + relevant_peripherals.map(SpiPeripheral::from_peripheral); + peripheral_interrupts + .map(|p| { + let interrupt = format_ident!("{}", p.interrupt); + let name = format_ident!("{}", p.name); + quote! { #interrupt => #name } + }) + .collect() + } + PeripheralKind::I2c => { + let peripheral_interrupts = + relevant_peripherals.map(I2cPeripheral::from_peripheral); + peripheral_interrupts + .map(|p| { + let ev_interrupt = format_ident!("{}", p.ev_interrupt); + let er_interrupt = format_ident!("{}", p.er_interrupt); + let name = format_ident!("{}", p.name); + quote! { #ev_interrupt, #er_interrupt => #name } + }) + .collect() + } + }; + + let peripheral_definition_macro = match input.peripheral_kind { + PeripheralKind::Spi => format_ident!("define_spi_drivers"), + PeripheralKind::I2c => format_ident!("define_i2c_drivers"), + }; + + // Some peripherals may not be usable at the same time because they rely on the same + // interrupt. We do not currently handle these in this macro, they will however be detected + // later in the compilation as peripherals attempt to move out the same interrupt. + // TODO: we could either generate all driver definitions, individually gated on laze + // `context`s, or only generate the definition needed for the current context/chip + quote! { + #peripheral_definition_macro!( + #( #peripheral_definitions ),* + ); + } + } + #[derive(Debug)] pub struct Input { pub peripheral_kind: PeripheralKind, @@ -176,4 +187,55 @@ mod define_stm32_drivers { } } } + + #[cfg(test)] + mod tests { + use std::fs; + + use super::*; + + fn test_driver_definition_from_json_file( + chip_embassy_name: &str, + peripheral_kind: PeripheralKind, + expected: &str, + ) { + let json_file_path = + format!("../../../stm32-data-generated/data/chips/{chip_embassy_name}.json"); + let json = fs::read_to_string(json_file_path).unwrap(); + let input = Input { peripheral_kind }; + + let generated = + generate_stm32_driver_definition(&json, chip_embassy_name, &input).to_string(); + assert_eq!(generated, expected); + } + + #[test] + fn test_i2c_driver_definitions() { + test_driver_definition_from_json_file( + "STM32H755ZI", + PeripheralKind::I2c, + "define_i2c_drivers ! (I2C1_EV , I2C1_ER => I2C1 , I2C2_EV , I2C2_ER => I2C2 , I2C3_EV , I2C3_ER => I2C3 , I2C4_EV , I2C4_ER => I2C4) ;", + ); + // There is not I2C2 on this chip. + test_driver_definition_from_json_file( + "STM32WB55RG", + PeripheralKind::I2c, + "define_i2c_drivers ! (I2C1_EV , I2C1_ER => I2C1 , I2C3_EV , I2C3_ER => I2C3) ;", + ); + } + + #[test] + fn test_spi_driver_definitions() { + test_driver_definition_from_json_file( + "STM32H755ZI", + PeripheralKind::Spi, + "define_spi_drivers ! (SPI1 => SPI1 , SPI2 => SPI2 , SPI3 => SPI3 , SPI4 => SPI4 , SPI5 => SPI5 , SPI6 => SPI6) ;", + ); + test_driver_definition_from_json_file( + "STM32WB55RG", + PeripheralKind::Spi, + "define_spi_drivers ! (SPI1 => SPI1 , SPI2 => SPI2) ;", + ); + } + } } From b4c4ae163d6946336c7300f95ac97284d56bac9d Mon Sep 17 00:00:00 2001 From: ROMemories Date: Thu, 8 Aug 2024 17:18:32 +0200 Subject: [PATCH 45/95] test(macros): test codegen from every STM32 JSON file This adds a test running `define_stm32_drivers!` on all JSON files, for both SPI and I2C drivers. --- .../src/define_stm32_drivers.rs | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/riot-rs-macros/src/define_stm32_drivers.rs b/src/riot-rs-macros/src/define_stm32_drivers.rs index b5205fa5f..0d3d8855f 100644 --- a/src/riot-rs-macros/src/define_stm32_drivers.rs +++ b/src/riot-rs-macros/src/define_stm32_drivers.rs @@ -61,7 +61,7 @@ mod define_stm32_drivers { let peripheral_definitions: Vec<_> = match input.peripheral_kind { PeripheralKind::Spi => { let peripheral_interrupts = - relevant_peripherals.map(SpiPeripheral::from_peripheral); + relevant_peripherals.filter_map(SpiPeripheral::try_from_peripheral); peripheral_interrupts .map(|p| { let interrupt = format_ident!("{}", p.interrupt); @@ -145,17 +145,23 @@ mod define_stm32_drivers { impl SpiPeripheral { /// Extracts data from the `stm32-data-serde` schema. - pub fn from_peripheral(peripheral: &core::Peripheral) -> Self { + pub fn try_from_peripheral(peripheral: &core::Peripheral) -> Option { let mut interrupts = peripheral.interrupts.as_ref().unwrap().iter(); - Self { + let interrupt = interrupts.next().unwrap(); + // Assert that all SPI peripheral have exactly one interrupt. + assert!(interrupts.next().is_none()); + + let interrupt = match interrupt.signal.as_ref() { + "RADIO" => return None, // This is for the SUBGHZSPI peripheral. + "GLOBAL" => interrupt.interrupt.clone(), + _ => panic!("{} is not a recognized SPI interrupt signal", interrupt.signal), + }; + + Some(Self { name: peripheral.name.clone(), - interrupt: interrupts - .find(|int| int.signal == "GLOBAL") - .unwrap() - .interrupt - .clone(), - } + interrupt, + }) } } @@ -201,7 +207,7 @@ mod define_stm32_drivers { ) { let json_file_path = format!("../../../stm32-data-generated/data/chips/{chip_embassy_name}.json"); - let json = fs::read_to_string(json_file_path).unwrap(); + let json = fs::read_to_string(&json_file_path).unwrap(); let input = Input { peripheral_kind }; let generated = @@ -237,5 +243,28 @@ mod define_stm32_drivers { "define_spi_drivers ! (SPI1 => SPI1 , SPI2 => SPI2) ;", ); } + + // Test that JSON files generate something without panicking. + #[test] + fn test_all_json_files() { + let json_files = fs::read_dir("../../../stm32-data-generated/data/chips").unwrap(); + + for json_file_path in json_files { + let json_file_path = json_file_path.unwrap().path(); + + let json = fs::read_to_string(&json_file_path).unwrap(); + + let chip_embassy_name = json_file_path.file_stem().unwrap().to_str().unwrap(); + dbg!(&chip_embassy_name); + + let input = Input { peripheral_kind: PeripheralKind::I2c }; + let _generated = + generate_stm32_driver_definition(&json, &chip_embassy_name, &input).to_string(); + + let input = Input { peripheral_kind: PeripheralKind::Spi }; + let _generated = + generate_stm32_driver_definition(&json, &chip_embassy_name, &input).to_string(); + } + } } } From 02f3465cc66eeea96900b87af2e3bba0a1a9e682 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 12:35:24 +0200 Subject: [PATCH 46/95] feat(i2c): add support for I2C on ESP32 --- src/riot-rs-embassy/src/arch/esp/i2c.rs | 96 +++++++++++++++++++++++++ src/riot-rs-embassy/src/arch/esp/mod.rs | 7 +- tests/i2c-bus/laze.yml | 1 + tests/i2c-bus/src/main.rs | 15 ++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 src/riot-rs-embassy/src/arch/esp/i2c.rs diff --git a/src/riot-rs-embassy/src/arch/esp/i2c.rs b/src/riot-rs-embassy/src/arch/esp/i2c.rs new file mode 100644 index 000000000..81caea1bd --- /dev/null +++ b/src/riot-rs-embassy/src/arch/esp/i2c.rs @@ -0,0 +1,96 @@ +use embedded_hal_async::i2c::Operation; +use esp_hal::{ + gpio::{InputPin, OutputPin}, + i2c::I2C, + peripheral::Peripheral, + peripherals, Async, +}; + +use crate::{arch, i2c::impl_async_i2c_for_driver_enum}; + +#[non_exhaustive] +#[derive(Clone)] +pub struct Config { + pub frequency: Frequency, +} + +impl Default for Config { + fn default() -> Self { + Self { + frequency: Frequency::K100, + } + } +} + +// FIXME: check how well this matches the ESP32 capabilities +// TODO: allow more free-from values? +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + K100 = 100_000, + K250 = 250_000, + K400 = 400_000, + M1 = 1_000_000, +} + +impl From for fugit::HertzU32 { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::K100 => fugit::Rate::::kHz(100), + Frequency::K250 => fugit::Rate::::kHz(250), + Frequency::K400 => fugit::Rate::::kHz(400), + Frequency::M1 => fugit::Rate::::MHz(1), + } + } +} + +macro_rules! define_i2c_drivers { + ($( $peripheral:ident ),* $(,)?) => { + // paste allows to create new identifiers by concatenation using `[]`. + paste::paste! { + $( + /// Peripheral-specific I2C driver. + pub struct [] { + twim: I2C<'static, peripherals::$peripheral, Async>, + } + + impl [] { + #[must_use] + pub fn new( + i2c_peripheral: impl Peripheral

+ 'static, + sda_pin: impl Peripheral

+ 'static, + scl_pin: impl Peripheral

+ 'static, + config: Config, + ) -> Self + where SDA: OutputPin + InputPin, + SCL: OutputPin + InputPin, + { + let frequency = config.frequency.into(); + let clocks = arch::CLOCKS.get().unwrap(); + + // FIXME: use `new_with_timeout_async()` instead? + let twim = I2C::new_async(i2c_peripheral, sda_pin, scl_pin, frequency, &clocks); + + Self { twim } + } + } + )* + + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral([]), )* + } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = esp_hal::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + } + } +} + +// FIXME: support other archs +// Define a driver per peripheral +#[cfg(context = "esp32c6")] +define_i2c_drivers!(I2C0); diff --git a/src/riot-rs-embassy/src/arch/esp/mod.rs b/src/riot-rs-embassy/src/arch/esp/mod.rs index f7609632c..6443900e8 100644 --- a/src/riot-rs-embassy/src/arch/esp/mod.rs +++ b/src/riot-rs-embassy/src/arch/esp/mod.rs @@ -1,4 +1,5 @@ pub mod gpio; +pub mod i2c; pub mod spi; pub mod peripheral { @@ -47,7 +48,11 @@ pub mod peripherals { } } -use esp_hal::{clock::{ClockControl, Clocks}, system::SystemControl, timer::timg::TimerGroup}; +use esp_hal::{ + clock::{ClockControl, Clocks}, + system::SystemControl, + timer::timg::TimerGroup, +}; use once_cell::sync::OnceCell; pub use esp_hal::peripherals::OptionalPeripherals; diff --git a/tests/i2c-bus/laze.yml b/tests/i2c-bus/laze.yml index 9bd4b4fc7..c638c6b62 100644 --- a/tests/i2c-bus/laze.yml +++ b/tests/i2c-bus/laze.yml @@ -5,6 +5,7 @@ apps: CARGO_ENV: - CONFIG_ISR_STACKSIZE=16384 context: + - espressif-esp32-c6-devkitc-1 - nrf52840 - nrf5340 - rp2040 diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index af1f91036..2effe92fd 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -24,6 +24,13 @@ const LIS3DH_I2C_ADDR: u8 = 0x19; // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; +#[cfg(context = "esp")] +riot_rs::define_peripherals!(Peripherals { + i2c_peripheral: I2C0, + i2c_sda: GPIO_0, + i2c_scl: GPIO_1, +}); + #[cfg(context = "rp")] riot_rs::define_peripherals!(Peripherals { i2c_peripheral: I2C0, @@ -58,6 +65,14 @@ async fn main(peripherals: Peripherals) { let mut i2c_config = i2c::Config::default(); i2c_config.frequency = i2c::Frequency::K100; + #[cfg(context = "esp")] + let i2c_bus = i2c::I2c::I2C0(i2c::I2cI2C0::new( + peripherals.i2c_peripheral, + peripherals.i2c_sda, + peripherals.i2c_scl, + i2c_config, + )); + #[cfg(context = "rp")] let i2c_bus = i2c::I2c::I2C0(i2c::I2cI2C0::new( peripherals.i2c_peripheral, From 94bce7c623434141384ac6d35d9133371e83afc2 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:35:24 +0200 Subject: [PATCH 47/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 646c32bfa..587fd9c17 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -1,7 +1,7 @@ use embassy_rp::{ bind_interrupts, i2c::{InterruptHandler, SclPin, SdaPin}, - peripherals, + peripherals, Peripheral, }; use embedded_hal_async::i2c::Operation; From a8d285ba8397c94d8f367ac5c28d7c2f2af662f9 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:35:24 +0200 Subject: [PATCH 48/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 587fd9c17..60b91273b 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -46,9 +46,9 @@ macro_rules! define_i2c_drivers { impl [] { #[must_use] pub fn new( - i2c_peripheral: peripherals::$peripheral, - sda_pin: impl SdaPin, - scl_pin: impl SclPin, + i2c_peripheral: impl Peripheral

+ 'static, + sda_pin: impl Peripheral

> + 'static, + scl_pin: impl Peripheral

> + 'static, config: Config, ) -> Self { let mut i2c_config = embassy_rp::i2c::Config::default(); From 9f770624024dceccb0ed7c6a506bace88c9af795 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:35:24 +0200 Subject: [PATCH 49/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index 592b37eac..ef88d593e 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -1,6 +1,7 @@ use embassy_rp::{ dma, peripherals, spi::{Async, ClkPin, MisoPin, MosiPin, Phase, Polarity, Spi as InnerSpi}, + Peripheral, }; use crate::spi::impl_async_spibus_for_driver_enum; From 44695091454d1b1b0c5596d340d2b5e46ddf33dd Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:35:24 +0200 Subject: [PATCH 50/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index ef88d593e..219f303bc 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -71,10 +71,10 @@ macro_rules! define_spi_drivers { impl [] { #[must_use] pub fn new( - spi_peripheral: peripherals::$peripheral, - sck_pin: impl ClkPin, - miso_pin: impl MisoPin, - mosi_pin: impl MosiPin, + spi_peripheral: impl Peripheral

+ 'static, + sck_pin: impl Peripheral

> + 'static, + miso_pin: impl Peripheral

> + 'static, + mosi_pin: impl Peripheral

> + 'static, tx_dma: impl dma::Channel, rx_dma: impl dma::Channel, config: Config, From ea389f26694380ba263ad6fe7b9506e9c8d12a63 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:40:20 +0200 Subject: [PATCH 51/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- src/riot-rs-embassy/src/arch/nrf/i2c.rs | 7 ++++--- src/riot-rs-embassy/src/arch/nrf/spi.rs | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index f084b7c57..560fc8cf7 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -3,6 +3,7 @@ use embassy_nrf::{ gpio::Pin as GpioPin, peripherals, twim::{InterruptHandler, Twim}, + Peripheral, }; use embedded_hal_async::i2c::Operation; @@ -45,9 +46,9 @@ macro_rules! define_i2c_drivers { impl [] { #[must_use] pub fn new( - twim_peripheral: peripherals::$peripheral, - sda_pin: impl GpioPin, - scl_pin: impl GpioPin, + twim_peripheral: impl Peripheral

+ 'static, + sda_pin: impl Peripheral

+ 'static, + scl_pin: impl Peripheral

+ 'static, config: Config, ) -> Self { let mut twim_config = embassy_nrf::twim::Config::default(); diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index d02cd1f42..d9c9d501f 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -3,6 +3,7 @@ use embassy_nrf::{ gpio::{self, Pin as GpioPin}, peripherals, spim::{InterruptHandler, Spim}, + Peripheral, }; use crate::spi::impl_async_spibus_for_driver_enum; @@ -75,10 +76,10 @@ macro_rules! define_spi_drivers { impl [] { #[must_use] pub fn new( - spim_peripheral: peripherals::$peripheral, - sck_pin: impl GpioPin, - miso_pin: impl GpioPin, - mosi_pin: impl GpioPin, + spim_peripheral: impl Peripheral

+ 'static, + sck_pin: impl Peripheral

+ 'static, + miso_pin: impl Peripheral

+ 'static, + mosi_pin: impl Peripheral

+ 'static, config: Config, ) -> Self { let mut spi_config = embassy_nrf::spim::Config::default(); From 6b0ecde4c3196ea2200e739e0360821376ec91eb Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:45:03 +0200 Subject: [PATCH 52/95] fixup! 2557a4cb08120813e6442daade63326358c027c1 --- src/riot-rs-embassy/src/arch/nrf/i2c.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index 560fc8cf7..ac373089b 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -47,8 +47,8 @@ macro_rules! define_i2c_drivers { #[must_use] pub fn new( twim_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral

+ 'static, - scl_pin: impl Peripheral

+ 'static, + sda_pin: impl Peripheral + 'static, + scl_pin: impl Peripheral + 'static, config: Config, ) -> Self { let mut twim_config = embassy_nrf::twim::Config::default(); From 8882b3e55ecb23fd7a880a9b7e439b795d36808e Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:45:03 +0200 Subject: [PATCH 53/95] fixup! 2557a4cb08120813e6442daade63326358c027c1 --- src/riot-rs-embassy/src/arch/nrf/spi.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index d9c9d501f..8d40f9cf7 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -77,9 +77,9 @@ macro_rules! define_spi_drivers { #[must_use] pub fn new( spim_peripheral: impl Peripheral

+ 'static, - sck_pin: impl Peripheral

+ 'static, - miso_pin: impl Peripheral

+ 'static, - mosi_pin: impl Peripheral

+ 'static, + sck_pin: impl Peripheral + 'static, + miso_pin: impl Peripheral + 'static, + mosi_pin: impl Peripheral + 'static, config: Config, ) -> Self { let mut spi_config = embassy_nrf::spim::Config::default(); From 0bb8e69a9364207a9a3a15bcbf466eab14c1d5c5 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:45:03 +0200 Subject: [PATCH 54/95] fixup! 987b3232b098a9be62b4644448fae9fcd66fa190 --- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 60b91273b..847e6ac2c 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -47,8 +47,8 @@ macro_rules! define_i2c_drivers { #[must_use] pub fn new( i2c_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral

> + 'static, - scl_pin: impl Peripheral

> + 'static, + sda_pin: impl Peripheral> + 'static, + scl_pin: impl Peripheral> + 'static, config: Config, ) -> Self { let mut i2c_config = embassy_rp::i2c::Config::default(); From d5633ab5879f55e07eece806e183a2e325fc6d48 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 14:45:03 +0200 Subject: [PATCH 55/95] fixup! b29f8f5a5a3c259888f7687bb5bc3c71b73f4b2e --- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index 219f303bc..8af844528 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -72,9 +72,9 @@ macro_rules! define_spi_drivers { #[must_use] pub fn new( spi_peripheral: impl Peripheral

+ 'static, - sck_pin: impl Peripheral

> + 'static, - miso_pin: impl Peripheral

> + 'static, - mosi_pin: impl Peripheral

> + 'static, + sck_pin: impl Peripheral> + 'static, + miso_pin: impl Peripheral> + 'static, + mosi_pin: impl Peripheral> + 'static, tx_dma: impl dma::Channel, rx_dma: impl dma::Channel, config: Config, From 330b7bbe5027a89dafe2d9fb503361fe03fb648e Mon Sep 17 00:00:00 2001 From: ROMemories Date: Fri, 9 Aug 2024 15:54:09 +0200 Subject: [PATCH 56/95] WIP feat(spi): add support for SPI on ESP32 --- src/riot-rs-embassy/src/arch/esp/spi.rs | 40 +++++++++++++++---------- tests/spi-bus/src/main.rs | 23 ++++++++++++++ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 7bc06a4e5..9474f371a 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -46,7 +46,7 @@ pub enum Frequency { M32 = 32_000_000, } -impl From for fugit::Rate { +impl From for fugit::HertzU32 { fn from(freq: Frequency) -> Self { match freq { Frequency::K125 => fugit::Rate::::kHz(125), @@ -110,23 +110,21 @@ macro_rules! define_spi_drivers { impl [] { #[must_use] - pub fn new( - spi_peripheral: impl Peripheral

, - sck_pin: impl Peripheral, - miso_pin: impl Peripheral, - mosi_pin: impl Peripheral, - dma_ch: dma::Channel1, + pub fn new( + spi_peripheral: impl Peripheral

+ 'static, + sck_pin: impl Peripheral + 'static, + miso_pin: impl Peripheral + 'static, + mosi_pin: impl Peripheral + 'static, + dma_ch: dma::ChannelCreator<1>, config: Config, - ) -> Self - where C: dma::ChannelTypes, - C::P: dma::SpiPeripheral + dma::Spi2Peripheral - { + ) -> Self { + let frequency = config.frequency.into(); let clocks = arch::CLOCKS.get().unwrap(); let spi = esp_hal::spi::master::Spi::new( spi_peripheral, - config.frequency.into(), + frequency, config.mode.into(), - clocks, // FIXME: how to obtain this from the esp init()? + clocks, ); let spi = spi.with_bit_order( config.bit_order.into(), // Read order @@ -139,11 +137,19 @@ macro_rules! define_spi_drivers { Some(miso_pin), gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? ); - let dma_channel = dma_ch.configure_for_async(false, DmaPriority::Priority0); + + // FIXME: adjust the value (copied from Embassy SPI example for now) + // This value defines the maximum transaction length the DMA can handle. + let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); + + let dma_channel = dma_ch.configure_for_async( + false, + DmaPriority::Priority0, + ); let spi = spi.with_dma( dma_channel, - // tx_dma_descriptors, // FIXME: need to rebase to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 - // rx_dma_descriptors, + tx_dma_descriptors, // FIXME: need to rebase esp-hal to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 andhttps://github.com/esp-rs/esp-hal/commit/c6207c0f591263a271e2b909f646856a8f5d6cc9 + rx_dma_descriptors, ); Self { spim: spi } @@ -165,5 +171,7 @@ macro_rules! define_spi_drivers { }; } +// FIXME: there seems to be a DMA-enabled SPI3 on ESP32-S2 and ESP32-S3 // Define a driver per peripheral +#[cfg(context = "esp32c6")] define_spi_drivers!(SPI2); diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 834c9802e..4ddc614b9 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -23,6 +23,17 @@ use riot_rs::{ // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; +// FIXME +#[cfg(context = "esp")] +riot_rs::define_peripherals!(Peripherals { + spi_peripheral: SPI2, + spi_sck: GPIO_0, + spi_miso: GPIO_1, + spi_mosi: GPIO_2, + spi_cs: GPIO_3, + dma: DMA, +}); + #[cfg(context = "rp")] riot_rs::define_peripherals!(Peripherals { spi_peripheral: SPI0, @@ -66,6 +77,18 @@ async fn main(peripherals: Peripherals) { spi_config.frequency = spi::Frequency::M1; spi_config.mode = spi::Mode::Mode3; + let dma = esp_hal::dma::Dma::new(peripherals.dma); + + #[cfg(context = "esp")] + let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( + peripherals.spi_peripheral, + peripherals.spi_sck, + peripherals.spi_miso, + peripherals.spi_mosi, + dma.channel1, + spi_config, + )); + #[cfg(context = "rp")] let spi_bus = spi::Spi::SPI0(spi::SpiSPI0::new( peripherals.spi_peripheral, From 7a22282b1646a626b2e7dd8bcc39fac6314e3855 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 13 Aug 2024 14:47:57 +0200 Subject: [PATCH 57/95] feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 144 ++++++++++------- src/riot-rs-embassy/src/arch/nrf/spi.rs | 122 ++++++++------ src/riot-rs-embassy/src/arch/rp2040/spi.rs | 114 +++++++------ src/riot-rs-embassy/src/arch/stm32/i2c.rs | 5 +- src/riot-rs-embassy/src/arch/stm32/spi.rs | 117 ++++++++------ src/riot-rs-embassy/src/lib.rs | 2 + ....rs => call_with_stm32_peripheral_list.rs} | 151 +++++++++++++++--- src/riot-rs-macros/src/lib.rs | 2 +- tests/spi-bus/src/main.rs | 57 +++---- 9 files changed, 448 insertions(+), 266 deletions(-) rename src/riot-rs-macros/src/{define_stm32_drivers.rs => call_with_stm32_peripheral_list.rs} (62%) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 9474f371a..5c388fab9 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -97,77 +97,97 @@ impl From for esp_hal::spi::SpiBitOrder { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all SPI peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "esp32c6")] { + let _ = peripherals.SPI2.take().unwrap(); + } else { + compile_error!("this ESP32 chip is not supported"); + } + } +} + macro_rules! define_spi_drivers { ($( $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific SPI driver. - pub struct [] { - // FIXME: do we want full- or half-duplex? - spim: InnerSpi<'static, peripherals::$peripheral, dma::Channel1, FullDuplexMode, Async>, - } + $( + /// Peripheral-specific SPI driver. + pub struct $peripheral { + // FIXME: do we want full- or half-duplex? + spim: InnerSpi<'static, peripherals::$peripheral, dma::Channel1, FullDuplexMode, Async>, + } - impl [] { - #[must_use] - pub fn new( - spi_peripheral: impl Peripheral

+ 'static, - sck_pin: impl Peripheral + 'static, - miso_pin: impl Peripheral + 'static, - mosi_pin: impl Peripheral + 'static, - dma_ch: dma::ChannelCreator<1>, - config: Config, - ) -> Self { - let frequency = config.frequency.into(); - let clocks = arch::CLOCKS.get().unwrap(); - let spi = esp_hal::spi::master::Spi::new( - spi_peripheral, - frequency, - config.mode.into(), - clocks, - ); - let spi = spi.with_bit_order( - config.bit_order.into(), // Read order - config.bit_order.into(), // Write order - ); - // The order of MOSI/MISO pins is inverted. - let spi = spi.with_pins( - Some(sck_pin), - Some(mosi_pin), - Some(miso_pin), - gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? - ); - - // FIXME: adjust the value (copied from Embassy SPI example for now) - // This value defines the maximum transaction length the DMA can handle. - let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); - - let dma_channel = dma_ch.configure_for_async( - false, - DmaPriority::Priority0, - ); - let spi = spi.with_dma( - dma_channel, - tx_dma_descriptors, // FIXME: need to rebase esp-hal to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 andhttps://github.com/esp-rs/esp-hal/commit/c6207c0f591263a271e2b909f646856a8f5d6cc9 - rx_dma_descriptors, - ); - - Self { spim: spi } + impl $peripheral { + #[must_use] + pub fn new( + sck_pin: impl Peripheral + 'static, + miso_pin: impl Peripheral + 'static, + mosi_pin: impl Peripheral + 'static, + dma_ch: dma::ChannelCreator<1>, + config: Config, + ) -> Spi { + let frequency = config.frequency.into(); + let clocks = arch::CLOCKS.get().unwrap(); + + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum Spi { - $( $peripheral([]), )* + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let spi_peripheral = unsafe { peripherals::$peripheral::steal() }; + + let spi = esp_hal::spi::master::Spi::new( + spi_peripheral, + frequency, + config.mode.into(), + clocks, + ); + let spi = spi.with_bit_order( + config.bit_order.into(), // Read order + config.bit_order.into(), // Write order + ); + // The order of MOSI/MISO pins is inverted. + let spi = spi.with_pins( + Some(sck_pin), + Some(mosi_pin), + Some(miso_pin), + gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? + ); + + // FIXME: adjust the value (copied from Embassy SPI example for now) + // This value defines the maximum transaction length the DMA can handle. + let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); + + let dma_channel = dma_ch.configure_for_async( + false, + DmaPriority::Priority0, + ); + let spi = spi.with_dma( + dma_channel, + tx_dma_descriptors, // FIXME: need to rebase esp-hal to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 andhttps://github.com/esp-rs/esp-hal/commit/c6207c0f591263a271e2b909f646856a8f5d6cc9 + rx_dma_descriptors, + ); + + Spi::$peripheral(Self { spim: spi }) + } } + )* - impl embedded_hal_async::spi::ErrorType for Spi { - type Error = esp_hal::spi::Error; - } + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral($peripheral) ),* + } - impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = esp_hal::spi::Error; } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); }; } diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index 8d40f9cf7..f43eb789d 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -1,12 +1,12 @@ use embassy_nrf::{ bind_interrupts, - gpio::{self, Pin as GpioPin}, + gpio::Pin as GpioPin, peripherals, spim::{InterruptHandler, Spim}, Peripheral, }; -use crate::spi::impl_async_spibus_for_driver_enum; +use crate::{arch, spi::impl_async_spibus_for_driver_enum}; pub use embassy_nrf::spim::Frequency; @@ -63,61 +63,84 @@ impl From for embassy_nrf::spim::BitOrder { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all SPI peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "nrf52840")] { + let _ = peripherals.SPI2.take().unwrap(); + let _ = peripherals.SPI3.take().unwrap(); + } else if #[cfg(context = "nrf5340")] { + let _ = peripherals.SERIAL2.take().unwrap(); + let _ = peripherals.SERIAL3.take().unwrap(); + } else { + compile_error!("this nRF chip is not supported"); + } + } +} + macro_rules! define_spi_drivers { ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific SPI driver. - pub struct [] { - spim: Spim<'static, peripherals::$peripheral>, - } + $( + /// Peripheral-specific SPI driver. + pub struct $peripheral { + spim: Spim<'static, peripherals::$peripheral>, + } - impl [] { - #[must_use] - pub fn new( - spim_peripheral: impl Peripheral

+ 'static, - sck_pin: impl Peripheral + 'static, - miso_pin: impl Peripheral + 'static, - mosi_pin: impl Peripheral + 'static, - config: Config, - ) -> Self { - let mut spi_config = embassy_nrf::spim::Config::default(); - spi_config.frequency = config.frequency; - spi_config.mode = config.mode.into(); - spi_config.bit_order = config.bit_order.into(); - - bind_interrupts!( - struct Irqs { - $interrupt => InterruptHandler; - } - ); - - let spim = Spim::new( - spim_peripheral, - Irqs, - sck_pin, - miso_pin, - mosi_pin, - spi_config, - ); - - Self { spim } + impl $peripheral { + #[must_use] + pub fn new( + sck_pin: impl Peripheral + 'static, + miso_pin: impl Peripheral + 'static, + mosi_pin: impl Peripheral + 'static, + config: Config, + ) -> Spi { + let mut spi_config = embassy_nrf::spim::Config::default(); + spi_config.frequency = config.frequency; + spi_config.mode = config.mode.into(); + spi_config.bit_order = config.bit_order.into(); + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); + + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum Spi { - $( $peripheral([]), )* + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let spim_peripheral = unsafe { peripherals::$peripheral::steal() }; + + let spim = Spim::new( + spim_peripheral, + Irqs, + sck_pin, + miso_pin, + mosi_pin, + spi_config, + ); + + Spi::$peripheral(Self { spim }) + } } + )* - impl embedded_hal_async::spi::ErrorType for Spi { - type Error = embassy_nrf::spim::Error; - } + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral($peripheral) ),* + } - impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_nrf::spim::Error; } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); }; } @@ -125,12 +148,13 @@ macro_rules! define_spi_drivers { // Define a driver per peripheral #[cfg(context = "nrf52840")] define_spi_drivers!( - // FIXME + // FIXME: arbitrary selected peripherals // SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => TWISPI0, // SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 => TWISPI1, SPIM2_SPIS2_SPI2 => SPI2, SPIM3 => SPI3, ); +// FIXME: arbitrary selected peripherals #[cfg(context = "nrf5340")] define_spi_drivers!( SERIAL2 => SERIAL2, diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index 8af844528..b3bbe1f62 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -4,7 +4,7 @@ use embassy_rp::{ Peripheral, }; -use crate::spi::impl_async_spibus_for_driver_enum; +use crate::{arch, spi::impl_async_spibus_for_driver_enum}; #[derive(Clone)] #[non_exhaustive] @@ -58,61 +58,81 @@ impl From for (Polarity, Phase) { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all SPI peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "rp2040")] { + let _ = peripherals.SPI0.take().unwrap(); + let _ = peripherals.SPI1.take().unwrap(); + } else { + compile_error!("this RP chip is not supported"); + } + } +} + macro_rules! define_spi_drivers { ($( $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific SPI driver. - pub struct [] { - spim: InnerSpi<'static, peripherals::$peripheral, Async>, - } + $( + /// Peripheral-specific SPI driver. + pub struct $peripheral { + spim: InnerSpi<'static, peripherals::$peripheral, Async>, + } + + impl $peripheral { + #[must_use] + pub fn new( + sck_pin: impl Peripheral> + 'static, + miso_pin: impl Peripheral> + 'static, + mosi_pin: impl Peripheral> + 'static, + tx_dma: impl dma::Channel, + rx_dma: impl dma::Channel, + config: Config, + ) -> Spi { + let (pol, phase) = config.mode.into(); + + let mut spi_config = embassy_rp::spi::Config::default(); + spi_config.frequency = config.frequency as u32; + spi_config.polarity = pol; + spi_config.phase = phase; - impl [] { - #[must_use] - pub fn new( - spi_peripheral: impl Peripheral

+ 'static, - sck_pin: impl Peripheral> + 'static, - miso_pin: impl Peripheral> + 'static, - mosi_pin: impl Peripheral> + 'static, - tx_dma: impl dma::Channel, - rx_dma: impl dma::Channel, - config: Config, - ) -> Self { - let (pol, phase) = config.mode.into(); - - let mut spi_config = embassy_rp::spi::Config::default(); - spi_config.frequency = config.frequency as u32; - spi_config.polarity = pol; - spi_config.phase = phase; - - // The order of MOSI/MISO pins is inverted. - let spi = InnerSpi::new( - spi_peripheral, - sck_pin, - mosi_pin, - miso_pin, - tx_dma, - rx_dma, - spi_config, - ); - - Self { spim: spi } + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum Spi { - $( $peripheral([]), )* - } + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let spi_peripheral = unsafe { peripherals::$peripheral::steal() }; - impl embedded_hal_async::spi::ErrorType for Spi { - type Error = embassy_rp::spi::Error; + // The order of MOSI/MISO pins is inverted. + let spi = InnerSpi::new( + spi_peripheral, + sck_pin, + mosi_pin, + miso_pin, + tx_dma, + rx_dma, + spi_config, + ); + + Spi::$peripheral(Self { spim: spi }) + } } + )* - impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral($peripheral) ),* } + + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_rp::spi::Error; + } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); }; } diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index b4966932e..b5cee5697 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -9,6 +9,7 @@ use embassy_stm32::{ Peripheral, }; use embedded_hal_async::i2c::Operation; +use riot_rs_macros::call_with_stm32_peripheral_list; use crate::i2c::impl_async_i2c_for_driver_enum; @@ -53,7 +54,7 @@ impl From for Hertz { } macro_rules! define_i2c_drivers { - ($( $ev_interrupt:ident, $er_interrupt:ident => $peripheral:ident ),* $(,)?) => { + ($( $ev_interrupt:ident + $er_interrupt:ident => $peripheral:ident ),* $(,)?) => { // paste allows to create new identifiers by concatenation using `[]`. paste::paste! { $( @@ -118,4 +119,4 @@ macro_rules! define_i2c_drivers { } // Define a driver per peripheral -riot_rs_macros::define_stm32_drivers!(I2c); +call_with_stm32_peripheral_list!(define_i2c_drivers!, I2c, PeripheralsAndInterrupts); diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index de2a1d7aa..cd439206d 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -6,8 +6,9 @@ use embassy_stm32::{ time::Hertz, Peripheral, }; +use riot_rs_macros::call_with_stm32_peripheral_list; -use crate::spi::impl_async_spibus_for_driver_enum; +use crate::{arch, spi::impl_async_spibus_for_driver_enum}; #[derive(Clone)] #[non_exhaustive] @@ -94,62 +95,84 @@ impl From for embassy_stm32::spi::BitOrder { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // This macro has to be defined in this function so that the `peripherals` variables exists. + macro_rules! take_all_spi_peripherals { + ($peripherals:ident, $( $peripheral:ident ),*) => { + $( + let _ = peripherals.$peripheral.take().unwrap(); + )* + } + } + + // Take all SPI peripherals and do nothing with them. + call_with_stm32_peripheral_list!(take_all_spi_peripherals!, Spi, Peripherals); +} + macro_rules! define_spi_drivers { ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific SPI driver. - pub struct [] { - spim: InnerSpi<'static, Async>, - } + $( + /// Peripheral-specific SPI driver. + pub struct $peripheral { + spim: InnerSpi<'static, Async>, + } - impl [] { - #[must_use] - pub fn new( - spim_peripheral:impl Peripheral

+ 'static, - sck_pin: impl Peripheral> + 'static, - miso_pin: impl Peripheral> + 'static, - mosi_pin: impl Peripheral> + 'static, - tx_dma: impl Peripheral> + 'static, - rx_dma: impl Peripheral> + 'static, - config: Config, - ) -> Self { - let mut spi_config = embassy_stm32::spi::Config::default(); - spi_config.frequency = config.frequency.into(); - spi_config.mode = config.mode.into(); - spi_config.bit_order = config.bit_order.into(); - spi_config.miso_pull = gpio::Pull::None; // FIXME: ? - - // The order of MOSI/MISO pins is inverted. - let spim = InnerSpi::new( - spim_peripheral, - sck_pin, - mosi_pin, - miso_pin, - tx_dma, - rx_dma, - spi_config, - ); - - Self { spim } + impl $peripheral { + #[must_use] + pub fn new( + sck_pin: impl Peripheral> + 'static, + miso_pin: impl Peripheral> + 'static, + mosi_pin: impl Peripheral> + 'static, + tx_dma: impl Peripheral> + 'static, + rx_dma: impl Peripheral> + 'static, + config: Config, + ) -> Spi { + let mut spi_config = embassy_stm32::spi::Config::default(); + spi_config.frequency = config.frequency.into(); + spi_config.mode = config.mode.into(); + spi_config.bit_order = config.bit_order.into(); + spi_config.miso_pull = gpio::Pull::None; // FIXME: ? + + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum Spi { - $( $peripheral([]), )* + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let spim_peripheral = unsafe { peripherals::$peripheral::steal() }; + + // The order of MOSI/MISO pins is inverted. + let spim = InnerSpi::new( + spim_peripheral, + sck_pin, + mosi_pin, + miso_pin, + tx_dma, + rx_dma, + spi_config, + ); + + Spi::$peripheral(Self { spim }) + } } + )* - impl embedded_hal_async::spi::ErrorType for Spi { - type Error = embassy_stm32::spi::Error; - } + /// Peripheral-agnostic driver. + pub enum Spi { + $( $peripheral($peripheral) ),* + } - impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); + impl embedded_hal_async::spi::ErrorType for Spi { + type Error = embassy_stm32::spi::Error; } + + impl_async_spibus_for_driver_enum!(Spi, $( $peripheral ),*); }; } // Define a driver per peripheral -riot_rs_macros::define_stm32_drivers!(Spi); +call_with_stm32_peripheral_list!(define_spi_drivers!, Spi, PeripheralsAndInterrupts); diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 61dbcf569..7bbde3e06 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -160,6 +160,8 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) { #[cfg(all(context = "stm32", feature = "external-interrupts"))] extint_registry::EXTINT_REGISTRY.init(&mut peripherals); + arch::spi::init(&mut peripherals); + #[cfg(context = "esp")] arch::gpio::init(&mut peripherals); diff --git a/src/riot-rs-macros/src/define_stm32_drivers.rs b/src/riot-rs-macros/src/call_with_stm32_peripheral_list.rs similarity index 62% rename from src/riot-rs-macros/src/define_stm32_drivers.rs rename to src/riot-rs-macros/src/call_with_stm32_peripheral_list.rs index 0d3d8855f..1e91b4f98 100644 --- a/src/riot-rs-macros/src/define_stm32_drivers.rs +++ b/src/riot-rs-macros/src/call_with_stm32_peripheral_list.rs @@ -1,18 +1,21 @@ -/// Generates a call to the macro defined in arch-specific driver modules, which needs to be -/// provided with a "list" of peripherals and their association interrupt(s). +/// Generates a call to the given macro and provides it with a "list" of peripherals and optionally +/// their associated interrupt(s). /// -/// This "list" is automatically generated from machine-readable data provided by +/// We take the macro to call as parameter because nested macros are evaluated started from the +/// outer one, and it thus would not work for this macro to only return the generated "list". +/// +/// The "list" is automatically generated from machine-readable data provided by /// [`stm32-data-generated`](https://github.com/embassy-rs/stm32-data-generated). /// Its schema is given by /// [`stm32-data-serde`](https://github.com/embassy-rs/stm32-data/tree/main/stm32-data-serde) /// (currently not published on crates.io). // FIXME: rename this macro #[proc_macro] -pub fn define_stm32_drivers(item: TokenStream) -> TokenStream { +pub fn call_with_stm32_peripheral_list(item: TokenStream) -> TokenStream { use std::fs; #[allow(clippy::wildcard_imports)] - use define_stm32_drivers::*; + use call_with_stm32_peripheral_list::*; let input = syn::parse_macro_input!(item as Input); @@ -24,7 +27,7 @@ pub fn define_stm32_drivers(item: TokenStream) -> TokenStream { generate_stm32_driver_definition(&json, &chip_embassy_name, &input).into() } -mod define_stm32_drivers { +mod call_with_stm32_peripheral_list { use proc_macro2::TokenStream; use quote::{format_ident, quote}; use stm32_data_serde::{chip::core, Chip}; @@ -66,7 +69,11 @@ mod define_stm32_drivers { .map(|p| { let interrupt = format_ident!("{}", p.interrupt); let name = format_ident!("{}", p.name); - quote! { #interrupt => #name } + + match input.output_kind { + OutputKind::Peripherals => quote! { #name }, + OutputKind::PeripheralsAndInterrupts => quote! { #interrupt => #name }, + } }) .collect() } @@ -78,16 +85,19 @@ mod define_stm32_drivers { let ev_interrupt = format_ident!("{}", p.ev_interrupt); let er_interrupt = format_ident!("{}", p.er_interrupt); let name = format_ident!("{}", p.name); - quote! { #ev_interrupt, #er_interrupt => #name } + + match input.output_kind { + OutputKind::Peripherals => quote! { #name }, + OutputKind::PeripheralsAndInterrupts => { + quote! { #ev_interrupt + #er_interrupt => #name } + } + } }) .collect() } }; - let peripheral_definition_macro = match input.peripheral_kind { - PeripheralKind::Spi => format_ident!("define_spi_drivers"), - PeripheralKind::I2c => format_ident!("define_i2c_drivers"), - }; + let macro_to_call = &input.macro_to_call; // Some peripherals may not be usable at the same time because they rely on the same // interrupt. We do not currently handle these in this macro, they will however be detected @@ -95,22 +105,35 @@ mod define_stm32_drivers { // TODO: we could either generate all driver definitions, individually gated on laze // `context`s, or only generate the definition needed for the current context/chip quote! { - #peripheral_definition_macro!( - #( #peripheral_definitions ),* - ); + #macro_to_call!( #( #peripheral_definitions ),* ); } } #[derive(Debug)] pub struct Input { + pub macro_to_call: syn::Ident, pub peripheral_kind: PeripheralKind, + pub output_kind: OutputKind, } impl Parse for Input { fn parse(input: ParseStream) -> Result { + let macro_to_call = syn::Ident::parse(input)?; + let _: syn::Token![!] = input.parse()?; + + let _: syn::Token![,] = input.parse()?; let peripheral_kind = syn::Ident::parse(input)?; let peripheral_kind = PeripheralKind::try_from_ident(&peripheral_kind).unwrap(); - Ok(Self { peripheral_kind }) + + let _: syn::Token![,] = input.parse()?; + let output_kind = syn::Ident::parse(input)?; + let output_kind = OutputKind::try_from_ident(&output_kind).unwrap(); + + Ok(Self { + macro_to_call, + peripheral_kind, + output_kind, + }) } } @@ -137,6 +160,22 @@ mod define_stm32_drivers { } } + #[derive(Debug, Copy, Clone, PartialEq, Eq)] + pub enum OutputKind { + Peripherals, + PeripheralsAndInterrupts, + } + + impl OutputKind { + pub fn try_from_ident(ident: &syn::Ident) -> Option { + match ident.to_string().as_ref() { + "Peripherals" => Some(Self::Peripherals), + "PeripheralsAndInterrupts" => Some(Self::PeripheralsAndInterrupts), + _ => None, + } + } + } + #[derive(Debug, Clone, PartialEq, Eq)] pub struct SpiPeripheral { pub name: String, @@ -155,7 +194,10 @@ mod define_stm32_drivers { let interrupt = match interrupt.signal.as_ref() { "RADIO" => return None, // This is for the SUBGHZSPI peripheral. "GLOBAL" => interrupt.interrupt.clone(), - _ => panic!("{} is not a recognized SPI interrupt signal", interrupt.signal), + _ => panic!( + "{} is not a recognized SPI interrupt signal", + interrupt.signal + ), }; Some(Self { @@ -203,12 +245,18 @@ mod define_stm32_drivers { fn test_driver_definition_from_json_file( chip_embassy_name: &str, peripheral_kind: PeripheralKind, + output_kind: OutputKind, + macro_to_call: syn::Ident, expected: &str, ) { let json_file_path = format!("../../../stm32-data-generated/data/chips/{chip_embassy_name}.json"); let json = fs::read_to_string(&json_file_path).unwrap(); - let input = Input { peripheral_kind }; + let input = Input { + macro_to_call, + peripheral_kind, + output_kind, + }; let generated = generate_stm32_driver_definition(&json, chip_embassy_name, &input).to_string(); @@ -217,30 +265,72 @@ mod define_stm32_drivers { #[test] fn test_i2c_driver_definitions() { + let macro_to_call = format_ident!("test"); + test_driver_definition_from_json_file( "STM32H755ZI", PeripheralKind::I2c, - "define_i2c_drivers ! (I2C1_EV , I2C1_ER => I2C1 , I2C2_EV , I2C2_ER => I2C2 , I2C3_EV , I2C3_ER => I2C3 , I2C4_EV , I2C4_ER => I2C4) ;", + OutputKind::PeripheralsAndInterrupts, + macro_to_call.clone(), + "test ! (I2C1_EV + I2C1_ER => I2C1 , I2C2_EV + I2C2_ER => I2C2 , I2C3_EV + I2C3_ER => I2C3 , I2C4_EV + I2C4_ER => I2C4) ;", ); - // There is not I2C2 on this chip. + test_driver_definition_from_json_file( + "STM32H755ZI", + PeripheralKind::I2c, + OutputKind::Peripherals, + macro_to_call.clone(), + "test ! (I2C1 , I2C2 , I2C3 , I2C4) ;", + ); + + // There is no I2C2 on this chip. test_driver_definition_from_json_file( "STM32WB55RG", PeripheralKind::I2c, - "define_i2c_drivers ! (I2C1_EV , I2C1_ER => I2C1 , I2C3_EV , I2C3_ER => I2C3) ;", + OutputKind::PeripheralsAndInterrupts, + macro_to_call.clone(), + "test ! (I2C1_EV + I2C1_ER => I2C1 , I2C3_EV + I2C3_ER => I2C3) ;", + ); + test_driver_definition_from_json_file( + "STM32WB55RG", + PeripheralKind::I2c, + OutputKind::Peripherals, + macro_to_call.clone(), + "test ! (I2C1 , I2C3) ;", ); } #[test] fn test_spi_driver_definitions() { + let macro_to_call = format_ident!("test"); + test_driver_definition_from_json_file( "STM32H755ZI", PeripheralKind::Spi, - "define_spi_drivers ! (SPI1 => SPI1 , SPI2 => SPI2 , SPI3 => SPI3 , SPI4 => SPI4 , SPI5 => SPI5 , SPI6 => SPI6) ;", + OutputKind::PeripheralsAndInterrupts, + macro_to_call.clone(), + "test ! (SPI1 => SPI1 , SPI2 => SPI2 , SPI3 => SPI3 , SPI4 => SPI4 , SPI5 => SPI5 , SPI6 => SPI6) ;", ); + test_driver_definition_from_json_file( + "STM32H755ZI", + PeripheralKind::Spi, + OutputKind::Peripherals, + macro_to_call.clone(), + "test ! (SPI1 , SPI2 , SPI3 , SPI4 , SPI5 , SPI6) ;", + ); + test_driver_definition_from_json_file( "STM32WB55RG", PeripheralKind::Spi, - "define_spi_drivers ! (SPI1 => SPI1 , SPI2 => SPI2) ;", + OutputKind::PeripheralsAndInterrupts, + macro_to_call.clone(), + "test ! (SPI1 => SPI1 , SPI2 => SPI2) ;", + ); + test_driver_definition_from_json_file( + "STM32WB55RG", + PeripheralKind::Spi, + OutputKind::Peripherals, + macro_to_call.clone(), + "test ! (SPI1 , SPI2) ;", ); } @@ -257,13 +347,24 @@ mod define_stm32_drivers { let chip_embassy_name = json_file_path.file_stem().unwrap().to_str().unwrap(); dbg!(&chip_embassy_name); - let input = Input { peripheral_kind: PeripheralKind::I2c }; + let input = Input { + macro_to_call: format_ident!("test"), + peripheral_kind: PeripheralKind::I2c, + output_kind: OutputKind::PeripheralsAndInterrupts, + }; let _generated = generate_stm32_driver_definition(&json, &chip_embassy_name, &input).to_string(); - let input = Input { peripheral_kind: PeripheralKind::Spi }; + let input = Input { + macro_to_call: format_ident!("test"), + peripheral_kind: PeripheralKind::Spi, + output_kind: OutputKind::PeripheralsAndInterrupts, + }; let _generated = generate_stm32_driver_definition(&json, &chip_embassy_name, &input).to_string(); + + // We do not test with `OutputKind::Peripherals` as it is only a subset of + // `OutputKind::PeripheralsAndInterrupts`. } } } diff --git a/src/riot-rs-macros/src/lib.rs b/src/riot-rs-macros/src/lib.rs index cc295ae61..fc942a147 100644 --- a/src/riot-rs-macros/src/lib.rs +++ b/src/riot-rs-macros/src/lib.rs @@ -5,7 +5,7 @@ mod utils; use proc_macro::TokenStream; include!("config.rs"); -include!("define_stm32_drivers.rs"); +include!("call_with_stm32_peripheral_list.rs"); include!("spawner.rs"); include!("task.rs"); include!("thread.rs"); diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 4ddc614b9..3804063f2 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -23,10 +23,8 @@ use riot_rs::{ // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; -// FIXME #[cfg(context = "esp")] riot_rs::define_peripherals!(Peripherals { - spi_peripheral: SPI2, spi_sck: GPIO_0, spi_miso: GPIO_1, spi_mosi: GPIO_2, @@ -34,9 +32,22 @@ riot_rs::define_peripherals!(Peripherals { dma: DMA, }); +#[cfg(context = "nrf52840")] +type SensorSpi = spi::SPI2; +#[cfg(context = "nrf5340")] +type SensorSpi = spi::SERIAL2; +#[cfg(context = "nrf")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: P0_00, + spi_miso: P0_01, + spi_mosi: P0_04, + spi_cs: P0_05, +}); + +#[cfg(context = "rp")] +type SensorSpi = spi::SPI0; #[cfg(context = "rp")] riot_rs::define_peripherals!(Peripherals { - spi_peripheral: SPI0, spi_sck: PIN_18, spi_miso: PIN_16, spi_mosi: PIN_19, @@ -45,9 +56,10 @@ riot_rs::define_peripherals!(Peripherals { spi_rx_dma: DMA_CH1, }); +#[cfg(context = "stm32h755zitx")] +type SensorSpi = spi::SPI2; #[cfg(context = "stm32h755zitx")] riot_rs::define_peripherals!(Peripherals { - spi_peripheral: SPI2, spi_sck: PB10, spi_miso: PC2, spi_mosi: PC3, @@ -56,9 +68,10 @@ riot_rs::define_peripherals!(Peripherals { spi_rx_dma: DMA1_CH2, }); +#[cfg(context = "stm32wb55rgvx")] +type SensorSpi = spi::SPI2; #[cfg(context = "stm32wb55rgvx")] riot_rs::define_peripherals!(Peripherals { - spi_peripheral: SPI2, spi_sck: PA9, spi_miso: PC2, spi_mosi: PC1, @@ -77,11 +90,11 @@ async fn main(peripherals: Peripherals) { spi_config.frequency = spi::Frequency::M1; spi_config.mode = spi::Mode::Mode3; + // FIXME + #[cfg(context = "esp")] let dma = esp_hal::dma::Dma::new(peripherals.dma); - #[cfg(context = "esp")] let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( - peripherals.spi_peripheral, peripherals.spi_sck, peripherals.spi_miso, peripherals.spi_mosi, @@ -89,38 +102,16 @@ async fn main(peripherals: Peripherals) { spi_config, )); - #[cfg(context = "rp")] - let spi_bus = spi::Spi::SPI0(spi::SpiSPI0::new( - peripherals.spi_peripheral, + let spi_bus = SensorSpi::new( peripherals.spi_sck, peripherals.spi_miso, peripherals.spi_mosi, + #[cfg(any(context = "rp", context = "stm32"))] peripherals.spi_tx_dma, + #[cfg(any(context = "rp", context = "stm32"))] peripherals.spi_rx_dma, spi_config, - )); - - #[cfg(context = "stm32h755zitx")] - let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( - peripherals.spi_peripheral, - peripherals.spi_sck, - peripherals.spi_miso, - peripherals.spi_mosi, - peripherals.spi_tx_dma, - peripherals.spi_rx_dma, - spi_config, - )); - - #[cfg(context = "stm32wb55rgvx")] - let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( - peripherals.spi_peripheral, - peripherals.spi_sck, - peripherals.spi_miso, - peripherals.spi_mosi, - peripherals.spi_tx_dma, - peripherals.spi_rx_dma, - spi_config, - )); + ); let _ = SPI_BUS.set(Mutex::new(spi_bus)); From afcf118fe76a783e7943f5638b16aff9c7ccf09b Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 13 Aug 2024 15:47:40 +0200 Subject: [PATCH 58/95] feat: simplify the I2C API --- src/riot-rs-embassy/src/arch/esp/i2c.rs | 84 +++++++------ src/riot-rs-embassy/src/arch/nrf/i2c.rs | 105 ++++++++++------- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 106 ++++++++++------- src/riot-rs-embassy/src/arch/stm32/i2c.rs | 130 ++++++++++++--------- src/riot-rs-embassy/src/lib.rs | 6 +- tests/i2c-bus/src/main.rs | 56 ++++----- 6 files changed, 279 insertions(+), 208 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/i2c.rs b/src/riot-rs-embassy/src/arch/esp/i2c.rs index 81caea1bd..0ecda13eb 100644 --- a/src/riot-rs-embassy/src/arch/esp/i2c.rs +++ b/src/riot-rs-embassy/src/arch/esp/i2c.rs @@ -44,49 +44,65 @@ impl From for fugit::HertzU32 { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all I2C peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "esp32c6")] { + let _ = peripherals.I2C0.take().unwrap(); + } else { + compile_error!("this ESP32 chip is not supported"); + } + } +} + macro_rules! define_i2c_drivers { ($( $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific I2C driver. - pub struct [] { - twim: I2C<'static, peripherals::$peripheral, Async>, - } + $( + /// Peripheral-specific I2C driver. + pub struct $peripheral { + twim: I2C<'static, peripherals::$peripheral, Async>, + } + + impl $peripheral { + #[must_use] + pub fn new( + sda_pin: impl Peripheral

+ 'static, + scl_pin: impl Peripheral

+ 'static, + config: Config, + ) -> I2c { + let frequency = config.frequency.into(); + let clocks = arch::CLOCKS.get().unwrap(); - impl [] { - #[must_use] - pub fn new( - i2c_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral

+ 'static, - scl_pin: impl Peripheral

+ 'static, - config: Config, - ) -> Self - where SDA: OutputPin + InputPin, - SCL: OutputPin + InputPin, - { - let frequency = config.frequency.into(); - let clocks = arch::CLOCKS.get().unwrap(); - - // FIXME: use `new_with_timeout_async()` instead? - let twim = I2C::new_async(i2c_peripheral, sda_pin, scl_pin, frequency, &clocks); - - Self { twim } + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum I2c { - $( $peripheral([]), )* - } + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let i2c_peripheral = unsafe { peripherals::$peripheral::steal() }; - impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = esp_hal::i2c::Error; + // FIXME: use `new_with_timeout_async()` instead? + let twim = I2C::new_async(i2c_peripheral, sda_pin, scl_pin, frequency, &clocks); + + I2c::$peripheral(Self { twim }) + } } + )* - impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral($peripheral), )* } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = esp_hal::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index ac373089b..60fa390bf 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -7,7 +7,7 @@ use embassy_nrf::{ }; use embedded_hal_async::i2c::Operation; -use crate::i2c::impl_async_i2c_for_driver_enum; +use crate::{arch, i2c::impl_async_i2c_for_driver_enum}; pub use embassy_nrf::twim::Frequency; @@ -33,55 +33,78 @@ impl Default for Config { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all I2C peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "nrf52840")] { + let _ = peripherals.TWISPI0.take().unwrap(); + let _ = peripherals.TWISPI1.take().unwrap(); + } else if #[cfg(context = "nrf5340")] { + let _ = peripherals.SERIAL0.take().unwrap(); + let _ = peripherals.SERIAL1.take().unwrap(); + } else { + compile_error!("this nRF chip is not supported"); + } + } +} + macro_rules! define_i2c_drivers { ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific I2C driver. - pub struct [] { - twim: Twim<'static, peripherals::$peripheral>, - } + $( + /// Peripheral-specific I2C driver. + pub struct $peripheral { + twim: Twim<'static, peripherals::$peripheral>, + } + + impl $peripheral { + #[must_use] + pub fn new( + sda_pin: impl Peripheral + 'static, + scl_pin: impl Peripheral + 'static, + config: Config, + ) -> I2c { + let mut twim_config = embassy_nrf::twim::Config::default(); + twim_config.frequency = config.frequency; + twim_config.sda_pullup = config.sda_pullup; + twim_config.scl_pullup = config.scl_pullup; + twim_config.sda_high_drive = config.sda_high_drive; + twim_config.scl_high_drive = config.scl_high_drive; + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); - impl [] { - #[must_use] - pub fn new( - twim_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral + 'static, - scl_pin: impl Peripheral + 'static, - config: Config, - ) -> Self { - let mut twim_config = embassy_nrf::twim::Config::default(); - twim_config.frequency = config.frequency; - twim_config.sda_pullup = config.sda_pullup; - twim_config.scl_pullup = config.scl_pullup; - twim_config.sda_high_drive = config.sda_high_drive; - twim_config.scl_high_drive = config.scl_high_drive; - - bind_interrupts!( - struct Irqs { - $interrupt => InterruptHandler; - } - ); - - let twim = Twim::new(twim_peripheral, Irqs, sda_pin, scl_pin, twim_config); - - Self { twim } + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum I2c { - $( $peripheral([]), )* - } + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let twim_peripheral = unsafe { peripherals::$peripheral::steal() }; - impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_nrf::twim::Error; + let twim = Twim::new(twim_peripheral, Irqs, sda_pin, scl_pin, twim_config); + + I2c::$peripheral(Self { twim }) + } } + )* - impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral($peripheral), )* } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_nrf::twim::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 847e6ac2c..bb08afe43 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -5,7 +5,7 @@ use embassy_rp::{ }; use embedded_hal_async::i2c::Operation; -use crate::i2c::impl_async_i2c_for_driver_enum; +use crate::{arch, i2c::impl_async_i2c_for_driver_enum}; // We do not provide configuration for internal pull-ups as the RP2040 datasheet mentions in // section 4.3.1.3 that the GPIO used should have pull-ups enabled. @@ -33,57 +33,77 @@ pub enum Frequency { K400 = 400_000, } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // Take all I2C peripherals and do nothing with them. + cfg_if::cfg_if! { + if #[cfg(context = "rp2040")] { + let _ = peripherals.I2C0.take().unwrap(); + let _ = peripherals.I2C1.take().unwrap(); + } else { + compile_error!("this RP chip is not supported"); + } + } +} + macro_rules! define_i2c_drivers { ($( $interrupt:ident => $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific I2C driver. - pub struct [] { - twim: embassy_rp::i2c::I2c<'static, peripherals::$peripheral, embassy_rp::i2c::Async>, - } + $( + /// Peripheral-specific I2C driver. + pub struct $peripheral { + twim: embassy_rp::i2c::I2c<'static, peripherals::$peripheral, embassy_rp::i2c::Async>, + } + + impl $peripheral { + #[must_use] + pub fn new( + sda_pin: impl Peripheral> + 'static, + scl_pin: impl Peripheral> + 'static, + config: Config, + ) -> I2c { + let mut i2c_config = embassy_rp::i2c::Config::default(); + i2c_config.frequency = config.frequency as u32; + + bind_interrupts!( + struct Irqs { + $interrupt => InterruptHandler; + } + ); - impl [] { - #[must_use] - pub fn new( - i2c_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral> + 'static, - scl_pin: impl Peripheral> + 'static, - config: Config, - ) -> Self { - let mut i2c_config = embassy_rp::i2c::Config::default(); - i2c_config.frequency = config.frequency as u32; - - bind_interrupts!( - struct Irqs { - $interrupt => InterruptHandler; - } - ); - - let i2c = embassy_rp::i2c::I2c::new_async( - i2c_peripheral, - scl_pin, - sda_pin, - Irqs, - i2c_config, - ); - - Self { twim: i2c } + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum I2c { - $( $peripheral([]), )* - } + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let i2c_peripheral = unsafe { peripherals::$peripheral::steal() }; - impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_rp::i2c::Error; + let i2c = embassy_rp::i2c::I2c::new_async( + i2c_peripheral, + scl_pin, + sda_pin, + Irqs, + i2c_config, + ); + + I2c::$peripheral(Self { twim: i2c }) + } } + )* - impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral($peripheral), )* } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_rp::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index b5cee5697..5d80f5a54 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -11,7 +11,7 @@ use embassy_stm32::{ use embedded_hal_async::i2c::Operation; use riot_rs_macros::call_with_stm32_peripheral_list; -use crate::i2c::impl_async_i2c_for_driver_enum; +use crate::{arch, i2c::impl_async_i2c_for_driver_enum}; #[non_exhaustive] #[derive(Clone)] @@ -53,68 +53,90 @@ impl From for Hertz { } } +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + // This macro has to be defined in this function so that the `peripherals` variables exists. + macro_rules! take_all_i2c_peripherals { + ($peripherals:ident, $( $peripheral:ident ),*) => { + $( + let _ = peripherals.$peripheral.take().unwrap(); + )* + } + } + + // Take all I2c peripherals and do nothing with them. + call_with_stm32_peripheral_list!(take_all_i2c_peripherals!, I2c, Peripherals); +} + macro_rules! define_i2c_drivers { ($( $ev_interrupt:ident + $er_interrupt:ident => $peripheral:ident ),* $(,)?) => { - // paste allows to create new identifiers by concatenation using `[]`. - paste::paste! { - $( - /// Peripheral-specific I2C driver. - // NOTE(arch): this is not required on this architecture, as the inner I2C type is - // not generic over the I2C peripheral, and is only done for consistency with - // other architectures. - pub struct [] { - twim: InnerI2c<'static, Async> - } + $( + /// Peripheral-specific I2C driver. + // NOTE(arch): this is not required on this architecture, as the inner I2C type is + // not generic over the I2C peripheral, and is only done for consistency with + // other architectures. + pub struct $peripheral { + twim: InnerI2c<'static, Async> + } - impl [] { - #[must_use] - pub fn new( - twim_peripheral: impl Peripheral

+ 'static, - sda_pin: impl Peripheral> + 'static, - scl_pin: impl Peripheral> + 'static, - tx_dma: impl Peripheral> + 'static, - rx_dma: impl Peripheral> + 'static, - config: Config, - ) -> Self { - let mut i2c_config = embassy_stm32::i2c::Config::default(); - i2c_config.sda_pullup = config.sda_pullup; - i2c_config.scl_pullup = config.scl_pullup; - - bind_interrupts!( - struct Irqs { - $ev_interrupt => EventInterruptHandler; - $er_interrupt => ErrorInterruptHandler; - } - ); - - let frequency = config.frequency; - let i2c = InnerI2c::new( - twim_peripheral, - scl_pin, - sda_pin, - Irqs, - tx_dma, - rx_dma, - frequency.into(), - i2c_config, - ); - - Self { twim: i2c } + impl $peripheral { + #[must_use] + pub fn new( + sda_pin: impl Peripheral> + 'static, + scl_pin: impl Peripheral> + 'static, + tx_dma: impl Peripheral> + 'static, + rx_dma: impl Peripheral> + 'static, + config: Config, + ) -> I2c { + let mut i2c_config = embassy_stm32::i2c::Config::default(); + i2c_config.sda_pullup = config.sda_pullup; + i2c_config.scl_pullup = config.scl_pullup; + + bind_interrupts!( + struct Irqs { + $ev_interrupt => EventInterruptHandler; + $er_interrupt => ErrorInterruptHandler; + } + ); + + // Make this struct a compile-time-enforced singleton: having multiple statics + // defined with the same name would result in a compile-time error. + paste::paste! { + #[allow(dead_code)] + static []: () = (); } - } - )* - /// Peripheral-agnostic driver. - pub enum I2c { - $( $peripheral([]), )* - } + // FIXME(safety): enforce that the init code indeed has run + // SAFETY: this struct being a singleton prevents us from stealing the + // peripheral multiple times. + let twim_peripheral = unsafe { peripherals::$peripheral::steal() }; - impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_stm32::i2c::Error; + let frequency = config.frequency; + let i2c = InnerI2c::new( + twim_peripheral, + scl_pin, + sda_pin, + Irqs, + tx_dma, + rx_dma, + frequency.into(), + i2c_config, + ); + + I2c::$peripheral(Self { twim: i2c }) + } } + )* - impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); + /// Peripheral-agnostic driver. + pub enum I2c { + $( $peripheral($peripheral), )* } + + impl embedded_hal_async::i2c::ErrorType for I2c { + type Error = embassy_stm32::i2c::Error; + } + + impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 7bbde3e06..aa78d5b22 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -160,11 +160,13 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) { #[cfg(all(context = "stm32", feature = "external-interrupts"))] extint_registry::EXTINT_REGISTRY.init(&mut peripherals); - arch::spi::init(&mut peripherals); - #[cfg(context = "esp")] arch::gpio::init(&mut peripherals); + arch::i2c::init(&mut peripherals); + + arch::spi::init(&mut peripherals); + #[cfg(feature = "hwrng")] arch::hwrng::construct_rng(&mut peripherals); // Clock startup and entropy collection may lend themselves to parallelization, provided that diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 2effe92fd..75975f41f 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -24,32 +24,46 @@ const LIS3DH_I2C_ADDR: u8 = 0x19; // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; +#[cfg(context = "esp")] +type SensorI2c = i2c::I2C0; #[cfg(context = "esp")] riot_rs::define_peripherals!(Peripherals { - i2c_peripheral: I2C0, i2c_sda: GPIO_0, i2c_scl: GPIO_1, }); +#[cfg(context = "nrf52840")] +type SensorI2c = i2c::TWISPI0; +#[cfg(context = "nrf5340")] +type SensorI2c = i2c::SERIAL0; +#[cfg(context = "nrf")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: P0_00, + i2c_scl: P0_01, +}); + +#[cfg(context = "rp")] +type SensorI2c = i2c::I2C0; #[cfg(context = "rp")] riot_rs::define_peripherals!(Peripherals { - i2c_peripheral: I2C0, i2c_sda: PIN_12, i2c_scl: PIN_13, }); +#[cfg(context = "stm32h755zitx")] +type SensorI2c = i2c::I2C1; #[cfg(context = "stm32h755zitx")] riot_rs::define_peripherals!(Peripherals { - i2c_peripheral: I2C1, i2c_sda: PB9, i2c_scl: PB8, i2c_tx_dma: DMA1_CH1, i2c_rx_dma: DMA1_CH2, }); +#[cfg(context = "stm32wb55rgvx")] +type SensorI2c = i2c::I2C1; #[cfg(context = "stm32wb55rgvx")] riot_rs::define_peripherals!(Peripherals { - i2c_peripheral: I2C1, i2c_sda: PB9, i2c_scl: PB8, i2c_tx_dma: DMA1_CH1, @@ -65,41 +79,15 @@ async fn main(peripherals: Peripherals) { let mut i2c_config = i2c::Config::default(); i2c_config.frequency = i2c::Frequency::K100; - #[cfg(context = "esp")] - let i2c_bus = i2c::I2c::I2C0(i2c::I2cI2C0::new( - peripherals.i2c_peripheral, - peripherals.i2c_sda, - peripherals.i2c_scl, - i2c_config, - )); - - #[cfg(context = "rp")] - let i2c_bus = i2c::I2c::I2C0(i2c::I2cI2C0::new( - peripherals.i2c_peripheral, - peripherals.i2c_sda, - peripherals.i2c_scl, - i2c_config, - )); - - #[cfg(context = "stm32h755zitx")] - let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( - peripherals.i2c_peripheral, - peripherals.i2c_sda, - peripherals.i2c_scl, - peripherals.i2c_tx_dma, - peripherals.i2c_rx_dma, - i2c_config, - )); - - #[cfg(context = "stm32wb55rgvx")] - let i2c_bus = i2c::I2c::I2C1(i2c::I2cI2C1::new( - peripherals.i2c_peripheral, + let i2c_bus = SensorI2c::new( peripherals.i2c_sda, peripherals.i2c_scl, + #[cfg(any(context = "stm32h755zitx", context = "stm32wb55rgvx"))] peripherals.i2c_tx_dma, + #[cfg(any(context = "stm32h755zitx", context = "stm32wb55rgvx"))] peripherals.i2c_rx_dma, i2c_config, - )); + ); let _ = I2C_BUS.set(Mutex::new(i2c_bus)); From 1994acbc591238cf79e19d647cf0d13e47994caa Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 14 Aug 2024 16:11:35 +0200 Subject: [PATCH 59/95] fixup! feat: simplify the I2C API --- src/riot-rs-embassy/src/arch/dummy/i2c.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/riot-rs-embassy/src/arch/dummy/i2c.rs b/src/riot-rs-embassy/src/arch/dummy/i2c.rs index d38919cfa..6a84117ae 100644 --- a/src/riot-rs-embassy/src/arch/dummy/i2c.rs +++ b/src/riot-rs-embassy/src/arch/dummy/i2c.rs @@ -1,3 +1,5 @@ +use crate::arch; + /// Peripheral-agnostic I2C driver implementing [`embedded_hal_async::i2c::I2c`]. /// /// The driver instance is meant to be shared between tasks using @@ -12,3 +14,7 @@ /// The constructors of these peripheral-specific drivers depend on the architecture, please see /// the examples and tests for reference. pub enum I2c {} + +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + unimplemented!(); +} From 7f7fbd34956a95517a40312a020bd4f84f3a23c3 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Wed, 14 Aug 2024 16:11:46 +0200 Subject: [PATCH 60/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/dummy/spi.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/riot-rs-embassy/src/arch/dummy/spi.rs b/src/riot-rs-embassy/src/arch/dummy/spi.rs index 8c088f38d..48e7ac9ea 100644 --- a/src/riot-rs-embassy/src/arch/dummy/spi.rs +++ b/src/riot-rs-embassy/src/arch/dummy/spi.rs @@ -1,3 +1,5 @@ +use crate::arch; + /// Peripheral-agnostic SPI driver implementing [`embedded_hal_async::spi::SpiBus`]. /// /// The driver instance is meant to be shared between tasks using @@ -12,3 +14,7 @@ /// The constructors of these peripheral-specific drivers depend on the architecture, please see /// the examples and tests for reference. pub enum Spi {} + +pub fn init(peripherals: &mut arch::OptionalPeripherals) { + unimplemented!(); +} From 9d78fc3e0808665609a006d9b862ec1d66100c15 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 10:01:18 +0200 Subject: [PATCH 61/95] fixup! 1c5e89fa8e123452de4ec03004a7dfad4a33ec10 --- tests/i2c-bus/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i2c-bus/README.md b/tests/i2c-bus/README.md index 40e011f4f..495d76c8c 100644 --- a/tests/i2c-bus/README.md +++ b/tests/i2c-bus/README.md @@ -11,4 +11,4 @@ In this folder, run laze build -b nrf52840dk run -This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the example. +This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the test. From ad50dfc143544c4b090924eaf7a67fcc5f9a3b10 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 10:01:18 +0200 Subject: [PATCH 62/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spi-bus/README.md b/tests/spi-bus/README.md index d78e2681b..a0d78f66c 100644 --- a/tests/spi-bus/README.md +++ b/tests/spi-bus/README.md @@ -11,4 +11,4 @@ In this folder, run laze build -b nrf52840dk run -This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the example. +This example requires a LIS3DH sensor (3-axis accelerometer) attached to the pins configured in the test. From cae7e605a6f42e4dd55fc71235b1a6c73ead8a0c Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 10:20:36 +0200 Subject: [PATCH 63/95] refactor: feature-gate SPI and I2C buses --- src/riot-rs-embassy/Cargo.toml | 5 +++++ src/riot-rs-embassy/src/arch/esp/mod.rs | 3 +++ src/riot-rs-embassy/src/arch/nrf/mod.rs | 3 +++ src/riot-rs-embassy/src/arch/rp2040/mod.rs | 3 +++ src/riot-rs-embassy/src/arch/stm32/mod.rs | 3 +++ src/riot-rs-embassy/src/lib.rs | 9 +++++++-- src/riot-rs/Cargo.toml | 6 +++++- tests/i2c-bus/Cargo.toml | 1 + tests/spi-bus/Cargo.toml | 1 + 9 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index aa6ef2789..2635b4698 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -122,6 +122,11 @@ embassy-stm32 = { workspace = true, features = [ ## Enables GPIO interrupt support. external-interrupts = ["embassy-nrf?/gpiote", "embassy-stm32?/exti"] time = ["dep:embassy-time", "embassy-executor/integrated-timers"] + +## Enables I2C support. +i2c = [] +## Enables SPI support. +spi = [] usb = ["dep:embassy-usb"] # embassy-net requires embassy-time and support for timeouts in the executor net = ["dep:embassy-net", "time"] diff --git a/src/riot-rs-embassy/src/arch/esp/mod.rs b/src/riot-rs-embassy/src/arch/esp/mod.rs index 6443900e8..3ab6f04d7 100644 --- a/src/riot-rs-embassy/src/arch/esp/mod.rs +++ b/src/riot-rs-embassy/src/arch/esp/mod.rs @@ -1,5 +1,8 @@ pub mod gpio; + +#[cfg(feature = "i2c")] pub mod i2c; +#[cfg(feature = "spi")] pub mod spi; pub mod peripheral { diff --git a/src/riot-rs-embassy/src/arch/nrf/mod.rs b/src/riot-rs-embassy/src/arch/nrf/mod.rs index 730b7684d..da1fed63f 100644 --- a/src/riot-rs-embassy/src/arch/nrf/mod.rs +++ b/src/riot-rs-embassy/src/arch/nrf/mod.rs @@ -1,5 +1,8 @@ pub mod gpio; + +#[cfg(feature = "i2c")] pub mod i2c; +#[cfg(feature = "spi")] pub mod spi; pub mod peripheral { diff --git a/src/riot-rs-embassy/src/arch/rp2040/mod.rs b/src/riot-rs-embassy/src/arch/rp2040/mod.rs index 9e4be8292..77513e20b 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/mod.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/mod.rs @@ -1,5 +1,8 @@ pub mod gpio; + +#[cfg(feature = "i2c")] pub mod i2c; +#[cfg(feature = "spi")] pub mod spi; pub mod peripheral { diff --git a/src/riot-rs-embassy/src/arch/stm32/mod.rs b/src/riot-rs-embassy/src/arch/stm32/mod.rs index b16afbad8..390ffdd47 100644 --- a/src/riot-rs-embassy/src/arch/stm32/mod.rs +++ b/src/riot-rs-embassy/src/arch/stm32/mod.rs @@ -1,5 +1,8 @@ pub mod gpio; + +#[cfg(feature = "i2c")] pub mod i2c; +#[cfg(feature = "spi")] pub mod spi; pub mod peripheral { diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index aa78d5b22..43d2c302d 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -9,8 +9,6 @@ pub mod define_peripherals; pub mod gpio; -pub mod i2c; -pub mod spi; #[cfg(feature = "external-interrupts")] mod extint_registry; @@ -39,6 +37,11 @@ cfg_if::cfg_if! { } } +#[cfg(feature = "i2c")] +pub mod i2c; +#[cfg(feature = "spi")] +pub mod spi; + #[cfg(feature = "usb")] pub mod usb; @@ -163,8 +166,10 @@ async fn init_task(mut peripherals: arch::OptionalPeripherals) { #[cfg(context = "esp")] arch::gpio::init(&mut peripherals); + #[cfg(feature = "i2c")] arch::i2c::init(&mut peripherals); + #[cfg(feature = "spi")] arch::spi::init(&mut peripherals); #[cfg(feature = "hwrng")] diff --git a/src/riot-rs/Cargo.toml b/src/riot-rs/Cargo.toml index 9fb1cd2f8..cc345174d 100644 --- a/src/riot-rs/Cargo.toml +++ b/src/riot-rs/Cargo.toml @@ -44,7 +44,11 @@ csprng = ["riot-rs-random/csprng"] ## Enables seeding the random number generator from hardware. hwrng = ["riot-rs-embassy/hwrng"] -#! ## Wired communication +#! ## Communication buses +## Enables I2C support. +i2c = ["riot-rs-embassy/i2c"] +## Enables SPI support. +spi = ["riot-rs-embassy/spi"] ## Enables USB support. usb = ["riot-rs-embassy/usb"] diff --git a/tests/i2c-bus/Cargo.toml b/tests/i2c-bus/Cargo.toml index 39cd73c48..41ae3b8d8 100644 --- a/tests/i2c-bus/Cargo.toml +++ b/tests/i2c-bus/Cargo.toml @@ -14,6 +14,7 @@ embassy-sync = { workspace = true } embedded-hal-async = { workspace = true } once_cell = { workspace = true } riot-rs = { path = "../../src/riot-rs", features = [ + "i2c", "time", # FIXME: seems to be required on STM32 ] } riot-rs-boards = { path = "../../src/riot-rs-boards" } diff --git a/tests/spi-bus/Cargo.toml b/tests/spi-bus/Cargo.toml index 1238e273d..699d15495 100644 --- a/tests/spi-bus/Cargo.toml +++ b/tests/spi-bus/Cargo.toml @@ -14,6 +14,7 @@ embassy-sync = { workspace = true } embedded-hal-async = { workspace = true } once_cell = { workspace = true } riot-rs = { path = "../../src/riot-rs", features = [ + "spi", "time", ] } # FIXME: the `time` feature seems to be required by the SPI transaction riot-rs-boards = { path = "../../src/riot-rs-boards" } From 713fc9a5a89b013432e4afdd30ba06eab10ce0ab Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:00:18 +0200 Subject: [PATCH 64/95] fixup! feat(embassy-arch): support sharing I2C and SPI buses --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1f947a7fe..b097a117a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ portable-atomic = { version = "1.6.0", default-features = false, features = [ "require-cas", ] } -embassy-embedded-hal = { version = "0.1.0", default-features = false } +embassy-embedded-hal = { version = "0.2.0", default-features = false } embassy-executor = { version = "0.6", default-features = false } embassy-futures = { version = "0.1.1", default-features = false } embassy-hal-internal = { version = "0.2.0", default-features = false } From d23a69f4bbdfd37c4bf6a5edf8132538c2231099 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:00:57 +0200 Subject: [PATCH 65/95] fixup! feat(example): add an example testing I2C --- tests/i2c-bus/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 75975f41f..9cca636f4 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -8,6 +8,7 @@ #![no_std] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] +#![feature(impl_trait_in_assoc_type)] use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c::I2c as _; From 79cc33bfc3d2b36c2e154d3847990ce869c17680 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:01:17 +0200 Subject: [PATCH 66/95] fixup! feat(example): add an example testing SPI --- tests/spi-bus/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 3804063f2..ddb04f0c7 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -8,6 +8,7 @@ #![no_std] #![feature(type_alias_impl_trait)] #![feature(used_with_arg)] +#![feature(impl_trait_in_assoc_type)] use embassy_sync::mutex::Mutex; use embedded_hal_async::spi::{Operation, SpiDevice as _}; From f694464b35e42d1b14ea7029a6eb08842a0f971a Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:39:49 +0200 Subject: [PATCH 67/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 5c388fab9..efa81de09 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -169,7 +169,7 @@ macro_rules! define_spi_drivers { ); let spi = spi.with_dma( dma_channel, - tx_dma_descriptors, // FIXME: need to rebase esp-hal to have https://github.com/esp-rs/esp-hal/commit/77535516713a0dabf4dbc9286c1d20b682f4e9c0 andhttps://github.com/esp-rs/esp-hal/commit/c6207c0f591263a271e2b909f646856a8f5d6cc9 + tx_dma_descriptors, rx_dma_descriptors, ); From 65b44fdfbdbca2eff5173adc6081351ec2a6d985 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:40:18 +0200 Subject: [PATCH 68/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index efa81de09..a36550f79 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -114,7 +114,7 @@ macro_rules! define_spi_drivers { /// Peripheral-specific SPI driver. pub struct $peripheral { // FIXME: do we want full- or half-duplex? - spim: InnerSpi<'static, peripherals::$peripheral, dma::Channel1, FullDuplexMode, Async>, + spim: InnerSpi<'static, peripherals::$peripheral, dma::DmaChannel1, FullDuplexMode, Async>, } impl $peripheral { From 9e09d3d0c07885f8c4b8ce7a9dad6ccb9540be0c Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:40:18 +0200 Subject: [PATCH 69/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index a36550f79..308da7da7 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -123,7 +123,7 @@ macro_rules! define_spi_drivers { sck_pin: impl Peripheral + 'static, miso_pin: impl Peripheral + 'static, mosi_pin: impl Peripheral + 'static, - dma_ch: dma::ChannelCreator<1>, + dma_ch: dma::ChannelCreator<1>, // FIXME: try not to hard-code the DMA channel config: Config, ) -> Spi { let frequency = config.frequency.into(); From 037f7e8b715e46ea6e00e9c17c81f18a19066637 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:40:18 +0200 Subject: [PATCH 70/95] fixup! feat: simplify the SPI API --- tests/spi-bus/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index ddb04f0c7..5a2540982 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -101,6 +101,8 @@ async fn main(peripherals: Peripherals) { peripherals.spi_mosi, dma.channel1, spi_config, + #[cfg(context = "esp")] + dma.channel1, )); let spi_bus = SensorSpi::new( From 4bf5f6c171c2aa55662177c481402444b86348f3 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:40:18 +0200 Subject: [PATCH 71/95] fixup! WIP feat(spi): add support for SPI on ESP32 --- tests/spi-bus/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 5a2540982..036fa24b9 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -24,6 +24,8 @@ use riot_rs::{ // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; +#[cfg(context = "esp")] +type SensorSpi = spi::SPI2; #[cfg(context = "esp")] riot_rs::define_peripherals!(Peripherals { spi_sck: GPIO_0, From 08ceac17f3c8a69d89853632547c56122977c86b Mon Sep 17 00:00:00 2001 From: ROMemories Date: Mon, 19 Aug 2024 15:40:18 +0200 Subject: [PATCH 72/95] fixup! WIP feat(spi): add support for SPI on ESP32 --- tests/spi-bus/src/main.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 036fa24b9..699845b03 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -96,14 +96,6 @@ async fn main(peripherals: Peripherals) { // FIXME #[cfg(context = "esp")] let dma = esp_hal::dma::Dma::new(peripherals.dma); - #[cfg(context = "esp")] - let spi_bus = spi::Spi::SPI2(spi::SpiSPI2::new( - peripherals.spi_sck, - peripherals.spi_miso, - peripherals.spi_mosi, - dma.channel1, - spi_config, - #[cfg(context = "esp")] dma.channel1, )); From 926a0f272e1c5a93ca7d51a9ade749b1b2713c2a Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 20 Aug 2024 09:42:28 +0200 Subject: [PATCH 73/95] fixup! 06ef192a80a5fb302f65db3b533dc18c66aed424 --- tests/spi-bus/src/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 699845b03..ae1740b22 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -96,8 +96,6 @@ async fn main(peripherals: Peripherals) { // FIXME #[cfg(context = "esp")] let dma = esp_hal::dma::Dma::new(peripherals.dma); - dma.channel1, - )); let spi_bus = SensorSpi::new( peripherals.spi_sck, From de9af1d676ff212d276428585b43c3abcfdacf7b Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 20 Aug 2024 09:42:28 +0200 Subject: [PATCH 74/95] fixup! fixup! fixup! feat(example): add an example testing SPI --- tests/spi-bus/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/spi-bus/Cargo.toml b/tests/spi-bus/Cargo.toml index 699d15495..f3c53c68f 100644 --- a/tests/spi-bus/Cargo.toml +++ b/tests/spi-bus/Cargo.toml @@ -12,6 +12,7 @@ workspace = true embassy-executor = { workspace = true } embassy-sync = { workspace = true } embedded-hal-async = { workspace = true } +esp-hal = { workspace = true } # FIXME: temporary once_cell = { workspace = true } riot-rs = { path = "../../src/riot-rs", features = [ "spi", From 44734ce2c6c152e6cd499dd7a503c4554db111d6 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 20 Aug 2024 09:42:28 +0200 Subject: [PATCH 75/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 308da7da7..025af8b0b 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -159,10 +159,6 @@ macro_rules! define_spi_drivers { gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? ); - // FIXME: adjust the value (copied from Embassy SPI example for now) - // This value defines the maximum transaction length the DMA can handle. - let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); - let dma_channel = dma_ch.configure_for_async( false, DmaPriority::Priority0, From a44e5dc7a5955ef4eea0ec15307a50bb9541edcf Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 20 Aug 2024 09:42:28 +0200 Subject: [PATCH 76/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 025af8b0b..4fd13776c 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -163,6 +163,11 @@ macro_rules! define_spi_drivers { false, DmaPriority::Priority0, ); + // FIXME: adjust the value (copied from Embassy SPI example for now) + // This value defines the maximum transaction length these DMA channels can + // handle. + let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); + let spi = spi.with_dma( dma_channel, tx_dma_descriptors, From dd6367965c33590480ae2e43af61369a7e1fd688 Mon Sep 17 00:00:00 2001 From: ROMemories Date: Tue, 20 Aug 2024 09:42:28 +0200 Subject: [PATCH 77/95] fixup! feat: simplify the SPI API --- tests/spi-bus/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index ae1740b22..f95673fb7 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -101,6 +101,8 @@ async fn main(peripherals: Peripherals) { peripherals.spi_sck, peripherals.spi_miso, peripherals.spi_mosi, + #[cfg(context = "esp")] + dma.channel1, #[cfg(any(context = "rp", context = "stm32"))] peripherals.spi_tx_dma, #[cfg(any(context = "rp", context = "stm32"))] From dd347962792917c5ba7ac373dea1a4aca07a9bf2 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:05:37 +0200 Subject: [PATCH 78/95] WIP: make SPI work on ESP32 --- src/riot-rs-embassy/src/arch/esp/spi.rs | 18 +++++++++++------- tests/spi-bus/Cargo.toml | 1 + tests/spi-bus/src/main.rs | 20 +++++++++++++------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 4fd13776c..a9608b5ec 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -15,9 +15,9 @@ use crate::{arch, spi::impl_async_spibus_for_driver_enum}; #[derive(Clone)] #[non_exhaustive] pub struct Config { - pub frequency: Frequency, // FIXME + pub frequency: Frequency, pub mode: Mode, - pub bit_order: BitOrder, // FIXME + pub bit_order: BitOrder, } impl Default for Config { @@ -156,18 +156,22 @@ macro_rules! define_spi_drivers { Some(sck_pin), Some(mosi_pin), Some(miso_pin), - gpio::NO_PIN, // The CS pin is managed separately // FIXME: is it? + gpio::NO_PIN, // The CS pin is managed separately ); - let dma_channel = dma_ch.configure_for_async( - false, - DmaPriority::Priority0, - ); + // FIXME: is this correct? + // Use the highest priority, as SPI is the DMA-enabled peripheral that is the + // most latency-sensitive. + let burst_mode = false; + let dma_priority = DmaPriority::Priority5; + let dma_channel = dma_ch.configure_for_async(burst_mode, dma_priority); // FIXME: adjust the value (copied from Embassy SPI example for now) // This value defines the maximum transaction length these DMA channels can // handle. let (tx_dma_descriptors, rx_dma_descriptors) = esp_hal::dma_descriptors!(32000); + // FIXME: we need to rebase esp-hal to have the new DMA API: + // https://github.com/esp-rs/esp-hal/commit/41f9925e2c393b1b753585e85e21f74cf5a8d131 let spi = spi.with_dma( dma_channel, tx_dma_descriptors, diff --git a/tests/spi-bus/Cargo.toml b/tests/spi-bus/Cargo.toml index f3c53c68f..55ed4e149 100644 --- a/tests/spi-bus/Cargo.toml +++ b/tests/spi-bus/Cargo.toml @@ -19,3 +19,4 @@ riot-rs = { path = "../../src/riot-rs", features = [ "time", ] } # FIXME: the `time` feature seems to be required by the SPI transaction riot-rs-boards = { path = "../../src/riot-rs-boards" } +static_cell = { workspace = true } diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index f95673fb7..e00eae072 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -83,15 +83,20 @@ riot_rs::define_peripherals!(Peripherals { spi_rx_dma: DMA1_CH2, }); -pub static SPI_BUS: once_cell::sync::OnceCell< - Mutex, -> = once_cell::sync::OnceCell::new(); +// pub static SPI_BUS: once_cell::sync::OnceCell< +// Mutex, +// > = once_cell::sync::OnceCell::new(); #[riot_rs::task(autostart, peripherals)] async fn main(peripherals: Peripherals) { let mut spi_config = spi::Config::default(); - spi_config.frequency = spi::Frequency::M1; - spi_config.mode = spi::Mode::Mode3; + spi_config.frequency = spi::Frequency::K125; + spi_config.mode = if !cfg!(context = "esp") { + spi::Mode::Mode3 + } else { + // FIXME: the sensor datasheet does match with SPI mode 3, not mode 0 + spi::Mode::Mode0 + }; // FIXME #[cfg(context = "esp")] @@ -110,11 +115,12 @@ async fn main(peripherals: Peripherals) { spi_config, ); - let _ = SPI_BUS.set(Mutex::new(spi_bus)); + let spi_bus = static_cell::make_static!(Mutex::new(spi_bus)); + // let _ = SPI_BUS.set(Mutex::new(spi_bus)); let cs_output = gpio::Output::new(peripherals.spi_cs, gpio::Level::High); - let mut spi_device = SpiDevice::new(SPI_BUS.get().unwrap(), cs_output); + let mut spi_device = SpiDevice::new(&*spi_bus, cs_output); let mut id = [0]; spi_device From c7590b66701d9b283ffaa67481b631d1da6751b4 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:11:12 +0200 Subject: [PATCH 79/95] refactor(spi): move `Mode` and `BitOrder` out of arch modules --- src/riot-rs-embassy/src/arch/esp/spi.rs | 26 ++++----------- src/riot-rs-embassy/src/arch/nrf/spi.rs | 22 +++---------- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 14 +++----- src/riot-rs-embassy/src/arch/stm32/spi.rs | 22 +++---------- src/riot-rs-embassy/src/spi.rs | 38 ++++++++++++++++++++++ 5 files changed, 59 insertions(+), 63 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index a9608b5ec..c21d3a986 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -10,7 +10,10 @@ use esp_hal::{ Async, }; -use crate::{arch, spi::impl_async_spibus_for_driver_enum}; +use crate::{ + arch, + spi::{impl_async_spibus_for_driver_enum, BitOrder, Mode}, +}; #[derive(Clone)] #[non_exhaustive] @@ -25,7 +28,7 @@ impl Default for Config { Self { frequency: Frequency::M1, // FIXME mode: Mode::Mode0, - bit_order: BitOrder::MsbFirst, + bit_order: BitOrder::default(), } } } @@ -62,17 +65,8 @@ impl From for fugit::HertzU32 { } } -#[derive(Copy, Clone)] -pub enum Mode { - Mode0, - Mode1, - Mode2, - Mode3, -} - -// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers -impl From for esp_hal::spi::SpiMode { - fn from(mode: Mode) -> Self { +impl From for esp_hal::spi::SpiMode { + fn from(mode: crate::spi::Mode) -> Self { match mode { Mode::Mode0 => esp_hal::spi::SpiMode::Mode0, Mode::Mode1 => esp_hal::spi::SpiMode::Mode1, @@ -82,12 +76,6 @@ impl From for esp_hal::spi::SpiMode { } } -#[derive(Copy, Clone)] -pub enum BitOrder { - MsbFirst, - LsbFirst, -} - impl From for esp_hal::spi::SpiBitOrder { fn from(bit_order: BitOrder) -> Self { match bit_order { diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index f43eb789d..cc734ee39 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -6,7 +6,10 @@ use embassy_nrf::{ Peripheral, }; -use crate::{arch, spi::impl_async_spibus_for_driver_enum}; +use crate::{ + arch, + spi::{impl_async_spibus_for_driver_enum, BitOrder, Mode}, +}; pub use embassy_nrf::spim::Frequency; @@ -23,20 +26,11 @@ impl Default for Config { Self { frequency: Frequency::M1, mode: Mode::Mode0, - bit_order: BitOrder::MsbFirst, + bit_order: BitOrder::default(), } } } -#[derive(Copy, Clone)] -pub enum Mode { - Mode0, - Mode1, - Mode2, - Mode3, -} - -// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers impl From for embassy_nrf::spim::Mode { fn from(mode: Mode) -> Self { match mode { @@ -48,12 +42,6 @@ impl From for embassy_nrf::spim::Mode { } } -#[derive(Copy, Clone)] -pub enum BitOrder { - MsbFirst, - LsbFirst, -} - impl From for embassy_nrf::spim::BitOrder { fn from(bit_order: BitOrder) -> Self { match bit_order { diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index b3bbe1f62..cbc2b4f18 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -4,7 +4,10 @@ use embassy_rp::{ Peripheral, }; -use crate::{arch, spi::impl_async_spibus_for_driver_enum}; +use crate::{ + arch, + spi::{impl_async_spibus_for_driver_enum, Mode}, +}; #[derive(Clone)] #[non_exhaustive] @@ -38,15 +41,6 @@ pub enum Frequency { M32 = 32_000_000, } -#[derive(Copy, Clone)] -pub enum Mode { - Mode0, - Mode1, - Mode2, - Mode3, -} - -// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers impl From for (Polarity, Phase) { fn from(mode: Mode) -> Self { match mode { diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index cd439206d..f66696567 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -8,7 +8,10 @@ use embassy_stm32::{ }; use riot_rs_macros::call_with_stm32_peripheral_list; -use crate::{arch, spi::impl_async_spibus_for_driver_enum}; +use crate::{ + arch, + spi::{impl_async_spibus_for_driver_enum, BitOrder, Mode}, +}; #[derive(Clone)] #[non_exhaustive] @@ -23,7 +26,7 @@ impl Default for Config { Self { frequency: Frequency::M1, mode: Mode::Mode0, - bit_order: BitOrder::MsbFirst, + bit_order: BitOrder::default(), } } } @@ -60,15 +63,6 @@ impl From for Hertz { } } -#[derive(Copy, Clone)] -pub enum Mode { - Mode0, - Mode1, - Mode2, - Mode3, -} - -// https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers impl From for embassy_stm32::spi::Mode { fn from(mode: Mode) -> Self { match mode { @@ -80,12 +74,6 @@ impl From for embassy_stm32::spi::Mode { } } -#[derive(Copy, Clone)] -pub enum BitOrder { - MsbFirst, - LsbFirst, -} - impl From for embassy_stm32::spi::BitOrder { fn from(bit_order: BitOrder) -> Self { match bit_order { diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index b5f55ae1b..7c3f1036f 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -46,3 +46,41 @@ macro_rules! impl_async_spibus_for_driver_enum { } #[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_spibus_for_driver_enum; + +/// SPI mode. +/// +/// - CPOL: Clock polarity. +/// - CPHA: Clock phase. +/// +/// See the [Wikipedia page for details](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#Mode_numbers). +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum Mode { + /// CPOL = 0, CPHA = 0. + Mode0, + /// CPOL = 0, CPHA = 1. + Mode1, + /// CPOL = 1, CPHA = 0. + Mode2, + /// CPOL = 1, CPHA = 1. + Mode3, +} + +// FIXME: should we offer configuring the bit order? (hiding from the docs for now) +/// Order in which bits are transmitted. +/// +/// Note: configuring the bit order is not supported on all architectures. +// NOTE(arch): the RP2040 and RP2350 always send the MSb first +#[doc(hidden)] +#[derive(Copy, Clone, PartialEq, Eq)] +pub enum BitOrder { + /// Most significant bit first. + MsbFirst, + /// Least significant bit first. + LsbFirst, +} + +impl Default for BitOrder { + fn default() -> Self { + Self::MsbFirst + } +} From d1c837d9225f0821cad21cc173ede634e42b1662 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:15:59 +0200 Subject: [PATCH 80/95] fixup! refactor: feature-gate SPI and I2C buses --- .github/workflows/build-deploy-docs.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index 1487d1f62..4e96d0d3e 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -48,7 +48,7 @@ jobs: - name: Build rustdoc docs run: | - cargo doc -p riot-rs --features no-boards,bench,threading,random,csprng,hwrng + cargo doc -p riot-rs --features no-boards,bench,i2c,spi,threading,random,csprng,hwrng echo "" > target/doc/index.html mkdir -p ./_site/dev/docs/api && mv target/doc/* ./_site/dev/docs/api diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a2346e9a2..efe051afe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -141,7 +141,7 @@ jobs: args: --verbose --locked --features no-boards -p riot-rs -p riot-rs-boards -p riot-rs-chips -p riot-rs-debug -p riot-rs-embassy -p riot-rs-macros -p riot-rs-random -p riot-rs-rt -p riot-rs-threads -p riot-rs-utils - name: rustdoc - run: RUSTDOCFLAGS='-D warnings' cargo doc -p riot-rs --features no-boards,bench,external-interrupts,threading,random,csprng,hwrng + run: RUSTDOCFLAGS='-D warnings' cargo doc -p riot-rs --features no-boards,bench,external-interrupts,i2c,spi,threading,random,csprng,hwrng - name: rustfmt run: cargo fmt --check --all From 51b256ca24998cb254d33df6d383e2e06973ab9d Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:06:30 +0200 Subject: [PATCH 81/95] fixup! refactor(spi): move `Mode` and `BitOrder` out of arch modules --- tests/spi-bus/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index e00eae072..b60415eca 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -17,7 +17,7 @@ use riot_rs::{ embassy::{ arch::{peripherals, spi}, gpio, - spi::SpiDevice, + spi::{Mode, SpiDevice}, }, }; @@ -92,10 +92,10 @@ async fn main(peripherals: Peripherals) { let mut spi_config = spi::Config::default(); spi_config.frequency = spi::Frequency::K125; spi_config.mode = if !cfg!(context = "esp") { - spi::Mode::Mode3 + Mode::Mode3 } else { // FIXME: the sensor datasheet does match with SPI mode 3, not mode 0 - spi::Mode::Mode0 + Mode::Mode0 }; // FIXME From a41e008467c5c30d2f4cd34dc31936c20f394dfd Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:29:15 +0200 Subject: [PATCH 82/95] feat(i2c): add timeouts on all architectures to prevent hangs --- src/riot-rs-embassy/Cargo.toml | 3 +- src/riot-rs-embassy/src/arch/esp/i2c.rs | 33 +++++++++- src/riot-rs-embassy/src/arch/nrf/i2c.rs | 25 +++++++- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 25 +++++++- src/riot-rs-embassy/src/arch/stm32/i2c.rs | 21 ++++++- src/riot-rs-embassy/src/i2c.rs | 72 ++++++++++++++++++++-- 6 files changed, 168 insertions(+), 11 deletions(-) diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 2635b4698..4e7a96052 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -18,6 +18,7 @@ paste.workspace = true embassy-embedded-hal = { workspace = true } embassy-executor = { workspace = true, features = ["nightly"] } +embassy-futures = { workspace = true } embassy-hal-internal = { workspace = true } embassy-net = { workspace = true, optional = true, features = [ "dhcpv4", @@ -124,7 +125,7 @@ external-interrupts = ["embassy-nrf?/gpiote", "embassy-stm32?/exti"] time = ["dep:embassy-time", "embassy-executor/integrated-timers"] ## Enables I2C support. -i2c = [] +i2c = ["dep:embassy-time"] ## Enables SPI support. spi = [] usb = ["dep:embassy-usb"] diff --git a/src/riot-rs-embassy/src/arch/esp/i2c.rs b/src/riot-rs-embassy/src/arch/esp/i2c.rs index 0ecda13eb..e3cb52616 100644 --- a/src/riot-rs-embassy/src/arch/esp/i2c.rs +++ b/src/riot-rs-embassy/src/arch/esp/i2c.rs @@ -85,8 +85,18 @@ macro_rules! define_i2c_drivers { // peripheral multiple times. let i2c_peripheral = unsafe { peripherals::$peripheral::steal() }; - // FIXME: use `new_with_timeout_async()` instead? - let twim = I2C::new_async(i2c_peripheral, sda_pin, scl_pin, frequency, &clocks); + // NOTE(arch): even though we handle bus timeout at a higher level as well, it + // does not seem possible to disable the timeout feature on ESP; so we keep the + // default timeout instead (encoded as `None`). + let timeout = None; + let twim = I2C::new_with_timeout_async( + i2c_peripheral, + sda_pin, + scl_pin, + frequency, + &clocks, + timeout, + ); I2c::$peripheral(Self { twim }) } @@ -99,13 +109,30 @@ macro_rules! define_i2c_drivers { } impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = esp_hal::i2c::Error; + type Error = crate::i2c::Error; } impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } +impl From for crate::i2c::Error { + fn from(err: esp_hal::i2c::Error) -> Self { + use esp_hal::i2c::Error::*; + + use crate::i2c::{Error, NoAcknowledgeSource}; + + match err { + ExceedingFifo => Error::Overrun, + AckCheckFailed => Error::NoAcknowledge(NoAcknowledgeSource::Unknown), + TimeOut => Error::Timeout, + ArbitrationLost => Error::ArbitrationLoss, + ExecIncomplete => Error::Other, + CommandNrExceeded => Error::Other, + } + } +} + // FIXME: support other archs // Define a driver per peripheral #[cfg(context = "esp32c6")] diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index 60fa390bf..d4764b9ff 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -88,6 +88,8 @@ macro_rules! define_i2c_drivers { // peripheral multiple times. let twim_peripheral = unsafe { peripherals::$peripheral::steal() }; + // NOTE(arch): the I2C peripheral and driver do not have any built-in timeout, + // we implement it at a higher level, not in this arch-specific module. let twim = Twim::new(twim_peripheral, Irqs, sda_pin, scl_pin, twim_config); I2c::$peripheral(Self { twim }) @@ -101,13 +103,34 @@ macro_rules! define_i2c_drivers { } impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_nrf::twim::Error; + type Error = crate::i2c::Error; } impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } +impl From for crate::i2c::Error { + fn from(err: embassy_nrf::twim::Error) -> Self { + use embassy_nrf::twim::Error::*; + + use crate::i2c::{Error, NoAcknowledgeSource}; + + match err { + TxBufferTooLong => Error::Other, + RxBufferTooLong => Error::Other, + Transmit => Error::Other, + Receive => Error::Other, + BufferNotInRAM => Error::Other, + AddressNack => Error::NoAcknowledge(NoAcknowledgeSource::Address), + DataNack => Error::NoAcknowledge(NoAcknowledgeSource::Data), + Overrun => Error::Overrun, + Timeout => Error::Timeout, + _ => Error::Other, + } + } +} + // FIXME: support other nRF archs // Define a driver per peripheral #[cfg(context = "nrf52840")] diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index bb08afe43..0c10a0942 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -81,6 +81,8 @@ macro_rules! define_i2c_drivers { // peripheral multiple times. let i2c_peripheral = unsafe { peripherals::$peripheral::steal() }; + // NOTE(arch): even though we handle bus timeout at a higher level as well, it + // does not seem possible to disable the timeout feature on RP. let i2c = embassy_rp::i2c::I2c::new_async( i2c_peripheral, scl_pin, @@ -100,13 +102,34 @@ macro_rules! define_i2c_drivers { } impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_rp::i2c::Error; + type Error = crate::i2c::Error; } impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } +impl From for crate::i2c::Error { + fn from(err: embassy_rp::i2c::Error) -> Self { + use embassy_rp::i2c::{AbortReason, Error::*}; + + use crate::i2c::{Error, NoAcknowledgeSource}; + + match err { + Abort(reason) => match reason { + AbortReason::NoAcknowledge => Error::NoAcknowledge(NoAcknowledgeSource::Unknown), + AbortReason::ArbitrationLoss => Error::ArbitrationLoss, + AbortReason::TxNotEmpty(_) => Error::Other, + AbortReason::Other(_) => Error::Other, + }, + InvalidReadBufferLength => Error::Other, + InvalidWriteBufferLength => Error::Other, + AddressOutOfRange(_) => Error::Other, + AddressReserved(_) => Error::Other, + } + } +} + // Define a driver per peripheral define_i2c_drivers!( I2C0_IRQ => I2C0, diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index 5d80f5a54..a85a18469 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -90,6 +90,7 @@ macro_rules! define_i2c_drivers { let mut i2c_config = embassy_stm32::i2c::Config::default(); i2c_config.sda_pullup = config.sda_pullup; i2c_config.scl_pullup = config.scl_pullup; + i2c_config.timeout = crate::i2c::I2C_TIMEOUT; bind_interrupts!( struct Irqs { @@ -133,12 +134,30 @@ macro_rules! define_i2c_drivers { } impl embedded_hal_async::i2c::ErrorType for I2c { - type Error = embassy_stm32::i2c::Error; + type Error = crate::i2c::Error; } impl_async_i2c_for_driver_enum!(I2c, $( $peripheral ),*); } } +impl From for crate::i2c::Error { + fn from(err: embassy_stm32::i2c::Error) -> Self { + use embassy_stm32::i2c::Error::*; + + use crate::i2c::{Error, NoAcknowledgeSource}; + + match err { + Bus => Error::Bus, + Arbitration => Error::ArbitrationLoss, + Nack => Error::NoAcknowledge(NoAcknowledgeSource::Unknown), + Timeout => Error::Timeout, + Crc => Error::Other, + Overrun => Error::Overrun, + ZeroLengthTransfer => Error::Other, + } + } +} + // Define a driver per peripheral call_with_stm32_peripheral_list!(define_i2c_drivers!, I2c, PeripheralsAndInterrupts); diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 01d19a8d0..754facbc3 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -1,24 +1,54 @@ use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; +use embassy_time::Duration; use crate::arch; +pub use embedded_hal::i2c::NoAcknowledgeSource; + +// Architectures are allowed to timeout earlier. +pub const I2C_TIMEOUT: Duration = Duration::from_millis(100); + // TODO: do we actually need a CriticalSectionRawMutex here? pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, arch::i2c::I2c>; +macro_rules! handle_timeout_res { + ($i2c:ident, $op:ident, $address:ident, $( $param:ident ),+) => {{ + let res = embassy_futures::select::select( + $i2c.twim.$op($address, $( $param ),+), + embassy_time::Timer::after($crate::i2c::I2C_TIMEOUT), + ).await; + + if let embassy_futures::select::Either::First(op) = res { + Ok(op?) + } else { + Err($crate::i2c::Error::NoAcknowledge($crate::i2c::NoAcknowledgeSource::Unknown)) + } + }} +} +pub(crate) use handle_timeout_res; + #[allow(unused_macros, reason = "used by arch modules")] macro_rules! impl_async_i2c_for_driver_enum { ($driver_enum:ident, $( $peripheral:ident ),*) => { impl embedded_hal_async::i2c::I2c for $driver_enum { async fn read(&mut self, address: u8, read: &mut [u8]) -> Result<(), Self::Error> { match self { - $( Self::$peripheral(i2c) => i2c.twim.read(address, read).await, )* + $( + Self::$peripheral(i2c) => { + $crate::i2c::handle_timeout_res!(i2c, read, address, read) + } + )* } } async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error> { match self { - $( Self::$peripheral(i2c) => i2c.twim.write(address, write).await, )* + $( + Self::$peripheral(i2c) => { + $crate::i2c::handle_timeout_res!(i2c, write, address, write) + } + )* } } @@ -29,7 +59,11 @@ macro_rules! impl_async_i2c_for_driver_enum { read: &mut [u8], ) -> Result<(), Self::Error> { match self { - $( Self::$peripheral(i2c) => i2c.twim.write_read(address, write, read).await, )* + $( + Self::$peripheral(i2c) => { + $crate::i2c::handle_timeout_res!(i2c, write_read, address, write, read) + } + )* } } @@ -39,7 +73,11 @@ macro_rules! impl_async_i2c_for_driver_enum { operations: &mut [Operation<'_>], ) -> Result<(), Self::Error> { match self { - $( Self::$peripheral(i2c) => i2c.twim.transaction(address, operations).await, )* + $( + Self::$peripheral(i2c) => { + $crate::i2c::handle_timeout_res!(i2c, transaction, address, operations) + } + )* } } } @@ -47,3 +85,29 @@ macro_rules! impl_async_i2c_for_driver_enum { } #[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_i2c_for_driver_enum; + +// FIXME: make this non_exhaustive? +#[derive(Debug)] +pub enum Error { + Bus, + ArbitrationLoss, + NoAcknowledge(NoAcknowledgeSource), + Overrun, + Timeout, + Other, +} + +impl embedded_hal::i2c::Error for Error { + fn kind(&self) -> embedded_hal::i2c::ErrorKind { + use embedded_hal::i2c::ErrorKind::*; + + match self { + Self::Bus => Bus, + Self::ArbitrationLoss => ArbitrationLoss, + Self::NoAcknowledge(ack_source) => NoAcknowledge(*ack_source), + Self::Overrun => Overrun, + Self::Timeout => Other, // FIXME: not sure, is this always a lack of ack? + Self::Other => Other, + } + } +} From 99f00f6a77f995bad809201646e0d7363e9f5d50 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Wed, 21 Aug 2024 17:22:28 +0200 Subject: [PATCH 83/95] fixup! feat(i2c): add timeouts on all architectures to prevent hangs --- src/riot-rs-embassy/src/i2c.rs | 37 +++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 754facbc3..6c636d031 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -1,12 +1,14 @@ +//! Provides support for the I2C communication bus. + use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use embassy_time::Duration; use crate::arch; -pub use embedded_hal::i2c::NoAcknowledgeSource; - -// Architectures are allowed to timeout earlier. +/// Timeout value for I2C operations. +/// +/// Architectures are allowed to timeout earlier. pub const I2C_TIMEOUT: Duration = Duration::from_millis(100); // TODO: do we actually need a CriticalSectionRawMutex here? @@ -86,13 +88,17 @@ macro_rules! impl_async_i2c_for_driver_enum { #[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_i2c_for_driver_enum; +/// An I2C error. // FIXME: make this non_exhaustive? -#[derive(Debug)] +// NOTE(eq): not deriving `Eq` here because it *could* semantically contain floats later. +#[derive(Debug, Clone, PartialEq)] pub enum Error { Bus, ArbitrationLoss, + /// No acknowledgement was received when expected. NoAcknowledge(NoAcknowledgeSource), Overrun, + /// Timeout when attempting to use the bus; most likely the target device is not connected. Timeout, Other, } @@ -104,10 +110,31 @@ impl embedded_hal::i2c::Error for Error { match self { Self::Bus => Bus, Self::ArbitrationLoss => ArbitrationLoss, - Self::NoAcknowledge(ack_source) => NoAcknowledge(*ack_source), + Self::NoAcknowledge(ack_source) => NoAcknowledge((*ack_source).into()), Self::Overrun => Overrun, Self::Timeout => Other, // FIXME: not sure, is this always a lack of ack? Self::Other => Other, } } } + +/// Indicates what protocol step was not acknowledged by the target device. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum NoAcknowledgeSource { + /// The device did not acknowledge its address. + Address, + /// The device did not acknowledge the data. + Data, + /// The device did not acknowledge either its address or its data. + Unknown, +} + +impl From for embedded_hal::i2c::NoAcknowledgeSource { + fn from(src: NoAcknowledgeSource) -> Self { + match src { + NoAcknowledgeSource::Address => embedded_hal::i2c::NoAcknowledgeSource::Address, + NoAcknowledgeSource::Data => embedded_hal::i2c::NoAcknowledgeSource::Data, + NoAcknowledgeSource::Unknown => embedded_hal::i2c::NoAcknowledgeSource::Unknown, + } + } +} From 8646498ed2c4b6e8288391b3dc21f4f4a74f4b88 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:26:16 +0200 Subject: [PATCH 84/95] docs: complete the bus documentation --- src/riot-rs-embassy/src/arch/dummy/i2c.rs | 30 ++++++++++++---------- src/riot-rs-embassy/src/arch/dummy/mod.rs | 2 +- src/riot-rs-embassy/src/arch/dummy/spi.rs | 30 ++++++++++++---------- src/riot-rs-embassy/src/arch/esp/i2c.rs | 2 +- src/riot-rs-embassy/src/arch/esp/spi.rs | 2 +- src/riot-rs-embassy/src/arch/nrf/i2c.rs | 2 +- src/riot-rs-embassy/src/arch/nrf/spi.rs | 2 +- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 2 +- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 2 +- src/riot-rs-embassy/src/arch/stm32/i2c.rs | 2 +- src/riot-rs-embassy/src/arch/stm32/spi.rs | 2 +- src/riot-rs-embassy/src/i2c.rs | 11 ++++++++ src/riot-rs-embassy/src/spi.rs | 12 +++++++++ 13 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/dummy/i2c.rs b/src/riot-rs-embassy/src/arch/dummy/i2c.rs index 6a84117ae..0d1d727ef 100644 --- a/src/riot-rs-embassy/src/arch/dummy/i2c.rs +++ b/src/riot-rs-embassy/src/arch/dummy/i2c.rs @@ -1,20 +1,24 @@ +//! Architecture- and MCU-specific types for I2C. +//! +//! This module provides a driver for each I2C peripheral, the driver name being the same as the +//! peripheral; see the tests and examples to learn how to instantiate them. +//! These driver instances are meant to be shared between tasks using +//! [`I2cDevice`](crate::i2c::I2cDevice). + use crate::arch; /// Peripheral-agnostic I2C driver implementing [`embedded_hal_async::i2c::I2c`]. /// -/// The driver instance is meant to be shared between tasks using -/// [`I2cDevice`](crate::i2c::I2cDevice). -/// -/// This driver is not architecture-agnostic however, and has as many variants as the MCU has -/// I2C peripherals, each variant's name being the name of that peripheral. -/// Each enum variant has an associated value, which is the associated peripheral-specific driver -/// instance. -/// The names of peripheral-specific I2C drivers are `I2c$peripheral`, where `$peripheral` is the -/// name of the I2C peripheral (e.g, driver names can be `I2cI2C0`, `I2cTWISPI0`, or `I2cSERIAL0`). -/// The constructors of these peripheral-specific drivers depend on the architecture, please see -/// the examples and tests for reference. -pub enum I2c {} +/// This type is not meant to be instantiated directly; instead instantiate a peripheral-specific +/// driver provided by this module. +// NOTE: we keep this type public because it may still required in user-written type signatures. +pub enum I2c { + // Make the docs show that this enum has variants, but do not show any because they are + // MCU-specific. + #[doc(hidden)] + Hidden, +} -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { unimplemented!(); } diff --git a/src/riot-rs-embassy/src/arch/dummy/mod.rs b/src/riot-rs-embassy/src/arch/dummy/mod.rs index fcc2e84d5..0dc74d810 100644 --- a/src/riot-rs-embassy/src/arch/dummy/mod.rs +++ b/src/riot-rs-embassy/src/arch/dummy/mod.rs @@ -1,4 +1,4 @@ -//! Dummy module used to satisfy platform-independent tooling. +//! Architecture- and MCU-specific types. mod executor; pub mod gpio; diff --git a/src/riot-rs-embassy/src/arch/dummy/spi.rs b/src/riot-rs-embassy/src/arch/dummy/spi.rs index 48e7ac9ea..afa2bdc04 100644 --- a/src/riot-rs-embassy/src/arch/dummy/spi.rs +++ b/src/riot-rs-embassy/src/arch/dummy/spi.rs @@ -1,20 +1,24 @@ +//! Architecture- and MCU-specific types for SPI. +//! +//! This module provides a driver for each SPI peripheral, the driver name being the same as the +//! peripheral; see the tests and examples to learn how to instantiate them. +//! These driver instances are meant to be shared between tasks using +//! [`SpiDevice`](crate::spi::SpiDevice). + use crate::arch; /// Peripheral-agnostic SPI driver implementing [`embedded_hal_async::spi::SpiBus`]. /// -/// The driver instance is meant to be shared between tasks using -/// [`SpiDevice`](crate::spi::SpiDevice). -/// -/// This driver is not architecture-agnostic however, and has as many variants as the MCU has -/// SPI peripherals, each variant's name being the name of that peripheral. -/// Each enum variant has an associated value, which is the associated peripheral-specific driver -/// instance. -/// The names of peripheral-specific SPI drivers are `Spi$peripheral`, where `$peripheral` is the -/// name of the SPI peripheral (e.g, driver names can be `SpiSPI2`, `SpiSPI0`, or `SpiSERIAL2`). -/// The constructors of these peripheral-specific drivers depend on the architecture, please see -/// the examples and tests for reference. -pub enum Spi {} +/// This type is not meant to be instantiated directly; instead instantiate a peripheral-specific +/// driver provided by this module. +// NOTE: we keep this type public because it may still required in user-written type signatures. +pub enum Spi { + // Make the docs show that this enum has variants, but do not show any because they are + // MCU-specific. + #[doc(hidden)] + Hidden, +} -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { unimplemented!(); } diff --git a/src/riot-rs-embassy/src/arch/esp/i2c.rs b/src/riot-rs-embassy/src/arch/esp/i2c.rs index e3cb52616..437ee06c9 100644 --- a/src/riot-rs-embassy/src/arch/esp/i2c.rs +++ b/src/riot-rs-embassy/src/arch/esp/i2c.rs @@ -44,7 +44,7 @@ impl From for fugit::HertzU32 { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all I2C peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "esp32c6")] { diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index c21d3a986..738e2d08c 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -85,7 +85,7 @@ impl From for esp_hal::spi::SpiBitOrder { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all SPI peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "esp32c6")] { diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index d4764b9ff..a52ddbd0d 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -33,7 +33,7 @@ impl Default for Config { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all I2C peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "nrf52840")] { diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index cc734ee39..f9143fb33 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -51,7 +51,7 @@ impl From for embassy_nrf::spim::BitOrder { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all SPI peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "nrf52840")] { diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 0c10a0942..52b1c29d2 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -33,7 +33,7 @@ pub enum Frequency { K400 = 400_000, } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all I2C peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "rp2040")] { diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index cbc2b4f18..39eb4f16d 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -52,7 +52,7 @@ impl From for (Polarity, Phase) { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all SPI peripherals and do nothing with them. cfg_if::cfg_if! { if #[cfg(context = "rp2040")] { diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index a85a18469..cc2869505 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -53,7 +53,7 @@ impl From for Hertz { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // This macro has to be defined in this function so that the `peripherals` variables exists. macro_rules! take_all_i2c_peripherals { ($peripherals:ident, $( $peripheral:ident ),*) => { diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index f66696567..a68ea73e9 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -83,7 +83,7 @@ impl From for embassy_stm32::spi::BitOrder { } } -pub fn init(peripherals: &mut arch::OptionalPeripherals) { +pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // This macro has to be defined in this function so that the `peripherals` variables exists. macro_rules! take_all_spi_peripherals { ($peripherals:ident, $( $peripheral:ident ),*) => { diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 6c636d031..159827e0f 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -1,4 +1,5 @@ //! Provides support for the I2C communication bus. +#![deny(missing_docs)] use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice as InnerI2cDevice; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; @@ -11,6 +12,12 @@ use crate::arch; /// Architectures are allowed to timeout earlier. pub const I2C_TIMEOUT: Duration = Duration::from_millis(100); +/// An I2C driver implementing [`embedded_hal_async::i2c::I2c`]. +/// +/// Needs to be provided with an MCU-specific I2C driver tied to a specific I2C peripheral, +/// obtainable from the [`arch::i2c`] module. +/// +/// See [`embedded_hal::i2c`] to learn more about how to share the bus. // TODO: do we actually need a CriticalSectionRawMutex here? pub type I2cDevice = InnerI2cDevice<'static, CriticalSectionRawMutex, arch::i2c::I2c>; @@ -93,13 +100,17 @@ pub(crate) use impl_async_i2c_for_driver_enum; // NOTE(eq): not deriving `Eq` here because it *could* semantically contain floats later. #[derive(Debug, Clone, PartialEq)] pub enum Error { + /// A protocol error occurred (e.g., the transaction was terminated earlier than expected). Bus, + /// Bus arbitration was lost (e.g., because there are multiple controllers on the bus). ArbitrationLoss, /// No acknowledgement was received when expected. NoAcknowledge(NoAcknowledgeSource), + /// Overrun of the receive buffer. Overrun, /// Timeout when attempting to use the bus; most likely the target device is not connected. Timeout, + /// An other error occurred. Other, } diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 7c3f1036f..0ddf3c68c 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -1,8 +1,20 @@ +//! Provides support for the SPI communication bus. +#![deny(missing_docs)] + use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice as InnerSpiDevice; use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; use crate::{arch, gpio}; +/// An SPI driver implementing [`embedded_hal_async::spi::SpiDevice`]. +/// +/// Needs to be provided with an MCU-specific SPI driver tied to a specific SPI peripheral, +/// obtainable from the [`arch::spi`] module. +/// It also requires a [`gpio::Output`] for the chip-select (CS) signal. +/// +/// See [`embedded_hal::spi`] to learn more about the distinction between an +/// [`SpiBus`](embedded_hal::spi::SpiBus) and an +/// [`SpiDevice`](embedded_hal::spi::SpiDevice). // TODO: do we actually need a CriticalSectionRawMutex here? pub type SpiDevice = InnerSpiDevice<'static, CriticalSectionRawMutex, arch::spi::Spi, gpio::Output>; From 6440545aff66990f27b52aeebf00f494599bc63b Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:31:23 +0200 Subject: [PATCH 85/95] refactor(spi-test): move the pin configuration to its own module --- tests/spi-bus/src/main.rs | 67 +++------------------------------------ tests/spi-bus/src/pins.rs | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 tests/spi-bus/src/pins.rs diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index b60415eca..692ce2ec9 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -10,12 +10,14 @@ #![feature(used_with_arg)] #![feature(impl_trait_in_assoc_type)] +mod pins; + use embassy_sync::mutex::Mutex; use embedded_hal_async::spi::{Operation, SpiDevice as _}; use riot_rs::{ debug::{exit, log::info, EXIT_SUCCESS}, embassy::{ - arch::{peripherals, spi}, + arch::spi, gpio, spi::{Mode, SpiDevice}, }, @@ -24,71 +26,12 @@ use riot_rs::{ // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; -#[cfg(context = "esp")] -type SensorSpi = spi::SPI2; -#[cfg(context = "esp")] -riot_rs::define_peripherals!(Peripherals { - spi_sck: GPIO_0, - spi_miso: GPIO_1, - spi_mosi: GPIO_2, - spi_cs: GPIO_3, - dma: DMA, -}); - -#[cfg(context = "nrf52840")] -type SensorSpi = spi::SPI2; -#[cfg(context = "nrf5340")] -type SensorSpi = spi::SERIAL2; -#[cfg(context = "nrf")] -riot_rs::define_peripherals!(Peripherals { - spi_sck: P0_00, - spi_miso: P0_01, - spi_mosi: P0_04, - spi_cs: P0_05, -}); - -#[cfg(context = "rp")] -type SensorSpi = spi::SPI0; -#[cfg(context = "rp")] -riot_rs::define_peripherals!(Peripherals { - spi_sck: PIN_18, - spi_miso: PIN_16, - spi_mosi: PIN_19, - spi_cs: PIN_17, - spi_tx_dma: DMA_CH0, - spi_rx_dma: DMA_CH1, -}); - -#[cfg(context = "stm32h755zitx")] -type SensorSpi = spi::SPI2; -#[cfg(context = "stm32h755zitx")] -riot_rs::define_peripherals!(Peripherals { - spi_sck: PB10, - spi_miso: PC2, - spi_mosi: PC3, - spi_cs: PB12, - spi_tx_dma: DMA1_CH1, - spi_rx_dma: DMA1_CH2, -}); - -#[cfg(context = "stm32wb55rgvx")] -type SensorSpi = spi::SPI2; -#[cfg(context = "stm32wb55rgvx")] -riot_rs::define_peripherals!(Peripherals { - spi_sck: PA9, - spi_miso: PC2, - spi_mosi: PC1, - spi_cs: PC0, - spi_tx_dma: DMA1_CH1, - spi_rx_dma: DMA1_CH2, -}); - // pub static SPI_BUS: once_cell::sync::OnceCell< // Mutex, // > = once_cell::sync::OnceCell::new(); #[riot_rs::task(autostart, peripherals)] -async fn main(peripherals: Peripherals) { +async fn main(peripherals: pins::Peripherals) { let mut spi_config = spi::Config::default(); spi_config.frequency = spi::Frequency::K125; spi_config.mode = if !cfg!(context = "esp") { @@ -102,7 +45,7 @@ async fn main(peripherals: Peripherals) { #[cfg(context = "esp")] let dma = esp_hal::dma::Dma::new(peripherals.dma); - let spi_bus = SensorSpi::new( + let spi_bus = pins::SensorSpi::new( peripherals.spi_sck, peripherals.spi_miso, peripherals.spi_mosi, diff --git a/tests/spi-bus/src/pins.rs b/tests/spi-bus/src/pins.rs new file mode 100644 index 000000000..b4055c9f4 --- /dev/null +++ b/tests/spi-bus/src/pins.rs @@ -0,0 +1,60 @@ +use riot_rs::embassy::arch::{peripherals, spi}; + +#[cfg(context = "esp")] +pub type SensorSpi = spi::SPI2; +#[cfg(context = "esp")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: GPIO_0, + spi_miso: GPIO_1, + spi_mosi: GPIO_2, + spi_cs: GPIO_3, + dma: DMA, +}); + +#[cfg(context = "nrf52840")] +pub type SensorSpi = spi::SPI2; +#[cfg(context = "nrf5340")] +pub type SensorSpi = spi::SERIAL2; +#[cfg(context = "nrf")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: P0_00, + spi_miso: P0_01, + spi_mosi: P0_04, + spi_cs: P0_05, +}); + +#[cfg(context = "rp")] +pub type SensorSpi = spi::SPI0; +#[cfg(context = "rp")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: PIN_18, + spi_miso: PIN_16, + spi_mosi: PIN_19, + spi_cs: PIN_17, + spi_tx_dma: DMA_CH0, + spi_rx_dma: DMA_CH1, +}); + +#[cfg(context = "stm32h755zitx")] +pub type SensorSpi = spi::SPI2; +#[cfg(context = "stm32h755zitx")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: PB10, + spi_miso: PC2, + spi_mosi: PC3, + spi_cs: PB12, + spi_tx_dma: DMA1_CH1, + spi_rx_dma: DMA1_CH2, +}); + +#[cfg(context = "stm32wb55rgvx")] +pub type SensorSpi = spi::SPI2; +#[cfg(context = "stm32wb55rgvx")] +riot_rs::define_peripherals!(Peripherals { + spi_sck: PA9, + spi_miso: PC2, + spi_mosi: PC1, + spi_cs: PC0, + spi_tx_dma: DMA1_CH1, + spi_rx_dma: DMA1_CH2, +}); From 14f239ac88c433c8a6abc1245d5605710239df0b Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:31:23 +0200 Subject: [PATCH 86/95] refactor(i2c-test): move the pin configuration to its own module --- tests/i2c-bus/src/main.rs | 57 ++++----------------------------------- tests/i2c-bus/src/pins.rs | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 tests/i2c-bus/src/pins.rs diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 9cca636f4..9670a88e5 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -10,14 +10,13 @@ #![feature(used_with_arg)] #![feature(impl_trait_in_assoc_type)] +mod pins; + use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c::I2c as _; use riot_rs::{ debug::{exit, log::info, EXIT_SUCCESS}, - embassy::{ - arch::{i2c, peripherals}, - i2c::I2cDevice, - }, + embassy::{arch::i2c, i2c::I2cDevice}, }; const LIS3DH_I2C_ADDR: u8 = 0x19; @@ -25,62 +24,16 @@ const LIS3DH_I2C_ADDR: u8 = 0x19; // WHO_AM_I register of the LIS3DH sensor const WHO_AM_I_REG_ADDR: u8 = 0x0f; -#[cfg(context = "esp")] -type SensorI2c = i2c::I2C0; -#[cfg(context = "esp")] -riot_rs::define_peripherals!(Peripherals { - i2c_sda: GPIO_0, - i2c_scl: GPIO_1, -}); - -#[cfg(context = "nrf52840")] -type SensorI2c = i2c::TWISPI0; -#[cfg(context = "nrf5340")] -type SensorI2c = i2c::SERIAL0; -#[cfg(context = "nrf")] -riot_rs::define_peripherals!(Peripherals { - i2c_sda: P0_00, - i2c_scl: P0_01, -}); - -#[cfg(context = "rp")] -type SensorI2c = i2c::I2C0; -#[cfg(context = "rp")] -riot_rs::define_peripherals!(Peripherals { - i2c_sda: PIN_12, - i2c_scl: PIN_13, -}); - -#[cfg(context = "stm32h755zitx")] -type SensorI2c = i2c::I2C1; -#[cfg(context = "stm32h755zitx")] -riot_rs::define_peripherals!(Peripherals { - i2c_sda: PB9, - i2c_scl: PB8, - i2c_tx_dma: DMA1_CH1, - i2c_rx_dma: DMA1_CH2, -}); - -#[cfg(context = "stm32wb55rgvx")] -type SensorI2c = i2c::I2C1; -#[cfg(context = "stm32wb55rgvx")] -riot_rs::define_peripherals!(Peripherals { - i2c_sda: PB9, - i2c_scl: PB8, - i2c_tx_dma: DMA1_CH1, - i2c_rx_dma: DMA1_CH2, -}); - pub static I2C_BUS: once_cell::sync::OnceCell< Mutex, > = once_cell::sync::OnceCell::new(); #[riot_rs::task(autostart, peripherals)] -async fn main(peripherals: Peripherals) { +async fn main(peripherals: pins::Peripherals) { let mut i2c_config = i2c::Config::default(); i2c_config.frequency = i2c::Frequency::K100; - let i2c_bus = SensorI2c::new( + let i2c_bus = pins::SensorI2c::new( peripherals.i2c_sda, peripherals.i2c_scl, #[cfg(any(context = "stm32h755zitx", context = "stm32wb55rgvx"))] diff --git a/tests/i2c-bus/src/pins.rs b/tests/i2c-bus/src/pins.rs new file mode 100644 index 000000000..dee8f9918 --- /dev/null +++ b/tests/i2c-bus/src/pins.rs @@ -0,0 +1,47 @@ +use riot_rs::embassy::arch::{i2c, peripherals}; + +#[cfg(context = "esp")] +pub type SensorI2c = i2c::I2C0; +#[cfg(context = "esp")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: GPIO_2, + i2c_scl: GPIO_0, +}); + +#[cfg(context = "nrf52840")] +pub type SensorI2c = i2c::TWISPI0; +#[cfg(context = "nrf5340")] +pub type SensorI2c = i2c::SERIAL0; +#[cfg(context = "nrf")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: P0_00, + i2c_scl: P0_01, +}); + +#[cfg(context = "rp")] +pub type SensorI2c = i2c::I2C0; +#[cfg(context = "rp")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: PIN_12, + i2c_scl: PIN_13, +}); + +#[cfg(context = "stm32h755zitx")] +pub type SensorI2c = i2c::I2C1; +#[cfg(context = "stm32h755zitx")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: PB9, + i2c_scl: PB8, + i2c_tx_dma: DMA1_CH1, + i2c_rx_dma: DMA1_CH2, +}); + +#[cfg(context = "stm32wb55rgvx")] +pub type SensorI2c = i2c::I2C1; +#[cfg(context = "stm32wb55rgvx")] +riot_rs::define_peripherals!(Peripherals { + i2c_sda: PB9, + i2c_scl: PB8, + i2c_tx_dma: DMA1_CH1, + i2c_rx_dma: DMA1_CH2, +}); From 572d6c2ed80082389567e2c450c2c6fc5f7a683d Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:49:07 +0200 Subject: [PATCH 87/95] docs(buses): update the support matrix --- book/src/support_matrix.html | 20 +++++++++++++++++++- doc/support_matrix.yml | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/book/src/support_matrix.html b/book/src/support_matrix.html index feecf1790..fbc2fea9e 100644 --- a/book/src/support_matrix.html +++ b/book/src/support_matrix.html @@ -4,7 +4,7 @@ Chip Testing Board - Functionality + Functionality @@ -15,6 +15,8 @@ User USB Wi-Fi Ethernet over USB + I2C Controller + SPI Main Role @@ -27,6 +29,8 @@ ✅ ☑️ ✅ + ✅ + ☑️ nRF52xxx @@ -37,6 +41,8 @@ ✅ – ✅ + ✅ + ✅ nRF53xx @@ -47,6 +53,8 @@ ✅ – ✅ + ✅ + ✅ RP2040 @@ -57,6 +65,8 @@ ✅ – ✅ + ✅ + ✅ RP2040 @@ -67,6 +77,8 @@ ✅ ✅ ✅ + ✅ + ✅ STM32F401RETX @@ -77,6 +89,8 @@ – – – + ✅ + ✅ STM32F755ZITX @@ -87,6 +101,8 @@ ✅ – ❌ + ✅ + ✅ STM32W55RGVX @@ -97,6 +113,8 @@ ✅ – ✅ + ✅ + ✅ diff --git a/doc/support_matrix.yml b/doc/support_matrix.yml index 879792e7f..6f977af1f 100644 --- a/doc/support_matrix.yml +++ b/doc/support_matrix.yml @@ -35,6 +35,12 @@ functionalities: - name: ethernet_over_usb title: Ethernet over USB description: + - name: i2c-controller + title: I2C Controller + description: Controller for the I2C communication bus + - name: spi-main + title: SPI Main Role + description: Main role for the SPI communication bus # Encodes support status for each chip. chips: @@ -43,6 +49,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available @@ -51,6 +59,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available @@ -59,6 +69,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available @@ -67,6 +79,11 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: + status: supported_with_caveats + comments: + - the SPI driver is not `Send` logging: supported wifi: not_available @@ -75,6 +92,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available @@ -83,6 +102,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available @@ -91,6 +112,8 @@ chips: support: gpio: supported debug_output: supported + i2c-controller: supported + spi-main: supported logging: supported wifi: not_available From 6aee198204c5c810c33347a48e62626d0358fbf3 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:11:46 +0200 Subject: [PATCH 88/95] fixup! WIP: add support for SPI on ESP32 --- src/riot-rs-embassy/src/arch/esp/spi.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index 738e2d08c..bf20ace3f 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -38,15 +38,15 @@ impl Default for Config { #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K125 = 125_000, - K250 = 250_000, - K500 = 500_00, - M1 = 1_000_000, - M2 = 2_000_000, - M4 = 4_000_000, - M8 = 8_000_000, - M16 = 16_000_000, - M32 = 32_000_000, + K125, + K250, + K500, + M1, + M2, + M4, + M8, + M16, + M32, } impl From for fugit::HertzU32 { From e388d76eb8730f8a73b8ca36c21f4b7693cb6233 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:12:34 +0200 Subject: [PATCH 89/95] fixup! feat(spi): add support for SPI on STM32WB55RGVX --- src/riot-rs-embassy/src/arch/stm32/spi.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index a68ea73e9..aa5b5fe05 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -36,15 +36,15 @@ impl Default for Config { #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K125 = 125_000, - K250 = 250_000, - K500 = 500_00, - M1 = 1_000_000, - M2 = 2_000_000, - M4 = 4_000_000, - M8 = 8_000_000, - M16 = 16_000_000, - M32 = 32_000_000, + K125, + K250, + K500, + M1, + M2, + M4, + M8, + M16, + M32, } impl From for Hertz { From 07d4bbdfe7c7ac65cc957180fee12c1e38809348 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:13:15 +0200 Subject: [PATCH 90/95] fixup! feat: simplify the SPI API --- src/riot-rs-embassy/src/arch/esp/spi.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index bf20ace3f..d5bff541a 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -101,7 +101,6 @@ macro_rules! define_spi_drivers { $( /// Peripheral-specific SPI driver. pub struct $peripheral { - // FIXME: do we want full- or half-duplex? spim: InnerSpi<'static, peripherals::$peripheral, dma::DmaChannel1, FullDuplexMode, Async>, } From 5903208f1ab4c4f77ef26ae6383ac5087dab3da6 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:18:54 +0200 Subject: [PATCH 91/95] fixup! refactor: feature-gate SPI and I2C buses --- src/riot-rs-embassy/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 4e7a96052..7dad393db 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -16,7 +16,7 @@ portable-atomic.workspace = true fugit.workspace = true paste.workspace = true -embassy-embedded-hal = { workspace = true } +embassy-embedded-hal = { workspace = true, optional = true } embassy-executor = { workspace = true, features = ["nightly"] } embassy-futures = { workspace = true } embassy-hal-internal = { workspace = true } @@ -125,9 +125,9 @@ external-interrupts = ["embassy-nrf?/gpiote", "embassy-stm32?/exti"] time = ["dep:embassy-time", "embassy-executor/integrated-timers"] ## Enables I2C support. -i2c = ["dep:embassy-time"] +i2c = ["dep:embassy-embedded-hal", "dep:embassy-time"] ## Enables SPI support. -spi = [] +spi = ["dep:embassy-embedded-hal"] usb = ["dep:embassy-usb"] # embassy-net requires embassy-time and support for timeouts in the executor net = ["dep:embassy-net", "time"] From 2ba0694ac5b6ba85a78f1fa00eeb6755f66aa1fc Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:25:37 +0200 Subject: [PATCH 92/95] fixup! refactor: feature-gate SPI and I2C buses --- src/riot-rs/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riot-rs/Cargo.toml b/src/riot-rs/Cargo.toml index cc345174d..1248efc93 100644 --- a/src/riot-rs/Cargo.toml +++ b/src/riot-rs/Cargo.toml @@ -44,7 +44,7 @@ csprng = ["riot-rs-random/csprng"] ## Enables seeding the random number generator from hardware. hwrng = ["riot-rs-embassy/hwrng"] -#! ## Communication buses +#! ## Serial communication ## Enables I2C support. i2c = ["riot-rs-embassy/i2c"] ## Enables SPI support. From 06757abf0d74e5f88cb9e6472f7180fd601455d4 Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:15:01 +0200 Subject: [PATCH 93/95] fix(i2c): rework how frequencies are managed --- src/riot-rs-embassy/src/arch/dummy/i2c.rs | 10 +++++++ src/riot-rs-embassy/src/arch/esp/i2c.rs | 27 ++++++++++-------- src/riot-rs-embassy/src/arch/nrf/i2c.rs | 32 +++++++++++++++++++--- src/riot-rs-embassy/src/arch/rp2040/i2c.rs | 16 +++++++---- src/riot-rs-embassy/src/arch/stm32/i2c.rs | 24 ++++++++-------- src/riot-rs-embassy/src/i2c.rs | 21 ++++++++++++++ tests/i2c-bus/src/main.rs | 7 +++-- 7 files changed, 103 insertions(+), 34 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/dummy/i2c.rs b/src/riot-rs-embassy/src/arch/dummy/i2c.rs index 0d1d727ef..8ea9c6f34 100644 --- a/src/riot-rs-embassy/src/arch/dummy/i2c.rs +++ b/src/riot-rs-embassy/src/arch/dummy/i2c.rs @@ -19,6 +19,16 @@ pub enum I2c { Hidden, } +/// MCU-specific I2C bus frequency. +pub enum Frequency { + /// Standard mode. + _100k, + /// Fast mode. + _400k, + #[doc(hidden)] + Hidden, +} + pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { unimplemented!(); } diff --git a/src/riot-rs-embassy/src/arch/esp/i2c.rs b/src/riot-rs-embassy/src/arch/esp/i2c.rs index 437ee06c9..48ed9367d 100644 --- a/src/riot-rs-embassy/src/arch/esp/i2c.rs +++ b/src/riot-rs-embassy/src/arch/esp/i2c.rs @@ -17,29 +17,34 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::K100, + frequency: Frequency::_100k, } } } -// FIXME: check how well this matches the ESP32 capabilities -// TODO: allow more free-from values? +// TODO: also support arbitrary frequencies up to 800 kHz? +// NOTE(arch): the technical references only mention these frequencies, except above fast mode +// where intermediate frequencies are supported. +#[cfg(any(context = "esp32c3", context = "esp32c6"))] #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K100 = 100_000, - K250 = 250_000, - K400 = 400_000, - M1 = 1_000_000, + /// Standard mode. + _100k = 100_000, + /// Fast mode. + _400k = 400_000, + #[cfg(any(context = "esp32s3", context = "esp32c3"))] + /// Maximum frequency. + _800k = 800_000, } impl From for fugit::HertzU32 { fn from(freq: Frequency) -> Self { match freq { - Frequency::K100 => fugit::Rate::::kHz(100), - Frequency::K250 => fugit::Rate::::kHz(250), - Frequency::K400 => fugit::Rate::::kHz(400), - Frequency::M1 => fugit::Rate::::MHz(1), + Frequency::_100k => fugit::Rate::::kHz(100), + Frequency::_400k => fugit::Rate::::kHz(400), + #[cfg(any(context = "esp32s3", context = "esp32c3"))] + Frequency::_800k => fugit::Rate::::kHz(800), } } } diff --git a/src/riot-rs-embassy/src/arch/nrf/i2c.rs b/src/riot-rs-embassy/src/arch/nrf/i2c.rs index a52ddbd0d..d7569d941 100644 --- a/src/riot-rs-embassy/src/arch/nrf/i2c.rs +++ b/src/riot-rs-embassy/src/arch/nrf/i2c.rs @@ -9,8 +9,6 @@ use embedded_hal_async::i2c::Operation; use crate::{arch, i2c::impl_async_i2c_for_driver_enum}; -pub use embassy_nrf::twim::Frequency; - #[non_exhaustive] #[derive(Clone)] pub struct Config { @@ -24,7 +22,7 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::K100, + frequency: Frequency::_100k, sda_pullup: false, scl_pullup: false, sda_high_drive: false, @@ -33,6 +31,32 @@ impl Default for Config { } } +// NOTE(arch): the datasheets only mention these frequencies. +#[cfg(any(context = "nrf52840", context = "nrf5340"))] +#[derive(Copy, Clone)] +pub enum Frequency { + /// Standard mode. + _100k, + #[cfg(context = "nrf5340")] + _250k, + /// Fast mode. + _400k, + // FIXME(embassy): the upstream Embassy crate does not support this frequency + // #[cfg(context = "nrf5340")] + // K1000, +} + +impl From for embassy_nrf::twim::Frequency { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::_100k => embassy_nrf::twim::Frequency::K100, + #[cfg(context = "nrf5340")] + Frequency::_250k => embassy_nrf::twim::Frequency::K250, + Frequency::_400k => embassy_nrf::twim::Frequency::K400, + } + } +} + pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { // Take all I2C peripherals and do nothing with them. cfg_if::cfg_if! { @@ -64,7 +88,7 @@ macro_rules! define_i2c_drivers { config: Config, ) -> I2c { let mut twim_config = embassy_nrf::twim::Config::default(); - twim_config.frequency = config.frequency; + twim_config.frequency = config.frequency.into(); twim_config.sda_pullup = config.sda_pullup; twim_config.scl_pullup = config.scl_pullup; twim_config.sda_high_drive = config.sda_high_drive; diff --git a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs index 52b1c29d2..baf0931f6 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/i2c.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/i2c.rs @@ -18,19 +18,23 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::K100, + frequency: Frequency::_100k, } } } -// Possible values are copied from embassy-nrf -// TODO: check how well this matches the RP2040 capabilities +// NOTE(arch): intermediate frequencies are also supported. +// TODO: also support arbitrary frequencies up to 400 kHz? #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K100 = 100_000, - K250 = 250_000, - K400 = 400_000, + /// Standard mode. + _100k = 100_000, + _250k = 250_000, + /// Fast mode. + _400k = 400_000, + // FIXME(embassy): fast mode plus is supported by hardware but requires additional + // configuration that Embassy does not seem to currently provide. } pub(crate) fn init(peripherals: &mut arch::OptionalPeripherals) { diff --git a/src/riot-rs-embassy/src/arch/stm32/i2c.rs b/src/riot-rs-embassy/src/arch/stm32/i2c.rs index cc2869505..de8ccd4b8 100644 --- a/src/riot-rs-embassy/src/arch/stm32/i2c.rs +++ b/src/riot-rs-embassy/src/arch/stm32/i2c.rs @@ -24,31 +24,33 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::K100, + frequency: Frequency::_100k, sda_pullup: false, scl_pullup: false, } } } -// FIXME: check how well this matches the STM32 capabilities -// TODO: allow more free-from values? +// NOTE(arch): intermediate frequencies are also supported. +// TODO: also support arbitrary frequencies? #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K100 = 100_000, - K250 = 250_000, - K400 = 400_000, - M1 = 1_000_000, + /// Standard mode. + _100k = 100_000, + _250k = 250_000, + /// Fast mode. + _400k = 400_000, + // FIXME: frequencies up to 1 MHz are supported, but requires additional configuration of GPIOs + // used. } impl From for Hertz { fn from(freq: Frequency) -> Self { match freq { - Frequency::K100 => Hertz::khz(100), - Frequency::K250 => Hertz::khz(250), - Frequency::K400 => Hertz::khz(400), - Frequency::M1 => Hertz::mhz(1), + Frequency::_100k => Hertz::khz(100), + Frequency::_250k => Hertz::khz(250), + Frequency::_400k => Hertz::khz(400), } } } diff --git a/src/riot-rs-embassy/src/i2c.rs b/src/riot-rs-embassy/src/i2c.rs index 159827e0f..495987ffc 100644 --- a/src/riot-rs-embassy/src/i2c.rs +++ b/src/riot-rs-embassy/src/i2c.rs @@ -149,3 +149,24 @@ impl From for embedded_hal::i2c::NoAcknowledgeSource { } } } + +/// I2C bus frequency. +// FIXME: rename this to Bitrate, and use kbit/s instead? +pub enum Frequency { + /// MCU-specific frequency. + Arch(arch::i2c::Frequency), + /// Standard mode: 100 kHz. + _100k, + /// Fast mode: 400 kHz. + _400k, +} + +impl From for arch::i2c::Frequency { + fn from(freq: crate::i2c::Frequency) -> Self { + match freq { + crate::i2c::Frequency::Arch(freq) => freq, + crate::i2c::Frequency::_100k => arch::i2c::Frequency::_100k, + crate::i2c::Frequency::_400k => arch::i2c::Frequency::_400k, + } + } +} diff --git a/tests/i2c-bus/src/main.rs b/tests/i2c-bus/src/main.rs index 9670a88e5..b1ba6c197 100644 --- a/tests/i2c-bus/src/main.rs +++ b/tests/i2c-bus/src/main.rs @@ -16,7 +16,10 @@ use embassy_sync::mutex::Mutex; use embedded_hal_async::i2c::I2c as _; use riot_rs::{ debug::{exit, log::info, EXIT_SUCCESS}, - embassy::{arch::i2c, i2c::I2cDevice}, + embassy::{ + arch::i2c, + i2c::{Frequency, I2cDevice}, + }, }; const LIS3DH_I2C_ADDR: u8 = 0x19; @@ -31,7 +34,7 @@ pub static I2C_BUS: once_cell::sync::OnceCell< #[riot_rs::task(autostart, peripherals)] async fn main(peripherals: pins::Peripherals) { let mut i2c_config = i2c::Config::default(); - i2c_config.frequency = i2c::Frequency::K100; + i2c_config.frequency = Frequency::_100k.into(); let i2c_bus = pins::SensorI2c::new( peripherals.i2c_sda, From 07326166ce628b03ac453bef326c976c268b47e1 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Mon, 19 Aug 2024 14:49:07 +0200 Subject: [PATCH 94/95] feat(stm32): use `init_primary()` on h755 --- laze-project.yml | 1 + src/riot-rs-embassy/src/arch/stm32/mod.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/laze-project.yml b/laze-project.yml index 48c177b10..5cbc0e8ad 100644 --- a/laze-project.yml +++ b/laze-project.yml @@ -351,6 +351,7 @@ contexts: PROBE_RS_PROTOCOL: swd RUSTFLAGS: - --cfg context=\"stm32h755zitx\" + - --cfg capability=\"hw/stm32-dual-core\" CARGO_ENV: # This ISR is unused on a naked board. Configured here for testing. - CONFIG_SWI=UART5 diff --git a/src/riot-rs-embassy/src/arch/stm32/mod.rs b/src/riot-rs-embassy/src/arch/stm32/mod.rs index 390ffdd47..c11bc7d1d 100644 --- a/src/riot-rs-embassy/src/arch/stm32/mod.rs +++ b/src/riot-rs-embassy/src/arch/stm32/mod.rs @@ -32,10 +32,23 @@ cfg_if::cfg_if! { #[cfg(feature = "executor-interrupt")] include!(concat!(env!("OUT_DIR"), "/swi.rs")); +#[cfg(capability = "hw/stm32-dual-core")] +use {core::mem::MaybeUninit, embassy_stm32::SharedData}; + +// RIOT-rs doesn't support the second core yet, but upstream needs this. +#[cfg(capability = "hw/stm32-dual-core")] +static SHARED_DATA: MaybeUninit = MaybeUninit::uninit(); + pub fn init() -> OptionalPeripherals { let mut config = Config::default(); board_config(&mut config); + + #[cfg(not(capability = "hw/stm32-dual-core"))] let peripherals = embassy_stm32::init(config); + + #[cfg(capability = "hw/stm32-dual-core")] + let peripherals = embassy_stm32::init_primary(config, &SHARED_DATA); + OptionalPeripherals::from(peripherals) } From 1e833cb28d0e560d8bf22a25a30a425c0df196ad Mon Sep 17 00:00:00 2001 From: ROMemories <152802150+ROMemories@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:44:42 +0200 Subject: [PATCH 95/95] fix(spi): rework how frequencies are managed --- src/riot-rs-embassy/src/arch/esp/spi.rs | 38 ++++++++++---------- src/riot-rs-embassy/src/arch/nrf/spi.rs | 38 +++++++++++++++++--- src/riot-rs-embassy/src/arch/rp2040/spi.rs | 22 ++++++------ src/riot-rs-embassy/src/arch/stm32/spi.rs | 40 ++++++++++------------ src/riot-rs-embassy/src/spi.rs | 37 ++++++++++++++++++++ tests/spi-bus/src/main.rs | 4 +-- 6 files changed, 121 insertions(+), 58 deletions(-) diff --git a/src/riot-rs-embassy/src/arch/esp/spi.rs b/src/riot-rs-embassy/src/arch/esp/spi.rs index d5bff541a..c0d1184d6 100644 --- a/src/riot-rs-embassy/src/arch/esp/spi.rs +++ b/src/riot-rs-embassy/src/arch/esp/spi.rs @@ -26,7 +26,7 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::M1, // FIXME + frequency: Frequency::_1M, mode: Mode::Mode0, bit_order: BitOrder::default(), } @@ -38,29 +38,29 @@ impl Default for Config { #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K125, - K250, - K500, - M1, - M2, - M4, - M8, - M16, - M32, + _125k, + _250k, + _500k, + _1M, + _2M, + _4M, + _8M, + _16M, + _32M, } impl From for fugit::HertzU32 { fn from(freq: Frequency) -> Self { match freq { - Frequency::K125 => fugit::Rate::::kHz(125), - Frequency::K250 => fugit::Rate::::kHz(250), - Frequency::K500 => fugit::Rate::::kHz(500), - Frequency::M1 => fugit::Rate::::MHz(1), - Frequency::M2 => fugit::Rate::::MHz(2), - Frequency::M4 => fugit::Rate::::MHz(4), - Frequency::M8 => fugit::Rate::::MHz(8), - Frequency::M16 => fugit::Rate::::MHz(16), - Frequency::M32 => fugit::Rate::::MHz(32), + Frequency::_125k => fugit::Rate::::kHz(125), + Frequency::_250k => fugit::Rate::::kHz(250), + Frequency::_500k => fugit::Rate::::kHz(500), + Frequency::_1M => fugit::Rate::::MHz(1), + Frequency::_2M => fugit::Rate::::MHz(2), + Frequency::_4M => fugit::Rate::::MHz(4), + Frequency::_8M => fugit::Rate::::MHz(8), + Frequency::_16M => fugit::Rate::::MHz(16), + Frequency::_32M => fugit::Rate::::MHz(32), } } } diff --git a/src/riot-rs-embassy/src/arch/nrf/spi.rs b/src/riot-rs-embassy/src/arch/nrf/spi.rs index f9143fb33..d5003ce4f 100644 --- a/src/riot-rs-embassy/src/arch/nrf/spi.rs +++ b/src/riot-rs-embassy/src/arch/nrf/spi.rs @@ -11,8 +11,6 @@ use crate::{ spi::{impl_async_spibus_for_driver_enum, BitOrder, Mode}, }; -pub use embassy_nrf::spim::Frequency; - #[derive(Clone)] #[non_exhaustive] pub struct Config { @@ -24,13 +22,45 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::M1, + frequency: Frequency::_1M, mode: Mode::Mode0, bit_order: BitOrder::default(), } } } +#[derive(Copy, Clone)] +#[repr(u32)] +pub enum Frequency { + _125k, + _250k, + _500k, + _1M, + _2M, + _4M, + _8M, + // FIXME(embassy): these frequencies are supported by hardware but do not seem supported by + // Embassy. + // #[cfg(context = "nrf5340")] + // _16M, + // #[cfg(context = "nrf5340")] + // _32M, +} + +impl From for embassy_nrf::spim::Frequency { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::_125k => embassy_nrf::spim::Frequency::K125, + Frequency::_250k => embassy_nrf::spim::Frequency::K250, + Frequency::_500k => embassy_nrf::spim::Frequency::K500, + Frequency::_1M => embassy_nrf::spim::Frequency::M1, + Frequency::_2M => embassy_nrf::spim::Frequency::M2, + Frequency::_4M => embassy_nrf::spim::Frequency::M4, + Frequency::_8M => embassy_nrf::spim::Frequency::M8, + } + } +} + impl From for embassy_nrf::spim::Mode { fn from(mode: Mode) -> Self { match mode { @@ -83,7 +113,7 @@ macro_rules! define_spi_drivers { config: Config, ) -> Spi { let mut spi_config = embassy_nrf::spim::Config::default(); - spi_config.frequency = config.frequency; + spi_config.frequency = config.frequency.into(); spi_config.mode = config.mode.into(); spi_config.bit_order = config.bit_order.into(); diff --git a/src/riot-rs-embassy/src/arch/rp2040/spi.rs b/src/riot-rs-embassy/src/arch/rp2040/spi.rs index 39eb4f16d..3c3a65acb 100644 --- a/src/riot-rs-embassy/src/arch/rp2040/spi.rs +++ b/src/riot-rs-embassy/src/arch/rp2040/spi.rs @@ -19,26 +19,24 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::M1, + frequency: Frequency::_1M, mode: Mode::Mode0, } } } -// Possible values are copied from embassy-nrf -// TODO: check how well this matches the RP2040 capabilities #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K125 = 125_000, - K250 = 250_000, - K500 = 500_00, - M1 = 1_000_000, - M2 = 2_000_000, - M4 = 4_000_000, - M8 = 8_000_000, - M16 = 16_000_000, - M32 = 32_000_000, + _125k = 125_000, + _250k = 250_000, + _500k = 500_00, + _1M = 1_000_000, + _2M = 2_000_000, + _4M = 4_000_000, + _8M = 8_000_000, + _16M = 16_000_000, + _32M = 32_000_000, } impl From for (Polarity, Phase) { diff --git a/src/riot-rs-embassy/src/arch/stm32/spi.rs b/src/riot-rs-embassy/src/arch/stm32/spi.rs index aa5b5fe05..78eb045a5 100644 --- a/src/riot-rs-embassy/src/arch/stm32/spi.rs +++ b/src/riot-rs-embassy/src/arch/stm32/spi.rs @@ -24,41 +24,39 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - frequency: Frequency::M1, + frequency: Frequency::_1M, mode: Mode::Mode0, bit_order: BitOrder::default(), } } } -// Possible values are copied from embassy-nrf -// TODO: check how well this matches the STM32 capabilities #[derive(Copy, Clone)] #[repr(u32)] pub enum Frequency { - K125, - K250, - K500, - M1, - M2, - M4, - M8, - M16, - M32, + _125k, + _250k, + _500k, + _1M, + _2M, + _4M, + _8M, + _16M, + _32M, } impl From for Hertz { fn from(freq: Frequency) -> Self { match freq { - Frequency::K125 => Hertz::khz(125), - Frequency::K250 => Hertz::khz(250), - Frequency::K500 => Hertz::khz(500), - Frequency::M1 => Hertz::mhz(1), - Frequency::M2 => Hertz::mhz(2), - Frequency::M4 => Hertz::mhz(4), - Frequency::M8 => Hertz::mhz(8), - Frequency::M16 => Hertz::mhz(16), - Frequency::M32 => Hertz::mhz(32), + Frequency::_125k => Hertz::khz(125), + Frequency::_250k => Hertz::khz(250), + Frequency::_500k => Hertz::khz(500), + Frequency::_1M => Hertz::mhz(1), + Frequency::_2M => Hertz::mhz(2), + Frequency::_4M => Hertz::mhz(4), + Frequency::_8M => Hertz::mhz(8), + Frequency::_16M => Hertz::mhz(16), + Frequency::_32M => Hertz::mhz(32), } } } diff --git a/src/riot-rs-embassy/src/spi.rs b/src/riot-rs-embassy/src/spi.rs index 0ddf3c68c..4e0a03c1f 100644 --- a/src/riot-rs-embassy/src/spi.rs +++ b/src/riot-rs-embassy/src/spi.rs @@ -59,6 +59,43 @@ macro_rules! impl_async_spibus_for_driver_enum { #[allow(unused_imports, reason = "used by arch modules")] pub(crate) use impl_async_spibus_for_driver_enum; +// FIXME: rename this to Bitrate and use bps instead? +/// SPI bus frequency. +#[derive(Copy, Clone)] +pub enum Frequency { + /// MCU-specific frequency. + Arch(arch::spi::Frequency), + /// 125 kHz. + _125k, + /// 250 kHz. + _250k, + /// 500 kHz. + _500k, + /// 1 MHz. + _1M, + /// 2 MHz. + _2M, + /// 4 MHz. + _4M, + /// 8 MHz. + _8M, +} + +impl From for arch::spi::Frequency { + fn from(freq: Frequency) -> Self { + match freq { + Frequency::Arch(freq) => freq, + Frequency::_125k => arch::spi::Frequency::_125k, + Frequency::_250k => arch::spi::Frequency::_250k, + Frequency::_500k => arch::spi::Frequency::_500k, + Frequency::_1M => arch::spi::Frequency::_1M, + Frequency::_2M => arch::spi::Frequency::_2M, + Frequency::_4M => arch::spi::Frequency::_4M, + Frequency::_8M => arch::spi::Frequency::_8M, + } + } +} + /// SPI mode. /// /// - CPOL: Clock polarity. diff --git a/tests/spi-bus/src/main.rs b/tests/spi-bus/src/main.rs index 692ce2ec9..9af3d8c54 100644 --- a/tests/spi-bus/src/main.rs +++ b/tests/spi-bus/src/main.rs @@ -19,7 +19,7 @@ use riot_rs::{ embassy::{ arch::spi, gpio, - spi::{Mode, SpiDevice}, + spi::{Frequency, Mode, SpiDevice}, }, }; @@ -33,7 +33,7 @@ const WHO_AM_I_REG_ADDR: u8 = 0x0f; #[riot_rs::task(autostart, peripherals)] async fn main(peripherals: pins::Peripherals) { let mut spi_config = spi::Config::default(); - spi_config.frequency = spi::Frequency::K125; + spi_config.frequency = Frequency::_125k.into(); spi_config.mode = if !cfg!(context = "esp") { Mode::Mode3 } else {