nrf52840_pac/pwm0/
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 `SEQEND0_STOP` reader - Shortcut between SEQEND\\[0\\]
38event and STOP task"]
39pub type SEQEND0_STOP_R = crate::BitReader<SEQEND0_STOP_A>;
40#[doc = "Shortcut between SEQEND\\[0\\]
41event and STOP task\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43pub enum SEQEND0_STOP_A {
44    #[doc = "0: Disable shortcut"]
45    DISABLED = 0,
46    #[doc = "1: Enable shortcut"]
47    ENABLED = 1,
48}
49impl From<SEQEND0_STOP_A> for bool {
50    #[inline(always)]
51    fn from(variant: SEQEND0_STOP_A) -> Self {
52        variant as u8 != 0
53    }
54}
55impl SEQEND0_STOP_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> SEQEND0_STOP_A {
59        match self.bits {
60            false => SEQEND0_STOP_A::DISABLED,
61            true => SEQEND0_STOP_A::ENABLED,
62        }
63    }
64    #[doc = "Checks if the value of the field is `DISABLED`"]
65    #[inline(always)]
66    pub fn is_disabled(&self) -> bool {
67        *self == SEQEND0_STOP_A::DISABLED
68    }
69    #[doc = "Checks if the value of the field is `ENABLED`"]
70    #[inline(always)]
71    pub fn is_enabled(&self) -> bool {
72        *self == SEQEND0_STOP_A::ENABLED
73    }
74}
75#[doc = "Field `SEQEND0_STOP` writer - Shortcut between SEQEND\\[0\\]
76event and STOP task"]
77pub type SEQEND0_STOP_W<'a, const O: u8> =
78    crate::BitWriter<'a, u32, SHORTS_SPEC, SEQEND0_STOP_A, O>;
79impl<'a, const O: u8> SEQEND0_STOP_W<'a, O> {
80    #[doc = "Disable shortcut"]
81    #[inline(always)]
82    pub fn disabled(self) -> &'a mut W {
83        self.variant(SEQEND0_STOP_A::DISABLED)
84    }
85    #[doc = "Enable shortcut"]
86    #[inline(always)]
87    pub fn enabled(self) -> &'a mut W {
88        self.variant(SEQEND0_STOP_A::ENABLED)
89    }
90}
91#[doc = "Field `SEQEND1_STOP` reader - Shortcut between SEQEND\\[1\\]
92event and STOP task"]
93pub type SEQEND1_STOP_R = crate::BitReader<SEQEND1_STOP_A>;
94#[doc = "Shortcut between SEQEND\\[1\\]
95event and STOP task\n\nValue on reset: 0"]
96#[derive(Clone, Copy, Debug, PartialEq)]
97pub enum SEQEND1_STOP_A {
98    #[doc = "0: Disable shortcut"]
99    DISABLED = 0,
100    #[doc = "1: Enable shortcut"]
101    ENABLED = 1,
102}
103impl From<SEQEND1_STOP_A> for bool {
104    #[inline(always)]
105    fn from(variant: SEQEND1_STOP_A) -> Self {
106        variant as u8 != 0
107    }
108}
109impl SEQEND1_STOP_R {
110    #[doc = "Get enumerated values variant"]
111    #[inline(always)]
112    pub fn variant(&self) -> SEQEND1_STOP_A {
113        match self.bits {
114            false => SEQEND1_STOP_A::DISABLED,
115            true => SEQEND1_STOP_A::ENABLED,
116        }
117    }
118    #[doc = "Checks if the value of the field is `DISABLED`"]
119    #[inline(always)]
120    pub fn is_disabled(&self) -> bool {
121        *self == SEQEND1_STOP_A::DISABLED
122    }
123    #[doc = "Checks if the value of the field is `ENABLED`"]
124    #[inline(always)]
125    pub fn is_enabled(&self) -> bool {
126        *self == SEQEND1_STOP_A::ENABLED
127    }
128}
129#[doc = "Field `SEQEND1_STOP` writer - Shortcut between SEQEND\\[1\\]
130event and STOP task"]
131pub type SEQEND1_STOP_W<'a, const O: u8> =
132    crate::BitWriter<'a, u32, SHORTS_SPEC, SEQEND1_STOP_A, O>;
133impl<'a, const O: u8> SEQEND1_STOP_W<'a, O> {
134    #[doc = "Disable shortcut"]
135    #[inline(always)]
136    pub fn disabled(self) -> &'a mut W {
137        self.variant(SEQEND1_STOP_A::DISABLED)
138    }
139    #[doc = "Enable shortcut"]
140    #[inline(always)]
141    pub fn enabled(self) -> &'a mut W {
142        self.variant(SEQEND1_STOP_A::ENABLED)
143    }
144}
145#[doc = "Field `LOOPSDONE_SEQSTART0` reader - Shortcut between LOOPSDONE event and SEQSTART\\[0\\]
146task"]
147pub type LOOPSDONE_SEQSTART0_R = crate::BitReader<LOOPSDONE_SEQSTART0_A>;
148#[doc = "Shortcut between LOOPSDONE event and SEQSTART\\[0\\]
149task\n\nValue on reset: 0"]
150#[derive(Clone, Copy, Debug, PartialEq)]
151pub enum LOOPSDONE_SEQSTART0_A {
152    #[doc = "0: Disable shortcut"]
153    DISABLED = 0,
154    #[doc = "1: Enable shortcut"]
155    ENABLED = 1,
156}
157impl From<LOOPSDONE_SEQSTART0_A> for bool {
158    #[inline(always)]
159    fn from(variant: LOOPSDONE_SEQSTART0_A) -> Self {
160        variant as u8 != 0
161    }
162}
163impl LOOPSDONE_SEQSTART0_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub fn variant(&self) -> LOOPSDONE_SEQSTART0_A {
167        match self.bits {
168            false => LOOPSDONE_SEQSTART0_A::DISABLED,
169            true => LOOPSDONE_SEQSTART0_A::ENABLED,
170        }
171    }
172    #[doc = "Checks if the value of the field is `DISABLED`"]
173    #[inline(always)]
174    pub fn is_disabled(&self) -> bool {
175        *self == LOOPSDONE_SEQSTART0_A::DISABLED
176    }
177    #[doc = "Checks if the value of the field is `ENABLED`"]
178    #[inline(always)]
179    pub fn is_enabled(&self) -> bool {
180        *self == LOOPSDONE_SEQSTART0_A::ENABLED
181    }
182}
183#[doc = "Field `LOOPSDONE_SEQSTART0` writer - Shortcut between LOOPSDONE event and SEQSTART\\[0\\]
184task"]
185pub type LOOPSDONE_SEQSTART0_W<'a, const O: u8> =
186    crate::BitWriter<'a, u32, SHORTS_SPEC, LOOPSDONE_SEQSTART0_A, O>;
187impl<'a, const O: u8> LOOPSDONE_SEQSTART0_W<'a, O> {
188    #[doc = "Disable shortcut"]
189    #[inline(always)]
190    pub fn disabled(self) -> &'a mut W {
191        self.variant(LOOPSDONE_SEQSTART0_A::DISABLED)
192    }
193    #[doc = "Enable shortcut"]
194    #[inline(always)]
195    pub fn enabled(self) -> &'a mut W {
196        self.variant(LOOPSDONE_SEQSTART0_A::ENABLED)
197    }
198}
199#[doc = "Field `LOOPSDONE_SEQSTART1` reader - Shortcut between LOOPSDONE event and SEQSTART\\[1\\]
200task"]
201pub type LOOPSDONE_SEQSTART1_R = crate::BitReader<LOOPSDONE_SEQSTART1_A>;
202#[doc = "Shortcut between LOOPSDONE event and SEQSTART\\[1\\]
203task\n\nValue on reset: 0"]
204#[derive(Clone, Copy, Debug, PartialEq)]
205pub enum LOOPSDONE_SEQSTART1_A {
206    #[doc = "0: Disable shortcut"]
207    DISABLED = 0,
208    #[doc = "1: Enable shortcut"]
209    ENABLED = 1,
210}
211impl From<LOOPSDONE_SEQSTART1_A> for bool {
212    #[inline(always)]
213    fn from(variant: LOOPSDONE_SEQSTART1_A) -> Self {
214        variant as u8 != 0
215    }
216}
217impl LOOPSDONE_SEQSTART1_R {
218    #[doc = "Get enumerated values variant"]
219    #[inline(always)]
220    pub fn variant(&self) -> LOOPSDONE_SEQSTART1_A {
221        match self.bits {
222            false => LOOPSDONE_SEQSTART1_A::DISABLED,
223            true => LOOPSDONE_SEQSTART1_A::ENABLED,
224        }
225    }
226    #[doc = "Checks if the value of the field is `DISABLED`"]
227    #[inline(always)]
228    pub fn is_disabled(&self) -> bool {
229        *self == LOOPSDONE_SEQSTART1_A::DISABLED
230    }
231    #[doc = "Checks if the value of the field is `ENABLED`"]
232    #[inline(always)]
233    pub fn is_enabled(&self) -> bool {
234        *self == LOOPSDONE_SEQSTART1_A::ENABLED
235    }
236}
237#[doc = "Field `LOOPSDONE_SEQSTART1` writer - Shortcut between LOOPSDONE event and SEQSTART\\[1\\]
238task"]
239pub type LOOPSDONE_SEQSTART1_W<'a, const O: u8> =
240    crate::BitWriter<'a, u32, SHORTS_SPEC, LOOPSDONE_SEQSTART1_A, O>;
241impl<'a, const O: u8> LOOPSDONE_SEQSTART1_W<'a, O> {
242    #[doc = "Disable shortcut"]
243    #[inline(always)]
244    pub fn disabled(self) -> &'a mut W {
245        self.variant(LOOPSDONE_SEQSTART1_A::DISABLED)
246    }
247    #[doc = "Enable shortcut"]
248    #[inline(always)]
249    pub fn enabled(self) -> &'a mut W {
250        self.variant(LOOPSDONE_SEQSTART1_A::ENABLED)
251    }
252}
253#[doc = "Field `LOOPSDONE_STOP` reader - Shortcut between LOOPSDONE event and STOP task"]
254pub type LOOPSDONE_STOP_R = crate::BitReader<LOOPSDONE_STOP_A>;
255#[doc = "Shortcut between LOOPSDONE event and STOP task\n\nValue on reset: 0"]
256#[derive(Clone, Copy, Debug, PartialEq)]
257pub enum LOOPSDONE_STOP_A {
258    #[doc = "0: Disable shortcut"]
259    DISABLED = 0,
260    #[doc = "1: Enable shortcut"]
261    ENABLED = 1,
262}
263impl From<LOOPSDONE_STOP_A> for bool {
264    #[inline(always)]
265    fn from(variant: LOOPSDONE_STOP_A) -> Self {
266        variant as u8 != 0
267    }
268}
269impl LOOPSDONE_STOP_R {
270    #[doc = "Get enumerated values variant"]
271    #[inline(always)]
272    pub fn variant(&self) -> LOOPSDONE_STOP_A {
273        match self.bits {
274            false => LOOPSDONE_STOP_A::DISABLED,
275            true => LOOPSDONE_STOP_A::ENABLED,
276        }
277    }
278    #[doc = "Checks if the value of the field is `DISABLED`"]
279    #[inline(always)]
280    pub fn is_disabled(&self) -> bool {
281        *self == LOOPSDONE_STOP_A::DISABLED
282    }
283    #[doc = "Checks if the value of the field is `ENABLED`"]
284    #[inline(always)]
285    pub fn is_enabled(&self) -> bool {
286        *self == LOOPSDONE_STOP_A::ENABLED
287    }
288}
289#[doc = "Field `LOOPSDONE_STOP` writer - Shortcut between LOOPSDONE event and STOP task"]
290pub type LOOPSDONE_STOP_W<'a, const O: u8> =
291    crate::BitWriter<'a, u32, SHORTS_SPEC, LOOPSDONE_STOP_A, O>;
292impl<'a, const O: u8> LOOPSDONE_STOP_W<'a, O> {
293    #[doc = "Disable shortcut"]
294    #[inline(always)]
295    pub fn disabled(self) -> &'a mut W {
296        self.variant(LOOPSDONE_STOP_A::DISABLED)
297    }
298    #[doc = "Enable shortcut"]
299    #[inline(always)]
300    pub fn enabled(self) -> &'a mut W {
301        self.variant(LOOPSDONE_STOP_A::ENABLED)
302    }
303}
304impl R {
305    #[doc = "Bit 0 - Shortcut between SEQEND\\[0\\]
306event and STOP task"]
307    #[inline(always)]
308    pub fn seqend0_stop(&self) -> SEQEND0_STOP_R {
309        SEQEND0_STOP_R::new((self.bits & 1) != 0)
310    }
311    #[doc = "Bit 1 - Shortcut between SEQEND\\[1\\]
312event and STOP task"]
313    #[inline(always)]
314    pub fn seqend1_stop(&self) -> SEQEND1_STOP_R {
315        SEQEND1_STOP_R::new(((self.bits >> 1) & 1) != 0)
316    }
317    #[doc = "Bit 2 - Shortcut between LOOPSDONE event and SEQSTART\\[0\\]
318task"]
319    #[inline(always)]
320    pub fn loopsdone_seqstart0(&self) -> LOOPSDONE_SEQSTART0_R {
321        LOOPSDONE_SEQSTART0_R::new(((self.bits >> 2) & 1) != 0)
322    }
323    #[doc = "Bit 3 - Shortcut between LOOPSDONE event and SEQSTART\\[1\\]
324task"]
325    #[inline(always)]
326    pub fn loopsdone_seqstart1(&self) -> LOOPSDONE_SEQSTART1_R {
327        LOOPSDONE_SEQSTART1_R::new(((self.bits >> 3) & 1) != 0)
328    }
329    #[doc = "Bit 4 - Shortcut between LOOPSDONE event and STOP task"]
330    #[inline(always)]
331    pub fn loopsdone_stop(&self) -> LOOPSDONE_STOP_R {
332        LOOPSDONE_STOP_R::new(((self.bits >> 4) & 1) != 0)
333    }
334}
335impl W {
336    #[doc = "Bit 0 - Shortcut between SEQEND\\[0\\]
337event and STOP task"]
338    #[inline(always)]
339    pub fn seqend0_stop(&mut self) -> SEQEND0_STOP_W<0> {
340        SEQEND0_STOP_W::new(self)
341    }
342    #[doc = "Bit 1 - Shortcut between SEQEND\\[1\\]
343event and STOP task"]
344    #[inline(always)]
345    pub fn seqend1_stop(&mut self) -> SEQEND1_STOP_W<1> {
346        SEQEND1_STOP_W::new(self)
347    }
348    #[doc = "Bit 2 - Shortcut between LOOPSDONE event and SEQSTART\\[0\\]
349task"]
350    #[inline(always)]
351    pub fn loopsdone_seqstart0(&mut self) -> LOOPSDONE_SEQSTART0_W<2> {
352        LOOPSDONE_SEQSTART0_W::new(self)
353    }
354    #[doc = "Bit 3 - Shortcut between LOOPSDONE event and SEQSTART\\[1\\]
355task"]
356    #[inline(always)]
357    pub fn loopsdone_seqstart1(&mut self) -> LOOPSDONE_SEQSTART1_W<3> {
358        LOOPSDONE_SEQSTART1_W::new(self)
359    }
360    #[doc = "Bit 4 - Shortcut between LOOPSDONE event and STOP task"]
361    #[inline(always)]
362    pub fn loopsdone_stop(&mut self) -> LOOPSDONE_STOP_W<4> {
363        LOOPSDONE_STOP_W::new(self)
364    }
365    #[doc = "Writes raw bits to the register."]
366    #[inline(always)]
367    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
368        self.0.bits(bits);
369        self
370    }
371}
372#[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"]
373pub struct SHORTS_SPEC;
374impl crate::RegisterSpec for SHORTS_SPEC {
375    type Ux = u32;
376}
377#[doc = "`read()` method returns [shorts::R](R) reader structure"]
378impl crate::Readable for SHORTS_SPEC {
379    type Reader = R;
380}
381#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
382impl crate::Writable for SHORTS_SPEC {
383    type Writer = W;
384}
385#[doc = "`reset()` method sets SHORTS to value 0"]
386impl crate::Resettable for SHORTS_SPEC {
387    #[inline(always)]
388    fn reset_value() -> Self::Ux {
389        0
390    }
391}