bl602_pac/aon/
acomp_ctrl.rs

1#[doc = "Register `acomp_ctrl` reader"]
2pub struct R(crate::R<ACOMP_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ACOMP_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ACOMP_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ACOMP_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `acomp_ctrl` writer"]
17pub struct W(crate::W<ACOMP_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ACOMP_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<ACOMP_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ACOMP_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `acomp1_rstn_ana` reader - "]
38pub type ACOMP1_RSTN_ANA_R = crate::BitReader<bool>;
39#[doc = "Field `acomp1_rstn_ana` writer - "]
40pub type ACOMP1_RSTN_ANA_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP_CTRL_SPEC, bool, O>;
41#[doc = "Field `acomp0_rstn_ana` reader - "]
42pub type ACOMP0_RSTN_ANA_R = crate::BitReader<bool>;
43#[doc = "Field `acomp0_rstn_ana` writer - "]
44pub type ACOMP0_RSTN_ANA_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP_CTRL_SPEC, bool, O>;
45#[doc = "Field `acomp1_test_en` reader - "]
46pub type ACOMP1_TEST_EN_R = crate::BitReader<bool>;
47#[doc = "Field `acomp1_test_en` writer - "]
48pub type ACOMP1_TEST_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP_CTRL_SPEC, bool, O>;
49#[doc = "Field `acomp0_test_en` reader - "]
50pub type ACOMP0_TEST_EN_R = crate::BitReader<bool>;
51#[doc = "Field `acomp0_test_en` writer - "]
52pub type ACOMP0_TEST_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ACOMP_CTRL_SPEC, bool, O>;
53#[doc = "Field `acomp1_test_sel` reader - "]
54pub type ACOMP1_TEST_SEL_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `acomp1_test_sel` writer - "]
56pub type ACOMP1_TEST_SEL_W<'a, const O: u8> =
57    crate::FieldWriter<'a, u32, ACOMP_CTRL_SPEC, u8, u8, 2, O>;
58#[doc = "Field `acomp0_test_sel` reader - "]
59pub type ACOMP0_TEST_SEL_R = crate::FieldReader<u8, u8>;
60#[doc = "Field `acomp0_test_sel` writer - "]
61pub type ACOMP0_TEST_SEL_W<'a, const O: u8> =
62    crate::FieldWriter<'a, u32, ACOMP_CTRL_SPEC, u8, u8, 2, O>;
63#[doc = "Field `acomp1_out_raw` reader - "]
64pub type ACOMP1_OUT_RAW_R = crate::BitReader<bool>;
65#[doc = "Field `acomp0_out_raw` reader - "]
66pub type ACOMP0_OUT_RAW_R = crate::BitReader<bool>;
67#[doc = "Field `acomp_reserved` reader - "]
68pub type ACOMP_RESERVED_R = crate::FieldReader<u8, u8>;
69#[doc = "Field `acomp_reserved` writer - "]
70pub type ACOMP_RESERVED_W<'a, const O: u8> =
71    crate::FieldWriter<'a, u32, ACOMP_CTRL_SPEC, u8, u8, 8, O>;
72impl R {
73    #[doc = "Bit 0"]
74    #[inline(always)]
75    pub fn acomp1_rstn_ana(&self) -> ACOMP1_RSTN_ANA_R {
76        ACOMP1_RSTN_ANA_R::new((self.bits & 1) != 0)
77    }
78    #[doc = "Bit 1"]
79    #[inline(always)]
80    pub fn acomp0_rstn_ana(&self) -> ACOMP0_RSTN_ANA_R {
81        ACOMP0_RSTN_ANA_R::new(((self.bits >> 1) & 1) != 0)
82    }
83    #[doc = "Bit 8"]
84    #[inline(always)]
85    pub fn acomp1_test_en(&self) -> ACOMP1_TEST_EN_R {
86        ACOMP1_TEST_EN_R::new(((self.bits >> 8) & 1) != 0)
87    }
88    #[doc = "Bit 9"]
89    #[inline(always)]
90    pub fn acomp0_test_en(&self) -> ACOMP0_TEST_EN_R {
91        ACOMP0_TEST_EN_R::new(((self.bits >> 9) & 1) != 0)
92    }
93    #[doc = "Bits 10:11"]
94    #[inline(always)]
95    pub fn acomp1_test_sel(&self) -> ACOMP1_TEST_SEL_R {
96        ACOMP1_TEST_SEL_R::new(((self.bits >> 10) & 3) as u8)
97    }
98    #[doc = "Bits 12:13"]
99    #[inline(always)]
100    pub fn acomp0_test_sel(&self) -> ACOMP0_TEST_SEL_R {
101        ACOMP0_TEST_SEL_R::new(((self.bits >> 12) & 3) as u8)
102    }
103    #[doc = "Bit 17"]
104    #[inline(always)]
105    pub fn acomp1_out_raw(&self) -> ACOMP1_OUT_RAW_R {
106        ACOMP1_OUT_RAW_R::new(((self.bits >> 17) & 1) != 0)
107    }
108    #[doc = "Bit 19"]
109    #[inline(always)]
110    pub fn acomp0_out_raw(&self) -> ACOMP0_OUT_RAW_R {
111        ACOMP0_OUT_RAW_R::new(((self.bits >> 19) & 1) != 0)
112    }
113    #[doc = "Bits 24:31"]
114    #[inline(always)]
115    pub fn acomp_reserved(&self) -> ACOMP_RESERVED_R {
116        ACOMP_RESERVED_R::new(((self.bits >> 24) & 0xff) as u8)
117    }
118}
119impl W {
120    #[doc = "Bit 0"]
121    #[inline(always)]
122    #[must_use]
123    pub fn acomp1_rstn_ana(&mut self) -> ACOMP1_RSTN_ANA_W<0> {
124        ACOMP1_RSTN_ANA_W::new(self)
125    }
126    #[doc = "Bit 1"]
127    #[inline(always)]
128    #[must_use]
129    pub fn acomp0_rstn_ana(&mut self) -> ACOMP0_RSTN_ANA_W<1> {
130        ACOMP0_RSTN_ANA_W::new(self)
131    }
132    #[doc = "Bit 8"]
133    #[inline(always)]
134    #[must_use]
135    pub fn acomp1_test_en(&mut self) -> ACOMP1_TEST_EN_W<8> {
136        ACOMP1_TEST_EN_W::new(self)
137    }
138    #[doc = "Bit 9"]
139    #[inline(always)]
140    #[must_use]
141    pub fn acomp0_test_en(&mut self) -> ACOMP0_TEST_EN_W<9> {
142        ACOMP0_TEST_EN_W::new(self)
143    }
144    #[doc = "Bits 10:11"]
145    #[inline(always)]
146    #[must_use]
147    pub fn acomp1_test_sel(&mut self) -> ACOMP1_TEST_SEL_W<10> {
148        ACOMP1_TEST_SEL_W::new(self)
149    }
150    #[doc = "Bits 12:13"]
151    #[inline(always)]
152    #[must_use]
153    pub fn acomp0_test_sel(&mut self) -> ACOMP0_TEST_SEL_W<12> {
154        ACOMP0_TEST_SEL_W::new(self)
155    }
156    #[doc = "Bits 24:31"]
157    #[inline(always)]
158    #[must_use]
159    pub fn acomp_reserved(&mut self) -> ACOMP_RESERVED_W<24> {
160        ACOMP_RESERVED_W::new(self)
161    }
162    #[doc = "Writes raw bits to the register."]
163    #[inline(always)]
164    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
165        self.0.bits(bits);
166        self
167    }
168}
169#[doc = "acomp_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 [acomp_ctrl](index.html) module"]
170pub struct ACOMP_CTRL_SPEC;
171impl crate::RegisterSpec for ACOMP_CTRL_SPEC {
172    type Ux = u32;
173}
174#[doc = "`read()` method returns [acomp_ctrl::R](R) reader structure"]
175impl crate::Readable for ACOMP_CTRL_SPEC {
176    type Reader = R;
177}
178#[doc = "`write(|w| ..)` method takes [acomp_ctrl::W](W) writer structure"]
179impl crate::Writable for ACOMP_CTRL_SPEC {
180    type Writer = W;
181    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
182    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
183}
184#[doc = "`reset()` method sets acomp_ctrl to value 0x03"]
185impl crate::Resettable for ACOMP_CTRL_SPEC {
186    const RESET_VALUE: Self::Ux = 0x03;
187}