Fix async read_movement
This commit is contained in:
parent
0658e3015d
commit
96ace21f95
2 changed files with 4 additions and 4 deletions
|
@ -31,10 +31,10 @@ async fn main(_spawner: Spawner) {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let usb_fut = MouseHID::run_usb().await;
|
let usb_future = MouseHID::run_usb().await;
|
||||||
|
|
||||||
// Do stuff with the class!
|
// Do stuff with the class!
|
||||||
let hid_fut = async {
|
let hid_future = async {
|
||||||
loop {
|
loop {
|
||||||
if let Some((x, y)) = mouse_sensor.read_movement().await {
|
if let Some((x, y)) = mouse_sensor.read_movement().await {
|
||||||
let report = MouseReport {
|
let report = MouseReport {
|
||||||
|
@ -52,5 +52,5 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
// Run everything concurrently.
|
// Run everything concurrently.
|
||||||
// If we had made everything `'static` above instead, we could do this using separate tasks instead.
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ where
|
||||||
(motion, x_overflow, y_overflow)
|
(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;
|
let (motion, x_overflow, y_overflow) = self.motion_detected().await;
|
||||||
|
|
||||||
if motion {
|
if motion {
|
||||||
|
|
Loading…
Reference in a new issue