Skip to content

i2C register definitions for stm32g4xx #510

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

Merged
merged 4 commits into from
Mar 14, 2021
Merged

i2C register definitions for stm32g4xx #510

merged 4 commits into from
Mar 14, 2021

Conversation

Geens
Copy link
Contributor

@Geens Geens commented Mar 7, 2021

I added register definitions for the I2C peripheral for the g4 series. First time I'm doing this, so feedback is much appreciated.

I noticed the module is named i2c1, is there a way to change this to i2c, without the 1 at the end? Or is there a reason it's there?

@github-actions
Copy link

github-actions bot commented Mar 7, 2021

Memory map comparison

@github-actions
Copy link

github-actions bot commented Mar 7, 2021

Memory map comparison

@adamgreig
Copy link
Member

Thanks for this PR!

Your new descriptions look generally good with a few style points:

  • We use capital letters for the variant names, especially for example Disabled, Enabled, and Clear
  • We use camel-case for the variant names, for example instead of set and not_set we'd have Empty and NotEmpty

However, when I checked, it looks like the existing file peripherals/i2c/i2c_v2.yaml (mostly with descriptions in the included i2c_v2_base.yaml file) already covers the G4's I2C peripheral, it just hasn't been included in the G4 device files yet. I used the scripts/matchperipherals.py script to check the existing YAML applies cleanly, and also quickly diffed it with your new file to check there were no other differences. This sucks after you've put in all the effort to write out new descriptions, so I'm sorry! But if the existing file does match this peripheral, we should use it, so that it's consistent with other devices.

I noticed the module is named i2c1, is there a way to change this to i2c, without the 1 at the end? Or is there a reason it's there?

The module gets named after whichever is the 'base' peripheral from which the others derive, so in this case I2C1. There's no way in svd2rust to tell it what name to use for the module without also renaming the peripheral (which we can't do, since it needs to be I2C1 since there's also I2C2, 3, etc).

@github-actions
Copy link

Memory map comparison

@Geens
Copy link
Contributor Author

Geens commented Mar 14, 2021

I have no idea how I missed this. I really thought I checked.

I'll remember the style guide and other advice for next time and consider this a learning exercise. Thanks you for the explanation!

I removed the g4 file and updated the g4 devices to use the v2 file.

Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you again!

bors merge

@bors bors bot merged commit a4495ca into stm32-rs:master Mar 14, 2021
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

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy