swm341_pac/sys/
adccr.rs

1#[doc = "Register `ADCCR` reader"]
2pub struct R(crate::R<ADCCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADCCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADCCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADCCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ADCCR` writer"]
17pub struct W(crate::W<ADCCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ADCCR_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<ADCCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ADCCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `_0IVREN` reader - _0IVREN field"]
38pub type _0IVREN_R = crate::BitReader<bool>;
39#[doc = "Field `_0IVREN` writer - _0IVREN field"]
40pub type _0IVREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
41#[doc = "Field `_1IVREN` reader - _1IVREN field"]
42pub type _1IVREN_R = crate::BitReader<bool>;
43#[doc = "Field `_1IVREN` writer - _1IVREN field"]
44pub type _1IVREN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
45#[doc = "Field `_0IVRSEL` reader - _0IVRSEL field"]
46pub type _0IVRSEL_R = crate::BitReader<bool>;
47#[doc = "Field `_0IVRSEL` writer - _0IVRSEL field"]
48pub type _0IVRSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
49#[doc = "Field `_1IVRSEL` reader - _1IVRSEL field"]
50pub type _1IVRSEL_R = crate::BitReader<bool>;
51#[doc = "Field `_1IVRSEL` writer - _1IVRSEL field"]
52pub type _1IVRSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
53#[doc = "Field `IVRFLT` reader - IVRFLT field"]
54pub type IVRFLT_R = crate::BitReader<bool>;
55#[doc = "Field `IVRFLT` writer - IVRFLT field"]
56pub type IVRFLT_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
57#[doc = "Field `IVROuA` reader - IVROuA field"]
58pub type IVROU_A_R = crate::BitReader<bool>;
59#[doc = "Field `IVROuA` writer - IVROuA field"]
60pub type IVROU_A_W<'a, const O: u8> = crate::BitWriter<'a, u32, ADCCR_SPEC, bool, O>;
61#[doc = "Field `IVRLVL` reader - IVRLVL field"]
62pub type IVRLVL_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `IVRLVL` writer - IVRLVL field"]
64pub type IVRLVL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, ADCCR_SPEC, u8, u8, 3, O>;
65#[doc = "Field `IVRTRIM` reader - IVRTRIM field"]
66pub type IVRTRIM_R = crate::FieldReader<u8, u8>;
67#[doc = "Field `IVRTRIM` writer - IVRTRIM field"]
68pub type IVRTRIM_W<'a, const O: u8> = crate::FieldWriter<'a, u32, ADCCR_SPEC, u8, u8, 3, O>;
69impl R {
70    #[doc = "Bit 0 - _0IVREN field"]
71    #[inline(always)]
72    pub fn _0ivren(&self) -> _0IVREN_R {
73        _0IVREN_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1 - _1IVREN field"]
76    #[inline(always)]
77    pub fn _1ivren(&self) -> _1IVREN_R {
78        _1IVREN_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bit 2 - _0IVRSEL field"]
81    #[inline(always)]
82    pub fn _0ivrsel(&self) -> _0IVRSEL_R {
83        _0IVRSEL_R::new(((self.bits >> 2) & 1) != 0)
84    }
85    #[doc = "Bit 3 - _1IVRSEL field"]
86    #[inline(always)]
87    pub fn _1ivrsel(&self) -> _1IVRSEL_R {
88        _1IVRSEL_R::new(((self.bits >> 3) & 1) != 0)
89    }
90    #[doc = "Bit 4 - IVRFLT field"]
91    #[inline(always)]
92    pub fn ivrflt(&self) -> IVRFLT_R {
93        IVRFLT_R::new(((self.bits >> 4) & 1) != 0)
94    }
95    #[doc = "Bit 5 - IVROuA field"]
96    #[inline(always)]
97    pub fn ivrou_a(&self) -> IVROU_A_R {
98        IVROU_A_R::new(((self.bits >> 5) & 1) != 0)
99    }
100    #[doc = "Bits 6:8 - IVRLVL field"]
101    #[inline(always)]
102    pub fn ivrlvl(&self) -> IVRLVL_R {
103        IVRLVL_R::new(((self.bits >> 6) & 7) as u8)
104    }
105    #[doc = "Bits 9:11 - IVRTRIM field"]
106    #[inline(always)]
107    pub fn ivrtrim(&self) -> IVRTRIM_R {
108        IVRTRIM_R::new(((self.bits >> 9) & 7) as u8)
109    }
110}
111impl W {
112    #[doc = "Bit 0 - _0IVREN field"]
113    #[inline(always)]
114    pub fn _0ivren(&mut self) -> _0IVREN_W<0> {
115        _0IVREN_W::new(self)
116    }
117    #[doc = "Bit 1 - _1IVREN field"]
118    #[inline(always)]
119    pub fn _1ivren(&mut self) -> _1IVREN_W<1> {
120        _1IVREN_W::new(self)
121    }
122    #[doc = "Bit 2 - _0IVRSEL field"]
123    #[inline(always)]
124    pub fn _0ivrsel(&mut self) -> _0IVRSEL_W<2> {
125        _0IVRSEL_W::new(self)
126    }
127    #[doc = "Bit 3 - _1IVRSEL field"]
128    #[inline(always)]
129    pub fn _1ivrsel(&mut self) -> _1IVRSEL_W<3> {
130        _1IVRSEL_W::new(self)
131    }
132    #[doc = "Bit 4 - IVRFLT field"]
133    #[inline(always)]
134    pub fn ivrflt(&mut self) -> IVRFLT_W<4> {
135        IVRFLT_W::new(self)
136    }
137    #[doc = "Bit 5 - IVROuA field"]
138    #[inline(always)]
139    pub fn ivrou_a(&mut self) -> IVROU_A_W<5> {
140        IVROU_A_W::new(self)
141    }
142    #[doc = "Bits 6:8 - IVRLVL field"]
143    #[inline(always)]
144    pub fn ivrlvl(&mut self) -> IVRLVL_W<6> {
145        IVRLVL_W::new(self)
146    }
147    #[doc = "Bits 9:11 - IVRTRIM field"]
148    #[inline(always)]
149    pub fn ivrtrim(&mut self) -> IVRTRIM_W<9> {
150        IVRTRIM_W::new(self)
151    }
152    #[doc = "Writes raw bits to the register."]
153    #[inline(always)]
154    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155        self.0.bits(bits);
156        self
157    }
158}
159#[doc = "ADCCR 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 [adccr](index.html) module"]
160pub struct ADCCR_SPEC;
161impl crate::RegisterSpec for ADCCR_SPEC {
162    type Ux = u32;
163}
164#[doc = "`read()` method returns [adccr::R](R) reader structure"]
165impl crate::Readable for ADCCR_SPEC {
166    type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [adccr::W](W) writer structure"]
169impl crate::Writable for ADCCR_SPEC {
170    type Writer = W;
171}
172#[doc = "`reset()` method sets ADCCR to value 0"]
173impl crate::Resettable for ADCCR_SPEC {
174    #[inline(always)]
175    fn reset_value() -> Self::Ux {
176        0
177    }
178}