1pub type R = crate::R<HFXOCTRLrs>;
3pub type W = crate::W<HFXOCTRLrs>;
5pub type ModeR = crate::BitReader;
7pub type ModeW<'a, REG> = crate::BitWriter<'a, REG>;
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14#[repr(u8)]
15pub enum PEAKDETSHUNTOPTMODE {
16 Autocmd = 0,
18 Cmd = 1,
20 Manual = 2,
22}
23impl From<PEAKDETSHUNTOPTMODE> for u8 {
24 #[inline(always)]
25 fn from(variant: PEAKDETSHUNTOPTMODE) -> Self {
26 variant as _
27 }
28}
29impl crate::FieldSpec for PEAKDETSHUNTOPTMODE {
30 type Ux = u8;
31}
32impl crate::IsEnum for PEAKDETSHUNTOPTMODE {}
33pub type PeakdetshuntoptmodeR = crate::FieldReader<PEAKDETSHUNTOPTMODE>;
35impl PeakdetshuntoptmodeR {
36 #[inline(always)]
38 pub const fn variant(&self) -> Option<PEAKDETSHUNTOPTMODE> {
39 match self.bits {
40 0 => Some(PEAKDETSHUNTOPTMODE::Autocmd),
41 1 => Some(PEAKDETSHUNTOPTMODE::Cmd),
42 2 => Some(PEAKDETSHUNTOPTMODE::Manual),
43 _ => None,
44 }
45 }
46 #[inline(always)]
48 pub fn is_autocmd(&self) -> bool {
49 *self == PEAKDETSHUNTOPTMODE::Autocmd
50 }
51 #[inline(always)]
53 pub fn is_cmd(&self) -> bool {
54 *self == PEAKDETSHUNTOPTMODE::Cmd
55 }
56 #[inline(always)]
58 pub fn is_manual(&self) -> bool {
59 *self == PEAKDETSHUNTOPTMODE::Manual
60 }
61}
62pub type PeakdetshuntoptmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, PEAKDETSHUNTOPTMODE>;
64impl<'a, REG> PeakdetshuntoptmodeW<'a, REG>
65where
66 REG: crate::Writable + crate::RegisterSpec,
67 REG::Ux: From<u8>,
68{
69 #[inline(always)]
71 pub fn autocmd(self) -> &'a mut crate::W<REG> {
72 self.variant(PEAKDETSHUNTOPTMODE::Autocmd)
73 }
74 #[inline(always)]
76 pub fn cmd(self) -> &'a mut crate::W<REG> {
77 self.variant(PEAKDETSHUNTOPTMODE::Cmd)
78 }
79 #[inline(always)]
81 pub fn manual(self) -> &'a mut crate::W<REG> {
82 self.variant(PEAKDETSHUNTOPTMODE::Manual)
83 }
84}
85pub type LowpowerR = crate::BitReader;
87pub type LowpowerW<'a, REG> = crate::BitWriter<'a, REG>;
89pub type Xti2gndR = crate::BitReader;
91pub type Xti2gndW<'a, REG> = crate::BitWriter<'a, REG>;
93pub type Xto2gndR = crate::BitReader;
95pub type Xto2gndW<'a, REG> = crate::BitWriter<'a, REG>;
97#[cfg_attr(feature = "defmt", derive(defmt::Format))]
101#[derive(Clone, Copy, Debug, PartialEq, Eq)]
102#[repr(u8)]
103pub enum LFTIMEOUT {
104 _0cycles = 0,
106 _2cycles = 1,
108 _4cycles = 2,
110 _16cycles = 3,
112 _32cycles = 4,
114 _64cycles = 5,
116 _1kcycles = 6,
118 _4kcycles = 7,
120}
121impl From<LFTIMEOUT> for u8 {
122 #[inline(always)]
123 fn from(variant: LFTIMEOUT) -> Self {
124 variant as _
125 }
126}
127impl crate::FieldSpec for LFTIMEOUT {
128 type Ux = u8;
129}
130impl crate::IsEnum for LFTIMEOUT {}
131pub type LftimeoutR = crate::FieldReader<LFTIMEOUT>;
133impl LftimeoutR {
134 #[inline(always)]
136 pub const fn variant(&self) -> LFTIMEOUT {
137 match self.bits {
138 0 => LFTIMEOUT::_0cycles,
139 1 => LFTIMEOUT::_2cycles,
140 2 => LFTIMEOUT::_4cycles,
141 3 => LFTIMEOUT::_16cycles,
142 4 => LFTIMEOUT::_32cycles,
143 5 => LFTIMEOUT::_64cycles,
144 6 => LFTIMEOUT::_1kcycles,
145 7 => LFTIMEOUT::_4kcycles,
146 _ => unreachable!(),
147 }
148 }
149 #[inline(always)]
151 pub fn is_0cycles(&self) -> bool {
152 *self == LFTIMEOUT::_0cycles
153 }
154 #[inline(always)]
156 pub fn is_2cycles(&self) -> bool {
157 *self == LFTIMEOUT::_2cycles
158 }
159 #[inline(always)]
161 pub fn is_4cycles(&self) -> bool {
162 *self == LFTIMEOUT::_4cycles
163 }
164 #[inline(always)]
166 pub fn is_16cycles(&self) -> bool {
167 *self == LFTIMEOUT::_16cycles
168 }
169 #[inline(always)]
171 pub fn is_32cycles(&self) -> bool {
172 *self == LFTIMEOUT::_32cycles
173 }
174 #[inline(always)]
176 pub fn is_64cycles(&self) -> bool {
177 *self == LFTIMEOUT::_64cycles
178 }
179 #[inline(always)]
181 pub fn is_1kcycles(&self) -> bool {
182 *self == LFTIMEOUT::_1kcycles
183 }
184 #[inline(always)]
186 pub fn is_4kcycles(&self) -> bool {
187 *self == LFTIMEOUT::_4kcycles
188 }
189}
190pub type LftimeoutW<'a, REG> = crate::FieldWriter<'a, REG, 3, LFTIMEOUT, crate::Safe>;
192impl<'a, REG> LftimeoutW<'a, REG>
193where
194 REG: crate::Writable + crate::RegisterSpec,
195 REG::Ux: From<u8>,
196{
197 #[inline(always)]
199 pub fn _0cycles(self) -> &'a mut crate::W<REG> {
200 self.variant(LFTIMEOUT::_0cycles)
201 }
202 #[inline(always)]
204 pub fn _2cycles(self) -> &'a mut crate::W<REG> {
205 self.variant(LFTIMEOUT::_2cycles)
206 }
207 #[inline(always)]
209 pub fn _4cycles(self) -> &'a mut crate::W<REG> {
210 self.variant(LFTIMEOUT::_4cycles)
211 }
212 #[inline(always)]
214 pub fn _16cycles(self) -> &'a mut crate::W<REG> {
215 self.variant(LFTIMEOUT::_16cycles)
216 }
217 #[inline(always)]
219 pub fn _32cycles(self) -> &'a mut crate::W<REG> {
220 self.variant(LFTIMEOUT::_32cycles)
221 }
222 #[inline(always)]
224 pub fn _64cycles(self) -> &'a mut crate::W<REG> {
225 self.variant(LFTIMEOUT::_64cycles)
226 }
227 #[inline(always)]
229 pub fn _1kcycles(self) -> &'a mut crate::W<REG> {
230 self.variant(LFTIMEOUT::_1kcycles)
231 }
232 #[inline(always)]
234 pub fn _4kcycles(self) -> &'a mut crate::W<REG> {
235 self.variant(LFTIMEOUT::_4kcycles)
236 }
237}
238pub type Autostartem0em1R = crate::BitReader;
240pub type Autostartem0em1W<'a, REG> = crate::BitWriter<'a, REG>;
242pub type Autostartselem0em1R = crate::BitReader;
244pub type Autostartselem0em1W<'a, REG> = crate::BitWriter<'a, REG>;
246impl R {
247 #[inline(always)]
249 pub fn mode(&self) -> ModeR {
250 ModeR::new((self.bits & 1) != 0)
251 }
252 #[inline(always)]
254 pub fn peakdetshuntoptmode(&self) -> PeakdetshuntoptmodeR {
255 PeakdetshuntoptmodeR::new(((self.bits >> 4) & 3) as u8)
256 }
257 #[inline(always)]
259 pub fn lowpower(&self) -> LowpowerR {
260 LowpowerR::new(((self.bits >> 8) & 1) != 0)
261 }
262 #[inline(always)]
264 pub fn xti2gnd(&self) -> Xti2gndR {
265 Xti2gndR::new(((self.bits >> 9) & 1) != 0)
266 }
267 #[inline(always)]
269 pub fn xto2gnd(&self) -> Xto2gndR {
270 Xto2gndR::new(((self.bits >> 10) & 1) != 0)
271 }
272 #[inline(always)]
274 pub fn lftimeout(&self) -> LftimeoutR {
275 LftimeoutR::new(((self.bits >> 24) & 7) as u8)
276 }
277 #[inline(always)]
279 pub fn autostartem0em1(&self) -> Autostartem0em1R {
280 Autostartem0em1R::new(((self.bits >> 28) & 1) != 0)
281 }
282 #[inline(always)]
284 pub fn autostartselem0em1(&self) -> Autostartselem0em1R {
285 Autostartselem0em1R::new(((self.bits >> 29) & 1) != 0)
286 }
287}
288impl core::fmt::Debug for R {
289 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
290 f.debug_struct("HFXOCTRL")
291 .field("mode", &self.mode())
292 .field("peakdetshuntoptmode", &self.peakdetshuntoptmode())
293 .field("lowpower", &self.lowpower())
294 .field("xti2gnd", &self.xti2gnd())
295 .field("xto2gnd", &self.xto2gnd())
296 .field("lftimeout", &self.lftimeout())
297 .field("autostartem0em1", &self.autostartem0em1())
298 .field("autostartselem0em1", &self.autostartselem0em1())
299 .finish()
300 }
301}
302impl W {
303 #[inline(always)]
305 pub fn mode(&mut self) -> ModeW<'_, HFXOCTRLrs> {
306 ModeW::new(self, 0)
307 }
308 #[inline(always)]
310 pub fn peakdetshuntoptmode(&mut self) -> PeakdetshuntoptmodeW<'_, HFXOCTRLrs> {
311 PeakdetshuntoptmodeW::new(self, 4)
312 }
313 #[inline(always)]
315 pub fn lowpower(&mut self) -> LowpowerW<'_, HFXOCTRLrs> {
316 LowpowerW::new(self, 8)
317 }
318 #[inline(always)]
320 pub fn xti2gnd(&mut self) -> Xti2gndW<'_, HFXOCTRLrs> {
321 Xti2gndW::new(self, 9)
322 }
323 #[inline(always)]
325 pub fn xto2gnd(&mut self) -> Xto2gndW<'_, HFXOCTRLrs> {
326 Xto2gndW::new(self, 10)
327 }
328 #[inline(always)]
330 pub fn lftimeout(&mut self) -> LftimeoutW<'_, HFXOCTRLrs> {
331 LftimeoutW::new(self, 24)
332 }
333 #[inline(always)]
335 pub fn autostartem0em1(&mut self) -> Autostartem0em1W<'_, HFXOCTRLrs> {
336 Autostartem0em1W::new(self, 28)
337 }
338 #[inline(always)]
340 pub fn autostartselem0em1(&mut self) -> Autostartselem0em1W<'_, HFXOCTRLrs> {
341 Autostartselem0em1W::new(self, 29)
342 }
343}
344pub struct HFXOCTRLrs;
348impl crate::RegisterSpec for HFXOCTRLrs {
349 type Ux = u32;
350}
351impl crate::Readable for HFXOCTRLrs {}
353impl crate::Writable for HFXOCTRLrs {
355 type Safety = crate::Unsafe;
356}
357impl crate::Resettable for HFXOCTRLrs {}