gd32vf103_pac/uart3/
stat.rs

1#[doc = "Register `STAT` reader"]
2pub struct R(crate::R<STAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `STAT` writer"]
17pub struct W(crate::W<STAT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<STAT_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<STAT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<STAT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PERR` reader - Parity error flag"]
38pub type PERR_R = crate::BitReader<bool>;
39#[doc = "Field `FERR` reader - Frame error flag"]
40pub type FERR_R = crate::BitReader<bool>;
41#[doc = "Field `NERR` reader - Noise error flag"]
42pub type NERR_R = crate::BitReader<bool>;
43#[doc = "Field `ORERR` reader - Overrun error"]
44pub type ORERR_R = crate::BitReader<bool>;
45#[doc = "Field `IDLEF` reader - IDLE frame detected flag"]
46pub type IDLEF_R = crate::BitReader<bool>;
47#[doc = "Field `RBNE` reader - Read data buffer not empty"]
48pub type RBNE_R = crate::BitReader<bool>;
49#[doc = "Field `RBNE` writer - Read data buffer not empty"]
50pub type RBNE_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
51#[doc = "Field `TC` reader - Transmission complete"]
52pub type TC_R = crate::BitReader<bool>;
53#[doc = "Field `TC` writer - Transmission complete"]
54pub type TC_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
55#[doc = "Field `TBE` reader - Transmit data buffer empty"]
56pub type TBE_R = crate::BitReader<bool>;
57#[doc = "Field `LBDF` reader - LIN break detection flag"]
58pub type LBDF_R = crate::BitReader<bool>;
59#[doc = "Field `LBDF` writer - LIN break detection flag"]
60pub type LBDF_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
61impl R {
62    #[doc = "Bit 0 - Parity error flag"]
63    #[inline(always)]
64    pub fn perr(&self) -> PERR_R {
65        PERR_R::new((self.bits & 1) != 0)
66    }
67    #[doc = "Bit 1 - Frame error flag"]
68    #[inline(always)]
69    pub fn ferr(&self) -> FERR_R {
70        FERR_R::new(((self.bits >> 1) & 1) != 0)
71    }
72    #[doc = "Bit 2 - Noise error flag"]
73    #[inline(always)]
74    pub fn nerr(&self) -> NERR_R {
75        NERR_R::new(((self.bits >> 2) & 1) != 0)
76    }
77    #[doc = "Bit 3 - Overrun error"]
78    #[inline(always)]
79    pub fn orerr(&self) -> ORERR_R {
80        ORERR_R::new(((self.bits >> 3) & 1) != 0)
81    }
82    #[doc = "Bit 4 - IDLE frame detected flag"]
83    #[inline(always)]
84    pub fn idlef(&self) -> IDLEF_R {
85        IDLEF_R::new(((self.bits >> 4) & 1) != 0)
86    }
87    #[doc = "Bit 5 - Read data buffer not empty"]
88    #[inline(always)]
89    pub fn rbne(&self) -> RBNE_R {
90        RBNE_R::new(((self.bits >> 5) & 1) != 0)
91    }
92    #[doc = "Bit 6 - Transmission complete"]
93    #[inline(always)]
94    pub fn tc(&self) -> TC_R {
95        TC_R::new(((self.bits >> 6) & 1) != 0)
96    }
97    #[doc = "Bit 7 - Transmit data buffer empty"]
98    #[inline(always)]
99    pub fn tbe(&self) -> TBE_R {
100        TBE_R::new(((self.bits >> 7) & 1) != 0)
101    }
102    #[doc = "Bit 8 - LIN break detection flag"]
103    #[inline(always)]
104    pub fn lbdf(&self) -> LBDF_R {
105        LBDF_R::new(((self.bits >> 8) & 1) != 0)
106    }
107}
108impl W {
109    #[doc = "Bit 5 - Read data buffer not empty"]
110    #[inline(always)]
111    #[must_use]
112    pub fn rbne(&mut self) -> RBNE_W<5> {
113        RBNE_W::new(self)
114    }
115    #[doc = "Bit 6 - Transmission complete"]
116    #[inline(always)]
117    #[must_use]
118    pub fn tc(&mut self) -> TC_W<6> {
119        TC_W::new(self)
120    }
121    #[doc = "Bit 8 - LIN break detection flag"]
122    #[inline(always)]
123    #[must_use]
124    pub fn lbdf(&mut self) -> LBDF_W<8> {
125        LBDF_W::new(self)
126    }
127    #[doc = "Writes raw bits to the register."]
128    #[inline(always)]
129    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
130        self.0.bits(bits);
131        self
132    }
133}
134#[doc = "Status 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 [stat](index.html) module"]
135pub struct STAT_SPEC;
136impl crate::RegisterSpec for STAT_SPEC {
137    type Ux = u32;
138}
139#[doc = "`read()` method returns [stat::R](R) reader structure"]
140impl crate::Readable for STAT_SPEC {
141    type Reader = R;
142}
143#[doc = "`write(|w| ..)` method takes [stat::W](W) writer structure"]
144impl crate::Writable for STAT_SPEC {
145    type Writer = W;
146    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
147    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
148}
149#[doc = "`reset()` method sets STAT to value 0xc0"]
150impl crate::Resettable for STAT_SPEC {
151    const RESET_VALUE: Self::Ux = 0xc0;
152}