-
Notifications
You must be signed in to change notification settings - Fork 210
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
Make the SPI FIFO a separate object from the master driver #1579
Conversation
esp-hal/src/spi/master.rs
Outdated
pub struct WholeFifo; | ||
pub struct HalfFifo { | ||
is_high_part: bool, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially had an additional LowerHalfFifo
and UpperHalfFifo
types, that could be downgraded into a HalfFifo
, but I figured no one would really care in practice and this would be excessive generics/type state.
# Conflicts: # examples/src/bin/spi_eh1_device_loopback.rs # examples/src/bin/spi_eh1_loopback.rs
Sorry for not getting to this yet, I will make some time this week to look at this and your proposal in the original issue. |
5b787eb
to
db942a8
Compare
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
The title says it all but basically this PR makes it so that when you create an Spi driver you get a separate FIFO object as well.
The main advantage of this being you can split the FIFO in two and prepare one half of it whilst the other is being used in an active transfer.
There's other advantages and I've outlined then in this comment.
Testing
I ran the new and existing examples on my M5Stack CoreS3.
My new example isn't quite working, I fear I may have hit a hardware bug https://www.esp32.com/viewtopic.php?f=14&t=31389 . If I can't figure it out then I'll remove the FIFO splitting feature.No hardware bug, apparently the async fifos need to also be cleared in FIFO mode, which the existing code didn't do, so I've added that and the example works.