| Age | Commit message (Collapse) | Author |
|
Since stm32ral doesn't have register arrays, I'm using prose and
pseudo-code to document each macro's support for register arrays. This
seemed to be today's simplest way to document the features for users.
I have another commit that implements a hidden module with a RAL-like
API and register arrays. Documentation examples then reference this
hidden module to demonstrate the register array feature. But, it adds
more code (could be shared with the tests), and it resulted in
inconsistent documentation examples when compared to the STM examples.
|
|
I'm experimenting with a RAL code generator that collapses contiguous
register arrays. The generated code would resemble
pub struct RegisterBlock {
pub MY_ARRAY: [RWRegister<u32>; 3],
}
and an individual register would be addressed like
ral::read_reg!(ral::my_mod, my_inst, MY_ARRAY[1]);
This commit extends the four macros so that we can specify an array
offset. We simply need to match zero or more `[N]` patterns, where `N`
is some expression that produces an array offset. The included test case
shows that the approach should support multi-dimensional arrays.
|
|
|
|
Guarantees that the layout is the same as the inner type. Since
UnsafeCell is also transparent, this ensures that the register has the
same ABI as T.
Today's registers work without this. Otherwise, RAL register blocks
would have unaccounted offsets / wrong sizes. This is for completness,
and a signal for others that a transmute might be OK. Requires Rust
1.28.
|
|
|