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

Common crate(s) for code shared between hal crates #6

Open
davidlattimore opened this issue Aug 19, 2021 · 0 comments
Open

Common crate(s) for code shared between hal crates #6

davidlattimore opened this issue Aug 19, 2021 · 0 comments

Comments

@davidlattimore
Copy link

What do people think of having a crate (or crates?) for bits of code that's shared between crates. At the moment in particular, I'm thinking of the code that computes the value for the timing register in the i2c peripheral of many devices. This code is somewhat complex and sharing it would make it easier to fix bugs across multiple HALs. See this issue. The same bug seems to be present in many other HAL crates. The h7 crate has tests for the code and could serve as a basis for a shared crate.

Questions:

  • Should a shared crate limit its scope to just i2c timing (i.e. be a single function crate), or be more general? I'm not sure what other bits of complex code exist that are very similar or identical between HAL crates.
  • Should the crate avoid depending on cortex_m etc so that it can easily be tested without an STM32 connected? In the case of the i2c timing code, there's no need for cortex_m and the tests can run quite well on a desktop.
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

1 participant