Use async fn instead of impl Future
This commit is contained in:
parent
e807a9eaec
commit
69953a78f1
@ -4,7 +4,6 @@ use crate::interrupt;
|
||||
use crate::pac;
|
||||
use crate::peripherals::TEMP;
|
||||
|
||||
use core::future::Future;
|
||||
use core::marker::PhantomData;
|
||||
use core::task::Poll;
|
||||
use embassy::interrupt::InterruptExt;
|
||||
@ -54,7 +53,7 @@ impl<'d> Temp<'d> {
|
||||
/// let mut t = Temp::new(p.TEMP, interrupt::take!(TEMP));
|
||||
/// let v: u16 = t.read().await.to_num::<u16>();
|
||||
/// ```
|
||||
pub fn read(&mut self) -> impl Future<Output = I30F2> {
|
||||
pub async fn read(&mut self) -> I30F2 {
|
||||
// In case the future is dropped, stop the task and reset events.
|
||||
let on_drop = OnDrop::new(|| {
|
||||
let t = Self::regs();
|
||||
@ -66,7 +65,6 @@ impl<'d> Temp<'d> {
|
||||
t.intenset.write(|w| w.datardy().set());
|
||||
unsafe { t.tasks_start.write(|w| w.bits(1)) };
|
||||
|
||||
async move {
|
||||
let value = poll_fn(|cx| {
|
||||
WAKER.register(cx.waker());
|
||||
if t.events_datardy.read().bits() == 0 {
|
||||
@ -81,7 +79,6 @@ impl<'d> Temp<'d> {
|
||||
on_drop.defuse();
|
||||
value
|
||||
}
|
||||
}
|
||||
|
||||
fn regs() -> &'static pac::temp::RegisterBlock {
|
||||
unsafe { &*pac::TEMP::ptr() }
|
||||
|
Loading…
Reference in New Issue
Block a user