py32f0/py32f040/adc/
jsqr.rs

1///Register `JSQR` reader
2pub struct R(crate::R<JSQR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<JSQR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<JSQR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<JSQR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16///Register `JSQR` writer
17pub struct W(crate::W<JSQR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<JSQR_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<JSQR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<JSQR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37///Field `JSQ1` reader - desc JSQ1
38pub type JSQ1_R = crate::FieldReader<u8, u8>;
39///Field `JSQ1` writer - desc JSQ1
40pub type JSQ1_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
41///Field `JSQ2` reader - desc JSQ2
42pub type JSQ2_R = crate::FieldReader<u8, u8>;
43///Field `JSQ2` writer - desc JSQ2
44pub type JSQ2_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
45///Field `JSQ3` reader - desc JSQ3
46pub type JSQ3_R = crate::FieldReader<u8, u8>;
47///Field `JSQ3` writer - desc JSQ3
48pub type JSQ3_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
49///Field `JSQ4` reader - desc JSQ4
50pub type JSQ4_R = crate::FieldReader<u8, u8>;
51///Field `JSQ4` writer - desc JSQ4
52pub type JSQ4_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
53///Field `JL` reader - desc JL
54pub type JL_R = crate::FieldReader<u8, JL_A>;
55/**desc JL
56
57Value on reset: 0*/
58#[derive(Clone, Copy, Debug, PartialEq, Eq)]
59#[repr(u8)]
60pub enum JL_A {
61    ///0: 1 Conversion
62    Conversion1 = 0,
63    ///1: 2 Transitions
64    Transition2 = 1,
65    ///2: 3 Conversions
66    Conversion3 = 2,
67    ///3: 4 Transitions
68    Transition4 = 3,
69}
70impl From<JL_A> for u8 {
71    #[inline(always)]
72    fn from(variant: JL_A) -> Self {
73        variant as _
74    }
75}
76impl JL_R {
77    ///Get enumerated values variant
78    #[inline(always)]
79    pub fn variant(&self) -> Option<JL_A> {
80        match self.bits {
81            0 => Some(JL_A::Conversion1),
82            1 => Some(JL_A::Transition2),
83            2 => Some(JL_A::Conversion3),
84            3 => Some(JL_A::Transition4),
85            _ => None,
86        }
87    }
88    ///Checks if the value of the field is `Conversion1`
89    #[inline(always)]
90    pub fn is_conversion1(&self) -> bool {
91        *self == JL_A::Conversion1
92    }
93    ///Checks if the value of the field is `Transition2`
94    #[inline(always)]
95    pub fn is_transition2(&self) -> bool {
96        *self == JL_A::Transition2
97    }
98    ///Checks if the value of the field is `Conversion3`
99    #[inline(always)]
100    pub fn is_conversion3(&self) -> bool {
101        *self == JL_A::Conversion3
102    }
103    ///Checks if the value of the field is `Transition4`
104    #[inline(always)]
105    pub fn is_transition4(&self) -> bool {
106        *self == JL_A::Transition4
107    }
108}
109///Field `JL` writer - desc JL
110pub type JL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, JSQR_SPEC, u8, JL_A, 4, O>;
111impl<'a, const O: u8> JL_W<'a, O> {
112    ///1 Conversion
113    #[inline(always)]
114    pub fn conversion1(self) -> &'a mut W {
115        self.variant(JL_A::Conversion1)
116    }
117    ///2 Transitions
118    #[inline(always)]
119    pub fn transition2(self) -> &'a mut W {
120        self.variant(JL_A::Transition2)
121    }
122    ///3 Conversions
123    #[inline(always)]
124    pub fn conversion3(self) -> &'a mut W {
125        self.variant(JL_A::Conversion3)
126    }
127    ///4 Transitions
128    #[inline(always)]
129    pub fn transition4(self) -> &'a mut W {
130        self.variant(JL_A::Transition4)
131    }
132}
133impl R {
134    ///Bits 0:4 - desc JSQ1
135    #[inline(always)]
136    pub fn jsq1(&self) -> JSQ1_R {
137        JSQ1_R::new((self.bits & 0x1f) as u8)
138    }
139    ///Bits 5:9 - desc JSQ2
140    #[inline(always)]
141    pub fn jsq2(&self) -> JSQ2_R {
142        JSQ2_R::new(((self.bits >> 5) & 0x1f) as u8)
143    }
144    ///Bits 10:14 - desc JSQ3
145    #[inline(always)]
146    pub fn jsq3(&self) -> JSQ3_R {
147        JSQ3_R::new(((self.bits >> 10) & 0x1f) as u8)
148    }
149    ///Bits 15:19 - desc JSQ4
150    #[inline(always)]
151    pub fn jsq4(&self) -> JSQ4_R {
152        JSQ4_R::new(((self.bits >> 15) & 0x1f) as u8)
153    }
154    ///Bits 20:23 - desc JL
155    #[inline(always)]
156    pub fn jl(&self) -> JL_R {
157        JL_R::new(((self.bits >> 20) & 0x0f) as u8)
158    }
159}
160impl W {
161    ///Bits 0:4 - desc JSQ1
162    #[inline(always)]
163    #[must_use]
164    pub fn jsq1(&mut self) -> JSQ1_W<0> {
165        JSQ1_W::new(self)
166    }
167    ///Bits 5:9 - desc JSQ2
168    #[inline(always)]
169    #[must_use]
170    pub fn jsq2(&mut self) -> JSQ2_W<5> {
171        JSQ2_W::new(self)
172    }
173    ///Bits 10:14 - desc JSQ3
174    #[inline(always)]
175    #[must_use]
176    pub fn jsq3(&mut self) -> JSQ3_W<10> {
177        JSQ3_W::new(self)
178    }
179    ///Bits 15:19 - desc JSQ4
180    #[inline(always)]
181    #[must_use]
182    pub fn jsq4(&mut self) -> JSQ4_W<15> {
183        JSQ4_W::new(self)
184    }
185    ///Bits 20:23 - desc JL
186    #[inline(always)]
187    #[must_use]
188    pub fn jl(&mut self) -> JL_W<20> {
189        JL_W::new(self)
190    }
191    ///Writes raw bits to the register.
192    #[inline(always)]
193    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
194        self.0.bits(bits);
195        self
196    }
197}
198/**desc JSQR
199
200This register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).
201
202For information about available fields see [jsqr](index.html) module*/
203pub struct JSQR_SPEC;
204impl crate::RegisterSpec for JSQR_SPEC {
205    type Ux = u32;
206}
207///`read()` method returns [jsqr::R](R) reader structure
208impl crate::Readable for JSQR_SPEC {
209    type Reader = R;
210}
211///`write(|w| ..)` method takes [jsqr::W](W) writer structure
212impl crate::Writable for JSQR_SPEC {
213    type Writer = W;
214    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
215    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
216}
217///`reset()` method sets JSQR to value 0
218impl crate::Resettable for JSQR_SPEC {
219    const RESET_VALUE: Self::Ux = 0;
220}