Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "derivedFrom" attribute #3

Open
konovod opened this issue Dec 2, 2024 · 2 comments
Open

Support "derivedFrom" attribute #3

konovod opened this issue Dec 2, 2024 · 2 comments

Comments

@konovod
Copy link
Contributor

konovod commented Dec 2, 2024

I've found this attributes in two places:

  1. peripherals
<peripheral derivedFrom="GPIOA">
  <name>GPIOB</name>
  <baseAddress>0x40010C00</baseAddress>
</peripheral>

Not sure how rust process it, but perhaps we should simply copy content of another peripheral and then apply changes.
Better way would be to define generic module and then extend it, but it seems more difficult (even deriving name GPIO by finding common substring from GPIOA and GPIOB looks hacky).

  1. <enumeratedValues derivedFrom="CTB2"/>
    In this context I think it is better to simply reuse already generated enum.
@RX14
Copy link
Owner

RX14 commented Dec 2, 2024

I think I will probably apply the duplication method. Not sure how enum inheritance works in Crystal though, perhaps it's better to always use a new enum. Though, I would like to collect up duplicate enums somewhere in a post-processing pass eventually.

@RX14
Copy link
Owner

RX14 commented Dec 2, 2024

I've been not working on embedded crystal the past few weeks due to working on a new electronics project instead, but after that's done (soon) I should have a new reason to work on embedded crystal again, and more peripherals to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants