ra4w1/agt0/
agtcr.rs

1#[doc = "Register `AGTCR` reader"]
2pub struct R(crate::R<AGTCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<AGTCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<AGTCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<AGTCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `AGTCR` writer"]
17pub struct W(crate::W<AGTCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<AGTCR_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<AGTCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<AGTCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TSTART` reader - AGT count start"]
38pub type TSTART_R = crate::BitReader<TSTART_A>;
39#[doc = "AGT count start\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TSTART_A {
42    #[doc = "0: Count stops"]
43    _0 = 0,
44    #[doc = "1: Count starts."]
45    _1 = 1,
46}
47impl From<TSTART_A> for bool {
48    #[inline(always)]
49    fn from(variant: TSTART_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl TSTART_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> TSTART_A {
57        match self.bits {
58            false => TSTART_A::_0,
59            true => TSTART_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == TSTART_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == TSTART_A::_1
71    }
72}
73#[doc = "Field `TSTART` writer - AGT count start"]
74pub type TSTART_W<'a, const O: u8> = crate::BitWriter<'a, u8, AGTCR_SPEC, TSTART_A, O>;
75impl<'a, const O: u8> TSTART_W<'a, O> {
76    #[doc = "Count stops"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(TSTART_A::_0)
80    }
81    #[doc = "Count starts."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(TSTART_A::_1)
85    }
86}
87#[doc = "Field `TCSTF` reader - AGT count status flag"]
88pub type TCSTF_R = crate::BitReader<TCSTF_A>;
89#[doc = "AGT count status flag\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum TCSTF_A {
92    #[doc = "0: Count stops"]
93    _0 = 0,
94    #[doc = "1: Count in progress."]
95    _1 = 1,
96}
97impl From<TCSTF_A> for bool {
98    #[inline(always)]
99    fn from(variant: TCSTF_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl TCSTF_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> TCSTF_A {
107        match self.bits {
108            false => TCSTF_A::_0,
109            true => TCSTF_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == TCSTF_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == TCSTF_A::_1
121    }
122}
123#[doc = "AGT count forced stop\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum TSTOP_AW {
126    #[doc = "0: Writing is invalid"]
127    _0 = 0,
128    #[doc = "1: The count is forcibly stopped."]
129    _1 = 1,
130}
131impl From<TSTOP_AW> for bool {
132    #[inline(always)]
133    fn from(variant: TSTOP_AW) -> Self {
134        variant as u8 != 0
135    }
136}
137#[doc = "Field `TSTOP` writer - AGT count forced stop"]
138pub type TSTOP_W<'a, const O: u8> = crate::BitWriter<'a, u8, AGTCR_SPEC, TSTOP_AW, O>;
139impl<'a, const O: u8> TSTOP_W<'a, O> {
140    #[doc = "Writing is invalid"]
141    #[inline(always)]
142    pub fn _0(self) -> &'a mut W {
143        self.variant(TSTOP_AW::_0)
144    }
145    #[doc = "The count is forcibly stopped."]
146    #[inline(always)]
147    pub fn _1(self) -> &'a mut W {
148        self.variant(TSTOP_AW::_1)
149    }
150}
151#[doc = "Field `TEDGF` reader - Active edge judgment flag\n\nThe field is **modified** in some way after a read operation."]
152pub type TEDGF_R = crate::BitReader<TEDGF_A>;
153#[doc = "Active edge judgment flag\n\nValue on reset: 0"]
154#[derive(Clone, Copy, Debug, PartialEq, Eq)]
155pub enum TEDGF_A {
156    #[doc = "0: No active edge received"]
157    _0 = 0,
158    #[doc = "1: Active edge received."]
159    _1 = 1,
160}
161impl From<TEDGF_A> for bool {
162    #[inline(always)]
163    fn from(variant: TEDGF_A) -> Self {
164        variant as u8 != 0
165    }
166}
167impl TEDGF_R {
168    #[doc = "Get enumerated values variant"]
169    #[inline(always)]
170    pub fn variant(&self) -> TEDGF_A {
171        match self.bits {
172            false => TEDGF_A::_0,
173            true => TEDGF_A::_1,
174        }
175    }
176    #[doc = "Checks if the value of the field is `_0`"]
177    #[inline(always)]
178    pub fn is_0(&self) -> bool {
179        *self == TEDGF_A::_0
180    }
181    #[doc = "Checks if the value of the field is `_1`"]
182    #[inline(always)]
183    pub fn is_1(&self) -> bool {
184        *self == TEDGF_A::_1
185    }
186}
187#[doc = "Field `TEDGF` writer - Active edge judgment flag"]
188pub type TEDGF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, AGTCR_SPEC, TEDGF_A, O>;
189impl<'a, const O: u8> TEDGF_W<'a, O> {
190    #[doc = "No active edge received"]
191    #[inline(always)]
192    pub fn _0(self) -> &'a mut W {
193        self.variant(TEDGF_A::_0)
194    }
195    #[doc = "Active edge received."]
196    #[inline(always)]
197    pub fn _1(self) -> &'a mut W {
198        self.variant(TEDGF_A::_1)
199    }
200}
201#[doc = "Field `TUNDF` reader - Underflow flag\n\nThe field is **modified** in some way after a read operation."]
202pub type TUNDF_R = crate::BitReader<TUNDF_A>;
203#[doc = "Underflow flag\n\nValue on reset: 0"]
204#[derive(Clone, Copy, Debug, PartialEq, Eq)]
205pub enum TUNDF_A {
206    #[doc = "0: No match"]
207    _0 = 0,
208    #[doc = "1: Match."]
209    _1 = 1,
210}
211impl From<TUNDF_A> for bool {
212    #[inline(always)]
213    fn from(variant: TUNDF_A) -> Self {
214        variant as u8 != 0
215    }
216}
217impl TUNDF_R {
218    #[doc = "Get enumerated values variant"]
219    #[inline(always)]
220    pub fn variant(&self) -> TUNDF_A {
221        match self.bits {
222            false => TUNDF_A::_0,
223            true => TUNDF_A::_1,
224        }
225    }
226    #[doc = "Checks if the value of the field is `_0`"]
227    #[inline(always)]
228    pub fn is_0(&self) -> bool {
229        *self == TUNDF_A::_0
230    }
231    #[doc = "Checks if the value of the field is `_1`"]
232    #[inline(always)]
233    pub fn is_1(&self) -> bool {
234        *self == TUNDF_A::_1
235    }
236}
237#[doc = "Field `TUNDF` writer - Underflow flag"]
238pub type TUNDF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, AGTCR_SPEC, TUNDF_A, O>;
239impl<'a, const O: u8> TUNDF_W<'a, O> {
240    #[doc = "No match"]
241    #[inline(always)]
242    pub fn _0(self) -> &'a mut W {
243        self.variant(TUNDF_A::_0)
244    }
245    #[doc = "Match."]
246    #[inline(always)]
247    pub fn _1(self) -> &'a mut W {
248        self.variant(TUNDF_A::_1)
249    }
250}
251#[doc = "Field `TCMAF` reader - Compare match A flag\n\nThe field is **modified** in some way after a read operation."]
252pub type TCMAF_R = crate::BitReader<TCMAF_A>;
253#[doc = "Compare match A flag\n\nValue on reset: 0"]
254#[derive(Clone, Copy, Debug, PartialEq, Eq)]
255pub enum TCMAF_A {
256    #[doc = "0: No match"]
257    _0 = 0,
258    #[doc = "1: Match."]
259    _1 = 1,
260}
261impl From<TCMAF_A> for bool {
262    #[inline(always)]
263    fn from(variant: TCMAF_A) -> Self {
264        variant as u8 != 0
265    }
266}
267impl TCMAF_R {
268    #[doc = "Get enumerated values variant"]
269    #[inline(always)]
270    pub fn variant(&self) -> TCMAF_A {
271        match self.bits {
272            false => TCMAF_A::_0,
273            true => TCMAF_A::_1,
274        }
275    }
276    #[doc = "Checks if the value of the field is `_0`"]
277    #[inline(always)]
278    pub fn is_0(&self) -> bool {
279        *self == TCMAF_A::_0
280    }
281    #[doc = "Checks if the value of the field is `_1`"]
282    #[inline(always)]
283    pub fn is_1(&self) -> bool {
284        *self == TCMAF_A::_1
285    }
286}
287#[doc = "Field `TCMAF` writer - Compare match A flag"]
288pub type TCMAF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, AGTCR_SPEC, TCMAF_A, O>;
289impl<'a, const O: u8> TCMAF_W<'a, O> {
290    #[doc = "No match"]
291    #[inline(always)]
292    pub fn _0(self) -> &'a mut W {
293        self.variant(TCMAF_A::_0)
294    }
295    #[doc = "Match."]
296    #[inline(always)]
297    pub fn _1(self) -> &'a mut W {
298        self.variant(TCMAF_A::_1)
299    }
300}
301#[doc = "Field `TCMBF` reader - Compare match B flag\n\nThe field is **modified** in some way after a read operation."]
302pub type TCMBF_R = crate::BitReader<TCMBF_A>;
303#[doc = "Compare match B flag\n\nValue on reset: 0"]
304#[derive(Clone, Copy, Debug, PartialEq, Eq)]
305pub enum TCMBF_A {
306    #[doc = "0: No match"]
307    _0 = 0,
308    #[doc = "1: Match."]
309    _1 = 1,
310}
311impl From<TCMBF_A> for bool {
312    #[inline(always)]
313    fn from(variant: TCMBF_A) -> Self {
314        variant as u8 != 0
315    }
316}
317impl TCMBF_R {
318    #[doc = "Get enumerated values variant"]
319    #[inline(always)]
320    pub fn variant(&self) -> TCMBF_A {
321        match self.bits {
322            false => TCMBF_A::_0,
323            true => TCMBF_A::_1,
324        }
325    }
326    #[doc = "Checks if the value of the field is `_0`"]
327    #[inline(always)]
328    pub fn is_0(&self) -> bool {
329        *self == TCMBF_A::_0
330    }
331    #[doc = "Checks if the value of the field is `_1`"]
332    #[inline(always)]
333    pub fn is_1(&self) -> bool {
334        *self == TCMBF_A::_1
335    }
336}
337#[doc = "Field `TCMBF` writer - Compare match B flag"]
338pub type TCMBF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, AGTCR_SPEC, TCMBF_A, O>;
339impl<'a, const O: u8> TCMBF_W<'a, O> {
340    #[doc = "No match"]
341    #[inline(always)]
342    pub fn _0(self) -> &'a mut W {
343        self.variant(TCMBF_A::_0)
344    }
345    #[doc = "Match."]
346    #[inline(always)]
347    pub fn _1(self) -> &'a mut W {
348        self.variant(TCMBF_A::_1)
349    }
350}
351impl R {
352    #[doc = "Bit 0 - AGT count start"]
353    #[inline(always)]
354    pub fn tstart(&self) -> TSTART_R {
355        TSTART_R::new((self.bits & 1) != 0)
356    }
357    #[doc = "Bit 1 - AGT count status flag"]
358    #[inline(always)]
359    pub fn tcstf(&self) -> TCSTF_R {
360        TCSTF_R::new(((self.bits >> 1) & 1) != 0)
361    }
362    #[doc = "Bit 4 - Active edge judgment flag"]
363    #[inline(always)]
364    pub fn tedgf(&self) -> TEDGF_R {
365        TEDGF_R::new(((self.bits >> 4) & 1) != 0)
366    }
367    #[doc = "Bit 5 - Underflow flag"]
368    #[inline(always)]
369    pub fn tundf(&self) -> TUNDF_R {
370        TUNDF_R::new(((self.bits >> 5) & 1) != 0)
371    }
372    #[doc = "Bit 6 - Compare match A flag"]
373    #[inline(always)]
374    pub fn tcmaf(&self) -> TCMAF_R {
375        TCMAF_R::new(((self.bits >> 6) & 1) != 0)
376    }
377    #[doc = "Bit 7 - Compare match B flag"]
378    #[inline(always)]
379    pub fn tcmbf(&self) -> TCMBF_R {
380        TCMBF_R::new(((self.bits >> 7) & 1) != 0)
381    }
382}
383impl W {
384    #[doc = "Bit 0 - AGT count start"]
385    #[inline(always)]
386    #[must_use]
387    pub fn tstart(&mut self) -> TSTART_W<0> {
388        TSTART_W::new(self)
389    }
390    #[doc = "Bit 2 - AGT count forced stop"]
391    #[inline(always)]
392    #[must_use]
393    pub fn tstop(&mut self) -> TSTOP_W<2> {
394        TSTOP_W::new(self)
395    }
396    #[doc = "Bit 4 - Active edge judgment flag"]
397    #[inline(always)]
398    #[must_use]
399    pub fn tedgf(&mut self) -> TEDGF_W<4> {
400        TEDGF_W::new(self)
401    }
402    #[doc = "Bit 5 - Underflow flag"]
403    #[inline(always)]
404    #[must_use]
405    pub fn tundf(&mut self) -> TUNDF_W<5> {
406        TUNDF_W::new(self)
407    }
408    #[doc = "Bit 6 - Compare match A flag"]
409    #[inline(always)]
410    #[must_use]
411    pub fn tcmaf(&mut self) -> TCMAF_W<6> {
412        TCMAF_W::new(self)
413    }
414    #[doc = "Bit 7 - Compare match B flag"]
415    #[inline(always)]
416    #[must_use]
417    pub fn tcmbf(&mut self) -> TCMBF_W<7> {
418        TCMBF_W::new(self)
419    }
420    #[doc = "Writes raw bits to the register."]
421    #[inline(always)]
422    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
423        self.0.bits(bits);
424        self
425    }
426}
427#[doc = "AGT 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 [agtcr](index.html) module"]
428pub struct AGTCR_SPEC;
429impl crate::RegisterSpec for AGTCR_SPEC {
430    type Ux = u8;
431}
432#[doc = "`read()` method returns [agtcr::R](R) reader structure"]
433impl crate::Readable for AGTCR_SPEC {
434    type Reader = R;
435}
436#[doc = "`write(|w| ..)` method takes [agtcr::W](W) writer structure"]
437impl crate::Writable for AGTCR_SPEC {
438    type Writer = W;
439    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0xf0;
440    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
441}
442#[doc = "`reset()` method sets AGTCR to value 0"]
443impl crate::Resettable for AGTCR_SPEC {
444    const RESET_VALUE: Self::Ux = 0;
445}