Fix async read_movement

This commit is contained in:
hodasemi 2023-04-15 10:29:52 +02:00
parent 0658e3015d
commit 96ace21f95
2 changed files with 4 additions and 4 deletions

View file

@ -31,10 +31,10 @@ async fn main(_spawner: Spawner) {
)
.await;
let usb_fut = MouseHID::run_usb().await;
let usb_future = MouseHID::run_usb().await;
// Do stuff with the class!
let hid_fut = async {
let hid_future = async {
loop {
if let Some((x, y)) = mouse_sensor.read_movement().await {
let report = MouseReport {
@ -52,5 +52,5 @@ async fn main(_spawner: Spawner) {
// Run everything concurrently.
// If we had made everything `'static` above instead, we could do this using separate tasks instead.
join(hid_fut, usb_fut).await;
join(hid_future, usb_future).await;
}

View file

@ -150,7 +150,7 @@ where
(motion, x_overflow, y_overflow)
}
pub async fn read_movement(&'d mut self) -> Option<(i8, i8)> {
pub async fn read_movement(&mut self) -> Option<(i8, i8)> {
let (motion, x_overflow, y_overflow) = self.motion_detected().await;
if motion {