From e94d9dcac90b4b0622f573656f32883807381145 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Sun, 15 Aug 2021 11:00:01 +0100 Subject: Initial commit. Import `registers.rs` from stm32ral. --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..abdd137 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# ral-registers + +[![Version](https://img.shields.io/crates/v/ral-registers.svg)](https://crates.io/crates/ral-registers) +[![Documentation](https://docs.rs/ral-registers/badge.svg)](https://docs.rs/ral-registers) +![CI](https://github.com/adamgreig/ral-registers/workflows/CI/badge.svg) +![License](https://img.shields.io/crates/l/ral-registers.svg) + +This crate contains an MMIO abstraction that uses macros to read, modify, +and write fields in registers. + +For example, several fields on a register can be updated (without changing the +other fields) using: + +```rust +// Modify some fields on GPIOA.MODER without changing others. +modify_reg!(gpio, GPIOA, MODER, MODER1: Input, MODER2: Output, MODER3: Input); + +// Check a condition on a field. +while read_reg!(gpio, GPIOA, IDR, IDR3 == High) {} + +// Read and write the entire register word value. +let port = read_reg!(gpio, GPIOA, IDR); +write_reg!(gpio, GPIOA, port); +``` + +This crate contains register code originally written in +[stm32ral](https://github.com/adamgreig/stm32ral), extracted +for easier use in other projects. + +## Licence + +Licensed under either of + +* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +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. -- cgit v1.2.3