atsame70q21/afec0/
afec_cgr.rs1#[doc = "Register `AFEC_CGR` reader"]
2pub struct R(crate::R<AFEC_CGR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<AFEC_CGR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<AFEC_CGR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<AFEC_CGR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `AFEC_CGR` writer"]
17pub struct W(crate::W<AFEC_CGR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<AFEC_CGR_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<AFEC_CGR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<AFEC_CGR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `GAIN0` reader - Gain for Channel 0"]
38pub struct GAIN0_R(crate::FieldReader<u8, u8>);
39impl GAIN0_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 GAIN0_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for GAIN0_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `GAIN0` writer - Gain for Channel 0"]
53pub struct GAIN0_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> GAIN0_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
61 self.w
62 }
63}
64#[doc = "Field `GAIN1` reader - Gain for Channel 1"]
65pub struct GAIN1_R(crate::FieldReader<u8, u8>);
66impl GAIN1_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u8) -> Self {
69 GAIN1_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for GAIN1_R {
73 type Target = crate::FieldReader<u8, u8>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `GAIN1` writer - Gain for Channel 1"]
80pub struct GAIN1_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> GAIN1_W<'a> {
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub unsafe fn bits(self, value: u8) -> &'a mut W {
87 self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u32 & 0x03) << 2);
88 self.w
89 }
90}
91#[doc = "Field `GAIN2` reader - Gain for Channel 2"]
92pub struct GAIN2_R(crate::FieldReader<u8, u8>);
93impl GAIN2_R {
94 #[inline(always)]
95 pub(crate) fn new(bits: u8) -> Self {
96 GAIN2_R(crate::FieldReader::new(bits))
97 }
98}
99impl core::ops::Deref for GAIN2_R {
100 type Target = crate::FieldReader<u8, u8>;
101 #[inline(always)]
102 fn deref(&self) -> &Self::Target {
103 &self.0
104 }
105}
106#[doc = "Field `GAIN2` writer - Gain for Channel 2"]
107pub struct GAIN2_W<'a> {
108 w: &'a mut W,
109}
110impl<'a> GAIN2_W<'a> {
111 #[doc = r"Writes raw bits to the field"]
112 #[inline(always)]
113 pub unsafe fn bits(self, value: u8) -> &'a mut W {
114 self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u32 & 0x03) << 4);
115 self.w
116 }
117}
118#[doc = "Field `GAIN3` reader - Gain for Channel 3"]
119pub struct GAIN3_R(crate::FieldReader<u8, u8>);
120impl GAIN3_R {
121 #[inline(always)]
122 pub(crate) fn new(bits: u8) -> Self {
123 GAIN3_R(crate::FieldReader::new(bits))
124 }
125}
126impl core::ops::Deref for GAIN3_R {
127 type Target = crate::FieldReader<u8, u8>;
128 #[inline(always)]
129 fn deref(&self) -> &Self::Target {
130 &self.0
131 }
132}
133#[doc = "Field `GAIN3` writer - Gain for Channel 3"]
134pub struct GAIN3_W<'a> {
135 w: &'a mut W,
136}
137impl<'a> GAIN3_W<'a> {
138 #[doc = r"Writes raw bits to the field"]
139 #[inline(always)]
140 pub unsafe fn bits(self, value: u8) -> &'a mut W {
141 self.w.bits = (self.w.bits & !(0x03 << 6)) | ((value as u32 & 0x03) << 6);
142 self.w
143 }
144}
145#[doc = "Field `GAIN4` reader - Gain for Channel 4"]
146pub struct GAIN4_R(crate::FieldReader<u8, u8>);
147impl GAIN4_R {
148 #[inline(always)]
149 pub(crate) fn new(bits: u8) -> Self {
150 GAIN4_R(crate::FieldReader::new(bits))
151 }
152}
153impl core::ops::Deref for GAIN4_R {
154 type Target = crate::FieldReader<u8, u8>;
155 #[inline(always)]
156 fn deref(&self) -> &Self::Target {
157 &self.0
158 }
159}
160#[doc = "Field `GAIN4` writer - Gain for Channel 4"]
161pub struct GAIN4_W<'a> {
162 w: &'a mut W,
163}
164impl<'a> GAIN4_W<'a> {
165 #[doc = r"Writes raw bits to the field"]
166 #[inline(always)]
167 pub unsafe fn bits(self, value: u8) -> &'a mut W {
168 self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
169 self.w
170 }
171}
172#[doc = "Field `GAIN5` reader - Gain for Channel 5"]
173pub struct GAIN5_R(crate::FieldReader<u8, u8>);
174impl GAIN5_R {
175 #[inline(always)]
176 pub(crate) fn new(bits: u8) -> Self {
177 GAIN5_R(crate::FieldReader::new(bits))
178 }
179}
180impl core::ops::Deref for GAIN5_R {
181 type Target = crate::FieldReader<u8, u8>;
182 #[inline(always)]
183 fn deref(&self) -> &Self::Target {
184 &self.0
185 }
186}
187#[doc = "Field `GAIN5` writer - Gain for Channel 5"]
188pub struct GAIN5_W<'a> {
189 w: &'a mut W,
190}
191impl<'a> GAIN5_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 & !(0x03 << 10)) | ((value as u32 & 0x03) << 10);
196 self.w
197 }
198}
199#[doc = "Field `GAIN6` reader - Gain for Channel 6"]
200pub struct GAIN6_R(crate::FieldReader<u8, u8>);
201impl GAIN6_R {
202 #[inline(always)]
203 pub(crate) fn new(bits: u8) -> Self {
204 GAIN6_R(crate::FieldReader::new(bits))
205 }
206}
207impl core::ops::Deref for GAIN6_R {
208 type Target = crate::FieldReader<u8, u8>;
209 #[inline(always)]
210 fn deref(&self) -> &Self::Target {
211 &self.0
212 }
213}
214#[doc = "Field `GAIN6` writer - Gain for Channel 6"]
215pub struct GAIN6_W<'a> {
216 w: &'a mut W,
217}
218impl<'a> GAIN6_W<'a> {
219 #[doc = r"Writes raw bits to the field"]
220 #[inline(always)]
221 pub unsafe fn bits(self, value: u8) -> &'a mut W {
222 self.w.bits = (self.w.bits & !(0x03 << 12)) | ((value as u32 & 0x03) << 12);
223 self.w
224 }
225}
226#[doc = "Field `GAIN7` reader - Gain for Channel 7"]
227pub struct GAIN7_R(crate::FieldReader<u8, u8>);
228impl GAIN7_R {
229 #[inline(always)]
230 pub(crate) fn new(bits: u8) -> Self {
231 GAIN7_R(crate::FieldReader::new(bits))
232 }
233}
234impl core::ops::Deref for GAIN7_R {
235 type Target = crate::FieldReader<u8, u8>;
236 #[inline(always)]
237 fn deref(&self) -> &Self::Target {
238 &self.0
239 }
240}
241#[doc = "Field `GAIN7` writer - Gain for Channel 7"]
242pub struct GAIN7_W<'a> {
243 w: &'a mut W,
244}
245impl<'a> GAIN7_W<'a> {
246 #[doc = r"Writes raw bits to the field"]
247 #[inline(always)]
248 pub unsafe fn bits(self, value: u8) -> &'a mut W {
249 self.w.bits = (self.w.bits & !(0x03 << 14)) | ((value as u32 & 0x03) << 14);
250 self.w
251 }
252}
253#[doc = "Field `GAIN8` reader - Gain for Channel 8"]
254pub struct GAIN8_R(crate::FieldReader<u8, u8>);
255impl GAIN8_R {
256 #[inline(always)]
257 pub(crate) fn new(bits: u8) -> Self {
258 GAIN8_R(crate::FieldReader::new(bits))
259 }
260}
261impl core::ops::Deref for GAIN8_R {
262 type Target = crate::FieldReader<u8, u8>;
263 #[inline(always)]
264 fn deref(&self) -> &Self::Target {
265 &self.0
266 }
267}
268#[doc = "Field `GAIN8` writer - Gain for Channel 8"]
269pub struct GAIN8_W<'a> {
270 w: &'a mut W,
271}
272impl<'a> GAIN8_W<'a> {
273 #[doc = r"Writes raw bits to the field"]
274 #[inline(always)]
275 pub unsafe fn bits(self, value: u8) -> &'a mut W {
276 self.w.bits = (self.w.bits & !(0x03 << 16)) | ((value as u32 & 0x03) << 16);
277 self.w
278 }
279}
280#[doc = "Field `GAIN9` reader - Gain for Channel 9"]
281pub struct GAIN9_R(crate::FieldReader<u8, u8>);
282impl GAIN9_R {
283 #[inline(always)]
284 pub(crate) fn new(bits: u8) -> Self {
285 GAIN9_R(crate::FieldReader::new(bits))
286 }
287}
288impl core::ops::Deref for GAIN9_R {
289 type Target = crate::FieldReader<u8, u8>;
290 #[inline(always)]
291 fn deref(&self) -> &Self::Target {
292 &self.0
293 }
294}
295#[doc = "Field `GAIN9` writer - Gain for Channel 9"]
296pub struct GAIN9_W<'a> {
297 w: &'a mut W,
298}
299impl<'a> GAIN9_W<'a> {
300 #[doc = r"Writes raw bits to the field"]
301 #[inline(always)]
302 pub unsafe fn bits(self, value: u8) -> &'a mut W {
303 self.w.bits = (self.w.bits & !(0x03 << 18)) | ((value as u32 & 0x03) << 18);
304 self.w
305 }
306}
307#[doc = "Field `GAIN10` reader - Gain for Channel 10"]
308pub struct GAIN10_R(crate::FieldReader<u8, u8>);
309impl GAIN10_R {
310 #[inline(always)]
311 pub(crate) fn new(bits: u8) -> Self {
312 GAIN10_R(crate::FieldReader::new(bits))
313 }
314}
315impl core::ops::Deref for GAIN10_R {
316 type Target = crate::FieldReader<u8, u8>;
317 #[inline(always)]
318 fn deref(&self) -> &Self::Target {
319 &self.0
320 }
321}
322#[doc = "Field `GAIN10` writer - Gain for Channel 10"]
323pub struct GAIN10_W<'a> {
324 w: &'a mut W,
325}
326impl<'a> GAIN10_W<'a> {
327 #[doc = r"Writes raw bits to the field"]
328 #[inline(always)]
329 pub unsafe fn bits(self, value: u8) -> &'a mut W {
330 self.w.bits = (self.w.bits & !(0x03 << 20)) | ((value as u32 & 0x03) << 20);
331 self.w
332 }
333}
334#[doc = "Field `GAIN11` reader - Gain for Channel 11"]
335pub struct GAIN11_R(crate::FieldReader<u8, u8>);
336impl GAIN11_R {
337 #[inline(always)]
338 pub(crate) fn new(bits: u8) -> Self {
339 GAIN11_R(crate::FieldReader::new(bits))
340 }
341}
342impl core::ops::Deref for GAIN11_R {
343 type Target = crate::FieldReader<u8, u8>;
344 #[inline(always)]
345 fn deref(&self) -> &Self::Target {
346 &self.0
347 }
348}
349#[doc = "Field `GAIN11` writer - Gain for Channel 11"]
350pub struct GAIN11_W<'a> {
351 w: &'a mut W,
352}
353impl<'a> GAIN11_W<'a> {
354 #[doc = r"Writes raw bits to the field"]
355 #[inline(always)]
356 pub unsafe fn bits(self, value: u8) -> &'a mut W {
357 self.w.bits = (self.w.bits & !(0x03 << 22)) | ((value as u32 & 0x03) << 22);
358 self.w
359 }
360}
361impl R {
362 #[doc = "Bits 0:1 - Gain for Channel 0"]
363 #[inline(always)]
364 pub fn gain0(&self) -> GAIN0_R {
365 GAIN0_R::new((self.bits & 0x03) as u8)
366 }
367 #[doc = "Bits 2:3 - Gain for Channel 1"]
368 #[inline(always)]
369 pub fn gain1(&self) -> GAIN1_R {
370 GAIN1_R::new(((self.bits >> 2) & 0x03) as u8)
371 }
372 #[doc = "Bits 4:5 - Gain for Channel 2"]
373 #[inline(always)]
374 pub fn gain2(&self) -> GAIN2_R {
375 GAIN2_R::new(((self.bits >> 4) & 0x03) as u8)
376 }
377 #[doc = "Bits 6:7 - Gain for Channel 3"]
378 #[inline(always)]
379 pub fn gain3(&self) -> GAIN3_R {
380 GAIN3_R::new(((self.bits >> 6) & 0x03) as u8)
381 }
382 #[doc = "Bits 8:9 - Gain for Channel 4"]
383 #[inline(always)]
384 pub fn gain4(&self) -> GAIN4_R {
385 GAIN4_R::new(((self.bits >> 8) & 0x03) as u8)
386 }
387 #[doc = "Bits 10:11 - Gain for Channel 5"]
388 #[inline(always)]
389 pub fn gain5(&self) -> GAIN5_R {
390 GAIN5_R::new(((self.bits >> 10) & 0x03) as u8)
391 }
392 #[doc = "Bits 12:13 - Gain for Channel 6"]
393 #[inline(always)]
394 pub fn gain6(&self) -> GAIN6_R {
395 GAIN6_R::new(((self.bits >> 12) & 0x03) as u8)
396 }
397 #[doc = "Bits 14:15 - Gain for Channel 7"]
398 #[inline(always)]
399 pub fn gain7(&self) -> GAIN7_R {
400 GAIN7_R::new(((self.bits >> 14) & 0x03) as u8)
401 }
402 #[doc = "Bits 16:17 - Gain for Channel 8"]
403 #[inline(always)]
404 pub fn gain8(&self) -> GAIN8_R {
405 GAIN8_R::new(((self.bits >> 16) & 0x03) as u8)
406 }
407 #[doc = "Bits 18:19 - Gain for Channel 9"]
408 #[inline(always)]
409 pub fn gain9(&self) -> GAIN9_R {
410 GAIN9_R::new(((self.bits >> 18) & 0x03) as u8)
411 }
412 #[doc = "Bits 20:21 - Gain for Channel 10"]
413 #[inline(always)]
414 pub fn gain10(&self) -> GAIN10_R {
415 GAIN10_R::new(((self.bits >> 20) & 0x03) as u8)
416 }
417 #[doc = "Bits 22:23 - Gain for Channel 11"]
418 #[inline(always)]
419 pub fn gain11(&self) -> GAIN11_R {
420 GAIN11_R::new(((self.bits >> 22) & 0x03) as u8)
421 }
422}
423impl W {
424 #[doc = "Bits 0:1 - Gain for Channel 0"]
425 #[inline(always)]
426 pub fn gain0(&mut self) -> GAIN0_W {
427 GAIN0_W { w: self }
428 }
429 #[doc = "Bits 2:3 - Gain for Channel 1"]
430 #[inline(always)]
431 pub fn gain1(&mut self) -> GAIN1_W {
432 GAIN1_W { w: self }
433 }
434 #[doc = "Bits 4:5 - Gain for Channel 2"]
435 #[inline(always)]
436 pub fn gain2(&mut self) -> GAIN2_W {
437 GAIN2_W { w: self }
438 }
439 #[doc = "Bits 6:7 - Gain for Channel 3"]
440 #[inline(always)]
441 pub fn gain3(&mut self) -> GAIN3_W {
442 GAIN3_W { w: self }
443 }
444 #[doc = "Bits 8:9 - Gain for Channel 4"]
445 #[inline(always)]
446 pub fn gain4(&mut self) -> GAIN4_W {
447 GAIN4_W { w: self }
448 }
449 #[doc = "Bits 10:11 - Gain for Channel 5"]
450 #[inline(always)]
451 pub fn gain5(&mut self) -> GAIN5_W {
452 GAIN5_W { w: self }
453 }
454 #[doc = "Bits 12:13 - Gain for Channel 6"]
455 #[inline(always)]
456 pub fn gain6(&mut self) -> GAIN6_W {
457 GAIN6_W { w: self }
458 }
459 #[doc = "Bits 14:15 - Gain for Channel 7"]
460 #[inline(always)]
461 pub fn gain7(&mut self) -> GAIN7_W {
462 GAIN7_W { w: self }
463 }
464 #[doc = "Bits 16:17 - Gain for Channel 8"]
465 #[inline(always)]
466 pub fn gain8(&mut self) -> GAIN8_W {
467 GAIN8_W { w: self }
468 }
469 #[doc = "Bits 18:19 - Gain for Channel 9"]
470 #[inline(always)]
471 pub fn gain9(&mut self) -> GAIN9_W {
472 GAIN9_W { w: self }
473 }
474 #[doc = "Bits 20:21 - Gain for Channel 10"]
475 #[inline(always)]
476 pub fn gain10(&mut self) -> GAIN10_W {
477 GAIN10_W { w: self }
478 }
479 #[doc = "Bits 22:23 - Gain for Channel 11"]
480 #[inline(always)]
481 pub fn gain11(&mut self) -> GAIN11_W {
482 GAIN11_W { w: self }
483 }
484 #[doc = "Writes raw bits to the register."]
485 #[inline(always)]
486 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
487 self.0.bits(bits);
488 self
489 }
490}
491#[doc = "AFEC Channel Gain 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 [afec_cgr](index.html) module"]
492pub struct AFEC_CGR_SPEC;
493impl crate::RegisterSpec for AFEC_CGR_SPEC {
494 type Ux = u32;
495}
496#[doc = "`read()` method returns [afec_cgr::R](R) reader structure"]
497impl crate::Readable for AFEC_CGR_SPEC {
498 type Reader = R;
499}
500#[doc = "`write(|w| ..)` method takes [afec_cgr::W](W) writer structure"]
501impl crate::Writable for AFEC_CGR_SPEC {
502 type Writer = W;
503}
504#[doc = "`reset()` method sets AFEC_CGR to value 0"]
505impl crate::Resettable for AFEC_CGR_SPEC {
506 #[inline(always)]
507 fn reset_value() -> Self::Ux {
508 0
509 }
510}