ra6m2/port1/
pcntr4.rs

1#[doc = "Register `PCNTR4` reader"]
2pub struct R(crate::R<PCNTR4_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PCNTR4_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PCNTR4_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PCNTR4_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PCNTR4` writer"]
17pub struct W(crate::W<PCNTR4_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PCNTR4_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<PCNTR4_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PCNTR4_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EOSR` reader - Pmn Event Output Set"]
38pub type EOSR_R = crate::FieldReader<u16, EOSR_A>;
39#[doc = "Pmn Event Output Set\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum EOSR_A {
43    #[doc = "0: No affect to output"]
44    _0 = 0,
45    #[doc = "1: High output."]
46    _1 = 1,
47}
48impl From<EOSR_A> for u16 {
49    #[inline(always)]
50    fn from(variant: EOSR_A) -> Self {
51        variant as _
52    }
53}
54impl EOSR_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<EOSR_A> {
58        match self.bits {
59            0 => Some(EOSR_A::_0),
60            1 => Some(EOSR_A::_1),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `_0`"]
65    #[inline(always)]
66    pub fn is_0(&self) -> bool {
67        *self == EOSR_A::_0
68    }
69    #[doc = "Checks if the value of the field is `_1`"]
70    #[inline(always)]
71    pub fn is_1(&self) -> bool {
72        *self == EOSR_A::_1
73    }
74}
75#[doc = "Field `EOSR` writer - Pmn Event Output Set"]
76pub type EOSR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PCNTR4_SPEC, u16, EOSR_A, 16, O>;
77impl<'a, const O: u8> EOSR_W<'a, O> {
78    #[doc = "No affect to output"]
79    #[inline(always)]
80    pub fn _0(self) -> &'a mut W {
81        self.variant(EOSR_A::_0)
82    }
83    #[doc = "High output."]
84    #[inline(always)]
85    pub fn _1(self) -> &'a mut W {
86        self.variant(EOSR_A::_1)
87    }
88}
89#[doc = "Field `EORR` reader - Pmn Event Output Reset"]
90pub type EORR_R = crate::FieldReader<u16, EORR_A>;
91#[doc = "Pmn Event Output Reset\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u16)]
94pub enum EORR_A {
95    #[doc = "0: No affect to output"]
96    _0 = 0,
97    #[doc = "1: Low output"]
98    _1 = 1,
99}
100impl From<EORR_A> for u16 {
101    #[inline(always)]
102    fn from(variant: EORR_A) -> Self {
103        variant as _
104    }
105}
106impl EORR_R {
107    #[doc = "Get enumerated values variant"]
108    #[inline(always)]
109    pub fn variant(&self) -> Option<EORR_A> {
110        match self.bits {
111            0 => Some(EORR_A::_0),
112            1 => Some(EORR_A::_1),
113            _ => None,
114        }
115    }
116    #[doc = "Checks if the value of the field is `_0`"]
117    #[inline(always)]
118    pub fn is_0(&self) -> bool {
119        *self == EORR_A::_0
120    }
121    #[doc = "Checks if the value of the field is `_1`"]
122    #[inline(always)]
123    pub fn is_1(&self) -> bool {
124        *self == EORR_A::_1
125    }
126}
127#[doc = "Field `EORR` writer - Pmn Event Output Reset"]
128pub type EORR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PCNTR4_SPEC, u16, EORR_A, 16, O>;
129impl<'a, const O: u8> EORR_W<'a, O> {
130    #[doc = "No affect to output"]
131    #[inline(always)]
132    pub fn _0(self) -> &'a mut W {
133        self.variant(EORR_A::_0)
134    }
135    #[doc = "Low output"]
136    #[inline(always)]
137    pub fn _1(self) -> &'a mut W {
138        self.variant(EORR_A::_1)
139    }
140}
141impl R {
142    #[doc = "Bits 0:15 - Pmn Event Output Set"]
143    #[inline(always)]
144    pub fn eosr(&self) -> EOSR_R {
145        EOSR_R::new((self.bits & 0xffff) as u16)
146    }
147    #[doc = "Bits 16:31 - Pmn Event Output Reset"]
148    #[inline(always)]
149    pub fn eorr(&self) -> EORR_R {
150        EORR_R::new(((self.bits >> 16) & 0xffff) as u16)
151    }
152}
153impl W {
154    #[doc = "Bits 0:15 - Pmn Event Output Set"]
155    #[inline(always)]
156    #[must_use]
157    pub fn eosr(&mut self) -> EOSR_W<0> {
158        EOSR_W::new(self)
159    }
160    #[doc = "Bits 16:31 - Pmn Event Output Reset"]
161    #[inline(always)]
162    #[must_use]
163    pub fn eorr(&mut self) -> EORR_W<16> {
164        EORR_W::new(self)
165    }
166    #[doc = "Writes raw bits to the register."]
167    #[inline(always)]
168    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169        self.0.bits(bits);
170        self
171    }
172}
173#[doc = "Port Control Register 4\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 [pcntr4](index.html) module"]
174pub struct PCNTR4_SPEC;
175impl crate::RegisterSpec for PCNTR4_SPEC {
176    type Ux = u32;
177}
178#[doc = "`read()` method returns [pcntr4::R](R) reader structure"]
179impl crate::Readable for PCNTR4_SPEC {
180    type Reader = R;
181}
182#[doc = "`write(|w| ..)` method takes [pcntr4::W](W) writer structure"]
183impl crate::Writable for PCNTR4_SPEC {
184    type Writer = W;
185    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
186    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
187}
188#[doc = "`reset()` method sets PCNTR4 to value 0"]
189impl crate::Resettable for PCNTR4_SPEC {
190    const RESET_VALUE: Self::Ux = 0;
191}