Crates.io | stm32-extras |
lib.rs | stm32-extras |
version | 0.1.0 |
source | src |
created_at | 2017-09-22 00:48:51.993265 |
updated_at | 2017-09-22 00:48:51.993265 |
description | Bit-banding access for STM32 peripherals |
homepage | |
repository | https://github.com/idubrov/stm32-extras |
max_upload_size | |
id | 32599 |
size | 23,252 |
Extra API on top of STM32 device crates (stm32f103xx
)
Configuring GPIO pins without disturbing other pins (no read-modify-write which could lead to data races):
use stm32_extras::GPIOExtras;
let gpioc = unsafe { &*stm32f103xx::GPIOC.get() }; // Get GPIOC somehow...
// Set pin to 2Mhz, open-drain.
// Modifies corresponding GPIO configuration bits without reads
gpioc.pin_config(13).output2().open_drain();
Generalized interface to GPIO pins:
use stm32_extras::GPIOExtras;
let gpioc = unsafe { &*stm32f103xx::GPIOC.get() }; // Get GPIOC somehow...
// Set pins 13, 14 and 15 on GPIOC to 1, 0 and 1.
gpioc.write_pin_range(13, 3, 0b101);
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.