ra6t2/gpt324/
gtadcmsc.rs

1#[doc = "Register `GTADCMSC` reader"]
2pub struct R(crate::R<GTADCMSC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GTADCMSC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GTADCMSC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GTADCMSC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GTADCMSC` writer"]
17pub struct W(crate::W<GTADCMSC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GTADCMSC_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<GTADCMSC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GTADCMSC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ADCMSC1` reader - A/D Conversion Start Request Compare Match Skipping Counter 1 Count Source Select"]
38pub type ADCMSC1_R = crate::FieldReader<u8, ADCMSC1_A>;
39#[doc = "A/D Conversion Start Request Compare Match Skipping Counter 1 Count Source Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ADCMSC1_A {
43    #[doc = "0: Not counted (not skipped)"]
44    _00 = 0,
45    #[doc = "1: Counting GTADTRA register compare match"]
46    _01 = 1,
47    #[doc = "2: Counting GTADTRB register compare match"]
48    _10 = 2,
49    #[doc = "3: Counting both GTADTRA register compare match and GTADTRB register compare match"]
50    _11 = 3,
51}
52impl From<ADCMSC1_A> for u8 {
53    #[inline(always)]
54    fn from(variant: ADCMSC1_A) -> Self {
55        variant as _
56    }
57}
58impl ADCMSC1_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> ADCMSC1_A {
62        match self.bits {
63            0 => ADCMSC1_A::_00,
64            1 => ADCMSC1_A::_01,
65            2 => ADCMSC1_A::_10,
66            3 => ADCMSC1_A::_11,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `_00`"]
71    #[inline(always)]
72    pub fn is_00(&self) -> bool {
73        *self == ADCMSC1_A::_00
74    }
75    #[doc = "Checks if the value of the field is `_01`"]
76    #[inline(always)]
77    pub fn is_01(&self) -> bool {
78        *self == ADCMSC1_A::_01
79    }
80    #[doc = "Checks if the value of the field is `_10`"]
81    #[inline(always)]
82    pub fn is_10(&self) -> bool {
83        *self == ADCMSC1_A::_10
84    }
85    #[doc = "Checks if the value of the field is `_11`"]
86    #[inline(always)]
87    pub fn is_11(&self) -> bool {
88        *self == ADCMSC1_A::_11
89    }
90}
91#[doc = "Field `ADCMSC1` writer - A/D Conversion Start Request Compare Match Skipping Counter 1 Count Source Select"]
92pub type ADCMSC1_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, GTADCMSC_SPEC, u8, ADCMSC1_A, 2, O>;
94impl<'a, const O: u8> ADCMSC1_W<'a, O> {
95    #[doc = "Not counted (not skipped)"]
96    #[inline(always)]
97    pub fn _00(self) -> &'a mut W {
98        self.variant(ADCMSC1_A::_00)
99    }
100    #[doc = "Counting GTADTRA register compare match"]
101    #[inline(always)]
102    pub fn _01(self) -> &'a mut W {
103        self.variant(ADCMSC1_A::_01)
104    }
105    #[doc = "Counting GTADTRB register compare match"]
106    #[inline(always)]
107    pub fn _10(self) -> &'a mut W {
108        self.variant(ADCMSC1_A::_10)
109    }
110    #[doc = "Counting both GTADTRA register compare match and GTADTRB register compare match"]
111    #[inline(always)]
112    pub fn _11(self) -> &'a mut W {
113        self.variant(ADCMSC1_A::_11)
114    }
115}
116#[doc = "Field `ADCMST1` reader - A/D Conversion Start Request Compare Match Skipping 1 Skipping Count Setting"]
117pub type ADCMST1_R = crate::FieldReader<u8, u8>;
118#[doc = "Field `ADCMST1` writer - A/D Conversion Start Request Compare Match Skipping 1 Skipping Count Setting"]
119pub type ADCMST1_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTADCMSC_SPEC, u8, u8, 4, O>;
120#[doc = "Field `ADCMSCNT1IV` reader - A/D Conversion Start Request Compare Match Skipping Counter 1 Initial Value"]
121pub type ADCMSCNT1IV_R = crate::FieldReader<u8, u8>;
122#[doc = "Field `ADCMSCNT1IV` writer - A/D Conversion Start Request Compare Match Skipping Counter 1 Initial Value"]
123pub type ADCMSCNT1IV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTADCMSC_SPEC, u8, u8, 4, O>;
124#[doc = "Field `ADCMSCNT1` reader - A/D Conversion Start Request Compare Match Skipping Counter 1"]
125pub type ADCMSCNT1_R = crate::FieldReader<u8, u8>;
126#[doc = "Field `ADCMSC2` reader - A/D Conversion Start Request Compare Match Skipping Counter 2 Count Source Select"]
127pub type ADCMSC2_R = crate::FieldReader<u8, ADCMSC2_A>;
128#[doc = "A/D Conversion Start Request Compare Match Skipping Counter 2 Count Source Select\n\nValue on reset: 0"]
129#[derive(Clone, Copy, Debug, PartialEq, Eq)]
130#[repr(u8)]
131pub enum ADCMSC2_A {
132    #[doc = "0: Not counted (not skipped)"]
133    _00 = 0,
134    #[doc = "1: Counting GTADTRA register compare match"]
135    _01 = 1,
136    #[doc = "2: Counting GTADTRB register compare match"]
137    _10 = 2,
138    #[doc = "3: Counting both GTADTRA register compare match and GTADTRB register compare match"]
139    _11 = 3,
140}
141impl From<ADCMSC2_A> for u8 {
142    #[inline(always)]
143    fn from(variant: ADCMSC2_A) -> Self {
144        variant as _
145    }
146}
147impl ADCMSC2_R {
148    #[doc = "Get enumerated values variant"]
149    #[inline(always)]
150    pub fn variant(&self) -> ADCMSC2_A {
151        match self.bits {
152            0 => ADCMSC2_A::_00,
153            1 => ADCMSC2_A::_01,
154            2 => ADCMSC2_A::_10,
155            3 => ADCMSC2_A::_11,
156            _ => unreachable!(),
157        }
158    }
159    #[doc = "Checks if the value of the field is `_00`"]
160    #[inline(always)]
161    pub fn is_00(&self) -> bool {
162        *self == ADCMSC2_A::_00
163    }
164    #[doc = "Checks if the value of the field is `_01`"]
165    #[inline(always)]
166    pub fn is_01(&self) -> bool {
167        *self == ADCMSC2_A::_01
168    }
169    #[doc = "Checks if the value of the field is `_10`"]
170    #[inline(always)]
171    pub fn is_10(&self) -> bool {
172        *self == ADCMSC2_A::_10
173    }
174    #[doc = "Checks if the value of the field is `_11`"]
175    #[inline(always)]
176    pub fn is_11(&self) -> bool {
177        *self == ADCMSC2_A::_11
178    }
179}
180#[doc = "Field `ADCMSC2` writer - A/D Conversion Start Request Compare Match Skipping Counter 2 Count Source Select"]
181pub type ADCMSC2_W<'a, const O: u8> =
182    crate::FieldWriterSafe<'a, u32, GTADCMSC_SPEC, u8, ADCMSC2_A, 2, O>;
183impl<'a, const O: u8> ADCMSC2_W<'a, O> {
184    #[doc = "Not counted (not skipped)"]
185    #[inline(always)]
186    pub fn _00(self) -> &'a mut W {
187        self.variant(ADCMSC2_A::_00)
188    }
189    #[doc = "Counting GTADTRA register compare match"]
190    #[inline(always)]
191    pub fn _01(self) -> &'a mut W {
192        self.variant(ADCMSC2_A::_01)
193    }
194    #[doc = "Counting GTADTRB register compare match"]
195    #[inline(always)]
196    pub fn _10(self) -> &'a mut W {
197        self.variant(ADCMSC2_A::_10)
198    }
199    #[doc = "Counting both GTADTRA register compare match and GTADTRB register compare match"]
200    #[inline(always)]
201    pub fn _11(self) -> &'a mut W {
202        self.variant(ADCMSC2_A::_11)
203    }
204}
205#[doc = "Field `ADCMST2` reader - A/D Conversion Start Request Compare Match Skipping 2 Skipping Count Setting"]
206pub type ADCMST2_R = crate::FieldReader<u8, u8>;
207#[doc = "Field `ADCMST2` writer - A/D Conversion Start Request Compare Match Skipping 2 Skipping Count Setting"]
208pub type ADCMST2_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTADCMSC_SPEC, u8, u8, 4, O>;
209#[doc = "Field `ADCMSCNT2IV` reader - A/D Conversion Start Request Compare Match Skipping Counter 2 Initial Value"]
210pub type ADCMSCNT2IV_R = crate::FieldReader<u8, u8>;
211#[doc = "Field `ADCMSCNT2IV` writer - A/D Conversion Start Request Compare Match Skipping Counter 2 Initial Value"]
212pub type ADCMSCNT2IV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTADCMSC_SPEC, u8, u8, 4, O>;
213#[doc = "Field `ADCMSCNT2` reader - A/D Conversion Start Request Compare Match Skipping Counter 2"]
214pub type ADCMSCNT2_R = crate::FieldReader<u8, u8>;
215impl R {
216    #[doc = "Bits 0:1 - A/D Conversion Start Request Compare Match Skipping Counter 1 Count Source Select"]
217    #[inline(always)]
218    pub fn adcmsc1(&self) -> ADCMSC1_R {
219        ADCMSC1_R::new((self.bits & 3) as u8)
220    }
221    #[doc = "Bits 4:7 - A/D Conversion Start Request Compare Match Skipping 1 Skipping Count Setting"]
222    #[inline(always)]
223    pub fn adcmst1(&self) -> ADCMST1_R {
224        ADCMST1_R::new(((self.bits >> 4) & 0x0f) as u8)
225    }
226    #[doc = "Bits 8:11 - A/D Conversion Start Request Compare Match Skipping Counter 1 Initial Value"]
227    #[inline(always)]
228    pub fn adcmscnt1iv(&self) -> ADCMSCNT1IV_R {
229        ADCMSCNT1IV_R::new(((self.bits >> 8) & 0x0f) as u8)
230    }
231    #[doc = "Bits 12:15 - A/D Conversion Start Request Compare Match Skipping Counter 1"]
232    #[inline(always)]
233    pub fn adcmscnt1(&self) -> ADCMSCNT1_R {
234        ADCMSCNT1_R::new(((self.bits >> 12) & 0x0f) as u8)
235    }
236    #[doc = "Bits 16:17 - A/D Conversion Start Request Compare Match Skipping Counter 2 Count Source Select"]
237    #[inline(always)]
238    pub fn adcmsc2(&self) -> ADCMSC2_R {
239        ADCMSC2_R::new(((self.bits >> 16) & 3) as u8)
240    }
241    #[doc = "Bits 20:23 - A/D Conversion Start Request Compare Match Skipping 2 Skipping Count Setting"]
242    #[inline(always)]
243    pub fn adcmst2(&self) -> ADCMST2_R {
244        ADCMST2_R::new(((self.bits >> 20) & 0x0f) as u8)
245    }
246    #[doc = "Bits 24:27 - A/D Conversion Start Request Compare Match Skipping Counter 2 Initial Value"]
247    #[inline(always)]
248    pub fn adcmscnt2iv(&self) -> ADCMSCNT2IV_R {
249        ADCMSCNT2IV_R::new(((self.bits >> 24) & 0x0f) as u8)
250    }
251    #[doc = "Bits 28:31 - A/D Conversion Start Request Compare Match Skipping Counter 2"]
252    #[inline(always)]
253    pub fn adcmscnt2(&self) -> ADCMSCNT2_R {
254        ADCMSCNT2_R::new(((self.bits >> 28) & 0x0f) as u8)
255    }
256}
257impl W {
258    #[doc = "Bits 0:1 - A/D Conversion Start Request Compare Match Skipping Counter 1 Count Source Select"]
259    #[inline(always)]
260    #[must_use]
261    pub fn adcmsc1(&mut self) -> ADCMSC1_W<0> {
262        ADCMSC1_W::new(self)
263    }
264    #[doc = "Bits 4:7 - A/D Conversion Start Request Compare Match Skipping 1 Skipping Count Setting"]
265    #[inline(always)]
266    #[must_use]
267    pub fn adcmst1(&mut self) -> ADCMST1_W<4> {
268        ADCMST1_W::new(self)
269    }
270    #[doc = "Bits 8:11 - A/D Conversion Start Request Compare Match Skipping Counter 1 Initial Value"]
271    #[inline(always)]
272    #[must_use]
273    pub fn adcmscnt1iv(&mut self) -> ADCMSCNT1IV_W<8> {
274        ADCMSCNT1IV_W::new(self)
275    }
276    #[doc = "Bits 16:17 - A/D Conversion Start Request Compare Match Skipping Counter 2 Count Source Select"]
277    #[inline(always)]
278    #[must_use]
279    pub fn adcmsc2(&mut self) -> ADCMSC2_W<16> {
280        ADCMSC2_W::new(self)
281    }
282    #[doc = "Bits 20:23 - A/D Conversion Start Request Compare Match Skipping 2 Skipping Count Setting"]
283    #[inline(always)]
284    #[must_use]
285    pub fn adcmst2(&mut self) -> ADCMST2_W<20> {
286        ADCMST2_W::new(self)
287    }
288    #[doc = "Bits 24:27 - A/D Conversion Start Request Compare Match Skipping Counter 2 Initial Value"]
289    #[inline(always)]
290    #[must_use]
291    pub fn adcmscnt2iv(&mut self) -> ADCMSCNT2IV_W<24> {
292        ADCMSCNT2IV_W::new(self)
293    }
294    #[doc = "Writes raw bits to the register."]
295    #[inline(always)]
296    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
297        self.0.bits(bits);
298        self
299    }
300}
301#[doc = "General PWM Timer A/D Conversion Start Request Compare Match Skipping Control Register\n\nThis 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).\n\nFor information about available fields see [gtadcmsc](index.html) module"]
302pub struct GTADCMSC_SPEC;
303impl crate::RegisterSpec for GTADCMSC_SPEC {
304    type Ux = u32;
305}
306#[doc = "`read()` method returns [gtadcmsc::R](R) reader structure"]
307impl crate::Readable for GTADCMSC_SPEC {
308    type Reader = R;
309}
310#[doc = "`write(|w| ..)` method takes [gtadcmsc::W](W) writer structure"]
311impl crate::Writable for GTADCMSC_SPEC {
312    type Writer = W;
313    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
314    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
315}
316#[doc = "`reset()` method sets GTADCMSC to value 0"]
317impl crate::Resettable for GTADCMSC_SPEC {
318    const RESET_VALUE: Self::Ux = 0;
319}