stm32wl/stm32wl5x_cm4/tim2/
af1.rs1pub type R = crate::R<AF1rs>;
3pub type W = crate::W<AF1rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u8)]
11pub enum ETRSEL {
12 Legacy = 0,
14 Comp1 = 1,
16 Comp2 = 2,
18}
19impl From<ETRSEL> for u8 {
20 #[inline(always)]
21 fn from(variant: ETRSEL) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for ETRSEL {
26 type Ux = u8;
27}
28impl crate::IsEnum for ETRSEL {}
29pub type ETRSEL_R = crate::FieldReader<ETRSEL>;
31impl ETRSEL_R {
32 #[inline(always)]
34 pub const fn variant(&self) -> Option<ETRSEL> {
35 match self.bits {
36 0 => Some(ETRSEL::Legacy),
37 1 => Some(ETRSEL::Comp1),
38 2 => Some(ETRSEL::Comp2),
39 _ => None,
40 }
41 }
42 #[inline(always)]
44 pub fn is_legacy(&self) -> bool {
45 *self == ETRSEL::Legacy
46 }
47 #[inline(always)]
49 pub fn is_comp1(&self) -> bool {
50 *self == ETRSEL::Comp1
51 }
52 #[inline(always)]
54 pub fn is_comp2(&self) -> bool {
55 *self == ETRSEL::Comp2
56 }
57}
58pub type ETRSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, ETRSEL>;
60impl<'a, REG> ETRSEL_W<'a, REG>
61where
62 REG: crate::Writable + crate::RegisterSpec,
63 REG::Ux: From<u8>,
64{
65 #[inline(always)]
67 pub fn legacy(self) -> &'a mut crate::W<REG> {
68 self.variant(ETRSEL::Legacy)
69 }
70 #[inline(always)]
72 pub fn comp1(self) -> &'a mut crate::W<REG> {
73 self.variant(ETRSEL::Comp1)
74 }
75 #[inline(always)]
77 pub fn comp2(self) -> &'a mut crate::W<REG> {
78 self.variant(ETRSEL::Comp2)
79 }
80}
81impl R {
82 #[inline(always)]
84 pub fn etrsel(&self) -> ETRSEL_R {
85 ETRSEL_R::new(((self.bits >> 14) & 0x0f) as u8)
86 }
87}
88impl core::fmt::Debug for R {
89 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
90 f.debug_struct("AF1")
91 .field("etrsel", &self.etrsel())
92 .finish()
93 }
94}
95impl W {
96 #[inline(always)]
98 pub fn etrsel(&mut self) -> ETRSEL_W<AF1rs> {
99 ETRSEL_W::new(self, 14)
100 }
101}
102pub struct AF1rs;
108impl crate::RegisterSpec for AF1rs {
109 type Ux = u32;
110}
111impl crate::Readable for AF1rs {}
113impl crate::Writable for AF1rs {
115 type Safety = crate::Unsafe;
116}
117impl crate::Resettable for AF1rs {}