# ch641
This crate provides an autogenerated API for access to CH641 peripherals.
The API is generated using [svd2rust] with patched svd files containing
extensive type-safe support. For more information please see the [main repo].
Refer to the [documentation] for full details.
[svd2rust]: https://github.com/rust-embedded/svd2rust
[main repo]: https://github.com/ch32-rs/ch32-rs
[documentation]: https://docs.rs/ch641/latest/ch641/
## Usage
Each device supported by this crate is behind a feature gate so that you only
compile the device(s) you want. To use, in your Cargo.toml:
```toml
[dependencies.ch641]
version = "0.0.1"
features = ["ch641", "critical-section"]
[dependencies.riscv]
version = "0.10.1"
features = ["critical-section-single-hart"]
```
In your code:
```rust
use ch641::ch641;
let mut peripherals = ch641::Peripherals::take().unwrap();
let gpioa = &peripherals.GPIOA;