Use Infallible directly

This commit is contained in:
hodasemi 2024-03-10 19:35:25 +01:00
parent 7f2653a2ed
commit 6b9fd377e4
2 changed files with 4 additions and 5 deletions

View file

@ -10,4 +10,3 @@ embassy-rp = { version = "0.1.0", features = ["unstable-pac", "time-driver", "cr
embassy-usb = { version = "0.1.0" }
numtoa = "0.2.4"
futures = { version = "0.3.30", default-features = false }

View file

@ -4,8 +4,8 @@ mod serial_config;
use numtoa::NumToA;
use core::convert::Infallible;
use core::future::Future;
use futures::never::Never;
use embassy_rp::bind_interrupts;
use embassy_rp::peripherals::USB;
@ -36,7 +36,7 @@ impl Serial<'static> {
pub fn new(
usb: USB,
serial_config: SerialConfig<'static>,
) -> (Serial<'static>, impl Future<Output = Never>) {
) -> (Serial<'static>, impl Future<Output = Infallible>) {
// Create the driver, from the HAL.
let driver = Driver::new(usb, Irqs);
@ -83,11 +83,11 @@ impl Serial<'static> {
(Self { class }, Self::run_usb())
}
fn run_usb() -> impl Future<Output = Never> {
fn run_usb() -> impl Future<Output = Infallible> {
unsafe {
async {
loop {
USB.as_mut().unwrap().run().await
USB.as_mut().unwrap().run().await;
}
}
}