#arm #cortex-m #stm32 #hal

no-std stm32wlxx-hal

Hardware abstraction layer for the STM32WL series microcontrollers

10 releases (5 breaking)

0.6.1 Aug 1, 2022
0.6.0 Jul 4, 2022
0.5.1 May 14, 2022
0.4.1 Mar 22, 2022
0.1.0 Mar 26, 2021

#3 in #stm32-hal

Download history 47/week @ 2023-06-05 70/week @ 2023-06-12 79/week @ 2023-06-19 43/week @ 2023-06-26 69/week @ 2023-07-03 44/week @ 2023-07-10 46/week @ 2023-07-17 64/week @ 2023-07-24 39/week @ 2023-07-31 38/week @ 2023-08-07 44/week @ 2023-08-14 25/week @ 2023-08-21 17/week @ 2023-08-28 50/week @ 2023-09-04 31/week @ 2023-09-11 29/week @ 2023-09-18

138 downloads per month
Used in 2 crates

MIT/Apache

740KB
11K SLoC

stm32wlxx-hal

CI stable-docs nightly-docs crates.io rustc

Embedded rust HAL (hardware abstraction layer) for the STM32WL series.

This is still in development, the code that exists today covers basic usage of:

  • SubGHz LoRa TX + RX
  • SubGHz (G)FSK TX + RX
  • SPI
  • GPIO
  • UART
  • I2C
  • Low-power timers
  • ADC
  • DAC
  • PKA ECDSA signing + verification
  • Secure random number generation
  • AES ECB encryption + decryption
  • RTC date and time

Usage

[dependencies.stm32wlxx-hal]
version = "0.6.1"
features = [
    # use exactly one to match your target hardware
    "stm32wl5x_cm0p",
    "stm32wl5x_cm4",
    "stm32wle5",
    # optional: use the cortex-m-rt interrupt interface
    "rt",
    # optional: use defmt
    "defmt",
    # optional: enable conversions with embedded-time types
    "embedded-time",
    # optional: use the real time clock (RTC)
    "chrono",
]

Examples

All examples run on the NUCLEO-WL55JC2. Examples are located in the examples crate. The arguments got long for this, so a run-ex cargo alias is provided.

DEFMT_LOG=trace cargo run-ex gpio-blink

The on-target tests are also excellent reference material.

System Level Example

The testsuites and examples are a good starting point, but they demonstrate features independent of each-other. A system-level example using multiple features simultaneously is provided in a separate repo: stm32wl-lightswitch-demo

Unit Tests

Off-target unit tests use the built-in cargo framework. You must specify the target device as a feature.

cargo test --features stm32wl5x_cm4

On-Target Tests

See testsuite/README.md.

Reference Documentation

Dependencies

~17MB
~505K SLoC