v853_pac/uart/
usr.rs

1#[doc = "Register `usr` reader"]
2pub struct R(crate::R<USR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<USR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<USR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<USR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "RX FIFO Full\n\nValue on reset: 0"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub enum RFF_A {
19    #[doc = "0: `0`"]
20    NOT_FULL = 0,
21    #[doc = "1: `1`"]
22    FULL = 1,
23}
24impl From<RFF_A> for bool {
25    #[inline(always)]
26    fn from(variant: RFF_A) -> Self {
27        variant as u8 != 0
28    }
29}
30#[doc = "Field `rff` reader - RX FIFO Full"]
31pub type RFF_R = crate::BitReader<RFF_A>;
32impl RFF_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> RFF_A {
36        match self.bits {
37            false => RFF_A::NOT_FULL,
38            true => RFF_A::FULL,
39        }
40    }
41    #[doc = "Checks if the value of the field is `NOT_FULL`"]
42    #[inline(always)]
43    pub fn is_not_full(&self) -> bool {
44        *self == RFF_A::NOT_FULL
45    }
46    #[doc = "Checks if the value of the field is `FULL`"]
47    #[inline(always)]
48    pub fn is_full(&self) -> bool {
49        *self == RFF_A::FULL
50    }
51}
52#[doc = "RX FIFO Not Empty\n\nValue on reset: 0"]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub enum RFNE_A {
55    #[doc = "0: `0`"]
56    EMPTY = 0,
57    #[doc = "1: `1`"]
58    NOT_EMPTY = 1,
59}
60impl From<RFNE_A> for bool {
61    #[inline(always)]
62    fn from(variant: RFNE_A) -> Self {
63        variant as u8 != 0
64    }
65}
66#[doc = "Field `rfne` reader - RX FIFO Not Empty"]
67pub type RFNE_R = crate::BitReader<RFNE_A>;
68impl RFNE_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> RFNE_A {
72        match self.bits {
73            false => RFNE_A::EMPTY,
74            true => RFNE_A::NOT_EMPTY,
75        }
76    }
77    #[doc = "Checks if the value of the field is `EMPTY`"]
78    #[inline(always)]
79    pub fn is_empty(&self) -> bool {
80        *self == RFNE_A::EMPTY
81    }
82    #[doc = "Checks if the value of the field is `NOT_EMPTY`"]
83    #[inline(always)]
84    pub fn is_not_empty(&self) -> bool {
85        *self == RFNE_A::NOT_EMPTY
86    }
87}
88#[doc = "TX FIFO Empty\n\nValue on reset: 0"]
89#[derive(Clone, Copy, Debug, PartialEq)]
90pub enum TFE_A {
91    #[doc = "0: `0`"]
92    NOT_EMPTY = 0,
93    #[doc = "1: `1`"]
94    EMPTY = 1,
95}
96impl From<TFE_A> for bool {
97    #[inline(always)]
98    fn from(variant: TFE_A) -> Self {
99        variant as u8 != 0
100    }
101}
102#[doc = "Field `tfe` reader - TX FIFO Empty"]
103pub type TFE_R = crate::BitReader<TFE_A>;
104impl TFE_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> TFE_A {
108        match self.bits {
109            false => TFE_A::NOT_EMPTY,
110            true => TFE_A::EMPTY,
111        }
112    }
113    #[doc = "Checks if the value of the field is `NOT_EMPTY`"]
114    #[inline(always)]
115    pub fn is_not_empty(&self) -> bool {
116        *self == TFE_A::NOT_EMPTY
117    }
118    #[doc = "Checks if the value of the field is `EMPTY`"]
119    #[inline(always)]
120    pub fn is_empty(&self) -> bool {
121        *self == TFE_A::EMPTY
122    }
123}
124#[doc = "TX FIFO Not Full\n\nValue on reset: 0"]
125#[derive(Clone, Copy, Debug, PartialEq)]
126pub enum TFNF_A {
127    #[doc = "0: `0`"]
128    FULL = 0,
129    #[doc = "1: `1`"]
130    NOT_FULL = 1,
131}
132impl From<TFNF_A> for bool {
133    #[inline(always)]
134    fn from(variant: TFNF_A) -> Self {
135        variant as u8 != 0
136    }
137}
138#[doc = "Field `tfnf` reader - TX FIFO Not Full"]
139pub type TFNF_R = crate::BitReader<TFNF_A>;
140impl TFNF_R {
141    #[doc = "Get enumerated values variant"]
142    #[inline(always)]
143    pub fn variant(&self) -> TFNF_A {
144        match self.bits {
145            false => TFNF_A::FULL,
146            true => TFNF_A::NOT_FULL,
147        }
148    }
149    #[doc = "Checks if the value of the field is `FULL`"]
150    #[inline(always)]
151    pub fn is_full(&self) -> bool {
152        *self == TFNF_A::FULL
153    }
154    #[doc = "Checks if the value of the field is `NOT_FULL`"]
155    #[inline(always)]
156    pub fn is_not_full(&self) -> bool {
157        *self == TFNF_A::NOT_FULL
158    }
159}
160#[doc = "UART Busy Bit\n\nValue on reset: 0"]
161#[derive(Clone, Copy, Debug, PartialEq)]
162pub enum BUSY_A {
163    #[doc = "0: `0`"]
164    IDLE = 0,
165    #[doc = "1: `1`"]
166    BUSY = 1,
167}
168impl From<BUSY_A> for bool {
169    #[inline(always)]
170    fn from(variant: BUSY_A) -> Self {
171        variant as u8 != 0
172    }
173}
174#[doc = "Field `busy` reader - UART Busy Bit"]
175pub type BUSY_R = crate::BitReader<BUSY_A>;
176impl BUSY_R {
177    #[doc = "Get enumerated values variant"]
178    #[inline(always)]
179    pub fn variant(&self) -> BUSY_A {
180        match self.bits {
181            false => BUSY_A::IDLE,
182            true => BUSY_A::BUSY,
183        }
184    }
185    #[doc = "Checks if the value of the field is `IDLE`"]
186    #[inline(always)]
187    pub fn is_idle(&self) -> bool {
188        *self == BUSY_A::IDLE
189    }
190    #[doc = "Checks if the value of the field is `BUSY`"]
191    #[inline(always)]
192    pub fn is_busy(&self) -> bool {
193        *self == BUSY_A::BUSY
194    }
195}
196impl R {
197    #[doc = "Bit 4 - RX FIFO Full"]
198    #[inline(always)]
199    pub fn rff(&self) -> RFF_R {
200        RFF_R::new(((self.bits >> 4) & 1) != 0)
201    }
202    #[doc = "Bit 3 - RX FIFO Not Empty"]
203    #[inline(always)]
204    pub fn rfne(&self) -> RFNE_R {
205        RFNE_R::new(((self.bits >> 3) & 1) != 0)
206    }
207    #[doc = "Bit 2 - TX FIFO Empty"]
208    #[inline(always)]
209    pub fn tfe(&self) -> TFE_R {
210        TFE_R::new(((self.bits >> 2) & 1) != 0)
211    }
212    #[doc = "Bit 1 - TX FIFO Not Full"]
213    #[inline(always)]
214    pub fn tfnf(&self) -> TFNF_R {
215        TFNF_R::new(((self.bits >> 1) & 1) != 0)
216    }
217    #[doc = "Bit 0 - UART Busy Bit"]
218    #[inline(always)]
219    pub fn busy(&self) -> BUSY_R {
220        BUSY_R::new((self.bits & 1) != 0)
221    }
222}
223#[doc = "UART Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usr](index.html) module"]
224pub struct USR_SPEC;
225impl crate::RegisterSpec for USR_SPEC {
226    type Ux = u32;
227}
228#[doc = "`read()` method returns [usr::R](R) reader structure"]
229impl crate::Readable for USR_SPEC {
230    type Reader = R;
231}
232#[doc = "`reset()` method sets usr to value 0"]
233impl crate::Resettable for USR_SPEC {
234    #[inline(always)]
235    fn reset_value() -> Self::Ux {
236        0
237    }
238}