1#[doc = "Register `IWCTR` reader"]
2pub type R = crate::R<IWCTR_SPEC>;
3#[doc = "Register `IWCTR` writer"]
4pub type W = crate::W<IWCTR_SPEC>;
5#[doc = "Field `NVALCNT` reader - Number of Values Counted"]
6pub type NVALCNT_R = crate::FieldReader;
7#[doc = "Integration Enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum INTEN_A {
10 #[doc = "0: Integration stopped. INTEN is cleared at the end of the integration window, i.e. upon the inverse trigger event transition of the external trigger signal."]
11 VALUE1 = 0,
12 #[doc = "1: Integration enabled. INTEN is set upon the defined trigger event."]
13 VALUE2 = 1,
14}
15impl From<INTEN_A> for bool {
16 #[inline(always)]
17 fn from(variant: INTEN_A) -> Self {
18 variant as u8 != 0
19 }
20}
21#[doc = "Field `INTEN` reader - Integration Enable"]
22pub type INTEN_R = crate::BitReader<INTEN_A>;
23impl INTEN_R {
24 #[doc = "Get enumerated values variant"]
25 #[inline(always)]
26 pub const fn variant(&self) -> INTEN_A {
27 match self.bits {
28 false => INTEN_A::VALUE1,
29 true => INTEN_A::VALUE2,
30 }
31 }
32 #[doc = "Integration stopped. INTEN is cleared at the end of the integration window, i.e. upon the inverse trigger event transition of the external trigger signal."]
33 #[inline(always)]
34 pub fn is_value1(&self) -> bool {
35 *self == INTEN_A::VALUE1
36 }
37 #[doc = "Integration enabled. INTEN is set upon the defined trigger event."]
38 #[inline(always)]
39 pub fn is_value2(&self) -> bool {
40 *self == INTEN_A::VALUE2
41 }
42}
43#[doc = "Field `REPCNT` reader - Integration Cycle Counter"]
44pub type REPCNT_R = crate::FieldReader;
45#[doc = "Field `REPVAL` reader - Number of Integration Cycles"]
46pub type REPVAL_R = crate::FieldReader;
47#[doc = "Field `REPVAL` writer - Number of Integration Cycles"]
48pub type REPVAL_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
49#[doc = "Field `NVALDIS` reader - Number of Values Discarded"]
50pub type NVALDIS_R = crate::FieldReader;
51#[doc = "Field `NVALDIS` writer - Number of Values Discarded"]
52pub type NVALDIS_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
53#[doc = "Integration Window SIze\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq, Eq)]
55pub enum IWS_A {
56 #[doc = "0: Internal control: stop integrator after REPVAL+1 integration cycles"]
57 VALUE1 = 0,
58 #[doc = "1: External control: stop integrator when bit INTEN becomes 0"]
59 VALUE2 = 1,
60}
61impl From<IWS_A> for bool {
62 #[inline(always)]
63 fn from(variant: IWS_A) -> Self {
64 variant as u8 != 0
65 }
66}
67#[doc = "Field `IWS` reader - Integration Window SIze"]
68pub type IWS_R = crate::BitReader<IWS_A>;
69impl IWS_R {
70 #[doc = "Get enumerated values variant"]
71 #[inline(always)]
72 pub const fn variant(&self) -> IWS_A {
73 match self.bits {
74 false => IWS_A::VALUE1,
75 true => IWS_A::VALUE2,
76 }
77 }
78 #[doc = "Internal control: stop integrator after REPVAL+1 integration cycles"]
79 #[inline(always)]
80 pub fn is_value1(&self) -> bool {
81 *self == IWS_A::VALUE1
82 }
83 #[doc = "External control: stop integrator when bit INTEN becomes 0"]
84 #[inline(always)]
85 pub fn is_value2(&self) -> bool {
86 *self == IWS_A::VALUE2
87 }
88}
89#[doc = "Field `IWS` writer - Integration Window SIze"]
90pub type IWS_W<'a, REG> = crate::BitWriter<'a, REG, IWS_A>;
91impl<'a, REG> IWS_W<'a, REG>
92where
93 REG: crate::Writable + crate::RegisterSpec,
94{
95 #[doc = "Internal control: stop integrator after REPVAL+1 integration cycles"]
96 #[inline(always)]
97 pub fn value1(self) -> &'a mut crate::W<REG> {
98 self.variant(IWS_A::VALUE1)
99 }
100 #[doc = "External control: stop integrator when bit INTEN becomes 0"]
101 #[inline(always)]
102 pub fn value2(self) -> &'a mut crate::W<REG> {
103 self.variant(IWS_A::VALUE2)
104 }
105}
106#[doc = "Field `NVALINT` reader - Number of Values Integrated"]
107pub type NVALINT_R = crate::FieldReader;
108#[doc = "Field `NVALINT` writer - Number of Values Integrated"]
109pub type NVALINT_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
110impl R {
111 #[doc = "Bits 0:5 - Number of Values Counted"]
112 #[inline(always)]
113 pub fn nvalcnt(&self) -> NVALCNT_R {
114 NVALCNT_R::new((self.bits & 0x3f) as u8)
115 }
116 #[doc = "Bit 7 - Integration Enable"]
117 #[inline(always)]
118 pub fn inten(&self) -> INTEN_R {
119 INTEN_R::new(((self.bits >> 7) & 1) != 0)
120 }
121 #[doc = "Bits 8:11 - Integration Cycle Counter"]
122 #[inline(always)]
123 pub fn repcnt(&self) -> REPCNT_R {
124 REPCNT_R::new(((self.bits >> 8) & 0x0f) as u8)
125 }
126 #[doc = "Bits 12:15 - Number of Integration Cycles"]
127 #[inline(always)]
128 pub fn repval(&self) -> REPVAL_R {
129 REPVAL_R::new(((self.bits >> 12) & 0x0f) as u8)
130 }
131 #[doc = "Bits 16:21 - Number of Values Discarded"]
132 #[inline(always)]
133 pub fn nvaldis(&self) -> NVALDIS_R {
134 NVALDIS_R::new(((self.bits >> 16) & 0x3f) as u8)
135 }
136 #[doc = "Bit 23 - Integration Window SIze"]
137 #[inline(always)]
138 pub fn iws(&self) -> IWS_R {
139 IWS_R::new(((self.bits >> 23) & 1) != 0)
140 }
141 #[doc = "Bits 24:29 - Number of Values Integrated"]
142 #[inline(always)]
143 pub fn nvalint(&self) -> NVALINT_R {
144 NVALINT_R::new(((self.bits >> 24) & 0x3f) as u8)
145 }
146}
147impl W {
148 #[doc = "Bits 12:15 - Number of Integration Cycles"]
149 #[inline(always)]
150 pub fn repval(&mut self) -> REPVAL_W<IWCTR_SPEC> {
151 REPVAL_W::new(self, 12)
152 }
153 #[doc = "Bits 16:21 - Number of Values Discarded"]
154 #[inline(always)]
155 pub fn nvaldis(&mut self) -> NVALDIS_W<IWCTR_SPEC> {
156 NVALDIS_W::new(self, 16)
157 }
158 #[doc = "Bit 23 - Integration Window SIze"]
159 #[inline(always)]
160 pub fn iws(&mut self) -> IWS_W<IWCTR_SPEC> {
161 IWS_W::new(self, 23)
162 }
163 #[doc = "Bits 24:29 - Number of Values Integrated"]
164 #[inline(always)]
165 pub fn nvalint(&mut self) -> NVALINT_W<IWCTR_SPEC> {
166 NVALINT_W::new(self, 24)
167 }
168}
169#[doc = "Integration Window Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`iwctr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`iwctr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
170pub struct IWCTR_SPEC;
171impl crate::RegisterSpec for IWCTR_SPEC {
172 type Ux = u32;
173}
174#[doc = "`read()` method returns [`iwctr::R`](R) reader structure"]
175impl crate::Readable for IWCTR_SPEC {}
176#[doc = "`write(|w| ..)` method takes [`iwctr::W`](W) writer structure"]
177impl crate::Writable for IWCTR_SPEC {
178 type Safety = crate::Unsafe;
179 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
180 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
181}
182#[doc = "`reset()` method sets IWCTR to value 0"]
183impl crate::Resettable for IWCTR_SPEC {
184 const RESET_VALUE: u32 = 0;
185}