-
Notifications
You must be signed in to change notification settings - Fork 118
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
orientation-screen: Migrate to rust #1631
Conversation
39c79ca to
781d4b1
Compare
benma
left a comment
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)
7d78b67 to
fece219
Compare
673483d to
d92d6f6
Compare
benma
left a comment
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 orientation screen is not actually working, it's always the same orientation no matter which side you tap.
Right, I noticed now that we deliver multiple short taps so the screen is rotated back to normal. In the C-code we popped the screen in the event handler so the screen never sees more than one tap. |
1e470d7 to
800cf1c
Compare
Last commit ensures that callback only is called once for the component. |
3845db8 to
822a8a7
Compare
45ed416 to
f2dd8dd
Compare
| option(&result).await | ||
| } | ||
|
|
||
| pub async fn create() -> 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.
don't know why that name, it does not mean anything to me. how about process or choose_and_handle?
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 C function is called orientation_screen_create(). I guess I could call it orientation_screen which is inline with confirm. But I do think it looks ugly to have confirm::confirm or orientation_screen::orientation_screen.
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.
Yeah the create functions there refer to creating component instances, but that does not transfer so well to higher level async Rust workflows.
f you don't like repeating words, the above function could be renamed to choose and this file to orientation, then it becomes worklows::orientation::choose(...).
Could also merge the two funcs again, I asked to split them when you still called the C callback, but now the distinction is a bit fuzzier.
tACK regardless
024c886 to
39ad25a
Compare
53ab1c9 to
6f2e946
Compare
benma
left a comment
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.
tACK (but please squash before merge)
c190075 to
752dfdc
Compare
|
@benma I decided to simplify the delay, removed some state and abort if more than 10 concurrently are allocated. PTAL |
3fd8452 to
c71bdd0
Compare
src/delay.c
Outdated
| } | ||
| CRITICAL_SECTION_LEAVE() | ||
| if (full) { | ||
| Abort("To many concurrent delays"); |
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.
To->Too
src/delay.c
Outdated
| if (_tasks[self->id].timer.cb && !_tasks[self->id].done) { | ||
| timer_remove_task(&TIMER_0, &_tasks[self->id].timer); | ||
| } | ||
| CRITICAL_SECTION_LEAVE(); |
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.
Shouldn't this be one line down, the last thing in the function?
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.
Yeah, if the api should be re-entrant it should be that. I can fix it.
benma
left a comment
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.
utACK
create an async friendly hardware supported delayin C and wrap it in rust using Future.
99d6d66 to
eb9513b
Compare
create an async friendly hardware supported delayin C and wrap it in rust using Future.