efm32pg12_pac/wtimer0/
dttime.rs1#[doc = "Reader of register DTTIME"]
2pub type R = crate::R<u32, super::DTTIME>;
3#[doc = "Writer for register DTTIME"]
4pub type W = crate::W<u32, super::DTTIME>;
5#[doc = "Register DTTIME `reset()`'s with value 0"]
6impl crate::ResetValue for super::DTTIME {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "DTI Prescaler Setting\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum DTPRESC_A {
17 #[doc = "0: The HFPERCLK is undivided"]
18 DIV1 = 0,
19 #[doc = "1: The HFPERCLK is divided by 2"]
20 DIV2 = 1,
21 #[doc = "2: The HFPERCLK is divided by 4"]
22 DIV4 = 2,
23 #[doc = "3: The HFPERCLK is divided by 8"]
24 DIV8 = 3,
25 #[doc = "4: The HFPERCLK is divided by 16"]
26 DIV16 = 4,
27 #[doc = "5: The HFPERCLK is divided by 32"]
28 DIV32 = 5,
29 #[doc = "6: The HFPERCLK is divided by 64"]
30 DIV64 = 6,
31 #[doc = "7: The HFPERCLK is divided by 128"]
32 DIV128 = 7,
33 #[doc = "8: The HFPERCLK is divided by 256"]
34 DIV256 = 8,
35 #[doc = "9: The HFPERCLK is divided by 512"]
36 DIV512 = 9,
37 #[doc = "10: The HFPERCLK is divided by 1024"]
38 DIV1024 = 10,
39}
40impl From<DTPRESC_A> for u8 {
41 #[inline(always)]
42 fn from(variant: DTPRESC_A) -> Self {
43 variant as _
44 }
45}
46#[doc = "Reader of field `DTPRESC`"]
47pub type DTPRESC_R = crate::R<u8, DTPRESC_A>;
48impl DTPRESC_R {
49 #[doc = r"Get enumerated values variant"]
50 #[inline(always)]
51 pub fn variant(&self) -> crate::Variant<u8, DTPRESC_A> {
52 use crate::Variant::*;
53 match self.bits {
54 0 => Val(DTPRESC_A::DIV1),
55 1 => Val(DTPRESC_A::DIV2),
56 2 => Val(DTPRESC_A::DIV4),
57 3 => Val(DTPRESC_A::DIV8),
58 4 => Val(DTPRESC_A::DIV16),
59 5 => Val(DTPRESC_A::DIV32),
60 6 => Val(DTPRESC_A::DIV64),
61 7 => Val(DTPRESC_A::DIV128),
62 8 => Val(DTPRESC_A::DIV256),
63 9 => Val(DTPRESC_A::DIV512),
64 10 => Val(DTPRESC_A::DIV1024),
65 i => Res(i),
66 }
67 }
68 #[doc = "Checks if the value of the field is `DIV1`"]
69 #[inline(always)]
70 pub fn is_div1(&self) -> bool {
71 *self == DTPRESC_A::DIV1
72 }
73 #[doc = "Checks if the value of the field is `DIV2`"]
74 #[inline(always)]
75 pub fn is_div2(&self) -> bool {
76 *self == DTPRESC_A::DIV2
77 }
78 #[doc = "Checks if the value of the field is `DIV4`"]
79 #[inline(always)]
80 pub fn is_div4(&self) -> bool {
81 *self == DTPRESC_A::DIV4
82 }
83 #[doc = "Checks if the value of the field is `DIV8`"]
84 #[inline(always)]
85 pub fn is_div8(&self) -> bool {
86 *self == DTPRESC_A::DIV8
87 }
88 #[doc = "Checks if the value of the field is `DIV16`"]
89 #[inline(always)]
90 pub fn is_div16(&self) -> bool {
91 *self == DTPRESC_A::DIV16
92 }
93 #[doc = "Checks if the value of the field is `DIV32`"]
94 #[inline(always)]
95 pub fn is_div32(&self) -> bool {
96 *self == DTPRESC_A::DIV32
97 }
98 #[doc = "Checks if the value of the field is `DIV64`"]
99 #[inline(always)]
100 pub fn is_div64(&self) -> bool {
101 *self == DTPRESC_A::DIV64
102 }
103 #[doc = "Checks if the value of the field is `DIV128`"]
104 #[inline(always)]
105 pub fn is_div128(&self) -> bool {
106 *self == DTPRESC_A::DIV128
107 }
108 #[doc = "Checks if the value of the field is `DIV256`"]
109 #[inline(always)]
110 pub fn is_div256(&self) -> bool {
111 *self == DTPRESC_A::DIV256
112 }
113 #[doc = "Checks if the value of the field is `DIV512`"]
114 #[inline(always)]
115 pub fn is_div512(&self) -> bool {
116 *self == DTPRESC_A::DIV512
117 }
118 #[doc = "Checks if the value of the field is `DIV1024`"]
119 #[inline(always)]
120 pub fn is_div1024(&self) -> bool {
121 *self == DTPRESC_A::DIV1024
122 }
123}
124#[doc = "Write proxy for field `DTPRESC`"]
125pub struct DTPRESC_W<'a> {
126 w: &'a mut W,
127}
128impl<'a> DTPRESC_W<'a> {
129 #[doc = r"Writes `variant` to the field"]
130 #[inline(always)]
131 pub fn variant(self, variant: DTPRESC_A) -> &'a mut W {
132 unsafe { self.bits(variant.into()) }
133 }
134 #[doc = "The HFPERCLK is undivided"]
135 #[inline(always)]
136 pub fn div1(self) -> &'a mut W {
137 self.variant(DTPRESC_A::DIV1)
138 }
139 #[doc = "The HFPERCLK is divided by 2"]
140 #[inline(always)]
141 pub fn div2(self) -> &'a mut W {
142 self.variant(DTPRESC_A::DIV2)
143 }
144 #[doc = "The HFPERCLK is divided by 4"]
145 #[inline(always)]
146 pub fn div4(self) -> &'a mut W {
147 self.variant(DTPRESC_A::DIV4)
148 }
149 #[doc = "The HFPERCLK is divided by 8"]
150 #[inline(always)]
151 pub fn div8(self) -> &'a mut W {
152 self.variant(DTPRESC_A::DIV8)
153 }
154 #[doc = "The HFPERCLK is divided by 16"]
155 #[inline(always)]
156 pub fn div16(self) -> &'a mut W {
157 self.variant(DTPRESC_A::DIV16)
158 }
159 #[doc = "The HFPERCLK is divided by 32"]
160 #[inline(always)]
161 pub fn div32(self) -> &'a mut W {
162 self.variant(DTPRESC_A::DIV32)
163 }
164 #[doc = "The HFPERCLK is divided by 64"]
165 #[inline(always)]
166 pub fn div64(self) -> &'a mut W {
167 self.variant(DTPRESC_A::DIV64)
168 }
169 #[doc = "The HFPERCLK is divided by 128"]
170 #[inline(always)]
171 pub fn div128(self) -> &'a mut W {
172 self.variant(DTPRESC_A::DIV128)
173 }
174 #[doc = "The HFPERCLK is divided by 256"]
175 #[inline(always)]
176 pub fn div256(self) -> &'a mut W {
177 self.variant(DTPRESC_A::DIV256)
178 }
179 #[doc = "The HFPERCLK is divided by 512"]
180 #[inline(always)]
181 pub fn div512(self) -> &'a mut W {
182 self.variant(DTPRESC_A::DIV512)
183 }
184 #[doc = "The HFPERCLK is divided by 1024"]
185 #[inline(always)]
186 pub fn div1024(self) -> &'a mut W {
187 self.variant(DTPRESC_A::DIV1024)
188 }
189 #[doc = r"Writes raw bits to the field"]
190 #[inline(always)]
191 pub unsafe fn bits(self, value: u8) -> &'a mut W {
192 self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
193 self.w
194 }
195}
196#[doc = "Reader of field `DTRISET`"]
197pub type DTRISET_R = crate::R<u8, u8>;
198#[doc = "Write proxy for field `DTRISET`"]
199pub struct DTRISET_W<'a> {
200 w: &'a mut W,
201}
202impl<'a> DTRISET_W<'a> {
203 #[doc = r"Writes raw bits to the field"]
204 #[inline(always)]
205 pub unsafe fn bits(self, value: u8) -> &'a mut W {
206 self.w.bits = (self.w.bits & !(0x3f << 8)) | (((value as u32) & 0x3f) << 8);
207 self.w
208 }
209}
210#[doc = "Reader of field `DTFALLT`"]
211pub type DTFALLT_R = crate::R<u8, u8>;
212#[doc = "Write proxy for field `DTFALLT`"]
213pub struct DTFALLT_W<'a> {
214 w: &'a mut W,
215}
216impl<'a> DTFALLT_W<'a> {
217 #[doc = r"Writes raw bits to the field"]
218 #[inline(always)]
219 pub unsafe fn bits(self, value: u8) -> &'a mut W {
220 self.w.bits = (self.w.bits & !(0x3f << 16)) | (((value as u32) & 0x3f) << 16);
221 self.w
222 }
223}
224impl R {
225 #[doc = "Bits 0:3 - DTI Prescaler Setting"]
226 #[inline(always)]
227 pub fn dtpresc(&self) -> DTPRESC_R {
228 DTPRESC_R::new((self.bits & 0x0f) as u8)
229 }
230 #[doc = "Bits 8:13 - DTI Rise-time"]
231 #[inline(always)]
232 pub fn dtriset(&self) -> DTRISET_R {
233 DTRISET_R::new(((self.bits >> 8) & 0x3f) as u8)
234 }
235 #[doc = "Bits 16:21 - DTI Fall-time"]
236 #[inline(always)]
237 pub fn dtfallt(&self) -> DTFALLT_R {
238 DTFALLT_R::new(((self.bits >> 16) & 0x3f) as u8)
239 }
240}
241impl W {
242 #[doc = "Bits 0:3 - DTI Prescaler Setting"]
243 #[inline(always)]
244 pub fn dtpresc(&mut self) -> DTPRESC_W {
245 DTPRESC_W { w: self }
246 }
247 #[doc = "Bits 8:13 - DTI Rise-time"]
248 #[inline(always)]
249 pub fn dtriset(&mut self) -> DTRISET_W {
250 DTRISET_W { w: self }
251 }
252 #[doc = "Bits 16:21 - DTI Fall-time"]
253 #[inline(always)]
254 pub fn dtfallt(&mut self) -> DTFALLT_W {
255 DTFALLT_W { w: self }
256 }
257}