aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/twis.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-03-26 16:01:37 +0100
committerDario Nieuwenhuis <[email protected]>2025-03-27 15:18:06 +0100
commitd41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch)
tree678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-nrf/src/twis.rs
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/twis.rs')
-rw-r--r--embassy-nrf/src/twis.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/embassy-nrf/src/twis.rs b/embassy-nrf/src/twis.rs
index 60de2ed9d..3e4d537ae 100644
--- a/embassy-nrf/src/twis.rs
+++ b/embassy-nrf/src/twis.rs
@@ -8,7 +8,7 @@ use core::sync::atomic::compiler_fence;
8use core::sync::atomic::Ordering::SeqCst; 8use core::sync::atomic::Ordering::SeqCst;
9use core::task::Poll; 9use core::task::Poll;
10 10
11use embassy_hal_internal::{into_ref, PeripheralRef}; 11use embassy_hal_internal::{Peri, PeripheralType};
12use embassy_sync::waitqueue::AtomicWaker; 12use embassy_sync::waitqueue::AtomicWaker;
13#[cfg(feature = "time")] 13#[cfg(feature = "time")]
14use embassy_time::{Duration, Instant}; 14use embassy_time::{Duration, Instant};
@@ -19,7 +19,7 @@ use crate::interrupt::typelevel::Interrupt;
19use crate::pac::gpio::vals as gpiovals; 19use crate::pac::gpio::vals as gpiovals;
20use crate::pac::twis::vals; 20use crate::pac::twis::vals;
21use crate::util::slice_in_ram_or; 21use crate::util::slice_in_ram_or;
22use crate::{gpio, interrupt, pac, Peripheral}; 22use crate::{gpio, interrupt, pac};
23 23
24/// TWIS config. 24/// TWIS config.
25#[non_exhaustive] 25#[non_exhaustive]
@@ -141,20 +141,18 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl
141 141
142/// TWIS driver. 142/// TWIS driver.
143pub struct Twis<'d, T: Instance> { 143pub struct Twis<'d, T: Instance> {
144 _p: PeripheralRef<'d, T>, 144 _p: Peri<'d, T>,
145} 145}
146 146
147impl<'d, T: Instance> Twis<'d, T> { 147impl<'d, T: Instance> Twis<'d, T> {
148 /// Create a new TWIS driver. 148 /// Create a new TWIS driver.
149 pub fn new( 149 pub fn new(
150 twis: impl Peripheral<P = T> + 'd, 150 twis: Peri<'d, T>,
151 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 151 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
152 sda: impl Peripheral<P = impl GpioPin> + 'd, 152 sda: Peri<'d, impl GpioPin>,
153 scl: impl Peripheral<P = impl GpioPin> + 'd, 153 scl: Peri<'d, impl GpioPin>,
154 config: Config, 154 config: Config,
155 ) -> Self { 155 ) -> Self {
156 into_ref!(twis, sda, scl);
157
158 let r = T::regs(); 156 let r = T::regs();
159 157
160 // Configure pins 158 // Configure pins
@@ -791,7 +789,7 @@ pub(crate) trait SealedInstance {
791 789
792/// TWIS peripheral instance. 790/// TWIS peripheral instance.
793#[allow(private_bounds)] 791#[allow(private_bounds)]
794pub trait Instance: Peripheral<P = Self> + SealedInstance + 'static { 792pub trait Instance: SealedInstance + PeripheralType + 'static {
795 /// Interrupt for this peripheral. 793 /// Interrupt for this peripheral.
796 type Interrupt: interrupt::typelevel::Interrupt; 794 type Interrupt: interrupt::typelevel::Interrupt;
797} 795}