stm32l4/stm32l4x1/dfsdm/ch/
awscdr.rs

1///Register `AWSCDR` reader
2pub type R = crate::R<AWSCDRrs>;
3///Register `AWSCDR` writer
4pub type W = crate::W<AWSCDRrs>;
5///Field `SCDT` reader - SCDT
6pub type SCDT_R = crate::FieldReader;
7///Field `SCDT` writer - SCDT
8pub type SCDT_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
9///Field `BKSCD` reader - BKSCD
10pub type BKSCD_R = crate::FieldReader;
11///Field `BKSCD` writer - BKSCD
12pub type BKSCD_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
13///Field `AWFOSR` reader - AWFOSR
14pub type AWFOSR_R = crate::FieldReader;
15///Field `AWFOSR` writer - AWFOSR
16pub type AWFOSR_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
17/**AWFORD
18
19Value on reset: 0*/
20#[cfg_attr(feature = "defmt", derive(defmt::Format))]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22#[repr(u8)]
23pub enum AWFORD {
24    ///0: FastSinc filter type
25    FastSinc = 0,
26    ///1: Sinc1 filter type
27    Sinc1 = 1,
28    ///2: Sinc2 filter type
29    Sinc2 = 2,
30    ///3: Sinc3 filter type
31    Sinc3 = 3,
32}
33impl From<AWFORD> for u8 {
34    #[inline(always)]
35    fn from(variant: AWFORD) -> Self {
36        variant as _
37    }
38}
39impl crate::FieldSpec for AWFORD {
40    type Ux = u8;
41}
42impl crate::IsEnum for AWFORD {}
43///Field `AWFORD` reader - AWFORD
44pub type AWFORD_R = crate::FieldReader<AWFORD>;
45impl AWFORD_R {
46    ///Get enumerated values variant
47    #[inline(always)]
48    pub const fn variant(&self) -> AWFORD {
49        match self.bits {
50            0 => AWFORD::FastSinc,
51            1 => AWFORD::Sinc1,
52            2 => AWFORD::Sinc2,
53            3 => AWFORD::Sinc3,
54            _ => unreachable!(),
55        }
56    }
57    ///FastSinc filter type
58    #[inline(always)]
59    pub fn is_fast_sinc(&self) -> bool {
60        *self == AWFORD::FastSinc
61    }
62    ///Sinc1 filter type
63    #[inline(always)]
64    pub fn is_sinc1(&self) -> bool {
65        *self == AWFORD::Sinc1
66    }
67    ///Sinc2 filter type
68    #[inline(always)]
69    pub fn is_sinc2(&self) -> bool {
70        *self == AWFORD::Sinc2
71    }
72    ///Sinc3 filter type
73    #[inline(always)]
74    pub fn is_sinc3(&self) -> bool {
75        *self == AWFORD::Sinc3
76    }
77}
78///Field `AWFORD` writer - AWFORD
79pub type AWFORD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, AWFORD, crate::Safe>;
80impl<'a, REG> AWFORD_W<'a, REG>
81where
82    REG: crate::Writable + crate::RegisterSpec,
83    REG::Ux: From<u8>,
84{
85    ///FastSinc filter type
86    #[inline(always)]
87    pub fn fast_sinc(self) -> &'a mut crate::W<REG> {
88        self.variant(AWFORD::FastSinc)
89    }
90    ///Sinc1 filter type
91    #[inline(always)]
92    pub fn sinc1(self) -> &'a mut crate::W<REG> {
93        self.variant(AWFORD::Sinc1)
94    }
95    ///Sinc2 filter type
96    #[inline(always)]
97    pub fn sinc2(self) -> &'a mut crate::W<REG> {
98        self.variant(AWFORD::Sinc2)
99    }
100    ///Sinc3 filter type
101    #[inline(always)]
102    pub fn sinc3(self) -> &'a mut crate::W<REG> {
103        self.variant(AWFORD::Sinc3)
104    }
105}
106impl R {
107    ///Bits 0:7 - SCDT
108    #[inline(always)]
109    pub fn scdt(&self) -> SCDT_R {
110        SCDT_R::new((self.bits & 0xff) as u8)
111    }
112    ///Bits 12:15 - BKSCD
113    #[inline(always)]
114    pub fn bkscd(&self) -> BKSCD_R {
115        BKSCD_R::new(((self.bits >> 12) & 0x0f) as u8)
116    }
117    ///Bits 16:20 - AWFOSR
118    #[inline(always)]
119    pub fn awfosr(&self) -> AWFOSR_R {
120        AWFOSR_R::new(((self.bits >> 16) & 0x1f) as u8)
121    }
122    ///Bits 22:23 - AWFORD
123    #[inline(always)]
124    pub fn awford(&self) -> AWFORD_R {
125        AWFORD_R::new(((self.bits >> 22) & 3) as u8)
126    }
127}
128impl core::fmt::Debug for R {
129    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
130        f.debug_struct("AWSCDR")
131            .field("awford", &self.awford())
132            .field("awfosr", &self.awfosr())
133            .field("bkscd", &self.bkscd())
134            .field("scdt", &self.scdt())
135            .finish()
136    }
137}
138impl W {
139    ///Bits 0:7 - SCDT
140    #[inline(always)]
141    pub fn scdt(&mut self) -> SCDT_W<AWSCDRrs> {
142        SCDT_W::new(self, 0)
143    }
144    ///Bits 12:15 - BKSCD
145    #[inline(always)]
146    pub fn bkscd(&mut self) -> BKSCD_W<AWSCDRrs> {
147        BKSCD_W::new(self, 12)
148    }
149    ///Bits 16:20 - AWFOSR
150    #[inline(always)]
151    pub fn awfosr(&mut self) -> AWFOSR_W<AWSCDRrs> {
152        AWFOSR_W::new(self, 16)
153    }
154    ///Bits 22:23 - AWFORD
155    #[inline(always)]
156    pub fn awford(&mut self) -> AWFORD_W<AWSCDRrs> {
157        AWFORD_W::new(self, 22)
158    }
159}
160/**analog watchdog and short-circuit detector register
161
162You can [`read`](crate::Reg::read) this register and get [`awscdr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`awscdr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
163pub struct AWSCDRrs;
164impl crate::RegisterSpec for AWSCDRrs {
165    type Ux = u32;
166}
167///`read()` method returns [`awscdr::R`](R) reader structure
168impl crate::Readable for AWSCDRrs {}
169///`write(|w| ..)` method takes [`awscdr::W`](W) writer structure
170impl crate::Writable for AWSCDRrs {
171    type Safety = crate::Unsafe;
172}
173///`reset()` method sets AWSCDR to value 0
174impl crate::Resettable for AWSCDRrs {}