nrf52840_pac/uart0/
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 `CTS_STARTRX` reader - Shortcut between CTS event and STARTRX task"]
38pub type CTS_STARTRX_R = crate::BitReader<CTS_STARTRX_A>;
39#[doc = "Shortcut between CTS event and STARTRX task\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum CTS_STARTRX_A {
42    #[doc = "0: Disable shortcut"]
43    DISABLED = 0,
44    #[doc = "1: Enable shortcut"]
45    ENABLED = 1,
46}
47impl From<CTS_STARTRX_A> for bool {
48    #[inline(always)]
49    fn from(variant: CTS_STARTRX_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CTS_STARTRX_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CTS_STARTRX_A {
57        match self.bits {
58            false => CTS_STARTRX_A::DISABLED,
59            true => CTS_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 == CTS_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 == CTS_STARTRX_A::ENABLED
71    }
72}
73#[doc = "Field `CTS_STARTRX` writer - Shortcut between CTS event and STARTRX task"]
74pub type CTS_STARTRX_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, CTS_STARTRX_A, O>;
75impl<'a, const O: u8> CTS_STARTRX_W<'a, O> {
76    #[doc = "Disable shortcut"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(CTS_STARTRX_A::DISABLED)
80    }
81    #[doc = "Enable shortcut"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(CTS_STARTRX_A::ENABLED)
85    }
86}
87#[doc = "Field `NCTS_STOPRX` reader - Shortcut between NCTS event and STOPRX task"]
88pub type NCTS_STOPRX_R = crate::BitReader<NCTS_STOPRX_A>;
89#[doc = "Shortcut between NCTS event and STOPRX task\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum NCTS_STOPRX_A {
92    #[doc = "0: Disable shortcut"]
93    DISABLED = 0,
94    #[doc = "1: Enable shortcut"]
95    ENABLED = 1,
96}
97impl From<NCTS_STOPRX_A> for bool {
98    #[inline(always)]
99    fn from(variant: NCTS_STOPRX_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl NCTS_STOPRX_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> NCTS_STOPRX_A {
107        match self.bits {
108            false => NCTS_STOPRX_A::DISABLED,
109            true => NCTS_STOPRX_A::ENABLED,
110        }
111    }
112    #[doc = "Checks if the value of the field is `DISABLED`"]
113    #[inline(always)]
114    pub fn is_disabled(&self) -> bool {
115        *self == NCTS_STOPRX_A::DISABLED
116    }
117    #[doc = "Checks if the value of the field is `ENABLED`"]
118    #[inline(always)]
119    pub fn is_enabled(&self) -> bool {
120        *self == NCTS_STOPRX_A::ENABLED
121    }
122}
123#[doc = "Field `NCTS_STOPRX` writer - Shortcut between NCTS event and STOPRX task"]
124pub type NCTS_STOPRX_W<'a, const O: u8> = crate::BitWriter<'a, u32, SHORTS_SPEC, NCTS_STOPRX_A, O>;
125impl<'a, const O: u8> NCTS_STOPRX_W<'a, O> {
126    #[doc = "Disable shortcut"]
127    #[inline(always)]
128    pub fn disabled(self) -> &'a mut W {
129        self.variant(NCTS_STOPRX_A::DISABLED)
130    }
131    #[doc = "Enable shortcut"]
132    #[inline(always)]
133    pub fn enabled(self) -> &'a mut W {
134        self.variant(NCTS_STOPRX_A::ENABLED)
135    }
136}
137impl R {
138    #[doc = "Bit 3 - Shortcut between CTS event and STARTRX task"]
139    #[inline(always)]
140    pub fn cts_startrx(&self) -> CTS_STARTRX_R {
141        CTS_STARTRX_R::new(((self.bits >> 3) & 1) != 0)
142    }
143    #[doc = "Bit 4 - Shortcut between NCTS event and STOPRX task"]
144    #[inline(always)]
145    pub fn ncts_stoprx(&self) -> NCTS_STOPRX_R {
146        NCTS_STOPRX_R::new(((self.bits >> 4) & 1) != 0)
147    }
148}
149impl W {
150    #[doc = "Bit 3 - Shortcut between CTS event and STARTRX task"]
151    #[inline(always)]
152    pub fn cts_startrx(&mut self) -> CTS_STARTRX_W<3> {
153        CTS_STARTRX_W::new(self)
154    }
155    #[doc = "Bit 4 - Shortcut between NCTS event and STOPRX task"]
156    #[inline(always)]
157    pub fn ncts_stoprx(&mut self) -> NCTS_STOPRX_W<4> {
158        NCTS_STOPRX_W::new(self)
159    }
160    #[doc = "Writes raw bits to the register."]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167#[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"]
168pub struct SHORTS_SPEC;
169impl crate::RegisterSpec for SHORTS_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [shorts::R](R) reader structure"]
173impl crate::Readable for SHORTS_SPEC {
174    type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [shorts::W](W) writer structure"]
177impl crate::Writable for SHORTS_SPEC {
178    type Writer = W;
179}
180#[doc = "`reset()` method sets SHORTS to value 0"]
181impl crate::Resettable for SHORTS_SPEC {
182    #[inline(always)]
183    fn reset_value() -> Self::Ux {
184        0
185    }
186}