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

Improve the architecture of SpiFuture #577

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

Conversation

bradleyharden
Copy link
Contributor

@bradleyharden bradleyharden commented Feb 26, 2022

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.

Summary

[describe your changes here]

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)

@bradleyharden bradleyharden force-pushed the improve_spi_future branch 3 times, most recently from 3e850bb to 101aa59 Compare February 26, 2022 17:13
@bradleyharden bradleyharden marked this pull request as draft February 28, 2022 02:48
@jbeaurivage
Copy link
Contributor

@bradleyharden, I quite like this. I think it definitely makes SpiFuture more flexible.

@bradleyharden
Copy link
Contributor Author

I still need to backport some other bug fixes. That's why I it's still a WIP

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants