swm341_pac/spi0/
i2scr.rs

1#[doc = "Register `I2SCR` reader"]
2pub struct R(crate::R<I2SCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<I2SCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<I2SCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<I2SCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `I2SCR` writer"]
17pub struct W(crate::W<I2SCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<I2SCR_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<I2SCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<I2SCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DIEN` reader - DIEN field"]
38pub type DIEN_R = crate::BitReader<bool>;
39#[doc = "Field `DIEN` writer - DIEN field"]
40pub type DIEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
41#[doc = "Field `DOEN` reader - DOEN field"]
42pub type DOEN_R = crate::BitReader<bool>;
43#[doc = "Field `DOEN` writer - DOEN field"]
44pub type DOEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
45#[doc = "Field `MSTR` reader - MSTR field"]
46pub type MSTR_R = crate::BitReader<bool>;
47#[doc = "Field `MSTR` writer - MSTR field"]
48pub type MSTR_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
49#[doc = "Field `EN` reader - EN field"]
50pub type EN_R = crate::BitReader<bool>;
51#[doc = "Field `EN` writer - EN field"]
52pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
53#[doc = "Field `FFMT` reader - FFMT field"]
54pub type FFMT_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `FFMT` writer - FFMT field"]
56pub type FFMT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, I2SCR_SPEC, u8, u8, 2, O>;
57#[doc = "Field `DLEN` reader - DLEN field"]
58pub type DLEN_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `DLEN` writer - DLEN field"]
60pub type DLEN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, I2SCR_SPEC, u8, u8, 2, O>;
61#[doc = "Field `PCMSYNW` reader - PCMSYNW field"]
62pub type PCMSYNW_R = crate::BitReader<bool>;
63#[doc = "Field `PCMSYNW` writer - PCMSYNW field"]
64pub type PCMSYNW_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
65#[doc = "Field `MCLKOE` reader - MCLKOE field"]
66pub type MCLKOE_R = crate::BitReader<bool>;
67#[doc = "Field `MCLKOE` writer - MCLKOE field"]
68pub type MCLKOE_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
69#[doc = "Field `CHLEN` reader - CHLEN field"]
70pub type CHLEN_R = crate::BitReader<bool>;
71#[doc = "Field `CHLEN` writer - CHLEN field"]
72pub type CHLEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
73#[doc = "Field `CHRIGHT` reader - CHRIGHT field"]
74pub type CHRIGHT_R = crate::BitReader<bool>;
75#[doc = "Field `CHRIGHT` writer - CHRIGHT field"]
76pub type CHRIGHT_W<'a, const O: u8> = crate::BitWriter<'a, u32, I2SCR_SPEC, bool, O>;
77impl R {
78    #[doc = "Bit 0 - DIEN field"]
79    #[inline(always)]
80    pub fn dien(&self) -> DIEN_R {
81        DIEN_R::new((self.bits & 1) != 0)
82    }
83    #[doc = "Bit 1 - DOEN field"]
84    #[inline(always)]
85    pub fn doen(&self) -> DOEN_R {
86        DOEN_R::new(((self.bits >> 1) & 1) != 0)
87    }
88    #[doc = "Bit 2 - MSTR field"]
89    #[inline(always)]
90    pub fn mstr(&self) -> MSTR_R {
91        MSTR_R::new(((self.bits >> 2) & 1) != 0)
92    }
93    #[doc = "Bit 3 - EN field"]
94    #[inline(always)]
95    pub fn en(&self) -> EN_R {
96        EN_R::new(((self.bits >> 3) & 1) != 0)
97    }
98    #[doc = "Bits 4:5 - FFMT field"]
99    #[inline(always)]
100    pub fn ffmt(&self) -> FFMT_R {
101        FFMT_R::new(((self.bits >> 4) & 3) as u8)
102    }
103    #[doc = "Bits 6:7 - DLEN field"]
104    #[inline(always)]
105    pub fn dlen(&self) -> DLEN_R {
106        DLEN_R::new(((self.bits >> 6) & 3) as u8)
107    }
108    #[doc = "Bit 8 - PCMSYNW field"]
109    #[inline(always)]
110    pub fn pcmsynw(&self) -> PCMSYNW_R {
111        PCMSYNW_R::new(((self.bits >> 8) & 1) != 0)
112    }
113    #[doc = "Bit 9 - MCLKOE field"]
114    #[inline(always)]
115    pub fn mclkoe(&self) -> MCLKOE_R {
116        MCLKOE_R::new(((self.bits >> 9) & 1) != 0)
117    }
118    #[doc = "Bit 10 - CHLEN field"]
119    #[inline(always)]
120    pub fn chlen(&self) -> CHLEN_R {
121        CHLEN_R::new(((self.bits >> 10) & 1) != 0)
122    }
123    #[doc = "Bit 16 - CHRIGHT field"]
124    #[inline(always)]
125    pub fn chright(&self) -> CHRIGHT_R {
126        CHRIGHT_R::new(((self.bits >> 16) & 1) != 0)
127    }
128}
129impl W {
130    #[doc = "Bit 0 - DIEN field"]
131    #[inline(always)]
132    pub fn dien(&mut self) -> DIEN_W<0> {
133        DIEN_W::new(self)
134    }
135    #[doc = "Bit 1 - DOEN field"]
136    #[inline(always)]
137    pub fn doen(&mut self) -> DOEN_W<1> {
138        DOEN_W::new(self)
139    }
140    #[doc = "Bit 2 - MSTR field"]
141    #[inline(always)]
142    pub fn mstr(&mut self) -> MSTR_W<2> {
143        MSTR_W::new(self)
144    }
145    #[doc = "Bit 3 - EN field"]
146    #[inline(always)]
147    pub fn en(&mut self) -> EN_W<3> {
148        EN_W::new(self)
149    }
150    #[doc = "Bits 4:5 - FFMT field"]
151    #[inline(always)]
152    pub fn ffmt(&mut self) -> FFMT_W<4> {
153        FFMT_W::new(self)
154    }
155    #[doc = "Bits 6:7 - DLEN field"]
156    #[inline(always)]
157    pub fn dlen(&mut self) -> DLEN_W<6> {
158        DLEN_W::new(self)
159    }
160    #[doc = "Bit 8 - PCMSYNW field"]
161    #[inline(always)]
162    pub fn pcmsynw(&mut self) -> PCMSYNW_W<8> {
163        PCMSYNW_W::new(self)
164    }
165    #[doc = "Bit 9 - MCLKOE field"]
166    #[inline(always)]
167    pub fn mclkoe(&mut self) -> MCLKOE_W<9> {
168        MCLKOE_W::new(self)
169    }
170    #[doc = "Bit 10 - CHLEN field"]
171    #[inline(always)]
172    pub fn chlen(&mut self) -> CHLEN_W<10> {
173        CHLEN_W::new(self)
174    }
175    #[doc = "Bit 16 - CHRIGHT field"]
176    #[inline(always)]
177    pub fn chright(&mut self) -> CHRIGHT_W<16> {
178        CHRIGHT_W::new(self)
179    }
180    #[doc = "Writes raw bits to the register."]
181    #[inline(always)]
182    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
183        self.0.bits(bits);
184        self
185    }
186}
187#[doc = "I2SCR 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 [i2scr](index.html) module"]
188pub struct I2SCR_SPEC;
189impl crate::RegisterSpec for I2SCR_SPEC {
190    type Ux = u32;
191}
192#[doc = "`read()` method returns [i2scr::R](R) reader structure"]
193impl crate::Readable for I2SCR_SPEC {
194    type Reader = R;
195}
196#[doc = "`write(|w| ..)` method takes [i2scr::W](W) writer structure"]
197impl crate::Writable for I2SCR_SPEC {
198    type Writer = W;
199}
200#[doc = "`reset()` method sets I2SCR to value 0"]
201impl crate::Resettable for I2SCR_SPEC {
202    #[inline(always)]
203    fn reset_value() -> Self::Ux {
204        0
205    }
206}