py32f0/py32f002a/tim16/
cr1.rs1pub struct R(crate::R<CR1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR1_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CR1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type CEN_R = crate::BitReader<CEN_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum CEN_A {
44 Disabled = 0,
46 Enabled = 1,
48}
49impl From<CEN_A> for bool {
50 #[inline(always)]
51 fn from(variant: CEN_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl CEN_R {
56 #[inline(always)]
58 pub fn variant(&self) -> CEN_A {
59 match self.bits {
60 false => CEN_A::Disabled,
61 true => CEN_A::Enabled,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == CEN_A::Disabled
68 }
69 #[inline(always)]
71 pub fn is_enabled(&self) -> bool {
72 *self == CEN_A::Enabled
73 }
74}
75pub type CEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, CEN_A, O>;
77impl<'a, const O: u8> CEN_W<'a, O> {
78 #[inline(always)]
80 pub fn disabled(self) -> &'a mut W {
81 self.variant(CEN_A::Disabled)
82 }
83 #[inline(always)]
85 pub fn enabled(self) -> &'a mut W {
86 self.variant(CEN_A::Enabled)
87 }
88}
89pub type UDIS_R = crate::BitReader<UDIS_A>;
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum UDIS_A {
96 Enabled = 0,
98 Disabled = 1,
100}
101impl From<UDIS_A> for bool {
102 #[inline(always)]
103 fn from(variant: UDIS_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl UDIS_R {
108 #[inline(always)]
110 pub fn variant(&self) -> UDIS_A {
111 match self.bits {
112 false => UDIS_A::Enabled,
113 true => UDIS_A::Disabled,
114 }
115 }
116 #[inline(always)]
118 pub fn is_enabled(&self) -> bool {
119 *self == UDIS_A::Enabled
120 }
121 #[inline(always)]
123 pub fn is_disabled(&self) -> bool {
124 *self == UDIS_A::Disabled
125 }
126}
127pub type UDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, UDIS_A, O>;
129impl<'a, const O: u8> UDIS_W<'a, O> {
130 #[inline(always)]
132 pub fn enabled(self) -> &'a mut W {
133 self.variant(UDIS_A::Enabled)
134 }
135 #[inline(always)]
137 pub fn disabled(self) -> &'a mut W {
138 self.variant(UDIS_A::Disabled)
139 }
140}
141pub type URS_R = crate::BitReader<URS_A>;
143#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147pub enum URS_A {
148 AnyEvent = 0,
150 CounterOnly = 1,
152}
153impl From<URS_A> for bool {
154 #[inline(always)]
155 fn from(variant: URS_A) -> Self {
156 variant as u8 != 0
157 }
158}
159impl URS_R {
160 #[inline(always)]
162 pub fn variant(&self) -> URS_A {
163 match self.bits {
164 false => URS_A::AnyEvent,
165 true => URS_A::CounterOnly,
166 }
167 }
168 #[inline(always)]
170 pub fn is_any_event(&self) -> bool {
171 *self == URS_A::AnyEvent
172 }
173 #[inline(always)]
175 pub fn is_counter_only(&self) -> bool {
176 *self == URS_A::CounterOnly
177 }
178}
179pub type URS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, URS_A, O>;
181impl<'a, const O: u8> URS_W<'a, O> {
182 #[inline(always)]
184 pub fn any_event(self) -> &'a mut W {
185 self.variant(URS_A::AnyEvent)
186 }
187 #[inline(always)]
189 pub fn counter_only(self) -> &'a mut W {
190 self.variant(URS_A::CounterOnly)
191 }
192}
193pub type OPM_R = crate::BitReader<bool>;
195pub type OPM_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, bool, O>;
197pub type ARPE_R = crate::BitReader<ARPE_A>;
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
203pub enum ARPE_A {
204 Disabled = 0,
206 Enabled = 1,
208}
209impl From<ARPE_A> for bool {
210 #[inline(always)]
211 fn from(variant: ARPE_A) -> Self {
212 variant as u8 != 0
213 }
214}
215impl ARPE_R {
216 #[inline(always)]
218 pub fn variant(&self) -> ARPE_A {
219 match self.bits {
220 false => ARPE_A::Disabled,
221 true => ARPE_A::Enabled,
222 }
223 }
224 #[inline(always)]
226 pub fn is_disabled(&self) -> bool {
227 *self == ARPE_A::Disabled
228 }
229 #[inline(always)]
231 pub fn is_enabled(&self) -> bool {
232 *self == ARPE_A::Enabled
233 }
234}
235pub type ARPE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, ARPE_A, O>;
237impl<'a, const O: u8> ARPE_W<'a, O> {
238 #[inline(always)]
240 pub fn disabled(self) -> &'a mut W {
241 self.variant(ARPE_A::Disabled)
242 }
243 #[inline(always)]
245 pub fn enabled(self) -> &'a mut W {
246 self.variant(ARPE_A::Enabled)
247 }
248}
249pub type CKD_R = crate::FieldReader<u8, u8>;
251pub type CKD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR1_SPEC, u8, u8, 2, O>;
253impl R {
254 #[inline(always)]
256 pub fn cen(&self) -> CEN_R {
257 CEN_R::new((self.bits & 1) != 0)
258 }
259 #[inline(always)]
261 pub fn udis(&self) -> UDIS_R {
262 UDIS_R::new(((self.bits >> 1) & 1) != 0)
263 }
264 #[inline(always)]
266 pub fn urs(&self) -> URS_R {
267 URS_R::new(((self.bits >> 2) & 1) != 0)
268 }
269 #[inline(always)]
271 pub fn opm(&self) -> OPM_R {
272 OPM_R::new(((self.bits >> 3) & 1) != 0)
273 }
274 #[inline(always)]
276 pub fn arpe(&self) -> ARPE_R {
277 ARPE_R::new(((self.bits >> 7) & 1) != 0)
278 }
279 #[inline(always)]
281 pub fn ckd(&self) -> CKD_R {
282 CKD_R::new(((self.bits >> 8) & 3) as u8)
283 }
284}
285impl W {
286 #[inline(always)]
288 #[must_use]
289 pub fn cen(&mut self) -> CEN_W<0> {
290 CEN_W::new(self)
291 }
292 #[inline(always)]
294 #[must_use]
295 pub fn udis(&mut self) -> UDIS_W<1> {
296 UDIS_W::new(self)
297 }
298 #[inline(always)]
300 #[must_use]
301 pub fn urs(&mut self) -> URS_W<2> {
302 URS_W::new(self)
303 }
304 #[inline(always)]
306 #[must_use]
307 pub fn opm(&mut self) -> OPM_W<3> {
308 OPM_W::new(self)
309 }
310 #[inline(always)]
312 #[must_use]
313 pub fn arpe(&mut self) -> ARPE_W<7> {
314 ARPE_W::new(self)
315 }
316 #[inline(always)]
318 #[must_use]
319 pub fn ckd(&mut self) -> CKD_W<8> {
320 CKD_W::new(self)
321 }
322 #[inline(always)]
324 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
325 self.0.bits(bits);
326 self
327 }
328}
329pub struct CR1_SPEC;
335impl crate::RegisterSpec for CR1_SPEC {
336 type Ux = u32;
337}
338impl crate::Readable for CR1_SPEC {
340 type Reader = R;
341}
342impl crate::Writable for CR1_SPEC {
344 type Writer = W;
345 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
346 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
347}
348impl crate::Resettable for CR1_SPEC {
350 const RESET_VALUE: Self::Ux = 0;
351}