stm32g0/stm32g030/tim3/
cr2.rs1pub type R = crate::R<CR2rs>;
3pub type W = crate::W<CR2rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CCDS {
11 OnCompare = 0,
13 OnUpdate = 1,
15}
16impl From<CCDS> for bool {
17 #[inline(always)]
18 fn from(variant: CCDS) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type CCDS_R = crate::BitReader<CCDS>;
24impl CCDS_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> CCDS {
28 match self.bits {
29 false => CCDS::OnCompare,
30 true => CCDS::OnUpdate,
31 }
32 }
33 #[inline(always)]
35 pub fn is_on_compare(&self) -> bool {
36 *self == CCDS::OnCompare
37 }
38 #[inline(always)]
40 pub fn is_on_update(&self) -> bool {
41 *self == CCDS::OnUpdate
42 }
43}
44pub type CCDS_W<'a, REG> = crate::BitWriter<'a, REG, CCDS>;
46impl<'a, REG> CCDS_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn on_compare(self) -> &'a mut crate::W<REG> {
53 self.variant(CCDS::OnCompare)
54 }
55 #[inline(always)]
57 pub fn on_update(self) -> &'a mut crate::W<REG> {
58 self.variant(CCDS::OnUpdate)
59 }
60}
61pub type MMS_R = crate::FieldReader;
63pub type MMS_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
65#[cfg_attr(feature = "defmt", derive(defmt::Format))]
69#[derive(Clone, Copy, Debug, PartialEq, Eq)]
70pub enum TI1S {
71 Normal = 0,
73 Xor = 1,
75}
76impl From<TI1S> for bool {
77 #[inline(always)]
78 fn from(variant: TI1S) -> Self {
79 variant as u8 != 0
80 }
81}
82pub type TI1S_R = crate::BitReader<TI1S>;
84impl TI1S_R {
85 #[inline(always)]
87 pub const fn variant(&self) -> TI1S {
88 match self.bits {
89 false => TI1S::Normal,
90 true => TI1S::Xor,
91 }
92 }
93 #[inline(always)]
95 pub fn is_normal(&self) -> bool {
96 *self == TI1S::Normal
97 }
98 #[inline(always)]
100 pub fn is_xor(&self) -> bool {
101 *self == TI1S::Xor
102 }
103}
104pub type TI1S_W<'a, REG> = crate::BitWriter<'a, REG, TI1S>;
106impl<'a, REG> TI1S_W<'a, REG>
107where
108 REG: crate::Writable + crate::RegisterSpec,
109{
110 #[inline(always)]
112 pub fn normal(self) -> &'a mut crate::W<REG> {
113 self.variant(TI1S::Normal)
114 }
115 #[inline(always)]
117 pub fn xor(self) -> &'a mut crate::W<REG> {
118 self.variant(TI1S::Xor)
119 }
120}
121impl R {
122 #[inline(always)]
124 pub fn ccds(&self) -> CCDS_R {
125 CCDS_R::new(((self.bits >> 3) & 1) != 0)
126 }
127 #[inline(always)]
129 pub fn mms(&self) -> MMS_R {
130 MMS_R::new(((self.bits >> 4) & 7) as u8)
131 }
132 #[inline(always)]
134 pub fn ti1s(&self) -> TI1S_R {
135 TI1S_R::new(((self.bits >> 7) & 1) != 0)
136 }
137}
138impl core::fmt::Debug for R {
139 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
140 f.debug_struct("CR2")
141 .field("ti1s", &self.ti1s())
142 .field("mms", &self.mms())
143 .field("ccds", &self.ccds())
144 .finish()
145 }
146}
147impl W {
148 #[inline(always)]
150 pub fn ccds(&mut self) -> CCDS_W<CR2rs> {
151 CCDS_W::new(self, 3)
152 }
153 #[inline(always)]
155 pub fn mms(&mut self) -> MMS_W<CR2rs> {
156 MMS_W::new(self, 4)
157 }
158 #[inline(always)]
160 pub fn ti1s(&mut self) -> TI1S_W<CR2rs> {
161 TI1S_W::new(self, 7)
162 }
163}
164pub struct CR2rs;
170impl crate::RegisterSpec for CR2rs {
171 type Ux = u32;
172}
173impl crate::Readable for CR2rs {}
175impl crate::Writable for CR2rs {
177 type Safety = crate::Unsafe;
178}
179impl crate::Resettable for CR2rs {}