-
Notifications
You must be signed in to change notification settings - Fork 114
orientation-screen: Migrate to rust #1631
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
base: master
Are you sure you want to change the base?
orientation-screen: Migrate to rust #1631
Conversation
97edacf
to
39c79ca
Compare
create an async friendly hardware supported delayin C and wrap it in rust using Future.
39c79ca
to
781d4b1
Compare
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.
(not done reviewing yet, just some quick comments)
orientation_arrows.screen_stack_push(); | ||
|
||
// Wait until orientation has been chosen | ||
option_no_screensaver(&result).await; |
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 think you want option
not option_no_screensaver
. The screensaver should become active in the orientation screen. It may be the most likely to actually burn in the screen, e.g. when connected and left plugged in.
// Switch to lockscreen that shows "See the bitbox app" and device name | ||
bitbox02::ui::screen_process_waiting_switch_to_lockscreen(); | ||
|
||
orientation_selected_cb(); |
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.
Did a double take seeing a callback called at the end of an async function. Would it be possible to simply return whatever value you need and use it when polling is done (in if let Poll::Ready(result) = result { ...
)
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 don't think so because this future isn't run in a traditional async runtime, it is run with our "glue layer". I could return the callback and then call it in the rust_workflow_spin()
function instead. But not sure if that is great.
I was hoping it would be helpful if the orientation workflow was in rust for the simulator. But in the end it didn't play out so well, I still have to call the glue-layer because I don't have a proper async runtime in the simulator either.
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.
(the rust version of the orientation selection is still more readable IMO than the c version with interrupts, so I still think it is a net win.)
7d78b67
to
fece219
Compare
create an async friendly hardware supported delayin C and wrap it in rust using Future.