From d3f8905e938eecfe7789841c6232cb34b5f43a20 Mon Sep 17 00:00:00 2001 From: Eekle <96976531+Eekle@users.noreply.github.com> Date: Tue, 2 Jul 2024 20:46:05 +0200 Subject: [PATCH] Use crate level PeriMode --- embassy-stm32/src/tsc/mod.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/embassy-stm32/src/tsc/mod.rs b/embassy-stm32/src/tsc/mod.rs index cd7ae4a53..5cb58e918 100644 --- a/embassy-stm32/src/tsc/mod.rs +++ b/embassy-stm32/src/tsc/mod.rs @@ -75,6 +75,7 @@ pub use enums::*; use crate::gpio::{AfType, AnyPin, OutputType, Speed}; use crate::interrupt::typelevel::Interrupt; +use crate::mode::{Async, Blocking, Mode as PeriMode}; use crate::rcc::{self, RccPeripheral}; use crate::{interrupt, peripherals, Peripheral}; @@ -93,23 +94,6 @@ pub enum Error { Test, } -/// Async acquisition API marker -pub struct Async; -/// Blocking acquisition API marker -pub struct Blocking; - -trait SealedDriverKind {} - -impl SealedDriverKind for Async {} -impl SealedDriverKind for Blocking {} - -#[allow(private_bounds)] -/// Driver variant marker for the TSC peripheral -pub trait DriverKind: SealedDriverKind {} - -impl DriverKind for Async {} -impl DriverKind for Blocking {} - /// TSC interrupt handler. pub struct InterruptHandler { _phantom: PhantomData, @@ -522,7 +506,7 @@ pub enum G7 {} pub enum G8 {} /// TSC driver -pub struct Tsc<'d, T: Instance, K: DriverKind> { +pub struct Tsc<'d, T: Instance, K: PeriMode> { _peri: PeripheralRef<'d, T>, _g1: Option>, _g2: Option>, @@ -703,7 +687,7 @@ impl<'d, T: Instance> Tsc<'d, T, Blocking> { } } -impl<'d, T: Instance, K: DriverKind> Tsc<'d, T, K> { +impl<'d, T: Instance, K: PeriMode> Tsc<'d, T, K> { /// Create new TSC driver fn check_shields( g1: &Option>, @@ -969,7 +953,7 @@ impl<'d, T: Instance, K: DriverKind> Tsc<'d, T, K> { } } -impl<'d, T: Instance, K: DriverKind> Drop for Tsc<'d, T, K> { +impl<'d, T: Instance, K: PeriMode> Drop for Tsc<'d, T, K> { fn drop(&mut self) { rcc::disable::(); }