swm341_pac/i2c0/
if_.rs

1#[doc = "Register `IF` reader"]
2pub struct R(crate::R<IF_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<IF_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<IF_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<IF_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `IF` writer"]
17pub struct W(crate::W<IF_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<IF_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<IF_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<IF_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXE` reader - TXE field"]
38pub type TXE_R = crate::BitReader<bool>;
39#[doc = "Field `TXE` writer - TXE field"]
40pub type TXE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
41#[doc = "Field `RXNE` reader - RXNE field"]
42pub type RXNE_R = crate::BitReader<bool>;
43#[doc = "Field `RXNE` writer - RXNE field"]
44pub type RXNE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
45#[doc = "Field `RXOV` reader - RXOV field"]
46pub type RXOV_R = crate::BitReader<bool>;
47#[doc = "Field `RXOV` writer - RXOV field"]
48pub type RXOV_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
49#[doc = "Field `TXDONE` reader - TXDONE field"]
50pub type TXDONE_R = crate::BitReader<bool>;
51#[doc = "Field `TXDONE` writer - TXDONE field"]
52pub type TXDONE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
53#[doc = "Field `RXDONE` reader - RXDONE field"]
54pub type RXDONE_R = crate::BitReader<bool>;
55#[doc = "Field `RXDONE` writer - RXDONE field"]
56pub type RXDONE_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
57#[doc = "Field `RXSTA` reader - RXSTA field"]
58pub type RXSTA_R = crate::BitReader<bool>;
59#[doc = "Field `RXSTA` writer - RXSTA field"]
60pub type RXSTA_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
61#[doc = "Field `RXSTO` reader - RXSTO field"]
62pub type RXSTO_R = crate::BitReader<bool>;
63#[doc = "Field `RXSTO` writer - RXSTO field"]
64pub type RXSTO_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
65#[doc = "Field `AL` reader - AL field"]
66pub type AL_R = crate::BitReader<bool>;
67#[doc = "Field `AL` writer - AL field"]
68pub type AL_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
69#[doc = "Field `MLTO` reader - MLTO field"]
70pub type MLTO_R = crate::BitReader<bool>;
71#[doc = "Field `MLTO` writer - MLTO field"]
72pub type MLTO_W<'a, const O: u8> = crate::BitWriter<'a, u32, IF_SPEC, bool, O>;
73impl R {
74    #[doc = "Bit 0 - TXE field"]
75    #[inline(always)]
76    pub fn txe(&self) -> TXE_R {
77        TXE_R::new((self.bits & 1) != 0)
78    }
79    #[doc = "Bit 1 - RXNE field"]
80    #[inline(always)]
81    pub fn rxne(&self) -> RXNE_R {
82        RXNE_R::new(((self.bits >> 1) & 1) != 0)
83    }
84    #[doc = "Bit 2 - RXOV field"]
85    #[inline(always)]
86    pub fn rxov(&self) -> RXOV_R {
87        RXOV_R::new(((self.bits >> 2) & 1) != 0)
88    }
89    #[doc = "Bit 3 - TXDONE field"]
90    #[inline(always)]
91    pub fn txdone(&self) -> TXDONE_R {
92        TXDONE_R::new(((self.bits >> 3) & 1) != 0)
93    }
94    #[doc = "Bit 4 - RXDONE field"]
95    #[inline(always)]
96    pub fn rxdone(&self) -> RXDONE_R {
97        RXDONE_R::new(((self.bits >> 4) & 1) != 0)
98    }
99    #[doc = "Bit 8 - RXSTA field"]
100    #[inline(always)]
101    pub fn rxsta(&self) -> RXSTA_R {
102        RXSTA_R::new(((self.bits >> 8) & 1) != 0)
103    }
104    #[doc = "Bit 9 - RXSTO field"]
105    #[inline(always)]
106    pub fn rxsto(&self) -> RXSTO_R {
107        RXSTO_R::new(((self.bits >> 9) & 1) != 0)
108    }
109    #[doc = "Bit 16 - AL field"]
110    #[inline(always)]
111    pub fn al(&self) -> AL_R {
112        AL_R::new(((self.bits >> 16) & 1) != 0)
113    }
114    #[doc = "Bit 17 - MLTO field"]
115    #[inline(always)]
116    pub fn mlto(&self) -> MLTO_R {
117        MLTO_R::new(((self.bits >> 17) & 1) != 0)
118    }
119}
120impl W {
121    #[doc = "Bit 0 - TXE field"]
122    #[inline(always)]
123    pub fn txe(&mut self) -> TXE_W<0> {
124        TXE_W::new(self)
125    }
126    #[doc = "Bit 1 - RXNE field"]
127    #[inline(always)]
128    pub fn rxne(&mut self) -> RXNE_W<1> {
129        RXNE_W::new(self)
130    }
131    #[doc = "Bit 2 - RXOV field"]
132    #[inline(always)]
133    pub fn rxov(&mut self) -> RXOV_W<2> {
134        RXOV_W::new(self)
135    }
136    #[doc = "Bit 3 - TXDONE field"]
137    #[inline(always)]
138    pub fn txdone(&mut self) -> TXDONE_W<3> {
139        TXDONE_W::new(self)
140    }
141    #[doc = "Bit 4 - RXDONE field"]
142    #[inline(always)]
143    pub fn rxdone(&mut self) -> RXDONE_W<4> {
144        RXDONE_W::new(self)
145    }
146    #[doc = "Bit 8 - RXSTA field"]
147    #[inline(always)]
148    pub fn rxsta(&mut self) -> RXSTA_W<8> {
149        RXSTA_W::new(self)
150    }
151    #[doc = "Bit 9 - RXSTO field"]
152    #[inline(always)]
153    pub fn rxsto(&mut self) -> RXSTO_W<9> {
154        RXSTO_W::new(self)
155    }
156    #[doc = "Bit 16 - AL field"]
157    #[inline(always)]
158    pub fn al(&mut self) -> AL_W<16> {
159        AL_W::new(self)
160    }
161    #[doc = "Bit 17 - MLTO field"]
162    #[inline(always)]
163    pub fn mlto(&mut self) -> MLTO_W<17> {
164        MLTO_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 = "IF 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 [if_](index.html) module"]
174pub struct IF_SPEC;
175impl crate::RegisterSpec for IF_SPEC {
176    type Ux = u32;
177}
178#[doc = "`read()` method returns [if_::R](R) reader structure"]
179impl crate::Readable for IF_SPEC {
180    type Reader = R;
181}
182#[doc = "`write(|w| ..)` method takes [if_::W](W) writer structure"]
183impl crate::Writable for IF_SPEC {
184    type Writer = W;
185}
186#[doc = "`reset()` method sets IF to value 0"]
187impl crate::Resettable for IF_SPEC {
188    #[inline(always)]
189    fn reset_value() -> Self::Ux {
190        0
191    }
192}