lpc82x_pac/pint/
pmctrl.rs1#[doc = "Register `PMCTRL` reader"]
2pub struct R(crate::R<PMCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PMCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PMCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PMCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PMCTRL` writer"]
17pub struct W(crate::W<PMCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PMCTRL_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<PMCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PMCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function.\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum SEL_PMATCH_A {
40 #[doc = "0: Pin interrupt. Interrupts are driven in response to the standard pin interrupt function."]
41 PIN_INTERRUPT = 0,
42 #[doc = "1: Pattern match. Interrupts are driven in response to pattern matches."]
43 PATTERN_MATCH = 1,
44}
45impl From<SEL_PMATCH_A> for bool {
46 #[inline(always)]
47 fn from(variant: SEL_PMATCH_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `SEL_PMATCH` reader - Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function."]
52pub struct SEL_PMATCH_R(crate::FieldReader<bool, SEL_PMATCH_A>);
53impl SEL_PMATCH_R {
54 pub(crate) fn new(bits: bool) -> Self {
55 SEL_PMATCH_R(crate::FieldReader::new(bits))
56 }
57 #[doc = r"Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> SEL_PMATCH_A {
60 match self.bits {
61 false => SEL_PMATCH_A::PIN_INTERRUPT,
62 true => SEL_PMATCH_A::PATTERN_MATCH,
63 }
64 }
65 #[doc = "Checks if the value of the field is `PIN_INTERRUPT`"]
66 #[inline(always)]
67 pub fn is_pin_interrupt(&self) -> bool {
68 **self == SEL_PMATCH_A::PIN_INTERRUPT
69 }
70 #[doc = "Checks if the value of the field is `PATTERN_MATCH`"]
71 #[inline(always)]
72 pub fn is_pattern_match(&self) -> bool {
73 **self == SEL_PMATCH_A::PATTERN_MATCH
74 }
75}
76impl core::ops::Deref for SEL_PMATCH_R {
77 type Target = crate::FieldReader<bool, SEL_PMATCH_A>;
78 #[inline(always)]
79 fn deref(&self) -> &Self::Target {
80 &self.0
81 }
82}
83#[doc = "Field `SEL_PMATCH` writer - Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function."]
84pub struct SEL_PMATCH_W<'a> {
85 w: &'a mut W,
86}
87impl<'a> SEL_PMATCH_W<'a> {
88 #[doc = r"Writes `variant` to the field"]
89 #[inline(always)]
90 pub fn variant(self, variant: SEL_PMATCH_A) -> &'a mut W {
91 self.bit(variant.into())
92 }
93 #[doc = "Pin interrupt. Interrupts are driven in response to the standard pin interrupt function."]
94 #[inline(always)]
95 pub fn pin_interrupt(self) -> &'a mut W {
96 self.variant(SEL_PMATCH_A::PIN_INTERRUPT)
97 }
98 #[doc = "Pattern match. Interrupts are driven in response to pattern matches."]
99 #[inline(always)]
100 pub fn pattern_match(self) -> &'a mut W {
101 self.variant(SEL_PMATCH_A::PATTERN_MATCH)
102 }
103 #[doc = r"Sets the field bit"]
104 #[inline(always)]
105 pub fn set_bit(self) -> &'a mut W {
106 self.bit(true)
107 }
108 #[doc = r"Clears the field bit"]
109 #[inline(always)]
110 pub fn clear_bit(self) -> &'a mut W {
111 self.bit(false)
112 }
113 #[doc = r"Writes raw bits to the field"]
114 #[inline(always)]
115 pub fn bit(self, value: bool) -> &'a mut W {
116 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
117 self.w
118 }
119}
120#[doc = "Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true.\n\nValue on reset: 0"]
121#[derive(Clone, Copy, Debug, PartialEq)]
122pub enum ENA_RXEV_A {
123 #[doc = "0: Disabled. RXEV output to the CPU is disabled."]
124 DISABLED = 0,
125 #[doc = "1: Enabled. RXEV output to the CPU is enabled."]
126 ENABLED = 1,
127}
128impl From<ENA_RXEV_A> for bool {
129 #[inline(always)]
130 fn from(variant: ENA_RXEV_A) -> Self {
131 variant as u8 != 0
132 }
133}
134#[doc = "Field `ENA_RXEV` reader - Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true."]
135pub struct ENA_RXEV_R(crate::FieldReader<bool, ENA_RXEV_A>);
136impl ENA_RXEV_R {
137 pub(crate) fn new(bits: bool) -> Self {
138 ENA_RXEV_R(crate::FieldReader::new(bits))
139 }
140 #[doc = r"Get enumerated values variant"]
141 #[inline(always)]
142 pub fn variant(&self) -> ENA_RXEV_A {
143 match self.bits {
144 false => ENA_RXEV_A::DISABLED,
145 true => ENA_RXEV_A::ENABLED,
146 }
147 }
148 #[doc = "Checks if the value of the field is `DISABLED`"]
149 #[inline(always)]
150 pub fn is_disabled(&self) -> bool {
151 **self == ENA_RXEV_A::DISABLED
152 }
153 #[doc = "Checks if the value of the field is `ENABLED`"]
154 #[inline(always)]
155 pub fn is_enabled(&self) -> bool {
156 **self == ENA_RXEV_A::ENABLED
157 }
158}
159impl core::ops::Deref for ENA_RXEV_R {
160 type Target = crate::FieldReader<bool, ENA_RXEV_A>;
161 #[inline(always)]
162 fn deref(&self) -> &Self::Target {
163 &self.0
164 }
165}
166#[doc = "Field `ENA_RXEV` writer - Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true."]
167pub struct ENA_RXEV_W<'a> {
168 w: &'a mut W,
169}
170impl<'a> ENA_RXEV_W<'a> {
171 #[doc = r"Writes `variant` to the field"]
172 #[inline(always)]
173 pub fn variant(self, variant: ENA_RXEV_A) -> &'a mut W {
174 self.bit(variant.into())
175 }
176 #[doc = "Disabled. RXEV output to the CPU is disabled."]
177 #[inline(always)]
178 pub fn disabled(self) -> &'a mut W {
179 self.variant(ENA_RXEV_A::DISABLED)
180 }
181 #[doc = "Enabled. RXEV output to the CPU is enabled."]
182 #[inline(always)]
183 pub fn enabled(self) -> &'a mut W {
184 self.variant(ENA_RXEV_A::ENABLED)
185 }
186 #[doc = r"Sets the field bit"]
187 #[inline(always)]
188 pub fn set_bit(self) -> &'a mut W {
189 self.bit(true)
190 }
191 #[doc = r"Clears the field bit"]
192 #[inline(always)]
193 pub fn clear_bit(self) -> &'a mut W {
194 self.bit(false)
195 }
196 #[doc = r"Writes raw bits to the field"]
197 #[inline(always)]
198 pub fn bit(self, value: bool) -> &'a mut W {
199 self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
200 self.w
201 }
202}
203#[doc = "Field `PMAT` reader - This field displays the current state of pattern matches. A 1 in any bit of this field indicates that the corresponding product term is matched by the current state of the appropriate inputs."]
204pub struct PMAT_R(crate::FieldReader<u8, u8>);
205impl PMAT_R {
206 pub(crate) fn new(bits: u8) -> Self {
207 PMAT_R(crate::FieldReader::new(bits))
208 }
209}
210impl core::ops::Deref for PMAT_R {
211 type Target = crate::FieldReader<u8, u8>;
212 #[inline(always)]
213 fn deref(&self) -> &Self::Target {
214 &self.0
215 }
216}
217#[doc = "Field `PMAT` writer - This field displays the current state of pattern matches. A 1 in any bit of this field indicates that the corresponding product term is matched by the current state of the appropriate inputs."]
218pub struct PMAT_W<'a> {
219 w: &'a mut W,
220}
221impl<'a> PMAT_W<'a> {
222 #[doc = r"Writes raw bits to the field"]
223 #[inline(always)]
224 pub unsafe fn bits(self, value: u8) -> &'a mut W {
225 self.w.bits = (self.w.bits & !(0xff << 24)) | ((value as u32 & 0xff) << 24);
226 self.w
227 }
228}
229impl R {
230 #[doc = "Bit 0 - Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function."]
231 #[inline(always)]
232 pub fn sel_pmatch(&self) -> SEL_PMATCH_R {
233 SEL_PMATCH_R::new((self.bits & 0x01) != 0)
234 }
235 #[doc = "Bit 1 - Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true."]
236 #[inline(always)]
237 pub fn ena_rxev(&self) -> ENA_RXEV_R {
238 ENA_RXEV_R::new(((self.bits >> 1) & 0x01) != 0)
239 }
240 #[doc = "Bits 24:31 - This field displays the current state of pattern matches. A 1 in any bit of this field indicates that the corresponding product term is matched by the current state of the appropriate inputs."]
241 #[inline(always)]
242 pub fn pmat(&self) -> PMAT_R {
243 PMAT_R::new(((self.bits >> 24) & 0xff) as u8)
244 }
245}
246impl W {
247 #[doc = "Bit 0 - Specifies whether the 8 pin interrupts are controlled by the pin interrupt function or by the pattern match function."]
248 #[inline(always)]
249 pub fn sel_pmatch(&mut self) -> SEL_PMATCH_W {
250 SEL_PMATCH_W { w: self }
251 }
252 #[doc = "Bit 1 - Enables the RXEV output to the CPU and/or to a GPIO output when the specified boolean expression evaluates to true."]
253 #[inline(always)]
254 pub fn ena_rxev(&mut self) -> ENA_RXEV_W {
255 ENA_RXEV_W { w: self }
256 }
257 #[doc = "Bits 24:31 - This field displays the current state of pattern matches. A 1 in any bit of this field indicates that the corresponding product term is matched by the current state of the appropriate inputs."]
258 #[inline(always)]
259 pub fn pmat(&mut self) -> PMAT_W {
260 PMAT_W { w: self }
261 }
262 #[doc = "Writes raw bits to the register."]
263 #[inline(always)]
264 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
265 self.0.bits(bits);
266 self
267 }
268}
269#[doc = "Pattern match interrupt 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 [pmctrl](index.html) module"]
270pub struct PMCTRL_SPEC;
271impl crate::RegisterSpec for PMCTRL_SPEC {
272 type Ux = u32;
273}
274#[doc = "`read()` method returns [pmctrl::R](R) reader structure"]
275impl crate::Readable for PMCTRL_SPEC {
276 type Reader = R;
277}
278#[doc = "`write(|w| ..)` method takes [pmctrl::W](W) writer structure"]
279impl crate::Writable for PMCTRL_SPEC {
280 type Writer = W;
281}
282#[doc = "`reset()` method sets PMCTRL to value 0"]
283impl crate::Resettable for PMCTRL_SPEC {
284 #[inline(always)]
285 fn reset_value() -> Self::Ux {
286 0
287 }
288}