bl702_pac/aon/
acomp0_ctrl.rs

1#[doc = "Register `acomp0_ctrl` reader"]
2pub struct R(crate::R<ACOMP0_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ACOMP0_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ACOMP0_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ACOMP0_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `acomp0_ctrl` writer"]
17pub struct W(crate::W<ACOMP0_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ACOMP0_CTRL_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<ACOMP0_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ACOMP0_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `acomp0_en` reader - "]
38pub type ACOMP0_EN_R = crate::BitReader<bool>;
39#[doc = "Field `acomp0_en` writer - "]
40pub type ACOMP0_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP0_CTRL_SPEC, bool, O>;
41#[doc = "Field `acomp0_hyst_seln` reader - "]
42pub type ACOMP0_HYST_SELN_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `acomp0_hyst_seln` writer - "]
44pub type ACOMP0_HYST_SELN_W<'a, const O: u8> =
45    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 3, O>;
46#[doc = "Field `acomp0_hyst_selp` reader - "]
47pub type ACOMP0_HYST_SELP_R = crate::FieldReader<u8, u8>;
48#[doc = "Field `acomp0_hyst_selp` writer - "]
49pub type ACOMP0_HYST_SELP_W<'a, const O: u8> =
50    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 3, O>;
51#[doc = "Field `acomp0_bias_prog` reader - "]
52pub type ACOMP0_BIAS_PROG_R = crate::FieldReader<u8, u8>;
53#[doc = "Field `acomp0_bias_prog` writer - "]
54pub type ACOMP0_BIAS_PROG_W<'a, const O: u8> =
55    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 2, O>;
56#[doc = "Field `acomp0_level_sel` reader - "]
57pub type ACOMP0_LEVEL_SEL_R = crate::FieldReader<u8, u8>;
58#[doc = "Field `acomp0_level_sel` writer - "]
59pub type ACOMP0_LEVEL_SEL_W<'a, const O: u8> =
60    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 6, O>;
61#[doc = "Field `acomp0_neg_sel` reader - "]
62pub type ACOMP0_NEG_SEL_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `acomp0_neg_sel` writer - "]
64pub type ACOMP0_NEG_SEL_W<'a, const O: u8> =
65    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 4, O>;
66#[doc = "Field `acomp0_pos_sel` reader - "]
67pub type ACOMP0_POS_SEL_R = crate::FieldReader<u8, u8>;
68#[doc = "Field `acomp0_pos_sel` writer - "]
69pub type ACOMP0_POS_SEL_W<'a, const O: u8> =
70    crate::FieldWriter<'a, u32, ACOMP0_CTRL_SPEC, u8, u8, 4, O>;
71#[doc = "Field `acomp0_muxen` reader - "]
72pub type ACOMP0_MUXEN_R = crate::BitReader<bool>;
73#[doc = "Field `acomp0_muxen` writer - "]
74pub type ACOMP0_MUXEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP0_CTRL_SPEC, bool, O>;
75impl R {
76    #[doc = "Bit 0"]
77    #[inline(always)]
78    pub fn acomp0_en(&self) -> ACOMP0_EN_R {
79        ACOMP0_EN_R::new((self.bits & 1) != 0)
80    }
81    #[doc = "Bits 4:6"]
82    #[inline(always)]
83    pub fn acomp0_hyst_seln(&self) -> ACOMP0_HYST_SELN_R {
84        ACOMP0_HYST_SELN_R::new(((self.bits >> 4) & 7) as u8)
85    }
86    #[doc = "Bits 7:9"]
87    #[inline(always)]
88    pub fn acomp0_hyst_selp(&self) -> ACOMP0_HYST_SELP_R {
89        ACOMP0_HYST_SELP_R::new(((self.bits >> 7) & 7) as u8)
90    }
91    #[doc = "Bits 10:11"]
92    #[inline(always)]
93    pub fn acomp0_bias_prog(&self) -> ACOMP0_BIAS_PROG_R {
94        ACOMP0_BIAS_PROG_R::new(((self.bits >> 10) & 3) as u8)
95    }
96    #[doc = "Bits 12:17"]
97    #[inline(always)]
98    pub fn acomp0_level_sel(&self) -> ACOMP0_LEVEL_SEL_R {
99        ACOMP0_LEVEL_SEL_R::new(((self.bits >> 12) & 0x3f) as u8)
100    }
101    #[doc = "Bits 18:21"]
102    #[inline(always)]
103    pub fn acomp0_neg_sel(&self) -> ACOMP0_NEG_SEL_R {
104        ACOMP0_NEG_SEL_R::new(((self.bits >> 18) & 0x0f) as u8)
105    }
106    #[doc = "Bits 22:25"]
107    #[inline(always)]
108    pub fn acomp0_pos_sel(&self) -> ACOMP0_POS_SEL_R {
109        ACOMP0_POS_SEL_R::new(((self.bits >> 22) & 0x0f) as u8)
110    }
111    #[doc = "Bit 26"]
112    #[inline(always)]
113    pub fn acomp0_muxen(&self) -> ACOMP0_MUXEN_R {
114        ACOMP0_MUXEN_R::new(((self.bits >> 26) & 1) != 0)
115    }
116}
117impl W {
118    #[doc = "Bit 0"]
119    #[inline(always)]
120    #[must_use]
121    pub fn acomp0_en(&mut self) -> ACOMP0_EN_W<0> {
122        ACOMP0_EN_W::new(self)
123    }
124    #[doc = "Bits 4:6"]
125    #[inline(always)]
126    #[must_use]
127    pub fn acomp0_hyst_seln(&mut self) -> ACOMP0_HYST_SELN_W<4> {
128        ACOMP0_HYST_SELN_W::new(self)
129    }
130    #[doc = "Bits 7:9"]
131    #[inline(always)]
132    #[must_use]
133    pub fn acomp0_hyst_selp(&mut self) -> ACOMP0_HYST_SELP_W<7> {
134        ACOMP0_HYST_SELP_W::new(self)
135    }
136    #[doc = "Bits 10:11"]
137    #[inline(always)]
138    #[must_use]
139    pub fn acomp0_bias_prog(&mut self) -> ACOMP0_BIAS_PROG_W<10> {
140        ACOMP0_BIAS_PROG_W::new(self)
141    }
142    #[doc = "Bits 12:17"]
143    #[inline(always)]
144    #[must_use]
145    pub fn acomp0_level_sel(&mut self) -> ACOMP0_LEVEL_SEL_W<12> {
146        ACOMP0_LEVEL_SEL_W::new(self)
147    }
148    #[doc = "Bits 18:21"]
149    #[inline(always)]
150    #[must_use]
151    pub fn acomp0_neg_sel(&mut self) -> ACOMP0_NEG_SEL_W<18> {
152        ACOMP0_NEG_SEL_W::new(self)
153    }
154    #[doc = "Bits 22:25"]
155    #[inline(always)]
156    #[must_use]
157    pub fn acomp0_pos_sel(&mut self) -> ACOMP0_POS_SEL_W<22> {
158        ACOMP0_POS_SEL_W::new(self)
159    }
160    #[doc = "Bit 26"]
161    #[inline(always)]
162    #[must_use]
163    pub fn acomp0_muxen(&mut self) -> ACOMP0_MUXEN_W<26> {
164        ACOMP0_MUXEN_W::new(self)
165    }
166    #[doc = "Writes raw bits to the register."]
167    #[inline(always)]
168    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169        self.0.bits(bits);
170        self
171    }
172}
173#[doc = "acomp0_ctrl.\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 [acomp0_ctrl](index.html) module"]
174pub struct ACOMP0_CTRL_SPEC;
175impl crate::RegisterSpec for ACOMP0_CTRL_SPEC {
176    type Ux = u32;
177}
178#[doc = "`read()` method returns [acomp0_ctrl::R](R) reader structure"]
179impl crate::Readable for ACOMP0_CTRL_SPEC {
180    type Reader = R;
181}
182#[doc = "`write(|w| ..)` method takes [acomp0_ctrl::W](W) writer structure"]
183impl crate::Writable for ACOMP0_CTRL_SPEC {
184    type Writer = W;
185    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
186    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
187}
188#[doc = "`reset()` method sets acomp0_ctrl to value 0"]
189impl crate::Resettable for ACOMP0_CTRL_SPEC {
190    const RESET_VALUE: Self::Ux = 0;
191}