Description
Register
can take the variant Single(RegisterInfo)
or Array(RegisterInfo, RegisterArrayInfo)
. The svd dim stuff is also valid for a peripheral, shouldn't that mean Peripheral should do the same?
What I suggest is to:
- Rename
RegisterArrayInfo
toDimInfo
(or something else that's generic over these types, likeArrayInfo
) - Rename
Peripheral
toPeripheralInfo
(to make it analog toRegisterInfo
) - Introduce the new
enum Peripheral
which is analog toenum Register
- Add
Peripheral::parse
analog to howRegister::parse
works
Breakage
There are 3 crates listed on crates.io as dependent on this crate. Only svd2rust have received updates in 2017.
Right now svd2rust silently generates garbage code when given peripheral arrays. It should be trivial to apply a quick patch which crashes the program when faced peripheral arrays and works as previous when faced single peripherals. This patch is also a prerequisite of supporting peripheral arrays in svd2rust. In other words, the breakage caused by this patch would be trivial to fix and benefit svd2rust greatly both immediately and in the future.