Skip to content
Snippets Groups Projects
Commit 05a577d9 authored by koenigl's avatar koenigl
Browse files

Make callback subscription un-temporary

As we cannot just use the `?` operator anymore since `check_user_presence`
doesn't return a Tock error (cf. e1c6aca7), we need to create match of the result
which in turn moves it, thus we cannot use a temporary closure anymore but need
an assignment.
parent 81b473fd
No related branches found
No related tags found
No related merge requests found
...@@ -337,12 +337,15 @@ fn check_user_presence(cid: ChannelID) -> Result<(), Ctap2StatusCode> { ...@@ -337,12 +337,15 @@ fn check_user_presence(cid: ChannelID) -> Result<(), Ctap2StatusCode> {
Ok(x) => x, Ok(x) => x,
Err(err) => panic!("Couldn't init buttons subsystem"), Err(err) => panic!("Couldn't init buttons subsystem"),
}; };
let _buttons_callback = match buttons_driver.subscribe(&mut |_button_num, state| {
let mut subscription = |_button_num, state| {
match state { match state {
ButtonState::Pressed => button_touched.set(true), ButtonState::Pressed => button_touched.set(true),
ButtonState::Released => (), ButtonState::Released => (),
}; };
}) { };
let _buttons_callback = buttons_driver.subscribe(&mut subscription);
let _buttons_callback = match _buttons_callback {
Ok(x) => x, Ok(x) => x,
Err(err) => panic!("Couldn't subscribe to button"), Err(err) => panic!("Couldn't subscribe to button"),
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment