Skip to content

Should Peripheral support array? #41

Closed
@kjetilkjeka

Description

@kjetilkjeka

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:

  1. Rename RegisterArrayInfo to DimInfo (or something else that's generic over these types, like ArrayInfo)
  2. Rename Peripheral to PeripheralInfo (to make it analog to RegisterInfo)
  3. Introduce the new enum Peripheral which is analog to enum Register
  4. Add Peripheral::parse analog to how Register::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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions