lpc845_pac/capt/
intenset.rs

1#[doc = "Register `INTENSET` reader"]
2pub struct R(crate::R<INTENSET_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTENSET_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTENSET_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTENSET_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTENSET` writer"]
17pub struct W(crate::W<INTENSET_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTENSET_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<INTENSET_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTENSET_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `YESTOUCH` reader - Is 1 if a touch detected should interrupt. This includes wake from low-power mode."]
38pub struct YESTOUCH_R(crate::FieldReader<bool, bool>);
39impl YESTOUCH_R {
40    pub(crate) fn new(bits: bool) -> Self {
41        YESTOUCH_R(crate::FieldReader::new(bits))
42    }
43}
44impl core::ops::Deref for YESTOUCH_R {
45    type Target = crate::FieldReader<bool, bool>;
46    #[inline(always)]
47    fn deref(&self) -> &Self::Target {
48        &self.0
49    }
50}
51#[doc = "Field `YESTOUCH` writer - Is 1 if a touch detected should interrupt. This includes wake from low-power mode."]
52pub struct YESTOUCH_W<'a> {
53    w: &'a mut W,
54}
55impl<'a> YESTOUCH_W<'a> {
56    #[doc = r"Sets the field bit"]
57    #[inline(always)]
58    pub fn set_bit(self) -> &'a mut W {
59        self.bit(true)
60    }
61    #[doc = r"Clears the field bit"]
62    #[inline(always)]
63    pub fn clear_bit(self) -> &'a mut W {
64        self.bit(false)
65    }
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub fn bit(self, value: bool) -> &'a mut W {
69        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
70        self.w
71    }
72}
73#[doc = "Field `NOTOUCH` reader - Is 1 if a no-touch detected should interrupt"]
74pub struct NOTOUCH_R(crate::FieldReader<bool, bool>);
75impl NOTOUCH_R {
76    pub(crate) fn new(bits: bool) -> Self {
77        NOTOUCH_R(crate::FieldReader::new(bits))
78    }
79}
80impl core::ops::Deref for NOTOUCH_R {
81    type Target = crate::FieldReader<bool, bool>;
82    #[inline(always)]
83    fn deref(&self) -> &Self::Target {
84        &self.0
85    }
86}
87#[doc = "Field `NOTOUCH` writer - Is 1 if a no-touch detected should interrupt"]
88pub struct NOTOUCH_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> NOTOUCH_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
106        self.w
107    }
108}
109#[doc = "Field `POLLDONE` reader - Is 1 if a poll or POLLNOW completing should interrupt"]
110pub struct POLLDONE_R(crate::FieldReader<bool, bool>);
111impl POLLDONE_R {
112    pub(crate) fn new(bits: bool) -> Self {
113        POLLDONE_R(crate::FieldReader::new(bits))
114    }
115}
116impl core::ops::Deref for POLLDONE_R {
117    type Target = crate::FieldReader<bool, bool>;
118    #[inline(always)]
119    fn deref(&self) -> &Self::Target {
120        &self.0
121    }
122}
123#[doc = "Field `POLLDONE` writer - Is 1 if a poll or POLLNOW completing should interrupt"]
124pub struct POLLDONE_W<'a> {
125    w: &'a mut W,
126}
127impl<'a> POLLDONE_W<'a> {
128    #[doc = r"Sets the field bit"]
129    #[inline(always)]
130    pub fn set_bit(self) -> &'a mut W {
131        self.bit(true)
132    }
133    #[doc = r"Clears the field bit"]
134    #[inline(always)]
135    pub fn clear_bit(self) -> &'a mut W {
136        self.bit(false)
137    }
138    #[doc = r"Writes raw bits to the field"]
139    #[inline(always)]
140    pub fn bit(self, value: bool) -> &'a mut W {
141        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
142        self.w
143    }
144}
145#[doc = "Field `TIMEOUT` reader - Is 1 if an integration cycle ending with timeout should interrupt"]
146pub struct TIMEOUT_R(crate::FieldReader<bool, bool>);
147impl TIMEOUT_R {
148    pub(crate) fn new(bits: bool) -> Self {
149        TIMEOUT_R(crate::FieldReader::new(bits))
150    }
151}
152impl core::ops::Deref for TIMEOUT_R {
153    type Target = crate::FieldReader<bool, bool>;
154    #[inline(always)]
155    fn deref(&self) -> &Self::Target {
156        &self.0
157    }
158}
159#[doc = "Field `TIMEOUT` writer - Is 1 if an integration cycle ending with timeout should interrupt"]
160pub struct TIMEOUT_W<'a> {
161    w: &'a mut W,
162}
163impl<'a> TIMEOUT_W<'a> {
164    #[doc = r"Sets the field bit"]
165    #[inline(always)]
166    pub fn set_bit(self) -> &'a mut W {
167        self.bit(true)
168    }
169    #[doc = r"Clears the field bit"]
170    #[inline(always)]
171    pub fn clear_bit(self) -> &'a mut W {
172        self.bit(false)
173    }
174    #[doc = r"Writes raw bits to the field"]
175    #[inline(always)]
176    pub fn bit(self, value: bool) -> &'a mut W {
177        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
178        self.w
179    }
180}
181#[doc = "Field `OVERUN` reader - Is 1 if an overrun should interrupt."]
182pub struct OVERUN_R(crate::FieldReader<bool, bool>);
183impl OVERUN_R {
184    pub(crate) fn new(bits: bool) -> Self {
185        OVERUN_R(crate::FieldReader::new(bits))
186    }
187}
188impl core::ops::Deref for OVERUN_R {
189    type Target = crate::FieldReader<bool, bool>;
190    #[inline(always)]
191    fn deref(&self) -> &Self::Target {
192        &self.0
193    }
194}
195#[doc = "Field `OVERUN` writer - Is 1 if an overrun should interrupt."]
196pub struct OVERUN_W<'a> {
197    w: &'a mut W,
198}
199impl<'a> OVERUN_W<'a> {
200    #[doc = r"Sets the field bit"]
201    #[inline(always)]
202    pub fn set_bit(self) -> &'a mut W {
203        self.bit(true)
204    }
205    #[doc = r"Clears the field bit"]
206    #[inline(always)]
207    pub fn clear_bit(self) -> &'a mut W {
208        self.bit(false)
209    }
210    #[doc = r"Writes raw bits to the field"]
211    #[inline(always)]
212    pub fn bit(self, value: bool) -> &'a mut W {
213        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
214        self.w
215    }
216}
217impl R {
218    #[doc = "Bit 0 - Is 1 if a touch detected should interrupt. This includes wake from low-power mode."]
219    #[inline(always)]
220    pub fn yestouch(&self) -> YESTOUCH_R {
221        YESTOUCH_R::new((self.bits & 0x01) != 0)
222    }
223    #[doc = "Bit 1 - Is 1 if a no-touch detected should interrupt"]
224    #[inline(always)]
225    pub fn notouch(&self) -> NOTOUCH_R {
226        NOTOUCH_R::new(((self.bits >> 1) & 0x01) != 0)
227    }
228    #[doc = "Bit 2 - Is 1 if a poll or POLLNOW completing should interrupt"]
229    #[inline(always)]
230    pub fn polldone(&self) -> POLLDONE_R {
231        POLLDONE_R::new(((self.bits >> 2) & 0x01) != 0)
232    }
233    #[doc = "Bit 3 - Is 1 if an integration cycle ending with timeout should interrupt"]
234    #[inline(always)]
235    pub fn timeout(&self) -> TIMEOUT_R {
236        TIMEOUT_R::new(((self.bits >> 3) & 0x01) != 0)
237    }
238    #[doc = "Bit 4 - Is 1 if an overrun should interrupt."]
239    #[inline(always)]
240    pub fn overun(&self) -> OVERUN_R {
241        OVERUN_R::new(((self.bits >> 4) & 0x01) != 0)
242    }
243}
244impl W {
245    #[doc = "Bit 0 - Is 1 if a touch detected should interrupt. This includes wake from low-power mode."]
246    #[inline(always)]
247    pub fn yestouch(&mut self) -> YESTOUCH_W {
248        YESTOUCH_W { w: self }
249    }
250    #[doc = "Bit 1 - Is 1 if a no-touch detected should interrupt"]
251    #[inline(always)]
252    pub fn notouch(&mut self) -> NOTOUCH_W {
253        NOTOUCH_W { w: self }
254    }
255    #[doc = "Bit 2 - Is 1 if a poll or POLLNOW completing should interrupt"]
256    #[inline(always)]
257    pub fn polldone(&mut self) -> POLLDONE_W {
258        POLLDONE_W { w: self }
259    }
260    #[doc = "Bit 3 - Is 1 if an integration cycle ending with timeout should interrupt"]
261    #[inline(always)]
262    pub fn timeout(&mut self) -> TIMEOUT_W {
263        TIMEOUT_W { w: self }
264    }
265    #[doc = "Bit 4 - Is 1 if an overrun should interrupt."]
266    #[inline(always)]
267    pub fn overun(&mut self) -> OVERUN_W {
268        OVERUN_W { w: self }
269    }
270    #[doc = "Writes raw bits to the register."]
271    #[inline(always)]
272    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
273        self.0.bits(bits);
274        self
275    }
276}
277#[doc = "Interrupt enable\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 [intenset](index.html) module"]
278pub struct INTENSET_SPEC;
279impl crate::RegisterSpec for INTENSET_SPEC {
280    type Ux = u32;
281}
282#[doc = "`read()` method returns [intenset::R](R) reader structure"]
283impl crate::Readable for INTENSET_SPEC {
284    type Reader = R;
285}
286#[doc = "`write(|w| ..)` method takes [intenset::W](W) writer structure"]
287impl crate::Writable for INTENSET_SPEC {
288    type Writer = W;
289}
290#[doc = "`reset()` method sets INTENSET to value 0"]
291impl crate::Resettable for INTENSET_SPEC {
292    #[inline(always)]
293    fn reset_value() -> Self::Ux {
294        0
295    }
296}