diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-nrf/src/temp.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/temp.rs')
| -rw-r--r-- | embassy-nrf/src/temp.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/embassy-nrf/src/temp.rs b/embassy-nrf/src/temp.rs index 1488c5c24..44be0f6d1 100644 --- a/embassy-nrf/src/temp.rs +++ b/embassy-nrf/src/temp.rs | |||
| @@ -4,13 +4,12 @@ use core::future::poll_fn; | |||
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use embassy_hal_internal::drop::OnDrop; | 6 | use embassy_hal_internal::drop::OnDrop; |
| 7 | use embassy_hal_internal::{into_ref, PeripheralRef}; | ||
| 8 | use embassy_sync::waitqueue::AtomicWaker; | 7 | use embassy_sync::waitqueue::AtomicWaker; |
| 9 | use fixed::types::I30F2; | 8 | use fixed::types::I30F2; |
| 10 | 9 | ||
| 11 | use crate::interrupt::InterruptExt; | 10 | use crate::interrupt::InterruptExt; |
| 12 | use crate::peripherals::TEMP; | 11 | use crate::peripherals::TEMP; |
| 13 | use crate::{interrupt, pac, Peripheral}; | 12 | use crate::{interrupt, pac, Peri}; |
| 14 | 13 | ||
| 15 | /// Interrupt handler. | 14 | /// Interrupt handler. |
| 16 | pub struct InterruptHandler { | 15 | pub struct InterruptHandler { |
| @@ -27,7 +26,7 @@ impl interrupt::typelevel::Handler<interrupt::typelevel::TEMP> for InterruptHand | |||
| 27 | 26 | ||
| 28 | /// Builtin temperature sensor driver. | 27 | /// Builtin temperature sensor driver. |
| 29 | pub struct Temp<'d> { | 28 | pub struct Temp<'d> { |
| 30 | _peri: PeripheralRef<'d, TEMP>, | 29 | _peri: Peri<'d, TEMP>, |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | static WAKER: AtomicWaker = AtomicWaker::new(); | 32 | static WAKER: AtomicWaker = AtomicWaker::new(); |
| @@ -35,11 +34,9 @@ static WAKER: AtomicWaker = AtomicWaker::new(); | |||
| 35 | impl<'d> Temp<'d> { | 34 | impl<'d> Temp<'d> { |
| 36 | /// Create a new temperature sensor driver. | 35 | /// Create a new temperature sensor driver. |
| 37 | pub fn new( | 36 | pub fn new( |
| 38 | _peri: impl Peripheral<P = TEMP> + 'd, | 37 | _peri: Peri<'d, TEMP>, |
| 39 | _irq: impl interrupt::typelevel::Binding<interrupt::typelevel::TEMP, InterruptHandler> + 'd, | 38 | _irq: impl interrupt::typelevel::Binding<interrupt::typelevel::TEMP, InterruptHandler> + 'd, |
| 40 | ) -> Self { | 39 | ) -> Self { |
| 41 | into_ref!(_peri); | ||
| 42 | |||
| 43 | // Enable interrupt that signals temperature values | 40 | // Enable interrupt that signals temperature values |
| 44 | interrupt::TEMP.unpend(); | 41 | interrupt::TEMP.unpend(); |
| 45 | unsafe { interrupt::TEMP.enable() }; | 42 | unsafe { interrupt::TEMP.enable() }; |
