1#[doc = "Reader of register BDTR"]
2pub type R = crate::R<u32, super::BDTR>;
3#[doc = "Writer for register BDTR"]
4pub type W = crate::W<u32, super::BDTR>;
5#[doc = "Register BDTR `reset()`'s with value 0"]
6impl crate::ResetValue for super::BDTR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `DTG`"]
14pub type DTG_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `DTG`"]
16pub struct DTG_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> DTG_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
24 self.w
25 }
26}
27#[doc = "Reader of field `LOCK`"]
28pub type LOCK_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `LOCK`"]
30pub struct LOCK_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> LOCK_W<'a> {
34 #[doc = r"Writes raw bits to the field"]
35 #[inline(always)]
36 pub unsafe fn bits(self, value: u8) -> &'a mut W {
37 self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
38 self.w
39 }
40}
41#[doc = "Reader of field `OSSI`"]
42pub type OSSI_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `OSSI`"]
44pub struct OSSI_W<'a> {
45 w: &'a mut W,
46}
47impl<'a> OSSI_W<'a> {
48 #[doc = r"Sets the field bit"]
49 #[inline(always)]
50 pub fn set_bit(self) -> &'a mut W {
51 self.bit(true)
52 }
53 #[doc = r"Clears the field bit"]
54 #[inline(always)]
55 pub fn clear_bit(self) -> &'a mut W {
56 self.bit(false)
57 }
58 #[doc = r"Writes raw bits to the field"]
59 #[inline(always)]
60 pub fn bit(self, value: bool) -> &'a mut W {
61 self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
62 self.w
63 }
64}
65#[doc = "Reader of field `OSSR`"]
66pub type OSSR_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `OSSR`"]
68pub struct OSSR_W<'a> {
69 w: &'a mut W,
70}
71impl<'a> OSSR_W<'a> {
72 #[doc = r"Sets the field bit"]
73 #[inline(always)]
74 pub fn set_bit(self) -> &'a mut W {
75 self.bit(true)
76 }
77 #[doc = r"Clears the field bit"]
78 #[inline(always)]
79 pub fn clear_bit(self) -> &'a mut W {
80 self.bit(false)
81 }
82 #[doc = r"Writes raw bits to the field"]
83 #[inline(always)]
84 pub fn bit(self, value: bool) -> &'a mut W {
85 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
86 self.w
87 }
88}
89#[doc = "Reader of field `BKE`"]
90pub type BKE_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `BKE`"]
92pub struct BKE_W<'a> {
93 w: &'a mut W,
94}
95impl<'a> BKE_W<'a> {
96 #[doc = r"Sets the field bit"]
97 #[inline(always)]
98 pub fn set_bit(self) -> &'a mut W {
99 self.bit(true)
100 }
101 #[doc = r"Clears the field bit"]
102 #[inline(always)]
103 pub fn clear_bit(self) -> &'a mut W {
104 self.bit(false)
105 }
106 #[doc = r"Writes raw bits to the field"]
107 #[inline(always)]
108 pub fn bit(self, value: bool) -> &'a mut W {
109 self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
110 self.w
111 }
112}
113#[doc = "Reader of field `BKP`"]
114pub type BKP_R = crate::R<bool, bool>;
115#[doc = "Write proxy for field `BKP`"]
116pub struct BKP_W<'a> {
117 w: &'a mut W,
118}
119impl<'a> BKP_W<'a> {
120 #[doc = r"Sets the field bit"]
121 #[inline(always)]
122 pub fn set_bit(self) -> &'a mut W {
123 self.bit(true)
124 }
125 #[doc = r"Clears the field bit"]
126 #[inline(always)]
127 pub fn clear_bit(self) -> &'a mut W {
128 self.bit(false)
129 }
130 #[doc = r"Writes raw bits to the field"]
131 #[inline(always)]
132 pub fn bit(self, value: bool) -> &'a mut W {
133 self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
134 self.w
135 }
136}
137#[doc = "Reader of field `AOE`"]
138pub type AOE_R = crate::R<bool, bool>;
139#[doc = "Write proxy for field `AOE`"]
140pub struct AOE_W<'a> {
141 w: &'a mut W,
142}
143impl<'a> AOE_W<'a> {
144 #[doc = r"Sets the field bit"]
145 #[inline(always)]
146 pub fn set_bit(self) -> &'a mut W {
147 self.bit(true)
148 }
149 #[doc = r"Clears the field bit"]
150 #[inline(always)]
151 pub fn clear_bit(self) -> &'a mut W {
152 self.bit(false)
153 }
154 #[doc = r"Writes raw bits to the field"]
155 #[inline(always)]
156 pub fn bit(self, value: bool) -> &'a mut W {
157 self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
158 self.w
159 }
160}
161#[doc = "Reader of field `MOE`"]
162pub type MOE_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `MOE`"]
164pub struct MOE_W<'a> {
165 w: &'a mut W,
166}
167impl<'a> MOE_W<'a> {
168 #[doc = r"Sets the field bit"]
169 #[inline(always)]
170 pub fn set_bit(self) -> &'a mut W {
171 self.bit(true)
172 }
173 #[doc = r"Clears the field bit"]
174 #[inline(always)]
175 pub fn clear_bit(self) -> &'a mut W {
176 self.bit(false)
177 }
178 #[doc = r"Writes raw bits to the field"]
179 #[inline(always)]
180 pub fn bit(self, value: bool) -> &'a mut W {
181 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
182 self.w
183 }
184}
185#[doc = "Reader of field `BKF`"]
186pub type BKF_R = crate::R<u8, u8>;
187#[doc = "Write proxy for field `BKF`"]
188pub struct BKF_W<'a> {
189 w: &'a mut W,
190}
191impl<'a> BKF_W<'a> {
192 #[doc = r"Writes raw bits to the field"]
193 #[inline(always)]
194 pub unsafe fn bits(self, value: u8) -> &'a mut W {
195 self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
196 self.w
197 }
198}
199#[doc = "Reader of field `BK2F`"]
200pub type BK2F_R = crate::R<u8, u8>;
201#[doc = "Write proxy for field `BK2F`"]
202pub struct BK2F_W<'a> {
203 w: &'a mut W,
204}
205impl<'a> BK2F_W<'a> {
206 #[doc = r"Writes raw bits to the field"]
207 #[inline(always)]
208 pub unsafe fn bits(self, value: u8) -> &'a mut W {
209 self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
210 self.w
211 }
212}
213#[doc = "Reader of field `BK2E`"]
214pub type BK2E_R = crate::R<bool, bool>;
215#[doc = "Write proxy for field `BK2E`"]
216pub struct BK2E_W<'a> {
217 w: &'a mut W,
218}
219impl<'a> BK2E_W<'a> {
220 #[doc = r"Sets the field bit"]
221 #[inline(always)]
222 pub fn set_bit(self) -> &'a mut W {
223 self.bit(true)
224 }
225 #[doc = r"Clears the field bit"]
226 #[inline(always)]
227 pub fn clear_bit(self) -> &'a mut W {
228 self.bit(false)
229 }
230 #[doc = r"Writes raw bits to the field"]
231 #[inline(always)]
232 pub fn bit(self, value: bool) -> &'a mut W {
233 self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
234 self.w
235 }
236}
237#[doc = "Reader of field `BK2P`"]
238pub type BK2P_R = crate::R<bool, bool>;
239#[doc = "Write proxy for field `BK2P`"]
240pub struct BK2P_W<'a> {
241 w: &'a mut W,
242}
243impl<'a> BK2P_W<'a> {
244 #[doc = r"Sets the field bit"]
245 #[inline(always)]
246 pub fn set_bit(self) -> &'a mut W {
247 self.bit(true)
248 }
249 #[doc = r"Clears the field bit"]
250 #[inline(always)]
251 pub fn clear_bit(self) -> &'a mut W {
252 self.bit(false)
253 }
254 #[doc = r"Writes raw bits to the field"]
255 #[inline(always)]
256 pub fn bit(self, value: bool) -> &'a mut W {
257 self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
258 self.w
259 }
260}
261impl R {
262 #[doc = "Bits 0:7 - Dead-time generator setup"]
263 #[inline(always)]
264 pub fn dtg(&self) -> DTG_R {
265 DTG_R::new((self.bits & 0xff) as u8)
266 }
267 #[doc = "Bits 8:9 - Lock configuration"]
268 #[inline(always)]
269 pub fn lock(&self) -> LOCK_R {
270 LOCK_R::new(((self.bits >> 8) & 0x03) as u8)
271 }
272 #[doc = "Bit 10 - Off-state selection for Idle mode"]
273 #[inline(always)]
274 pub fn ossi(&self) -> OSSI_R {
275 OSSI_R::new(((self.bits >> 10) & 0x01) != 0)
276 }
277 #[doc = "Bit 11 - Off-state selection for Run mode"]
278 #[inline(always)]
279 pub fn ossr(&self) -> OSSR_R {
280 OSSR_R::new(((self.bits >> 11) & 0x01) != 0)
281 }
282 #[doc = "Bit 12 - Break enable"]
283 #[inline(always)]
284 pub fn bke(&self) -> BKE_R {
285 BKE_R::new(((self.bits >> 12) & 0x01) != 0)
286 }
287 #[doc = "Bit 13 - Break polarity"]
288 #[inline(always)]
289 pub fn bkp(&self) -> BKP_R {
290 BKP_R::new(((self.bits >> 13) & 0x01) != 0)
291 }
292 #[doc = "Bit 14 - Automatic output enable"]
293 #[inline(always)]
294 pub fn aoe(&self) -> AOE_R {
295 AOE_R::new(((self.bits >> 14) & 0x01) != 0)
296 }
297 #[doc = "Bit 15 - Main output enable"]
298 #[inline(always)]
299 pub fn moe(&self) -> MOE_R {
300 MOE_R::new(((self.bits >> 15) & 0x01) != 0)
301 }
302 #[doc = "Bits 16:19 - Break filter"]
303 #[inline(always)]
304 pub fn bkf(&self) -> BKF_R {
305 BKF_R::new(((self.bits >> 16) & 0x0f) as u8)
306 }
307 #[doc = "Bits 20:23 - Break 2 filter"]
308 #[inline(always)]
309 pub fn bk2f(&self) -> BK2F_R {
310 BK2F_R::new(((self.bits >> 20) & 0x0f) as u8)
311 }
312 #[doc = "Bit 24 - Break 2 enable"]
313 #[inline(always)]
314 pub fn bk2e(&self) -> BK2E_R {
315 BK2E_R::new(((self.bits >> 24) & 0x01) != 0)
316 }
317 #[doc = "Bit 25 - Break 2 polarity"]
318 #[inline(always)]
319 pub fn bk2p(&self) -> BK2P_R {
320 BK2P_R::new(((self.bits >> 25) & 0x01) != 0)
321 }
322}
323impl W {
324 #[doc = "Bits 0:7 - Dead-time generator setup"]
325 #[inline(always)]
326 pub fn dtg(&mut self) -> DTG_W {
327 DTG_W { w: self }
328 }
329 #[doc = "Bits 8:9 - Lock configuration"]
330 #[inline(always)]
331 pub fn lock(&mut self) -> LOCK_W {
332 LOCK_W { w: self }
333 }
334 #[doc = "Bit 10 - Off-state selection for Idle mode"]
335 #[inline(always)]
336 pub fn ossi(&mut self) -> OSSI_W {
337 OSSI_W { w: self }
338 }
339 #[doc = "Bit 11 - Off-state selection for Run mode"]
340 #[inline(always)]
341 pub fn ossr(&mut self) -> OSSR_W {
342 OSSR_W { w: self }
343 }
344 #[doc = "Bit 12 - Break enable"]
345 #[inline(always)]
346 pub fn bke(&mut self) -> BKE_W {
347 BKE_W { w: self }
348 }
349 #[doc = "Bit 13 - Break polarity"]
350 #[inline(always)]
351 pub fn bkp(&mut self) -> BKP_W {
352 BKP_W { w: self }
353 }
354 #[doc = "Bit 14 - Automatic output enable"]
355 #[inline(always)]
356 pub fn aoe(&mut self) -> AOE_W {
357 AOE_W { w: self }
358 }
359 #[doc = "Bit 15 - Main output enable"]
360 #[inline(always)]
361 pub fn moe(&mut self) -> MOE_W {
362 MOE_W { w: self }
363 }
364 #[doc = "Bits 16:19 - Break filter"]
365 #[inline(always)]
366 pub fn bkf(&mut self) -> BKF_W {
367 BKF_W { w: self }
368 }
369 #[doc = "Bits 20:23 - Break 2 filter"]
370 #[inline(always)]
371 pub fn bk2f(&mut self) -> BK2F_W {
372 BK2F_W { w: self }
373 }
374 #[doc = "Bit 24 - Break 2 enable"]
375 #[inline(always)]
376 pub fn bk2e(&mut self) -> BK2E_W {
377 BK2E_W { w: self }
378 }
379 #[doc = "Bit 25 - Break 2 polarity"]
380 #[inline(always)]
381 pub fn bk2p(&mut self) -> BK2P_W {
382 BK2P_W { w: self }
383 }
384}