-
Notifications
You must be signed in to change notification settings - Fork 214
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
Implement async for lcd_cam i8080 #1834
Conversation
One issue is that I8080::new() takes the TX part of a channel and this does not carry the Async marker and that means that there is no way prove that the TX channel passed is appropriate. The quick fix would be to have I8080::new() take the entire Channel. |
I've had this one in my mental backlog but I'm glad someone else has gotten to it first. I love that you've kept the blocking method around even when the driver is in "async" mode, so the new
When it comes to one shot DMA transfers, where you provide a filled buffer upfront and you just wait for the transfer to finish. You don't actually need an async DMA channel (and should probably avoid it maybe) to make the driver async, you just need to use the peripheral's (LCD_CAM) own interrupt. LCD_TRANS_DONE or something like this. Since the LCD_CAM only has one interrupt handler (shared between the LCD and Camera), you'll have to move the struct LcdCam<'d, DM> {
lcd: Lcd<'d, DM>,
cam: Cam<'d>,
} I'm not too sure what to do with the shared |
Maybe we can do something similar to the way interrupts are handled in |
You mean the bit about allowing the user to setup their own handler even in async mode? |
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.
Code looks great!
Yes and this could extend to a by default implementation that creates seperate handlers for Camera and Lcd. |
My only qualm against it is having to come up with some kind of contract about what the user handler is allowed to do. I'd rather this sort of thing wait until the interrupt story in the HAL is more fleshed out. |
I added tests to make sure that:
When the TX and RX parts of a DMA channel carry the Mode then this can be removed and we can enforce Blocking with Blocking and Async with Async. |
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.
LGTM
Ideally send_dma_async
should call self.tear_down_send()
if the future it returns is cancelled but this hal in general doesn't support cancellation so I consider this optional.
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.
LGTM - I don't have the HW for it but maybe would be worth to at least re-test the blocking implementation example (@JurajSadel ?)
For the future would be good to have a way to have more checks in the test but at least we test it's not freezing or crashing the system
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.
LGTM, thanks!
…ompiler can't prevent it for now
rebased and update for ReadBuffer change |
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.
Thanks!
Looks like the CI failure was a timeout to |
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
Implement async i8080
Testing
new HIL tests
Local Hub75 application