stm32h7_staging/common/adc2/b07460bc/
pcsel.rs1pub type R = crate::R<PCSELrs>;
3pub type W = crate::W<PCSELrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u32)]
11pub enum PCSEL {
12 NotPreselected = 0,
14 Preselected = 1,
16}
17impl From<PCSEL> for u32 {
18 #[inline(always)]
19 fn from(variant: PCSEL) -> Self {
20 variant as _
21 }
22}
23impl crate::FieldSpec for PCSEL {
24 type Ux = u32;
25}
26impl crate::IsEnum for PCSEL {}
27pub type PCSEL_R = crate::FieldReader<PCSEL>;
29impl PCSEL_R {
30 #[inline(always)]
32 pub const fn variant(&self) -> Option<PCSEL> {
33 match self.bits {
34 0 => Some(PCSEL::NotPreselected),
35 1 => Some(PCSEL::Preselected),
36 _ => None,
37 }
38 }
39 #[inline(always)]
41 pub fn is_not_preselected(&self) -> bool {
42 *self == PCSEL::NotPreselected
43 }
44 #[inline(always)]
46 pub fn is_preselected(&self) -> bool {
47 *self == PCSEL::Preselected
48 }
49}
50pub type PCSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 20, PCSEL>;
52impl<'a, REG> PCSEL_W<'a, REG>
53where
54 REG: crate::Writable + crate::RegisterSpec,
55 REG::Ux: From<u32>,
56{
57 #[inline(always)]
59 pub fn not_preselected(self) -> &'a mut crate::W<REG> {
60 self.variant(PCSEL::NotPreselected)
61 }
62 #[inline(always)]
64 pub fn preselected(self) -> &'a mut crate::W<REG> {
65 self.variant(PCSEL::Preselected)
66 }
67}
68impl R {
69 #[inline(always)]
71 pub fn pcsel(&self) -> PCSEL_R {
72 PCSEL_R::new(self.bits & 0x000f_ffff)
73 }
74}
75impl core::fmt::Debug for R {
76 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
77 f.debug_struct("PCSEL").field("pcsel", &self.pcsel()).finish()
78 }
79}
80impl W {
81 #[inline(always)]
83 pub fn pcsel(&mut self) -> PCSEL_W<PCSELrs> {
84 PCSEL_W::new(self, 0)
85 }
86}
87pub struct PCSELrs;
91impl crate::RegisterSpec for PCSELrs {
92 type Ux = u32;
93}
94impl crate::Readable for PCSELrs {}
96impl crate::Writable for PCSELrs {
98 type Safety = crate::Unsafe;
99 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
100 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
101}
102impl crate::Resettable for PCSELrs {
104 const RESET_VALUE: u32 = 0;
105}