swm341_pac/spi0/
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 `WTC` reader - WTC field"]
38pub type WTC_R = crate::BitReader<bool>;
39#[doc = "Field `WTC` writer - WTC field"]
40pub type WTC_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
41#[doc = "Field `TFE` reader - TFE field"]
42pub type TFE_R = crate::BitReader<bool>;
43#[doc = "Field `TFE` writer - TFE field"]
44pub type TFE_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
45#[doc = "Field `TFNF` reader - TFNF field"]
46pub type TFNF_R = crate::BitReader<bool>;
47#[doc = "Field `TFNF` writer - TFNF field"]
48pub type TFNF_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
49#[doc = "Field `RFNE` reader - RFNE field"]
50pub type RFNE_R = crate::BitReader<bool>;
51#[doc = "Field `RFNE` writer - RFNE field"]
52pub type RFNE_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
53#[doc = "Field `RFF` reader - RFF field"]
54pub type RFF_R = crate::BitReader<bool>;
55#[doc = "Field `RFF` writer - RFF field"]
56pub type RFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
57#[doc = "Field `RFOV` reader - RFOV field"]
58pub type RFOV_R = crate::BitReader<bool>;
59#[doc = "Field `RFOV` writer - RFOV field"]
60pub type RFOV_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
61#[doc = "Field `TFLVL` reader - TFLVL field"]
62pub type TFLVL_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `TFLVL` writer - TFLVL field"]
64pub type TFLVL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, STAT_SPEC, u8, u8, 3, O>;
65#[doc = "Field `RFLVL` reader - RFLVL field"]
66pub type RFLVL_R = crate::FieldReader<u8, u8>;
67#[doc = "Field `RFLVL` writer - RFLVL field"]
68pub type RFLVL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, STAT_SPEC, u8, u8, 3, O>;
69#[doc = "Field `BUSY` reader - BUSY field"]
70pub type BUSY_R = crate::BitReader<bool>;
71#[doc = "Field `BUSY` writer - BUSY field"]
72pub type BUSY_W<'a, const O: u8> = crate::BitWriter<'a, u32, STAT_SPEC, bool, O>;
73impl R {
74    #[doc = "Bit 0 - WTC field"]
75    #[inline(always)]
76    pub fn wtc(&self) -> WTC_R {
77        WTC_R::new((self.bits & 1) != 0)
78    }
79    #[doc = "Bit 1 - TFE field"]
80    #[inline(always)]
81    pub fn tfe(&self) -> TFE_R {
82        TFE_R::new(((self.bits >> 1) & 1) != 0)
83    }
84    #[doc = "Bit 2 - TFNF field"]
85    #[inline(always)]
86    pub fn tfnf(&self) -> TFNF_R {
87        TFNF_R::new(((self.bits >> 2) & 1) != 0)
88    }
89    #[doc = "Bit 3 - RFNE field"]
90    #[inline(always)]
91    pub fn rfne(&self) -> RFNE_R {
92        RFNE_R::new(((self.bits >> 3) & 1) != 0)
93    }
94    #[doc = "Bit 4 - RFF field"]
95    #[inline(always)]
96    pub fn rff(&self) -> RFF_R {
97        RFF_R::new(((self.bits >> 4) & 1) != 0)
98    }
99    #[doc = "Bit 5 - RFOV field"]
100    #[inline(always)]
101    pub fn rfov(&self) -> RFOV_R {
102        RFOV_R::new(((self.bits >> 5) & 1) != 0)
103    }
104    #[doc = "Bits 6:8 - TFLVL field"]
105    #[inline(always)]
106    pub fn tflvl(&self) -> TFLVL_R {
107        TFLVL_R::new(((self.bits >> 6) & 7) as u8)
108    }
109    #[doc = "Bits 9:11 - RFLVL field"]
110    #[inline(always)]
111    pub fn rflvl(&self) -> RFLVL_R {
112        RFLVL_R::new(((self.bits >> 9) & 7) as u8)
113    }
114    #[doc = "Bit 15 - BUSY field"]
115    #[inline(always)]
116    pub fn busy(&self) -> BUSY_R {
117        BUSY_R::new(((self.bits >> 15) & 1) != 0)
118    }
119}
120impl W {
121    #[doc = "Bit 0 - WTC field"]
122    #[inline(always)]
123    pub fn wtc(&mut self) -> WTC_W<0> {
124        WTC_W::new(self)
125    }
126    #[doc = "Bit 1 - TFE field"]
127    #[inline(always)]
128    pub fn tfe(&mut self) -> TFE_W<1> {
129        TFE_W::new(self)
130    }
131    #[doc = "Bit 2 - TFNF field"]
132    #[inline(always)]
133    pub fn tfnf(&mut self) -> TFNF_W<2> {
134        TFNF_W::new(self)
135    }
136    #[doc = "Bit 3 - RFNE field"]
137    #[inline(always)]
138    pub fn rfne(&mut self) -> RFNE_W<3> {
139        RFNE_W::new(self)
140    }
141    #[doc = "Bit 4 - RFF field"]
142    #[inline(always)]
143    pub fn rff(&mut self) -> RFF_W<4> {
144        RFF_W::new(self)
145    }
146    #[doc = "Bit 5 - RFOV field"]
147    #[inline(always)]
148    pub fn rfov(&mut self) -> RFOV_W<5> {
149        RFOV_W::new(self)
150    }
151    #[doc = "Bits 6:8 - TFLVL field"]
152    #[inline(always)]
153    pub fn tflvl(&mut self) -> TFLVL_W<6> {
154        TFLVL_W::new(self)
155    }
156    #[doc = "Bits 9:11 - RFLVL field"]
157    #[inline(always)]
158    pub fn rflvl(&mut self) -> RFLVL_W<9> {
159        RFLVL_W::new(self)
160    }
161    #[doc = "Bit 15 - BUSY field"]
162    #[inline(always)]
163    pub fn busy(&mut self) -> BUSY_W<15> {
164        BUSY_W::new(self)
165    }
166    #[doc = "Writes raw bits to the register."]
167    #[inline(always)]
168    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169        self.0.bits(bits);
170        self
171    }
172}
173#[doc = "STAT 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"]
174pub struct STAT_SPEC;
175impl crate::RegisterSpec for STAT_SPEC {
176    type Ux = u32;
177}
178#[doc = "`read()` method returns [stat::R](R) reader structure"]
179impl crate::Readable for STAT_SPEC {
180    type Reader = R;
181}
182#[doc = "`write(|w| ..)` method takes [stat::W](W) writer structure"]
183impl crate::Writable for STAT_SPEC {
184    type Writer = W;
185}
186#[doc = "`reset()` method sets STAT to value 0"]
187impl crate::Resettable for STAT_SPEC {
188    #[inline(always)]
189    fn reset_value() -> Self::Ux {
190        0
191    }
192}