1#[doc = "Reader of register OFR2"]
2pub type R = crate::R<u32, super::OFR2>;
3#[doc = "Writer for register OFR2"]
4pub type W = crate::W<u32, super::OFR2>;
5#[doc = "Register OFR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::OFR2 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `OFFSET2_EN`"]
14pub type OFFSET2_EN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `OFFSET2_EN`"]
16pub struct OFFSET2_EN_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> OFFSET2_EN_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
34 self.w
35 }
36}
37#[doc = "Reader of field `OFFSET2_CH`"]
38pub type OFFSET2_CH_R = crate::R<u8, u8>;
39#[doc = "Write proxy for field `OFFSET2_CH`"]
40pub struct OFFSET2_CH_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> OFFSET2_CH_W<'a> {
44 #[doc = r"Writes raw bits to the field"]
45 #[inline(always)]
46 pub unsafe fn bits(self, value: u8) -> &'a mut W {
47 self.w.bits = (self.w.bits & !(0x1f << 26)) | (((value as u32) & 0x1f) << 26);
48 self.w
49 }
50}
51#[doc = "Reader of field `OFFSET2`"]
52pub type OFFSET2_R = crate::R<u16, u16>;
53#[doc = "Write proxy for field `OFFSET2`"]
54pub struct OFFSET2_W<'a> {
55 w: &'a mut W,
56}
57impl<'a> OFFSET2_W<'a> {
58 #[doc = r"Writes raw bits to the field"]
59 #[inline(always)]
60 pub unsafe fn bits(self, value: u16) -> &'a mut W {
61 self.w.bits = (self.w.bits & !0x0fff) | ((value as u32) & 0x0fff);
62 self.w
63 }
64}
65impl R {
66 #[doc = "Bit 31 - ADC offset number 2 enable"]
67 #[inline(always)]
68 pub fn offset2_en(&self) -> OFFSET2_EN_R {
69 OFFSET2_EN_R::new(((self.bits >> 31) & 0x01) != 0)
70 }
71 #[doc = "Bits 26:30 - ADC offset number 2 channel selection"]
72 #[inline(always)]
73 pub fn offset2_ch(&self) -> OFFSET2_CH_R {
74 OFFSET2_CH_R::new(((self.bits >> 26) & 0x1f) as u8)
75 }
76 #[doc = "Bits 0:11 - ADC offset number 2 offset level"]
77 #[inline(always)]
78 pub fn offset2(&self) -> OFFSET2_R {
79 OFFSET2_R::new((self.bits & 0x0fff) as u16)
80 }
81}
82impl W {
83 #[doc = "Bit 31 - ADC offset number 2 enable"]
84 #[inline(always)]
85 pub fn offset2_en(&mut self) -> OFFSET2_EN_W {
86 OFFSET2_EN_W { w: self }
87 }
88 #[doc = "Bits 26:30 - ADC offset number 2 channel selection"]
89 #[inline(always)]
90 pub fn offset2_ch(&mut self) -> OFFSET2_CH_W {
91 OFFSET2_CH_W { w: self }
92 }
93 #[doc = "Bits 0:11 - ADC offset number 2 offset level"]
94 #[inline(always)]
95 pub fn offset2(&mut self) -> OFFSET2_W {
96 OFFSET2_W { w: self }
97 }
98}