stm32/timer: Merge channel typestate structs

This commit is contained in:
Gabriel Smith 2025-03-28 17:20:36 +00:00
parent d097ccc68c
commit eee2d8c84d
3 changed files with 11 additions and 14 deletions

View File

@ -12,20 +12,12 @@ use super::{
CaptureCompareInterruptHandler, Channel, Channel1Pin, Channel2Pin, Channel3Pin, Channel4Pin,
GeneralInstance4Channel,
};
pub use super::{Ch1, Ch2, Ch3, Ch4};
use crate::gpio::{AfType, AnyPin, Pull};
use crate::interrupt::typelevel::{Binding, Interrupt};
use crate::time::Hertz;
use crate::Peripheral;
/// Channel 1 marker type.
pub enum Ch1 {}
/// Channel 2 marker type.
pub enum Ch2 {}
/// Channel 3 marker type.
pub enum Ch3 {}
/// Channel 4 marker type.
pub enum Ch4 {}
/// Capture pin wrapper.
///
/// This wraps a pin to make it usable with capture.

View File

@ -41,6 +41,15 @@ impl Channel {
}
}
/// Channel 1 marker type.
pub enum Ch1 {}
/// Channel 2 marker type.
pub enum Ch2 {}
/// Channel 3 marker type.
pub enum Ch3 {}
/// Channel 4 marker type.
pub enum Ch4 {}
/// Amount of bits of a timer.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]

View File

@ -6,6 +6,7 @@ use embassy_hal_internal::{into_ref, PeripheralRef};
use stm32_metapac::timer::vals;
use super::low_level::Timer;
pub use super::{Ch1, Ch2};
use super::{Channel1Pin, Channel2Pin, GeneralInstance4Channel};
use crate::gpio::{AfType, AnyPin, Pull};
use crate::Peripheral;
@ -18,11 +19,6 @@ pub enum Direction {
Downcounting,
}
/// Channel 1 marker type.
pub enum Ch1 {}
/// Channel 2 marker type.
pub enum Ch2 {}
/// Wrapper for using a pin with QEI.
pub struct QeiPin<'d, T, Channel> {
_pin: PeripheralRef<'d, AnyPin>,