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

Refactor the spi module #613

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bradleyharden
Copy link
Contributor

Summary

Checklist

  • CHANGELOG.md for the BSP or HAL updated
  • All new or modified code is well documented, especially public items
  • No new warnings or clippy suggestions have been introduced (see CI or check locally)

After trying to use `SpiFuture` in the real world, I encountered some
problems that these changes address. Specifically, I added the ability
for the `Spi` struct to be part of some user type. The `AsSpi` trait
provides an interface for the `SpiFuture`. This has the added benefit of
simplifying the implementation.
- Make conversion from `Status` to `Error` an inherent function of
  `Status` rather than an implementation of `TryFrom`
- Add a `DynCapability` enum to allow run-time branching on `Capability`
- Improve type-level consistency for the `AnyConfig` and `AnySpi` traits
- Change how the `.get_dyn_length()` and `.set_dyn_length()` methods are
  restricted to only those structs with `DynLength`
- Remove calls to `assert_eq!` to help limit formatting code
- Fix bugs related to `Tx` `Capability`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants