efm32pg12_pac/vdac0/
cal.rs

1#[doc = "Reader of register CAL"]
2pub type R = crate::R<u32, super::CAL>;
3#[doc = "Writer for register CAL"]
4pub type W = crate::W<u32, super::CAL>;
5#[doc = "Register CAL `reset()`'s with value 0x0008_2004"]
6impl crate::ResetValue for super::CAL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0008_2004
11    }
12}
13#[doc = "Reader of field `OFFSETTRIM`"]
14pub type OFFSETTRIM_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `OFFSETTRIM`"]
16pub struct OFFSETTRIM_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> OFFSETTRIM_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 & !0x07) | ((value as u32) & 0x07);
24        self.w
25    }
26}
27#[doc = "Reader of field `GAINERRTRIM`"]
28pub type GAINERRTRIM_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `GAINERRTRIM`"]
30pub struct GAINERRTRIM_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> GAINERRTRIM_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 & !(0x3f << 8)) | (((value as u32) & 0x3f) << 8);
38        self.w
39    }
40}
41#[doc = "Reader of field `GAINERRTRIMCH1`"]
42pub type GAINERRTRIMCH1_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `GAINERRTRIMCH1`"]
44pub struct GAINERRTRIMCH1_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> GAINERRTRIMCH1_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
52        self.w
53    }
54}
55impl R {
56    #[doc = "Bits 0:2 - Input Buffer Offset Calibration Value"]
57    #[inline(always)]
58    pub fn offsettrim(&self) -> OFFSETTRIM_R {
59        OFFSETTRIM_R::new((self.bits & 0x07) as u8)
60    }
61    #[doc = "Bits 8:13 - Gain Error Trim Value"]
62    #[inline(always)]
63    pub fn gainerrtrim(&self) -> GAINERRTRIM_R {
64        GAINERRTRIM_R::new(((self.bits >> 8) & 0x3f) as u8)
65    }
66    #[doc = "Bits 16:19 - Gain Error Trim Value for CH1"]
67    #[inline(always)]
68    pub fn gainerrtrimch1(&self) -> GAINERRTRIMCH1_R {
69        GAINERRTRIMCH1_R::new(((self.bits >> 16) & 0x0f) as u8)
70    }
71}
72impl W {
73    #[doc = "Bits 0:2 - Input Buffer Offset Calibration Value"]
74    #[inline(always)]
75    pub fn offsettrim(&mut self) -> OFFSETTRIM_W {
76        OFFSETTRIM_W { w: self }
77    }
78    #[doc = "Bits 8:13 - Gain Error Trim Value"]
79    #[inline(always)]
80    pub fn gainerrtrim(&mut self) -> GAINERRTRIM_W {
81        GAINERRTRIM_W { w: self }
82    }
83    #[doc = "Bits 16:19 - Gain Error Trim Value for CH1"]
84    #[inline(always)]
85    pub fn gainerrtrimch1(&mut self) -> GAINERRTRIMCH1_W {
86        GAINERRTRIMCH1_W { w: self }
87    }
88}