I2C target/board configuration is currently spread in a lot of places

Open
#1,539 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust

Research direction

Start by reading the stm32xx-i2c code and the build/i2c codegen mentioned in the issue, then trace where processor features and conditional use statements are configured. Document the board, processor, clock, and bus-speed assumptions before proposing a central configuration point. Done means the configuration is no longer scattered and build/i2c has enough documentation to explain its behavior.

Written by the indexing model from the issue text.

Description

I'm adding support for another STM32G0 board in I2C, and it's requiring a bit of a "shotgun" change that has caused me to notice some things.

  1. We have to add processor features and conditional use statements in a lot of places. We could almost certainly centralize this into a single place that everything depends on.
  2. In stm32xx-i2c there are a lot of calculations that are keyed on processor type that are actually setting things specific to a particular board or application -- particularly the waveform timing calculations. The current code assumes that a given processor is always going to run at the same clock speed, and always want its bus to run at the same speed, neither of which are valid assumptions, really.
  3. build/i2c's codegen could use more docs. I've updated it for the new target but I don't really understand what it's doing.
Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oxidecomputer/hubris

All issues in oxidecomputer/hubris

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.