#mmio #register #abstraction #macro #read-write #gpio

no-std ral-registers

MMIO registers abstraction with a macro API

4 releases

0.1.3 Jun 18, 2023
0.1.2 Jan 3, 2023
0.1.1 Sep 29, 2021
0.1.0 Aug 15, 2021

#1458 in Embedded development

Download history 1960/week @ 2024-07-22 2315/week @ 2024-07-29 2648/week @ 2024-08-05 3685/week @ 2024-08-12 4701/week @ 2024-08-19 3849/week @ 2024-08-26 5240/week @ 2024-09-02 3684/week @ 2024-09-09 4570/week @ 2024-09-16 4683/week @ 2024-09-23 3924/week @ 2024-09-30 5030/week @ 2024-10-07 4982/week @ 2024-10-14 5606/week @ 2024-10-21 4830/week @ 2024-10-28 4699/week @ 2024-11-04

20,436 downloads per month
Used in 19 crates (9 directly)

MIT/Apache

31KB
155 lines

ral-registers

Version Documentation CI License

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:

// 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, extracted for easier use in other projects.

Licence

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.

No runtime deps