diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-10-24 13:31:53 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-11-04 00:47:31 +0100 |
| commit | 51f6b813e1a4311ffb4adf2e66ed3effb990d246 (patch) | |
| tree | 66a175cc893b00dcd56bcaff0e6b90b4d0753732 /embassy-nrf/src/temp.rs | |
| parent | 650f97924ab540d3232b187cbde73d7a0104f734 (diff) | |
nrf: port to chiptool-based `nrf-pac`.
Diffstat (limited to 'embassy-nrf/src/temp.rs')
| -rw-r--r-- | embassy-nrf/src/temp.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs index ed4a47713..1488c5c24 100644 --- a/embassy-nrf/src/temp.rs +++ b/embassy-nrf/src/temp.rs | |||
| @@ -19,8 +19,8 @@ pub struct InterruptHandler { | |||
| 19 | 19 | ||
| 20 | impl interrupt::typelevel::Handler<interrupt::typelevel::TEMP> for InterruptHandler { | 20 | impl interrupt::typelevel::Handler<interrupt::typelevel::TEMP> for InterruptHandler { |
| 21 | unsafe fn on_interrupt() { | 21 | unsafe fn on_interrupt() { |
| 22 | let r = unsafe { &*pac::TEMP::PTR }; | 22 | let r = pac::TEMP; |
| 23 | r.intenclr.write(|w| w.datardy().clear()); | 23 | r.intenclr().write(|w| w.set_datardy(true)); |
| 24 | WAKER.wake(); | 24 | WAKER.wake(); |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| @@ -72,21 +72,21 @@ impl<'d> Temp<'d> { | |||
| 72 | // In case the future is dropped, stop the task and reset events. | 72 | // In case the future is dropped, stop the task and reset events. |
| 73 | let on_drop = OnDrop::new(|| { | 73 | let on_drop = OnDrop::new(|| { |
| 74 | let t = Self::regs(); | 74 | let t = Self::regs(); |
| 75 | t.tasks_stop.write(|w| unsafe { w.bits(1) }); | 75 | t.tasks_stop().write_value(1); |
| 76 | t.events_datardy.reset(); | 76 | t.events_datardy().write_value(0); |
| 77 | }); | 77 | }); |
| 78 | 78 | ||
| 79 | let t = Self::regs(); | 79 | let t = Self::regs(); |
| 80 | t.intenset.write(|w| w.datardy().set()); | 80 | t.intenset().write(|w| w.set_datardy(true)); |
| 81 | unsafe { t.tasks_start.write(|w| w.bits(1)) }; | 81 | t.tasks_start().write_value(1); |
| 82 | 82 | ||
| 83 | let value = poll_fn(|cx| { | 83 | let value = poll_fn(|cx| { |
| 84 | WAKER.register(cx.waker()); | 84 | WAKER.register(cx.waker()); |
| 85 | if t.events_datardy.read().bits() == 0 { | 85 | if t.events_datardy().read() == 0 { |
| 86 | Poll::Pending | 86 | Poll::Pending |
| 87 | } else { | 87 | } else { |
| 88 | t.events_datardy.reset(); | 88 | t.events_datardy().write_value(0); |
| 89 | let raw = t.temp.read().bits(); | 89 | let raw = t.temp().read(); |
| 90 | Poll::Ready(I30F2::from_bits(raw as i32)) | 90 | Poll::Ready(I30F2::from_bits(raw as i32)) |
| 91 | } | 91 | } |
| 92 | }) | 92 | }) |
| @@ -95,7 +95,7 @@ impl<'d> Temp<'d> { | |||
| 95 | value | 95 | value |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | fn regs() -> &'static pac::temp::RegisterBlock { | 98 | fn regs() -> pac::temp::Temp { |
| 99 | unsafe { &*pac::TEMP::ptr() } | 99 | pac::TEMP |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
