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