1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ENABLE` reader - Enable"]
38pub struct ENABLE_R(crate::FieldReader<bool, bool>);
39impl ENABLE_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 ENABLE_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for ENABLE_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `ENABLE` writer - Enable"]
53pub struct ENABLE_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> ENABLE_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71 self.w
72 }
73}
74#[doc = "Field `SEL_EXTINT_AS_ENABLE` reader - Select external input as enable"]
75pub struct SEL_EXTINT_AS_ENABLE_R(crate::FieldReader<bool, bool>);
76impl SEL_EXTINT_AS_ENABLE_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 SEL_EXTINT_AS_ENABLE_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for SEL_EXTINT_AS_ENABLE_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `SEL_EXTINT_AS_ENABLE` writer - Select external input as enable"]
90pub struct SEL_EXTINT_AS_ENABLE_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> SEL_EXTINT_AS_ENABLE_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits =
108 (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
109 self.w
110 }
111}
112#[doc = "Field `SEL_EXINT_AS_CLOCK` reader - Select external input as clock"]
113pub struct SEL_EXINT_AS_CLOCK_R(crate::FieldReader<bool, bool>);
114impl SEL_EXINT_AS_CLOCK_R {
115 #[inline(always)]
116 pub(crate) fn new(bits: bool) -> Self {
117 SEL_EXINT_AS_CLOCK_R(crate::FieldReader::new(bits))
118 }
119}
120impl core::ops::Deref for SEL_EXINT_AS_CLOCK_R {
121 type Target = crate::FieldReader<bool, bool>;
122 #[inline(always)]
123 fn deref(&self) -> &Self::Target {
124 &self.0
125 }
126}
127#[doc = "Field `SEL_EXINT_AS_CLOCK` writer - Select external input as clock"]
128pub struct SEL_EXINT_AS_CLOCK_W<'a> {
129 w: &'a mut W,
130}
131impl<'a> SEL_EXINT_AS_CLOCK_W<'a> {
132 #[doc = r"Sets the field bit"]
133 #[inline(always)]
134 pub fn set_bit(self) -> &'a mut W {
135 self.bit(true)
136 }
137 #[doc = r"Clears the field bit"]
138 #[inline(always)]
139 pub fn clear_bit(self) -> &'a mut W {
140 self.bit(false)
141 }
142 #[doc = r"Writes raw bits to the field"]
143 #[inline(always)]
144 pub fn bit(self, value: bool) -> &'a mut W {
145 self.w.bits =
146 (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
147 self.w
148 }
149}
150#[doc = "Field `TIMER_INT_ENABLE` reader - Timer interrupt enable"]
151pub struct TIMER_INT_ENABLE_R(crate::FieldReader<bool, bool>);
152impl TIMER_INT_ENABLE_R {
153 #[inline(always)]
154 pub(crate) fn new(bits: bool) -> Self {
155 TIMER_INT_ENABLE_R(crate::FieldReader::new(bits))
156 }
157}
158impl core::ops::Deref for TIMER_INT_ENABLE_R {
159 type Target = crate::FieldReader<bool, bool>;
160 #[inline(always)]
161 fn deref(&self) -> &Self::Target {
162 &self.0
163 }
164}
165#[doc = "Field `TIMER_INT_ENABLE` writer - Timer interrupt enable"]
166pub struct TIMER_INT_ENABLE_W<'a> {
167 w: &'a mut W,
168}
169impl<'a> TIMER_INT_ENABLE_W<'a> {
170 #[doc = r"Sets the field bit"]
171 #[inline(always)]
172 pub fn set_bit(self) -> &'a mut W {
173 self.bit(true)
174 }
175 #[doc = r"Clears the field bit"]
176 #[inline(always)]
177 pub fn clear_bit(self) -> &'a mut W {
178 self.bit(false)
179 }
180 #[doc = r"Writes raw bits to the field"]
181 #[inline(always)]
182 pub fn bit(self, value: bool) -> &'a mut W {
183 self.w.bits =
184 (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
185 self.w
186 }
187}
188impl R {
189 #[doc = "Bit 0 - Enable"]
190 #[inline(always)]
191 pub fn enable(&self) -> ENABLE_R {
192 ENABLE_R::new((self.bits & 0x01) != 0)
193 }
194 #[doc = "Bit 1 - Select external input as enable"]
195 #[inline(always)]
196 pub fn sel_extint_as_enable(&self) -> SEL_EXTINT_AS_ENABLE_R {
197 SEL_EXTINT_AS_ENABLE_R::new(((self.bits >> 1) & 0x01) != 0)
198 }
199 #[doc = "Bit 2 - Select external input as clock"]
200 #[inline(always)]
201 pub fn sel_exint_as_clock(&self) -> SEL_EXINT_AS_CLOCK_R {
202 SEL_EXINT_AS_CLOCK_R::new(((self.bits >> 2) & 0x01) != 0)
203 }
204 #[doc = "Bit 3 - Timer interrupt enable"]
205 #[inline(always)]
206 pub fn timer_int_enable(&self) -> TIMER_INT_ENABLE_R {
207 TIMER_INT_ENABLE_R::new(((self.bits >> 3) & 0x01) != 0)
208 }
209}
210impl W {
211 #[doc = "Bit 0 - Enable"]
212 #[inline(always)]
213 pub fn enable(&mut self) -> ENABLE_W {
214 ENABLE_W { w: self }
215 }
216 #[doc = "Bit 1 - Select external input as enable"]
217 #[inline(always)]
218 pub fn sel_extint_as_enable(&mut self) -> SEL_EXTINT_AS_ENABLE_W {
219 SEL_EXTINT_AS_ENABLE_W { w: self }
220 }
221 #[doc = "Bit 2 - Select external input as clock"]
222 #[inline(always)]
223 pub fn sel_exint_as_clock(&mut self) -> SEL_EXINT_AS_CLOCK_W {
224 SEL_EXINT_AS_CLOCK_W { w: self }
225 }
226 #[doc = "Bit 3 - Timer interrupt enable"]
227 #[inline(always)]
228 pub fn timer_int_enable(&mut self) -> TIMER_INT_ENABLE_W {
229 TIMER_INT_ENABLE_W { w: self }
230 }
231 #[doc = "Writes raw bits to the register."]
232 #[inline(always)]
233 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
234 self.0.bits(bits);
235 self
236 }
237}
238#[doc = "Timer control 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 [ctrl](index.html) module"]
239pub struct CTRL_SPEC;
240impl crate::RegisterSpec for CTRL_SPEC {
241 type Ux = u32;
242}
243#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
244impl crate::Readable for CTRL_SPEC {
245 type Reader = R;
246}
247#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
248impl crate::Writable for CTRL_SPEC {
249 type Writer = W;
250}
251#[doc = "`reset()` method sets CTRL to value 0"]
252impl crate::Resettable for CTRL_SPEC {
253 #[inline(always)]
254 fn reset_value() -> Self::Ux {
255 0
256 }
257}