crates.io crates.io CircleCI

stm32-extras

Extra API on top of STM32 device crates (stm32f103xx)

Examples

Configuring GPIO pins without disturbing other pins (no read-modify-write which could lead to data races):

```rust 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.pinconfig(13).output2().opendrain(); ```

Generalized interface to GPIO pins:

```rust 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.writepinrange(13, 3, 0b101); ```

License

Licensed under either of

at your option.

Contribution

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.