stm32l4x2_pac/sai1/ch/
slotr.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::SLOTR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct SLOTENR {
47 bits: u16,
48}
49impl SLOTENR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u16 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct NBSLOTR {
58 bits: u8,
59}
60impl NBSLOTR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct SLOTSZR {
69 bits: u8,
70}
71impl SLOTSZR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u8 {
75 self.bits
76 }
77}
78#[doc = r" Value of the field"]
79pub struct FBOFFR {
80 bits: u8,
81}
82impl FBOFFR {
83 #[doc = r" Value of the field as raw bits"]
84 #[inline]
85 pub fn bits(&self) -> u8 {
86 self.bits
87 }
88}
89#[doc = r" Proxy"]
90pub struct _SLOTENW<'a> {
91 w: &'a mut W,
92}
93impl<'a> _SLOTENW<'a> {
94 #[doc = r" Writes raw bits to the field"]
95 #[inline]
96 pub unsafe fn bits(self, value: u16) -> &'a mut W {
97 const MASK: u16 = 65535;
98 const OFFSET: u8 = 16;
99 self.w.bits &= !((MASK as u32) << OFFSET);
100 self.w.bits |= ((value & MASK) as u32) << OFFSET;
101 self.w
102 }
103}
104#[doc = r" Proxy"]
105pub struct _NBSLOTW<'a> {
106 w: &'a mut W,
107}
108impl<'a> _NBSLOTW<'a> {
109 #[doc = r" Writes raw bits to the field"]
110 #[inline]
111 pub unsafe fn bits(self, value: u8) -> &'a mut W {
112 const MASK: u8 = 15;
113 const OFFSET: u8 = 8;
114 self.w.bits &= !((MASK as u32) << OFFSET);
115 self.w.bits |= ((value & MASK) as u32) << OFFSET;
116 self.w
117 }
118}
119#[doc = r" Proxy"]
120pub struct _SLOTSZW<'a> {
121 w: &'a mut W,
122}
123impl<'a> _SLOTSZW<'a> {
124 #[doc = r" Writes raw bits to the field"]
125 #[inline]
126 pub unsafe fn bits(self, value: u8) -> &'a mut W {
127 const MASK: u8 = 3;
128 const OFFSET: u8 = 6;
129 self.w.bits &= !((MASK as u32) << OFFSET);
130 self.w.bits |= ((value & MASK) as u32) << OFFSET;
131 self.w
132 }
133}
134#[doc = r" Proxy"]
135pub struct _FBOFFW<'a> {
136 w: &'a mut W,
137}
138impl<'a> _FBOFFW<'a> {
139 #[doc = r" Writes raw bits to the field"]
140 #[inline]
141 pub unsafe fn bits(self, value: u8) -> &'a mut W {
142 const MASK: u8 = 31;
143 const OFFSET: u8 = 0;
144 self.w.bits &= !((MASK as u32) << OFFSET);
145 self.w.bits |= ((value & MASK) as u32) << OFFSET;
146 self.w
147 }
148}
149impl R {
150 #[doc = r" Value of the register as raw bits"]
151 #[inline]
152 pub fn bits(&self) -> u32 {
153 self.bits
154 }
155 #[doc = "Bits 16:31 - Slot enable"]
156 #[inline]
157 pub fn sloten(&self) -> SLOTENR {
158 let bits = {
159 const MASK: u16 = 65535;
160 const OFFSET: u8 = 16;
161 ((self.bits >> OFFSET) & MASK as u32) as u16
162 };
163 SLOTENR { bits }
164 }
165 #[doc = "Bits 8:11 - Number of slots in an audio frame"]
166 #[inline]
167 pub fn nbslot(&self) -> NBSLOTR {
168 let bits = {
169 const MASK: u8 = 15;
170 const OFFSET: u8 = 8;
171 ((self.bits >> OFFSET) & MASK as u32) as u8
172 };
173 NBSLOTR { bits }
174 }
175 #[doc = "Bits 6:7 - Slot size"]
176 #[inline]
177 pub fn slotsz(&self) -> SLOTSZR {
178 let bits = {
179 const MASK: u8 = 3;
180 const OFFSET: u8 = 6;
181 ((self.bits >> OFFSET) & MASK as u32) as u8
182 };
183 SLOTSZR { bits }
184 }
185 #[doc = "Bits 0:4 - First bit offset"]
186 #[inline]
187 pub fn fboff(&self) -> FBOFFR {
188 let bits = {
189 const MASK: u8 = 31;
190 const OFFSET: u8 = 0;
191 ((self.bits >> OFFSET) & MASK as u32) as u8
192 };
193 FBOFFR { bits }
194 }
195}
196impl W {
197 #[doc = r" Reset value of the register"]
198 #[inline]
199 pub fn reset_value() -> W {
200 W { bits: 0 }
201 }
202 #[doc = r" Writes raw bits to the register"]
203 #[inline]
204 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
205 self.bits = bits;
206 self
207 }
208 #[doc = "Bits 16:31 - Slot enable"]
209 #[inline]
210 pub fn sloten(&mut self) -> _SLOTENW {
211 _SLOTENW { w: self }
212 }
213 #[doc = "Bits 8:11 - Number of slots in an audio frame"]
214 #[inline]
215 pub fn nbslot(&mut self) -> _NBSLOTW {
216 _NBSLOTW { w: self }
217 }
218 #[doc = "Bits 6:7 - Slot size"]
219 #[inline]
220 pub fn slotsz(&mut self) -> _SLOTSZW {
221 _SLOTSZW { w: self }
222 }
223 #[doc = "Bits 0:4 - First bit offset"]
224 #[inline]
225 pub fn fboff(&mut self) -> _FBOFFW {
226 _FBOFFW { w: self }
227 }
228}