nrf5340_app_pac/uarte0_ns/
config.rs

1#[doc = "Register `CONFIG` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CONFIG` writer"]
17pub struct W(crate::W<CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CONFIG_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<CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `HWFC` reader - Hardware flow control"]
38pub type HWFC_R = crate::BitReader<HWFC_A>;
39#[doc = "Hardware flow control\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum HWFC_A {
42    #[doc = "0: Disabled"]
43    DISABLED = 0,
44    #[doc = "1: Enabled"]
45    ENABLED = 1,
46}
47impl From<HWFC_A> for bool {
48    #[inline(always)]
49    fn from(variant: HWFC_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl HWFC_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> HWFC_A {
57        match self.bits {
58            false => HWFC_A::DISABLED,
59            true => HWFC_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 == HWFC_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 == HWFC_A::ENABLED
71    }
72}
73#[doc = "Field `HWFC` writer - Hardware flow control"]
74pub type HWFC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, HWFC_A, O>;
75impl<'a, const O: u8> HWFC_W<'a, O> {
76    #[doc = "Disabled"]
77    #[inline(always)]
78    pub fn disabled(self) -> &'a mut W {
79        self.variant(HWFC_A::DISABLED)
80    }
81    #[doc = "Enabled"]
82    #[inline(always)]
83    pub fn enabled(self) -> &'a mut W {
84        self.variant(HWFC_A::ENABLED)
85    }
86}
87#[doc = "Field `PARITY` reader - Parity"]
88pub type PARITY_R = crate::FieldReader<u8, PARITY_A>;
89#[doc = "Parity\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91#[repr(u8)]
92pub enum PARITY_A {
93    #[doc = "0: Exclude parity bit"]
94    EXCLUDED = 0,
95    #[doc = "7: Include even parity bit"]
96    INCLUDED = 7,
97}
98impl From<PARITY_A> for u8 {
99    #[inline(always)]
100    fn from(variant: PARITY_A) -> Self {
101        variant as _
102    }
103}
104impl PARITY_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> Option<PARITY_A> {
108        match self.bits {
109            0 => Some(PARITY_A::EXCLUDED),
110            7 => Some(PARITY_A::INCLUDED),
111            _ => None,
112        }
113    }
114    #[doc = "Checks if the value of the field is `EXCLUDED`"]
115    #[inline(always)]
116    pub fn is_excluded(&self) -> bool {
117        *self == PARITY_A::EXCLUDED
118    }
119    #[doc = "Checks if the value of the field is `INCLUDED`"]
120    #[inline(always)]
121    pub fn is_included(&self) -> bool {
122        *self == PARITY_A::INCLUDED
123    }
124}
125#[doc = "Field `PARITY` writer - Parity"]
126pub type PARITY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, PARITY_A, 3, O>;
127impl<'a, const O: u8> PARITY_W<'a, O> {
128    #[doc = "Exclude parity bit"]
129    #[inline(always)]
130    pub fn excluded(self) -> &'a mut W {
131        self.variant(PARITY_A::EXCLUDED)
132    }
133    #[doc = "Include even parity bit"]
134    #[inline(always)]
135    pub fn included(self) -> &'a mut W {
136        self.variant(PARITY_A::INCLUDED)
137    }
138}
139#[doc = "Field `STOP` reader - Stop bits"]
140pub type STOP_R = crate::BitReader<STOP_A>;
141#[doc = "Stop bits\n\nValue on reset: 0"]
142#[derive(Clone, Copy, Debug, PartialEq)]
143pub enum STOP_A {
144    #[doc = "0: One stop bit"]
145    ONE = 0,
146    #[doc = "1: Two stop bits"]
147    TWO = 1,
148}
149impl From<STOP_A> for bool {
150    #[inline(always)]
151    fn from(variant: STOP_A) -> Self {
152        variant as u8 != 0
153    }
154}
155impl STOP_R {
156    #[doc = "Get enumerated values variant"]
157    #[inline(always)]
158    pub fn variant(&self) -> STOP_A {
159        match self.bits {
160            false => STOP_A::ONE,
161            true => STOP_A::TWO,
162        }
163    }
164    #[doc = "Checks if the value of the field is `ONE`"]
165    #[inline(always)]
166    pub fn is_one(&self) -> bool {
167        *self == STOP_A::ONE
168    }
169    #[doc = "Checks if the value of the field is `TWO`"]
170    #[inline(always)]
171    pub fn is_two(&self) -> bool {
172        *self == STOP_A::TWO
173    }
174}
175#[doc = "Field `STOP` writer - Stop bits"]
176pub type STOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, STOP_A, O>;
177impl<'a, const O: u8> STOP_W<'a, O> {
178    #[doc = "One stop bit"]
179    #[inline(always)]
180    pub fn one(self) -> &'a mut W {
181        self.variant(STOP_A::ONE)
182    }
183    #[doc = "Two stop bits"]
184    #[inline(always)]
185    pub fn two(self) -> &'a mut W {
186        self.variant(STOP_A::TWO)
187    }
188}
189#[doc = "Field `PARITYTYPE` reader - Even or odd parity type"]
190pub type PARITYTYPE_R = crate::BitReader<PARITYTYPE_A>;
191#[doc = "Even or odd parity type\n\nValue on reset: 0"]
192#[derive(Clone, Copy, Debug, PartialEq)]
193pub enum PARITYTYPE_A {
194    #[doc = "0: Even parity"]
195    EVEN = 0,
196    #[doc = "1: Odd parity"]
197    ODD = 1,
198}
199impl From<PARITYTYPE_A> for bool {
200    #[inline(always)]
201    fn from(variant: PARITYTYPE_A) -> Self {
202        variant as u8 != 0
203    }
204}
205impl PARITYTYPE_R {
206    #[doc = "Get enumerated values variant"]
207    #[inline(always)]
208    pub fn variant(&self) -> PARITYTYPE_A {
209        match self.bits {
210            false => PARITYTYPE_A::EVEN,
211            true => PARITYTYPE_A::ODD,
212        }
213    }
214    #[doc = "Checks if the value of the field is `EVEN`"]
215    #[inline(always)]
216    pub fn is_even(&self) -> bool {
217        *self == PARITYTYPE_A::EVEN
218    }
219    #[doc = "Checks if the value of the field is `ODD`"]
220    #[inline(always)]
221    pub fn is_odd(&self) -> bool {
222        *self == PARITYTYPE_A::ODD
223    }
224}
225#[doc = "Field `PARITYTYPE` writer - Even or odd parity type"]
226pub type PARITYTYPE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, PARITYTYPE_A, O>;
227impl<'a, const O: u8> PARITYTYPE_W<'a, O> {
228    #[doc = "Even parity"]
229    #[inline(always)]
230    pub fn even(self) -> &'a mut W {
231        self.variant(PARITYTYPE_A::EVEN)
232    }
233    #[doc = "Odd parity"]
234    #[inline(always)]
235    pub fn odd(self) -> &'a mut W {
236        self.variant(PARITYTYPE_A::ODD)
237    }
238}
239impl R {
240    #[doc = "Bit 0 - Hardware flow control"]
241    #[inline(always)]
242    pub fn hwfc(&self) -> HWFC_R {
243        HWFC_R::new((self.bits & 1) != 0)
244    }
245    #[doc = "Bits 1:3 - Parity"]
246    #[inline(always)]
247    pub fn parity(&self) -> PARITY_R {
248        PARITY_R::new(((self.bits >> 1) & 7) as u8)
249    }
250    #[doc = "Bit 4 - Stop bits"]
251    #[inline(always)]
252    pub fn stop(&self) -> STOP_R {
253        STOP_R::new(((self.bits >> 4) & 1) != 0)
254    }
255    #[doc = "Bit 8 - Even or odd parity type"]
256    #[inline(always)]
257    pub fn paritytype(&self) -> PARITYTYPE_R {
258        PARITYTYPE_R::new(((self.bits >> 8) & 1) != 0)
259    }
260}
261impl W {
262    #[doc = "Bit 0 - Hardware flow control"]
263    #[inline(always)]
264    pub fn hwfc(&mut self) -> HWFC_W<0> {
265        HWFC_W::new(self)
266    }
267    #[doc = "Bits 1:3 - Parity"]
268    #[inline(always)]
269    pub fn parity(&mut self) -> PARITY_W<1> {
270        PARITY_W::new(self)
271    }
272    #[doc = "Bit 4 - Stop bits"]
273    #[inline(always)]
274    pub fn stop(&mut self) -> STOP_W<4> {
275        STOP_W::new(self)
276    }
277    #[doc = "Bit 8 - Even or odd parity type"]
278    #[inline(always)]
279    pub fn paritytype(&mut self) -> PARITYTYPE_W<8> {
280        PARITYTYPE_W::new(self)
281    }
282    #[doc = "Writes raw bits to the register."]
283    #[inline(always)]
284    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
285        self.0.bits(bits);
286        self
287    }
288}
289#[doc = "Configuration of parity and hardware flow control\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 [config](index.html) module"]
290pub struct CONFIG_SPEC;
291impl crate::RegisterSpec for CONFIG_SPEC {
292    type Ux = u32;
293}
294#[doc = "`read()` method returns [config::R](R) reader structure"]
295impl crate::Readable for CONFIG_SPEC {
296    type Reader = R;
297}
298#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
299impl crate::Writable for CONFIG_SPEC {
300    type Writer = W;
301}
302#[doc = "`reset()` method sets CONFIG to value 0"]
303impl crate::Resettable for CONFIG_SPEC {
304    #[inline(always)]
305    fn reset_value() -> Self::Ux {
306        0
307    }
308}