21 个版本 (破坏性更新)
0.15.1 | 2022年7月4日 |
---|---|
0.14.0 | 2021年10月3日 |
0.13.0 | 2021年2月15日 |
0.12.1 | 2020年9月22日 |
0.2.2 | 2018年7月11日 |
#595 in 嵌入式开发
4,920 每月下载量
用于 12 个 crate (5 个直接使用)
54MB
1.5M SLoC
stm32l4
此 crate 提供了用于访问 STM32L4 外设的自生成的 API。API 是使用带有关联类型安全支持的修补 svd 文件通过 svd2rust 生成的。有关更多信息,请参阅 主仓库。
有关完整详细信息,请参阅 文档。
用法
此 crate 支持的每个设备都位于功能门后面,这样您就只能编译您想要的设备。要使用,在您的 Cargo.toml 中
[dependencies.stm32l4]
version = "0.15.1"
features = ["stm32l412"]
默认启用 rt
功能,并引入了对 cortex-m-rt
的支持。要禁用,请在 Cargo.toml
中指定 default-features = false
。
在您的代码中
use stm32l4::stm32l412;
let mut peripherals = stm32l412::Peripherals::take().unwrap();
let gpioa = &peripherals.GPIOA;
gpioa.odr.modify(|_, w| w.odr0().set_bit());
有关自动生成的 API 的完整详细信息,请参阅:https://docs.rs/svd2rust/0.24.1/svd2rust/#peripheral-api
支持的设备
模块 | 设备 | 链接 |
---|---|---|
stm32l412 | STM32L412, STM32L422 | RM0394, st.com |
stm32l4r5 | STM32L4R5, STM32L4S5 | RM0432, st.com |
stm32l4r9 | STM32L4R9, STM32L4S9 | RM0432, st.com |
stm32l4x1 | STM32L431, STM32L451, STM32L471 | RM0394, st.com |
stm32l4x2 | STM32L432, STM32L442, STM32L452, STM32L462 | RM0394, st.com |
stm32l4x3 | STM32L433, STM32L443 | RM0394, st.com |
stm32l4x5 | STM32L475 | RM0351, st.com |
stm32l4x6 | STM32L476, STM32L486, STM32L496, STM32L4A6 | RM0351, st.com |