stm32h5/stm32h533/tim2/
tisel.rs1pub type R = crate::R<TISELrs>;
3pub type W = crate::W<TISELrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u8)]
11pub enum TI1SEL {
12 Selected = 0,
14}
15impl From<TI1SEL> for u8 {
16 #[inline(always)]
17 fn from(variant: TI1SEL) -> Self {
18 variant as _
19 }
20}
21impl crate::FieldSpec for TI1SEL {
22 type Ux = u8;
23}
24impl crate::IsEnum for TI1SEL {}
25pub type TI1SEL_R = crate::FieldReader<TI1SEL>;
27impl TI1SEL_R {
28 #[inline(always)]
30 pub const fn variant(&self) -> Option<TI1SEL> {
31 match self.bits {
32 0 => Some(TI1SEL::Selected),
33 _ => None,
34 }
35 }
36 #[inline(always)]
38 pub fn is_selected(&self) -> bool {
39 *self == TI1SEL::Selected
40 }
41}
42pub type TI1SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 4, TI1SEL>;
44impl<'a, REG> TI1SEL_W<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47 REG::Ux: From<u8>,
48{
49 #[inline(always)]
51 pub fn selected(self) -> &'a mut crate::W<REG> {
52 self.variant(TI1SEL::Selected)
53 }
54}
55pub use TI1SEL_R as TI2SEL_R;
57pub use TI1SEL_R as TI3SEL_R;
59pub use TI1SEL_R as TI4SEL_R;
61pub use TI1SEL_W as TI2SEL_W;
63pub use TI1SEL_W as TI3SEL_W;
65pub use TI1SEL_W as TI4SEL_W;
67impl R {
68 #[inline(always)]
70 pub fn ti1sel(&self) -> TI1SEL_R {
71 TI1SEL_R::new((self.bits & 0x0f) as u8)
72 }
73 #[inline(always)]
75 pub fn ti2sel(&self) -> TI2SEL_R {
76 TI2SEL_R::new(((self.bits >> 8) & 0x0f) as u8)
77 }
78 #[inline(always)]
80 pub fn ti3sel(&self) -> TI3SEL_R {
81 TI3SEL_R::new(((self.bits >> 16) & 0x0f) as u8)
82 }
83 #[inline(always)]
85 pub fn ti4sel(&self) -> TI4SEL_R {
86 TI4SEL_R::new(((self.bits >> 24) & 0x0f) as u8)
87 }
88}
89impl core::fmt::Debug for R {
90 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
91 f.debug_struct("TISEL")
92 .field("ti1sel", &self.ti1sel())
93 .field("ti2sel", &self.ti2sel())
94 .field("ti3sel", &self.ti3sel())
95 .field("ti4sel", &self.ti4sel())
96 .finish()
97 }
98}
99impl W {
100 #[inline(always)]
102 pub fn ti1sel(&mut self) -> TI1SEL_W<TISELrs> {
103 TI1SEL_W::new(self, 0)
104 }
105 #[inline(always)]
107 pub fn ti2sel(&mut self) -> TI2SEL_W<TISELrs> {
108 TI2SEL_W::new(self, 8)
109 }
110 #[inline(always)]
112 pub fn ti3sel(&mut self) -> TI3SEL_W<TISELrs> {
113 TI3SEL_W::new(self, 16)
114 }
115 #[inline(always)]
117 pub fn ti4sel(&mut self) -> TI4SEL_W<TISELrs> {
118 TI4SEL_W::new(self, 24)
119 }
120}
121pub struct TISELrs;
127impl crate::RegisterSpec for TISELrs {
128 type Ux = u32;
129}
130impl crate::Readable for TISELrs {}
132impl crate::Writable for TISELrs {
134 type Safety = crate::Unsafe;
135}
136impl crate::Resettable for TISELrs {}