From f41a7b900235334cc7bbdca3f61302a7a9b7807f Mon Sep 17 00:00:00 2001 From: Lukrecja Date: Thu, 26 Feb 2026 15:35:19 +0100 Subject: [PATCH] reorder files in the crate --- .cargo/config.toml | 2 + Cargo.lock | 175 +++++++++++++++++- Cargo.toml | 52 +++++- README.md | 4 +- examples/stm32wle5jc/Cargo.toml | 2 +- rust-analyzer.toml | 1 + {stm32wl-subghz/src => src}/error.rs | 0 {stm32wl-subghz/src => src}/lib.rs | 0 .../src => src}/modulations/bpsk.rs | 0 .../src => src}/modulations/lora.rs | 0 .../src => src}/modulations/mod.rs | 0 {stm32wl-subghz/src => src}/radio.rs | 0 {stm32wl-subghz/src => src}/spi.rs | 0 {stm32wl-subghz/src => src}/traits.rs | 0 stm32wl-subghz/Cargo.toml | 17 -- stm32wl-subghz/LICENSE | 7 - stm32wl-subghz/README.md | 20 -- 17 files changed, 230 insertions(+), 50 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 rust-analyzer.toml rename {stm32wl-subghz/src => src}/error.rs (100%) rename {stm32wl-subghz/src => src}/lib.rs (100%) rename {stm32wl-subghz/src => src}/modulations/bpsk.rs (100%) rename {stm32wl-subghz/src => src}/modulations/lora.rs (100%) rename {stm32wl-subghz/src => src}/modulations/mod.rs (100%) rename {stm32wl-subghz/src => src}/radio.rs (100%) rename {stm32wl-subghz/src => src}/spi.rs (100%) rename {stm32wl-subghz/src => src}/traits.rs (100%) delete mode 100644 stm32wl-subghz/Cargo.toml delete mode 100644 stm32wl-subghz/LICENSE delete mode 100644 stm32wl-subghz/README.md diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..cc80e05 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "thumbv7em-none-eabi" diff --git a/Cargo.lock b/Cargo.lock index c642cd5..80330fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,6 +80,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "num-traits", +] + [[package]] name = "cortex-m" version = "0.7.7" @@ -88,6 +97,7 @@ checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" dependencies = [ "bare-metal", "bitfield", + "critical-section", "embedded-hal 0.2.7", "volatile-register", ] @@ -118,6 +128,50 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "defmt" +version = "0.3.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" +dependencies = [ + "defmt 1.0.1", +] + [[package]] name = "defmt" version = "1.0.1" @@ -150,6 +204,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "defmt-rtt" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e" +dependencies = [ + "critical-section", + "defmt 1.0.1", +] + [[package]] name = "document-features" version = "0.2.12" @@ -165,9 +229,11 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" dependencies = [ + "defmt 1.0.1", "embassy-futures", "embassy-hal-internal 0.3.0", "embassy-sync", + "embassy-time", "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-async", @@ -176,6 +242,38 @@ dependencies = [ "nb 1.1.0", ] +[[package]] +name = "embassy-executor" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" +dependencies = [ + "cortex-m", + "critical-section", + "defmt 1.0.1", + "document-features", + "embassy-executor-macros", + "embassy-executor-timer-queue", +] + +[[package]] +name = "embassy-executor-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "embassy-executor-timer-queue" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" + [[package]] name = "embassy-futures" version = "0.1.2" @@ -199,6 +297,7 @@ checksum = "7f10ce10a4dfdf6402d8e9bd63128986b96a736b1a0a6680547ed2ac55d55dba" dependencies = [ "cortex-m", "critical-section", + "defmt 1.0.1", "num-traits", ] @@ -207,6 +306,9 @@ name = "embassy-net-driver" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" +dependencies = [ + "defmt 0.3.100", +] [[package]] name = "embassy-stm32" @@ -219,15 +321,20 @@ dependencies = [ "bitflags 2.11.0", "block-device-driver", "cfg-if", + "chrono", "cortex-m", "cortex-m-rt", "critical-section", + "defmt 1.0.1", "document-features", "embassy-embedded-hal", "embassy-futures", "embassy-hal-internal 0.4.0", "embassy-net-driver", "embassy-sync", + "embassy-time", + "embassy-time-driver", + "embassy-time-queue-utils", "embassy-usb-driver", "embassy-usb-synopsys-otg", "embedded-can", @@ -263,6 +370,7 @@ checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" dependencies = [ "cfg-if", "critical-section", + "defmt 1.0.1", "embedded-io-async 0.6.1", "futures-core", "futures-sink", @@ -277,6 +385,7 @@ checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" dependencies = [ "cfg-if", "critical-section", + "defmt 1.0.1", "document-features", "embassy-time-driver", "embedded-hal 0.2.7", @@ -294,12 +403,23 @@ dependencies = [ "document-features", ] +[[package]] +name = "embassy-time-queue-utils" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" +dependencies = [ + "embassy-executor-timer-queue", + "heapless 0.8.0", +] + [[package]] name = "embassy-usb-driver" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" dependencies = [ + "defmt 1.0.1", "embedded-io-async 0.6.1", ] @@ -310,6 +430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23" dependencies = [ "critical-section", + "defmt 1.0.1", "embassy-sync", "embassy-usb-driver", ] @@ -369,6 +490,9 @@ name = "embedded-io" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7" +dependencies = [ + "defmt 1.0.1", +] [[package]] name = "embedded-io-async" @@ -385,6 +509,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2564b9f813c544241430e147d8bc454815ef9ac998878d30cc3055449f7fd4c0" dependencies = [ + "defmt 1.0.1", "embedded-io 0.7.1", ] @@ -403,6 +528,12 @@ dependencies = [ "embedded-storage", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "futures-core" version = "0.3.32" @@ -461,6 +592,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "litrs" version = "1.0.0" @@ -491,6 +628,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "panic-probe" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" +dependencies = [ + "cortex-m", + "defmt 1.0.1", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -608,6 +755,7 @@ checksum = "a411079520dbccc613af73172f944b7cf97ba84e3bd7381a0352b6ec7bfef03b" dependencies = [ "cortex-m", "cortex-m-rt", + "defmt 0.3.100", ] [[package]] @@ -615,13 +763,38 @@ name = "stm32wl-subghz" version = "0.1.0" dependencies = [ "cortex-m", - "defmt", + "defmt 1.0.1", "embassy-stm32", "embassy-time", "embedded-hal 1.0.0", "embedded-hal-async", ] +[[package]] +name = "stm32wl-subghz-examples" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "defmt 1.0.1", + "defmt-rtt", + "embassy-embedded-hal", + "embassy-executor", + "embassy-stm32", + "embassy-sync", + "embassy-time", + "embedded-hal 1.0.0", + "embedded-hal-async", + "panic-probe", + "stm32wl-subghz", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index f7915d2..3e51719 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,51 @@ +[package] +name = "stm32wl-subghz" +version = "0.1.0" +edition = "2024" +license = "MIT" +repository = "https://git.lusia.moe/lukrecja/stm32wl-subghz" +categories = [ "no-std", "embedded", "asynchronous" ] +keywords = [ "stm32wl", "stm32wle5jc", "lora", "fsk", "gfsk", "msk", "gmsk", "bpsk", "radio", "embedded-hal-async" ] +description = "Sub-GHz radio driver for STM32WL-series microcontrollers" + [workspace] -members = [ "stm32wl-subghz" ] -exclude = [ "examples/stm32wle5jc" ] \ No newline at end of file +members = ["examples/stm32wle5jc"] + +[features] +# Default chip for development/CI. Downstream users should use default-features = false +# and enable their specific chip feature. +default = ["stm32wle5jc"] +# Single-core variants +stm32wle4c8 = ["embassy-stm32/stm32wle4c8"] +stm32wle4cb = ["embassy-stm32/stm32wle4cb"] +stm32wle4cc = ["embassy-stm32/stm32wle4cc"] +stm32wle4j8 = ["embassy-stm32/stm32wle4j8"] +stm32wle4jb = ["embassy-stm32/stm32wle4jb"] +stm32wle4jc = ["embassy-stm32/stm32wle4jc"] +stm32wle5c8 = ["embassy-stm32/stm32wle5c8"] +stm32wle5cb = ["embassy-stm32/stm32wle5cb"] +stm32wle5cc = ["embassy-stm32/stm32wle5cc"] +stm32wle5j8 = ["embassy-stm32/stm32wle5j8"] +stm32wle5jb = ["embassy-stm32/stm32wle5jb"] +stm32wle5jc = ["embassy-stm32/stm32wle5jc"] +# Dual-core variants +stm32wl54cc-cm0p = ["embassy-stm32/stm32wl54cc-cm0p"] +stm32wl54cc-cm4 = ["embassy-stm32/stm32wl54cc-cm4"] +stm32wl54jc-cm0p = ["embassy-stm32/stm32wl54jc-cm0p"] +stm32wl54jc-cm4 = ["embassy-stm32/stm32wl54jc-cm4"] +stm32wl55cc-cm0p = ["embassy-stm32/stm32wl55cc-cm0p"] +stm32wl55cc-cm4 = ["embassy-stm32/stm32wl55cc-cm4"] +stm32wl55jc-cm0p = ["embassy-stm32/stm32wl55jc-cm0p"] +stm32wl55jc-cm4 = ["embassy-stm32/stm32wl55jc-cm4"] + +[dependencies] +embassy-stm32 = { version = "0.5.0", features = ["unstable-pac"] } +embassy-time = "0.5.0" +defmt = "1.0.1" +cortex-m = { version = "0.7.6", features = ["inline-asm"] } +embedded-hal = "1.0.0" +embedded-hal-async = "1.0.0" + +[profile.release] +debug = 2 +opt-level = 3 diff --git a/README.md b/README.md index 4b2ef1a..fd8452c 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ Sub-GHZ SPI device radio driver for STM32WL-series microcontrollers, currently supporting LoRa and BPSK. ## Crates -- [`stm32wl-subghz`](./stm32wl-subghz/) - the driver library +- [`stm32wl-subghz`](.) - the driver library - [`examples/stm32wle5jc`](./examples/stm32wle5jc/) - usage examples for the STM32WLE5JC-based boards ## License MIT [Latest Version]: https://img.shields.io/crates/v/stm32wl-subghz.svg -[crates.io]: https://crates.io/crates/stm32wl-subghz \ No newline at end of file +[crates.io]: https://crates.io/crates/stm32wl-subghz diff --git a/examples/stm32wle5jc/Cargo.toml b/examples/stm32wle5jc/Cargo.toml index 12a2560..94192cf 100644 --- a/examples/stm32wle5jc/Cargo.toml +++ b/examples/stm32wle5jc/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT" publish = false [dependencies] -stm32wl-subghz = { path = "../../stm32wl-subghz" } +stm32wl-subghz = { path = "../.." } embassy-stm32 = { version = "0.5.0", features = ["defmt", "stm32wle5jc", "time-driver-tim1", "memory-x", "unstable-pac", "exti", "chrono"] } embassy-sync = { version = "0.7.2", features = ["defmt"] } diff --git a/rust-analyzer.toml b/rust-analyzer.toml new file mode 100644 index 0000000..6444808 --- /dev/null +++ b/rust-analyzer.toml @@ -0,0 +1 @@ +linkedProjects = ["Cargo.toml", "examples/stm32wle5jc/Cargo.toml"] diff --git a/stm32wl-subghz/src/error.rs b/src/error.rs similarity index 100% rename from stm32wl-subghz/src/error.rs rename to src/error.rs diff --git a/stm32wl-subghz/src/lib.rs b/src/lib.rs similarity index 100% rename from stm32wl-subghz/src/lib.rs rename to src/lib.rs diff --git a/stm32wl-subghz/src/modulations/bpsk.rs b/src/modulations/bpsk.rs similarity index 100% rename from stm32wl-subghz/src/modulations/bpsk.rs rename to src/modulations/bpsk.rs diff --git a/stm32wl-subghz/src/modulations/lora.rs b/src/modulations/lora.rs similarity index 100% rename from stm32wl-subghz/src/modulations/lora.rs rename to src/modulations/lora.rs diff --git a/stm32wl-subghz/src/modulations/mod.rs b/src/modulations/mod.rs similarity index 100% rename from stm32wl-subghz/src/modulations/mod.rs rename to src/modulations/mod.rs diff --git a/stm32wl-subghz/src/radio.rs b/src/radio.rs similarity index 100% rename from stm32wl-subghz/src/radio.rs rename to src/radio.rs diff --git a/stm32wl-subghz/src/spi.rs b/src/spi.rs similarity index 100% rename from stm32wl-subghz/src/spi.rs rename to src/spi.rs diff --git a/stm32wl-subghz/src/traits.rs b/src/traits.rs similarity index 100% rename from stm32wl-subghz/src/traits.rs rename to src/traits.rs diff --git a/stm32wl-subghz/Cargo.toml b/stm32wl-subghz/Cargo.toml deleted file mode 100644 index bc65ce0..0000000 --- a/stm32wl-subghz/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "stm32wl-subghz" -version = "0.1.0" -edition = "2024" -license = "MIT" -repository = "https://git.lusia.moe/lukrecja/stm32wl-subghz" -categories = [ "no-std", "embedded", "asynchronous" ] -keywords = [ "stm32wl", "stm32wle5jc", "lora", "fsk", "gfsk", "msk", "gmsk", "bpsk", "radio", "embedded-hal-async" ] -description = "Sub-GHz radio driver for STM32WL-series microcontrollers" - -[dependencies] -embassy-stm32 = { version = "0.5.0", features = ["unstable-pac"] } -embassy-time = "0.5.0" -defmt = "1.0.1" -cortex-m = { version = "0.7.6", features = ["inline-asm"] } -embedded-hal = "1.0.0" -embedded-hal-async = "1.0.0" diff --git a/stm32wl-subghz/LICENSE b/stm32wl-subghz/LICENSE deleted file mode 100644 index 5aac19a..0000000 --- a/stm32wl-subghz/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright © 2026 Lukrecja Pleskaczyńska - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/stm32wl-subghz/README.md b/stm32wl-subghz/README.md deleted file mode 100644 index 8739301..0000000 --- a/stm32wl-subghz/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# stm32wl-subghz - -[![Latest Version]][crates.io] - -Sub-GHZ SPI device radio driver for STM32WL-series microcontrollers, currently supporting LoRa and BPSK. - -Built on `embedded-hal-async` and `embassy-stm32`. - -## Supported hardware -- STM32WLE5JC (single-core) - tested -- Possibly all the other variants in STM32WL5x and STM32WLEx families - -## Usage -See the [examples](../examples/) directory. - -## License -MIT - -[Latest Version]: https://img.shields.io/crates/v/stm32wl-subghz.svg -[crates.io]: https://crates.io/crates/stm32wl-subghz \ No newline at end of file