nrf52840_pac/twim0/
shorts.rs

1#[doc = "Register `SHORTS` reader"]
2pub struct R(crate::R<SHORTS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SHORTS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SHORTS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SHORTS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SHORTS` writer"]
17pub struct W(crate::W<SHORTS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SHORTS_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<SHORTS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SHORTS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `LASTTX_STARTRX` reader - Shortcut between LASTTX event and STARTRX task"]
38pub type LASTTX_STARTRX_R = crate::BitReader<LASTTX_STARTRX_A>;
39#[doc = "Shortcut between LASTTX event and STARTRX task\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum LASTTX_STARTRX_A {
42    #[doc = "0: Disable shortcut"]
43    DISABLED = 0,
44    #[doc = "1: Enable shortcut"]
45    ENABLED = 1,
46}
47impl From<LASTTX_STARTRX_A> for bool {
48    #[inline(always)]
49    fn from(variant: LASTTX_STARTRX_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl LASTTX_STARTRX_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> LASTTX_STARTRX_A {
57        match self.bits {
58            false => LASTTX_STARTRX_A::DISABLED,
59            true => LASTTX_STARTRX_A::ENABLED,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DISABLED`"]
63    #[inline(always)]
64    pub fn is_disabled(&self) -> bool {
65        *self == LASTTX_STARTRX_A::DISABLED
66    }
67    #[doc = "Checks if the value of the field is `ENABLED`"]
68    #[inline(always)]
69    pub fn is_enabled(&self) -> bool {
70        *self == LASTTX_STARTRX_A::ENABLED
71    }
72}
73#[doc = "Field `LASTTX_STARTRX` writer - Shortcut between LASTTX event and STARTRX task"]
74pub type LASTTX_STARTRX_W<'a, const O: u8> =
75    crate::BitWriter<'a, u32, SHORTS_SPEC, LASTTX_STARTRX_A, O>;
76impl<'a, const O: u8> LASTTX_STARTRX_W<'a, O> {
77    #[doc = "Disable shortcut"]
78    #[inline(always)]
79    pub fn disabled(self) -> &'a mut W {
80        self.variant(LASTTX_STARTRX_A::DISABLED)
81    }
82    #[doc = "Enable shortcut"]
83    #[inline(always)]
84    pub fn enabled(self) -> &'a mut W {
85        self.variant(LASTTX_STARTRX_A::ENABLED)
86    }
87}
88#[doc = "Field `LASTTX_SUSPEND` reader - Shortcut between LASTTX event and SUSPEND task"]
89pub type LASTTX_SUSPEND_R = crate::BitReader<LASTTX_SUSPEND_A>;
90#[doc = "Shortcut between LASTTX event and SUSPEND task\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq)]
92pub enum LASTTX_SUSPEND_A {
93    #[doc = "0: Disable shortcut"]
94    DISABLED = 0,
95    #[doc = "1: Enable shortcut"]
96    ENABLED = 1,
97}
98impl From<LASTTX_SUSPEND_A> for bool {
99    #[inline(always)]
100    fn from(variant: LASTTX_SUSPEND_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl LASTTX_SUSPEND_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> LASTTX_SUSPEND_A {
108        match self.bits {
109            false => LASTTX_SUSPEND_A::DISABLED,
110            true => LASTTX_SUSPEND_A::ENABLED,
111        }
112    }
113    #[doc = "Checks if the value of the field is `DISABLED`"]
114    #[inline(always)]
115    pub fn is_disabled(&self) -> bool {
116        *self == LASTTX_SUSPEND_A::DISABLED
117    }
118    #[doc = "Checks if the value of the field is `ENABLED`"]
119    #[inline(always)]
120    pub fn is_enabled(&self) -> bool {
121        *self == LASTTX_SUSPEND_A::ENABLED
122    }
123}
124#[doc = "Field `LASTTX_SUSPEND` writer - Shortcut between LASTTX event and SUSPEND task"]
125pub type LASTTX_SUSPEND_W<'a, const O: u8> =
126    crate::BitWriter<'a, u32, SHORTS_SPEC, LASTTX_SUSPEND_A, O>;
127impl<'a, const O: u8> LASTTX_SUSPEND_W<'a, O> {
128    #[doc = "Disable shortcut"]
129    #[inline(always)]
130    pub fn disabled(self) -> &'a mut W {
131        self.variant(LASTTX_SUSPEND_A::DISABLED)
132    }
133    #[doc = "Enable shortcut"]
134    #[inline(always)]
135    pub fn enabled(self) -> &'a mut W {
136        self.variant(LASTTX_SUSPEND_A::ENABLED)
137    }
138}
139#[doc = "Field `LASTTX_STOP` reader - Shortcut between LASTTX event and STOP task"]
140pub type LASTTX_STOP_R = crate::BitReader<LASTTX_STOP_A>;
141#[doc = "Shortcut between LASTTX event and STOP task\n\nValue on reset: 0"]
142#[derive(Clone, Copy, Debug, PartialEq)]
143pub enum LASTTX_STOP_A {
144    #[doc = "0: Disable shortcut"]
145    DISABLED = 0,
146    #[doc = "1: Enable shortcut"]
147    ENABLED = 1,
148}
149impl From<LASTTX_STOP_A> for bool {
150    #[inline(always)]
151    fn from(variant: LASTTX_STOP_A) -> Self {
152        variant as u8 != 0
153    }
154}
155impl LASTTX_STOP_R {
156    #[doc = "Get enumerated values variant"]
157    #[inline(always)]
158    pub fn variant(&self) -> LASTTX_STOP_A {
159        match self.bits {
160            false => LASTTX_STOP_A::DISABLED,
161            true => LASTTX_STOP_A::ENABLED,
162        }
163    }
164    #[doc = "Checks if the value of the field is `DISABLED`"]
165    #[inline(always)]
166    pub fn is_disabled(&self) -> bool {
167        *self == LASTTX_STOP_A::DISABLED
168    }
169    #[doc = "Checks if the value of the field is `ENABLED`"]
170    #[inline(always)]
171    pub fn is_enabled(&self) -> bool {
172        *self == LASTTX_STOP_A::ENABLED
173    }
174}
175#[doc = "Field `LASTTX_STOP` writer - Shortcut between LASTTX event and STOP task"]
176pub type LASTTX_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, LASTTX_STOP_A, O>;
177impl<'a, const O: u8> LASTTX_STOP_W<'a, O> {
178    #[doc = "Disable shortcut"]
179    #[inline(always)]
180    pub fn disabled(self) -> &'a mut W {
181        self.variant(LASTTX_STOP_A::DISABLED)
182    }
183    #[doc = "Enable shortcut"]
184    #[inline(always)]
185    pub fn enabled(self) -> &'a mut W {
186        self.variant(LASTTX_STOP_A::ENABLED)
187    }
188}
189#[doc = "Field `LASTRX_STARTTX` reader - Shortcut between LASTRX event and STARTTX task"]
190pub type LASTRX_STARTTX_R = crate::BitReader<LASTRX_STARTTX_A>;
191#[doc = "Shortcut between LASTRX event and STARTTX task\n\nValue on reset: 0"]
192#[derive(Clone, Copy, Debug, PartialEq)]
193pub enum LASTRX_STARTTX_A {
194    #[doc = "0: Disable shortcut"]
195    DISABLED = 0,
196    #[doc = "1: Enable shortcut"]
197    ENABLED = 1,
198}
199impl From<LASTRX_STARTTX_A> for bool {
200    #[inline(always)]
201    fn from(variant: LASTRX_STARTTX_A) -> Self {
202        variant as u8 != 0
203    }
204}
205impl LASTRX_STARTTX_R {
206    #[doc = "Get enumerated values variant"]
207    #[inline(always)]
208    pub fn variant(&self) -> LASTRX_STARTTX_A {
209        match self.bits {
210            false => LASTRX_STARTTX_A::DISABLED,
211            true => LASTRX_STARTTX_A::ENABLED,
212        }
213    }
214    #[doc = "Checks if the value of the field is `DISABLED`"]
215    #[inline(always)]
216    pub fn is_disabled(&self) -> bool {
217        *self == LASTRX_STARTTX_A::DISABLED
218    }
219    #[doc = "Checks if the value of the field is `ENABLED`"]
220    #[inline(always)]
221    pub fn is_enabled(&self) -> bool {
222        *self == LASTRX_STARTTX_A::ENABLED
223    }
224}
225#[doc = "Field `LASTRX_STARTTX` writer - Shortcut between LASTRX event and STARTTX task"]
226pub type LASTRX_STARTTX_W<'a, const O: u8> =
227    crate::BitWriter<'a, u32, SHORTS_SPEC, LASTRX_STARTTX_A, O>;
228impl<'a, const O: u8> LASTRX_STARTTX_W<'a, O> {
229    #[doc = "Disable shortcut"]
230    #[inline(always)]
231    pub fn disabled(self) -> &'a mut W {
232        self.variant(LASTRX_STARTTX_A::DISABLED)
233    }
234    #[doc = "Enable shortcut"]
235    #[inline(always)]
236    pub fn enabled(self) -> &'a mut W {
237        self.variant(LASTRX_STARTTX_A::ENABLED)
238    }
239}
240#[doc = "Field `LASTRX_SUSPEND` reader - Shortcut between LASTRX event and SUSPEND task"]
241pub type LASTRX_SUSPEND_R = crate::BitReader<LASTRX_SUSPEND_A>;
242#[doc = "Shortcut between LASTRX event and SUSPEND task\n\nValue on reset: 0"]
243#[derive(Clone, Copy, Debug, PartialEq)]
244pub enum LASTRX_SUSPEND_A {
245    #[doc = "0: Disable shortcut"]
246    DISABLED = 0,
247    #[doc = "1: Enable shortcut"]
248    ENABLED = 1,
249}
250impl From<LASTRX_SUSPEND_A> for bool {
251    #[inline(always)]
252    fn from(variant: LASTRX_SUSPEND_A) -> Self {
253        variant as u8 != 0
254    }
255}
256impl LASTRX_SUSPEND_R {
257    #[doc = "Get enumerated values variant"]
258    #[inline(always)]
259    pub fn variant(&self) -> LASTRX_SUSPEND_A {
260        match self.bits {
261            false => LASTRX_SUSPEND_A::DISABLED,
262            true => LASTRX_SUSPEND_A::ENABLED,
263        }
264    }
265    #[doc = "Checks if the value of the field is `DISABLED`"]
266    #[inline(always)]
267    pub fn is_disabled(&self) -> bool {
268        *self == LASTRX_SUSPEND_A::DISABLED
269    }
270    #[doc = "Checks if the value of the field is `ENABLED`"]
271    #[inline(always)]
272    pub fn is_enabled(&self) -> bool {
273        *self == LASTRX_SUSPEND_A::ENABLED
274    }
275}
276#[doc = "Field `LASTRX_SUSPEND` writer - Shortcut between LASTRX event and SUSPEND task"]
277pub type LASTRX_SUSPEND_W<'a, const O: u8> =
278    crate::BitWriter<'a, u32, SHORTS_SPEC, LASTRX_SUSPEND_A, O>;
279impl<'a, const O: u8> LASTRX_SUSPEND_W<'a, O> {
280    #[doc = "Disable shortcut"]
281    #[inline(always)]
282    pub fn disabled(self) -> &'a mut W {
283        self.variant(LASTRX_SUSPEND_A::DISABLED)
284    }
285    #[doc = "Enable shortcut"]
286    #[inline(always)]
287    pub fn enabled(self) -> &'a mut W {
288        self.variant(LASTRX_SUSPEND_A::ENABLED)
289    }
290}
291#[doc = "Field `LASTRX_STOP` reader - Shortcut between LASTRX event and STOP task"]
292pub type LASTRX_STOP_R = crate::BitReader<LASTRX_STOP_A>;
293#[doc = "Shortcut between LASTRX event and STOP task\n\nValue on reset: 0"]
294#[derive(Clone, Copy, Debug, PartialEq)]
295pub enum LASTRX_STOP_A {
296    #[doc = "0: Disable shortcut"]
297    DISABLED = 0,
298    #[doc = "1: Enable shortcut"]
299    ENABLED = 1,
300}
301impl From<LASTRX_STOP_A> for bool {
302    #[inline(always)]
303    fn from(variant: LASTRX_STOP_A) -> Self {
304        variant as u8 != 0
305    }
306}
307impl LASTRX_STOP_R {
308    #[doc = "Get enumerated values variant"]
309    #[inline(always)]
310    pub fn variant(&self) -> LASTRX_STOP_A {
311        match self.bits {
312            false => LASTRX_STOP_A::DISABLED,
313            true => LASTRX_STOP_A::ENABLED,
314        }
315    }
316    #[doc = "Checks if the value of the field is `DISABLED`"]
317    #[inline(always)]
318    pub fn is_disabled(&self) -> bool {
319        *self == LASTRX_STOP_A::DISABLED
320    }
321    #[doc = "Checks if the value of the field is `ENABLED`"]
322    #[inline(always)]
323    pub fn is_enabled(&self) -> bool {
324        *self == LASTRX_STOP_A::ENABLED
325    }
326}
327#[doc = "Field `LASTRX_STOP` writer - Shortcut between LASTRX event and STOP task"]
328pub type LASTRX_STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, LASTRX_STOP_A, O>;
329impl<'a, const O: u8> LASTRX_STOP_W<'a, O> {
330    #[doc = "Disable shortcut"]
331    #[inline(always)]
332    pub fn disabled(self) -> &'a mut W {
333        self.variant(LASTRX_STOP_A::DISABLED)
334    }
335    #[doc = "Enable shortcut"]
336    #[inline(always)]
337    pub fn enabled(self) -> &'a mut W {
338        self.variant(LASTRX_STOP_A::ENABLED)
339    }
340}
341impl R {
342    #[doc = "Bit 7 - Shortcut between LASTTX event and STARTRX task"]
343    #[inline(always)]
344    pub fn lasttx_startrx(&self) -> LASTTX_STARTRX_R {
345        LASTTX_STARTRX_R::new(((self.bits >> 7) & 1) != 0)
346    }
347    #[doc = "Bit 8 - Shortcut between LASTTX event and SUSPEND task"]
348    #[inline(always)]
349    pub fn lasttx_suspend(&self) -> LASTTX_SUSPEND_R {
350        LASTTX_SUSPEND_R::new(((self.bits >> 8) & 1) != 0)
351    }
352    #[doc = "Bit 9 - Shortcut between LASTTX event and STOP task"]
353    #[inline(always)]
354    pub fn lasttx_stop(&self) -> LASTTX_STOP_R {
355        LASTTX_STOP_R::new(((self.bits >> 9) & 1) != 0)
356    }
357    #[doc = "Bit 10 - Shortcut between LASTRX event and STARTTX task"]
358    #[inline(always)]
359    pub fn lastrx_starttx(&self) -> LASTRX_STARTTX_R {
360        LASTRX_STARTTX_R::new(((self.bits >> 10) & 1) != 0)
361    }
362    #[doc = "Bit 11 - Shortcut between LASTRX event and SUSPEND task"]
363    #[inline(always)]
364    pub fn lastrx_suspend(&self) -> LASTRX_SUSPEND_R {
365        LASTRX_SUSPEND_R::new(((self.bits >> 11) & 1) != 0)
366    }
367    #[doc = "Bit 12 - Shortcut between LASTRX event and STOP task"]
368    #[inline(always)]
369    pub fn lastrx_stop(&self) -> LASTRX_STOP_R {
370        LASTRX_STOP_R::new(((self.bits >> 12) & 1) != 0)
371    }
372}
373impl W {
374    #[doc = "Bit 7 - Shortcut between LASTTX event and STARTRX task"]
375    #[inline(always)]
376    pub fn lasttx_startrx(&mut self) -> LASTTX_STARTRX_W<7> {
377        LASTTX_STARTRX_W::new(self)
378    }
379    #[doc = "Bit 8 - Shortcut between LASTTX event and SUSPEND task"]
380    #[inline(always)]
381    pub fn lasttx_suspend(&mut self) -> LASTTX_SUSPEND_W<8> {
382        LASTTX_SUSPEND_W::new(self)
383    }
384    #[doc = "Bit 9 - Shortcut between LASTTX event and STOP task"]
385    #[inline(always)]
386    pub fn lasttx_stop(&mut self) -> LASTTX_STOP_W<9> {
387        LASTTX_STOP_W::new(self)
388    }
389    #[doc = "Bit 10 - Shortcut between LASTRX event and STARTTX task"]
390    #[inline(always)]
391    pub fn lastrx_starttx(&mut self) -> LASTRX_STARTTX_W<10> {
392        LASTRX_STARTTX_W::new(self)
393    }
394    #[doc = "Bit 11 - Shortcut between LASTRX event and SUSPEND task"]
395    #[inline(always)]
396    pub fn lastrx_suspend(&mut self) -> LASTRX_SUSPEND_W<11> {
397        LASTRX_SUSPEND_W::new(self)
398    }
399    #[doc = "Bit 12 - Shortcut between LASTRX event and STOP task"]
400    #[inline(always)]
401    pub fn lastrx_stop(&mut self) -> LASTRX_STOP_W<12> {
402        LASTRX_STOP_W::new(self)
403    }
404    #[doc = "Writes raw bits to the register."]
405    #[inline(always)]
406    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
407        self.0.bits(bits);
408        self
409    }
410}
411#[doc = "Shortcut 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 [shorts](index.html) module"]
412pub struct SHORTS_SPEC;
413impl crate::RegisterSpec for SHORTS_SPEC {
414    type Ux = u32;
415}
416#[doc = "`read()` method returns [shorts::R](R) reader structure"]
417impl crate::Readable for SHORTS_SPEC {
418    type Reader = R;
419}
420#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
421impl crate::Writable for SHORTS_SPEC {
422    type Writer = W;
423}
424#[doc = "`reset()` method sets SHORTS to value 0"]
425impl crate::Resettable for SHORTS_SPEC {
426    #[inline(always)]
427    fn reset_value() -> Self::Ux {
428        0
429    }
430}