stm32f3_staging/stm32f303/adc1/
cr.rs1pub type R = crate::R<CRrs>;
3pub type W = crate::W<CRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum ADENR {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<ADENR> for bool {
17 #[inline(always)]
18 fn from(variant: ADENR) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type ADEN_R = crate::BitReader<ADENR>;
24impl ADEN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> ADENR {
28 match self.bits {
29 false => ADENR::Disabled,
30 true => ADENR::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == ADENR::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == ADENR::Enabled
42 }
43}
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum ADENW {
50 Enabled = 1,
52}
53impl From<ADENW> for bool {
54 #[inline(always)]
55 fn from(variant: ADENW) -> Self {
56 variant as u8 != 0
57 }
58}
59pub type ADEN_W<'a, REG> = crate::BitWriter1S<'a, REG, ADENW>;
61impl<'a, REG> ADEN_W<'a, REG>
62where
63 REG: crate::Writable + crate::RegisterSpec,
64{
65 #[inline(always)]
67 pub fn enabled(self) -> &'a mut crate::W<REG> {
68 self.variant(ADENW::Enabled)
69 }
70}
71#[cfg_attr(feature = "defmt", derive(defmt::Format))]
75#[derive(Clone, Copy, Debug, PartialEq, Eq)]
76pub enum ADDISR {
77 NotDisabling = 0,
79 Disabling = 1,
81}
82impl From<ADDISR> for bool {
83 #[inline(always)]
84 fn from(variant: ADDISR) -> Self {
85 variant as u8 != 0
86 }
87}
88pub type ADDIS_R = crate::BitReader<ADDISR>;
90impl ADDIS_R {
91 #[inline(always)]
93 pub const fn variant(&self) -> ADDISR {
94 match self.bits {
95 false => ADDISR::NotDisabling,
96 true => ADDISR::Disabling,
97 }
98 }
99 #[inline(always)]
101 pub fn is_not_disabling(&self) -> bool {
102 *self == ADDISR::NotDisabling
103 }
104 #[inline(always)]
106 pub fn is_disabling(&self) -> bool {
107 *self == ADDISR::Disabling
108 }
109}
110#[cfg_attr(feature = "defmt", derive(defmt::Format))]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum ADDISW {
116 Disable = 1,
118}
119impl From<ADDISW> for bool {
120 #[inline(always)]
121 fn from(variant: ADDISW) -> Self {
122 variant as u8 != 0
123 }
124}
125pub type ADDIS_W<'a, REG> = crate::BitWriter1S<'a, REG, ADDISW>;
127impl<'a, REG> ADDIS_W<'a, REG>
128where
129 REG: crate::Writable + crate::RegisterSpec,
130{
131 #[inline(always)]
133 pub fn disable(self) -> &'a mut crate::W<REG> {
134 self.variant(ADDISW::Disable)
135 }
136}
137#[cfg_attr(feature = "defmt", derive(defmt::Format))]
141#[derive(Clone, Copy, Debug, PartialEq, Eq)]
142pub enum ADSTARTR {
143 NotActive = 0,
145 Active = 1,
147}
148impl From<ADSTARTR> for bool {
149 #[inline(always)]
150 fn from(variant: ADSTARTR) -> Self {
151 variant as u8 != 0
152 }
153}
154pub type ADSTART_R = crate::BitReader<ADSTARTR>;
156impl ADSTART_R {
157 #[inline(always)]
159 pub const fn variant(&self) -> ADSTARTR {
160 match self.bits {
161 false => ADSTARTR::NotActive,
162 true => ADSTARTR::Active,
163 }
164 }
165 #[inline(always)]
167 pub fn is_not_active(&self) -> bool {
168 *self == ADSTARTR::NotActive
169 }
170 #[inline(always)]
172 pub fn is_active(&self) -> bool {
173 *self == ADSTARTR::Active
174 }
175}
176#[cfg_attr(feature = "defmt", derive(defmt::Format))]
180#[derive(Clone, Copy, Debug, PartialEq, Eq)]
181pub enum ADSTARTW {
182 StartConversion = 1,
184}
185impl From<ADSTARTW> for bool {
186 #[inline(always)]
187 fn from(variant: ADSTARTW) -> Self {
188 variant as u8 != 0
189 }
190}
191pub type ADSTART_W<'a, REG> = crate::BitWriter1S<'a, REG, ADSTARTW>;
193impl<'a, REG> ADSTART_W<'a, REG>
194where
195 REG: crate::Writable + crate::RegisterSpec,
196{
197 #[inline(always)]
199 pub fn start_conversion(self) -> &'a mut crate::W<REG> {
200 self.variant(ADSTARTW::StartConversion)
201 }
202}
203pub use ADSTART_R as JADSTART_R;
205pub use ADSTART_W as JADSTART_W;
207#[cfg_attr(feature = "defmt", derive(defmt::Format))]
211#[derive(Clone, Copy, Debug, PartialEq, Eq)]
212pub enum ADSTPR {
213 NotStopping = 0,
215 Stopping = 1,
217}
218impl From<ADSTPR> for bool {
219 #[inline(always)]
220 fn from(variant: ADSTPR) -> Self {
221 variant as u8 != 0
222 }
223}
224pub type ADSTP_R = crate::BitReader<ADSTPR>;
226impl ADSTP_R {
227 #[inline(always)]
229 pub const fn variant(&self) -> ADSTPR {
230 match self.bits {
231 false => ADSTPR::NotStopping,
232 true => ADSTPR::Stopping,
233 }
234 }
235 #[inline(always)]
237 pub fn is_not_stopping(&self) -> bool {
238 *self == ADSTPR::NotStopping
239 }
240 #[inline(always)]
242 pub fn is_stopping(&self) -> bool {
243 *self == ADSTPR::Stopping
244 }
245}
246#[cfg_attr(feature = "defmt", derive(defmt::Format))]
250#[derive(Clone, Copy, Debug, PartialEq, Eq)]
251pub enum ADSTPW {
252 StopConversion = 1,
254}
255impl From<ADSTPW> for bool {
256 #[inline(always)]
257 fn from(variant: ADSTPW) -> Self {
258 variant as u8 != 0
259 }
260}
261pub type ADSTP_W<'a, REG> = crate::BitWriter1S<'a, REG, ADSTPW>;
263impl<'a, REG> ADSTP_W<'a, REG>
264where
265 REG: crate::Writable + crate::RegisterSpec,
266{
267 #[inline(always)]
269 pub fn stop_conversion(self) -> &'a mut crate::W<REG> {
270 self.variant(ADSTPW::StopConversion)
271 }
272}
273pub use ADSTP_R as JADSTP_R;
275pub use ADSTP_W as JADSTP_W;
277#[cfg_attr(feature = "defmt", derive(defmt::Format))]
281#[derive(Clone, Copy, Debug, PartialEq, Eq)]
282#[repr(u8)]
283pub enum ADVREGEN {
284 Intermediate = 0,
286 Enabled = 1,
288 Disabled = 2,
290}
291impl From<ADVREGEN> for u8 {
292 #[inline(always)]
293 fn from(variant: ADVREGEN) -> Self {
294 variant as _
295 }
296}
297impl crate::FieldSpec for ADVREGEN {
298 type Ux = u8;
299}
300impl crate::IsEnum for ADVREGEN {}
301pub type ADVREGEN_R = crate::FieldReader<ADVREGEN>;
303impl ADVREGEN_R {
304 #[inline(always)]
306 pub const fn variant(&self) -> Option<ADVREGEN> {
307 match self.bits {
308 0 => Some(ADVREGEN::Intermediate),
309 1 => Some(ADVREGEN::Enabled),
310 2 => Some(ADVREGEN::Disabled),
311 _ => None,
312 }
313 }
314 #[inline(always)]
316 pub fn is_intermediate(&self) -> bool {
317 *self == ADVREGEN::Intermediate
318 }
319 #[inline(always)]
321 pub fn is_enabled(&self) -> bool {
322 *self == ADVREGEN::Enabled
323 }
324 #[inline(always)]
326 pub fn is_disabled(&self) -> bool {
327 *self == ADVREGEN::Disabled
328 }
329}
330pub type ADVREGEN_W<'a, REG> = crate::FieldWriter<'a, REG, 2, ADVREGEN>;
332impl<'a, REG> ADVREGEN_W<'a, REG>
333where
334 REG: crate::Writable + crate::RegisterSpec,
335 REG::Ux: From<u8>,
336{
337 #[inline(always)]
339 pub fn intermediate(self) -> &'a mut crate::W<REG> {
340 self.variant(ADVREGEN::Intermediate)
341 }
342 #[inline(always)]
344 pub fn enabled(self) -> &'a mut crate::W<REG> {
345 self.variant(ADVREGEN::Enabled)
346 }
347 #[inline(always)]
349 pub fn disabled(self) -> &'a mut crate::W<REG> {
350 self.variant(ADVREGEN::Disabled)
351 }
352}
353#[cfg_attr(feature = "defmt", derive(defmt::Format))]
357#[derive(Clone, Copy, Debug, PartialEq, Eq)]
358pub enum ADCALDIF {
359 SingleEnded = 0,
361 Differential = 1,
363}
364impl From<ADCALDIF> for bool {
365 #[inline(always)]
366 fn from(variant: ADCALDIF) -> Self {
367 variant as u8 != 0
368 }
369}
370pub type ADCALDIF_R = crate::BitReader<ADCALDIF>;
372impl ADCALDIF_R {
373 #[inline(always)]
375 pub const fn variant(&self) -> ADCALDIF {
376 match self.bits {
377 false => ADCALDIF::SingleEnded,
378 true => ADCALDIF::Differential,
379 }
380 }
381 #[inline(always)]
383 pub fn is_single_ended(&self) -> bool {
384 *self == ADCALDIF::SingleEnded
385 }
386 #[inline(always)]
388 pub fn is_differential(&self) -> bool {
389 *self == ADCALDIF::Differential
390 }
391}
392pub type ADCALDIF_W<'a, REG> = crate::BitWriter<'a, REG, ADCALDIF>;
394impl<'a, REG> ADCALDIF_W<'a, REG>
395where
396 REG: crate::Writable + crate::RegisterSpec,
397{
398 #[inline(always)]
400 pub fn single_ended(self) -> &'a mut crate::W<REG> {
401 self.variant(ADCALDIF::SingleEnded)
402 }
403 #[inline(always)]
405 pub fn differential(self) -> &'a mut crate::W<REG> {
406 self.variant(ADCALDIF::Differential)
407 }
408}
409#[cfg_attr(feature = "defmt", derive(defmt::Format))]
413#[derive(Clone, Copy, Debug, PartialEq, Eq)]
414pub enum ADCALR {
415 NotCalibrating = 0,
417 Calibrating = 1,
419}
420impl From<ADCALR> for bool {
421 #[inline(always)]
422 fn from(variant: ADCALR) -> Self {
423 variant as u8 != 0
424 }
425}
426pub type ADCAL_R = crate::BitReader<ADCALR>;
428impl ADCAL_R {
429 #[inline(always)]
431 pub const fn variant(&self) -> ADCALR {
432 match self.bits {
433 false => ADCALR::NotCalibrating,
434 true => ADCALR::Calibrating,
435 }
436 }
437 #[inline(always)]
439 pub fn is_not_calibrating(&self) -> bool {
440 *self == ADCALR::NotCalibrating
441 }
442 #[inline(always)]
444 pub fn is_calibrating(&self) -> bool {
445 *self == ADCALR::Calibrating
446 }
447}
448#[cfg_attr(feature = "defmt", derive(defmt::Format))]
452#[derive(Clone, Copy, Debug, PartialEq, Eq)]
453pub enum ADCALW {
454 StartCalibration = 1,
456}
457impl From<ADCALW> for bool {
458 #[inline(always)]
459 fn from(variant: ADCALW) -> Self {
460 variant as u8 != 0
461 }
462}
463pub type ADCAL_W<'a, REG> = crate::BitWriter1S<'a, REG, ADCALW>;
465impl<'a, REG> ADCAL_W<'a, REG>
466where
467 REG: crate::Writable + crate::RegisterSpec,
468{
469 #[inline(always)]
471 pub fn start_calibration(self) -> &'a mut crate::W<REG> {
472 self.variant(ADCALW::StartCalibration)
473 }
474}
475impl R {
476 #[inline(always)]
478 pub fn aden(&self) -> ADEN_R {
479 ADEN_R::new((self.bits & 1) != 0)
480 }
481 #[inline(always)]
483 pub fn addis(&self) -> ADDIS_R {
484 ADDIS_R::new(((self.bits >> 1) & 1) != 0)
485 }
486 #[inline(always)]
488 pub fn adstart(&self) -> ADSTART_R {
489 ADSTART_R::new(((self.bits >> 2) & 1) != 0)
490 }
491 #[inline(always)]
493 pub fn jadstart(&self) -> JADSTART_R {
494 JADSTART_R::new(((self.bits >> 3) & 1) != 0)
495 }
496 #[inline(always)]
498 pub fn adstp(&self) -> ADSTP_R {
499 ADSTP_R::new(((self.bits >> 4) & 1) != 0)
500 }
501 #[inline(always)]
503 pub fn jadstp(&self) -> JADSTP_R {
504 JADSTP_R::new(((self.bits >> 5) & 1) != 0)
505 }
506 #[inline(always)]
508 pub fn advregen(&self) -> ADVREGEN_R {
509 ADVREGEN_R::new(((self.bits >> 28) & 3) as u8)
510 }
511 #[inline(always)]
513 pub fn adcaldif(&self) -> ADCALDIF_R {
514 ADCALDIF_R::new(((self.bits >> 30) & 1) != 0)
515 }
516 #[inline(always)]
518 pub fn adcal(&self) -> ADCAL_R {
519 ADCAL_R::new(((self.bits >> 31) & 1) != 0)
520 }
521}
522impl core::fmt::Debug for R {
523 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
524 f.debug_struct("CR")
525 .field("adcal", &self.adcal())
526 .field("adcaldif", &self.adcaldif())
527 .field("advregen", &self.advregen())
528 .field("adstp", &self.adstp())
529 .field("jadstp", &self.jadstp())
530 .field("adstart", &self.adstart())
531 .field("jadstart", &self.jadstart())
532 .field("addis", &self.addis())
533 .field("aden", &self.aden())
534 .finish()
535 }
536}
537impl W {
538 #[inline(always)]
540 pub fn aden(&mut self) -> ADEN_W<CRrs> {
541 ADEN_W::new(self, 0)
542 }
543 #[inline(always)]
545 pub fn addis(&mut self) -> ADDIS_W<CRrs> {
546 ADDIS_W::new(self, 1)
547 }
548 #[inline(always)]
550 pub fn adstart(&mut self) -> ADSTART_W<CRrs> {
551 ADSTART_W::new(self, 2)
552 }
553 #[inline(always)]
555 pub fn jadstart(&mut self) -> JADSTART_W<CRrs> {
556 JADSTART_W::new(self, 3)
557 }
558 #[inline(always)]
560 pub fn adstp(&mut self) -> ADSTP_W<CRrs> {
561 ADSTP_W::new(self, 4)
562 }
563 #[inline(always)]
565 pub fn jadstp(&mut self) -> JADSTP_W<CRrs> {
566 JADSTP_W::new(self, 5)
567 }
568 #[inline(always)]
570 pub fn advregen(&mut self) -> ADVREGEN_W<CRrs> {
571 ADVREGEN_W::new(self, 28)
572 }
573 #[inline(always)]
575 pub fn adcaldif(&mut self) -> ADCALDIF_W<CRrs> {
576 ADCALDIF_W::new(self, 30)
577 }
578 #[inline(always)]
580 pub fn adcal(&mut self) -> ADCAL_W<CRrs> {
581 ADCAL_W::new(self, 31)
582 }
583}
584pub struct CRrs;
590impl crate::RegisterSpec for CRrs {
591 type Ux = u32;
592}
593impl crate::Readable for CRrs {}
595impl crate::Writable for CRrs {
597 type Safety = crate::Unsafe;
598 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
599 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x8000_003f;
600}
601impl crate::Resettable for CRrs {
603 const RESET_VALUE: u32 = 0;
604}