d1_pac/uart/
usr.rs

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