d1_pac/audio_codec/
micbias.rs

1#[doc = "Register `micbias` reader"]
2pub type R = crate::R<MICBIAS_SPEC>;
3#[doc = "Register `micbias` writer"]
4pub type W = crate::W<MICBIAS_SPEC>;
5#[doc = "Field `mmic_bias_chopper_clk_sel` reader - MMIC BIAS Chopper Clock Select"]
6pub type MMIC_BIAS_CHOPPER_CLK_SEL_R = crate::FieldReader<MMIC_BIAS_CHOPPER_CLK_SEL_A>;
7#[doc = "MMIC BIAS Chopper Clock Select\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum MMIC_BIAS_CHOPPER_CLK_SEL_A {
11    #[doc = "0: 250 kHz"]
12    _250KHZ = 0,
13    #[doc = "1: 500 kHz"]
14    _500KHZ = 1,
15    #[doc = "2: 1 MHz"]
16    _1MHZ = 2,
17    #[doc = "3: 2 MHz"]
18    _2MHZ = 3,
19}
20impl From<MMIC_BIAS_CHOPPER_CLK_SEL_A> for u8 {
21    #[inline(always)]
22    fn from(variant: MMIC_BIAS_CHOPPER_CLK_SEL_A) -> Self {
23        variant as _
24    }
25}
26impl crate::FieldSpec for MMIC_BIAS_CHOPPER_CLK_SEL_A {
27    type Ux = u8;
28}
29impl MMIC_BIAS_CHOPPER_CLK_SEL_R {
30    #[doc = "Get enumerated values variant"]
31    #[inline(always)]
32    pub const fn variant(&self) -> MMIC_BIAS_CHOPPER_CLK_SEL_A {
33        match self.bits {
34            0 => MMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ,
35            1 => MMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ,
36            2 => MMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ,
37            3 => MMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ,
38            _ => unreachable!(),
39        }
40    }
41    #[doc = "250 kHz"]
42    #[inline(always)]
43    pub fn is_250khz(&self) -> bool {
44        *self == MMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ
45    }
46    #[doc = "500 kHz"]
47    #[inline(always)]
48    pub fn is_500khz(&self) -> bool {
49        *self == MMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ
50    }
51    #[doc = "1 MHz"]
52    #[inline(always)]
53    pub fn is_1mhz(&self) -> bool {
54        *self == MMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ
55    }
56    #[doc = "2 MHz"]
57    #[inline(always)]
58    pub fn is_2mhz(&self) -> bool {
59        *self == MMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ
60    }
61}
62#[doc = "Field `mmic_bias_chopper_clk_sel` writer - MMIC BIAS Chopper Clock Select"]
63pub type MMIC_BIAS_CHOPPER_CLK_SEL_W<'a, REG> =
64    crate::FieldWriterSafe<'a, REG, 2, MMIC_BIAS_CHOPPER_CLK_SEL_A>;
65impl<'a, REG> MMIC_BIAS_CHOPPER_CLK_SEL_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "250 kHz"]
71    #[inline(always)]
72    pub fn _250khz(self) -> &'a mut crate::W<REG> {
73        self.variant(MMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ)
74    }
75    #[doc = "500 kHz"]
76    #[inline(always)]
77    pub fn _500khz(self) -> &'a mut crate::W<REG> {
78        self.variant(MMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ)
79    }
80    #[doc = "1 MHz"]
81    #[inline(always)]
82    pub fn _1mhz(self) -> &'a mut crate::W<REG> {
83        self.variant(MMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ)
84    }
85    #[doc = "2 MHz"]
86    #[inline(always)]
87    pub fn _2mhz(self) -> &'a mut crate::W<REG> {
88        self.variant(MMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ)
89    }
90}
91#[doc = "Field `mmic_bias_chopper_en` reader - MMIC BIAS Chopper Enable"]
92pub type MMIC_BIAS_CHOPPER_EN_R = crate::BitReader<MMIC_BIAS_CHOPPER_EN_A>;
93#[doc = "MMIC BIAS Chopper Enable\n\nValue on reset: 1"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum MMIC_BIAS_CHOPPER_EN_A {
96    #[doc = "0: Disabled"]
97    DISABLED = 0,
98    #[doc = "1: Enabled"]
99    ENABLED = 1,
100}
101impl From<MMIC_BIAS_CHOPPER_EN_A> for bool {
102    #[inline(always)]
103    fn from(variant: MMIC_BIAS_CHOPPER_EN_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl MMIC_BIAS_CHOPPER_EN_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub const fn variant(&self) -> MMIC_BIAS_CHOPPER_EN_A {
111        match self.bits {
112            false => MMIC_BIAS_CHOPPER_EN_A::DISABLED,
113            true => MMIC_BIAS_CHOPPER_EN_A::ENABLED,
114        }
115    }
116    #[doc = "Disabled"]
117    #[inline(always)]
118    pub fn is_disabled(&self) -> bool {
119        *self == MMIC_BIAS_CHOPPER_EN_A::DISABLED
120    }
121    #[doc = "Enabled"]
122    #[inline(always)]
123    pub fn is_enabled(&self) -> bool {
124        *self == MMIC_BIAS_CHOPPER_EN_A::ENABLED
125    }
126}
127#[doc = "Field `mmic_bias_chopper_en` writer - MMIC BIAS Chopper Enable"]
128pub type MMIC_BIAS_CHOPPER_EN_W<'a, REG> = crate::BitWriter<'a, REG, MMIC_BIAS_CHOPPER_EN_A>;
129impl<'a, REG> MMIC_BIAS_CHOPPER_EN_W<'a, REG>
130where
131    REG: crate::Writable + crate::RegisterSpec,
132{
133    #[doc = "Disabled"]
134    #[inline(always)]
135    pub fn disabled(self) -> &'a mut crate::W<REG> {
136        self.variant(MMIC_BIAS_CHOPPER_EN_A::DISABLED)
137    }
138    #[doc = "Enabled"]
139    #[inline(always)]
140    pub fn enabled(self) -> &'a mut crate::W<REG> {
141        self.variant(MMIC_BIAS_CHOPPER_EN_A::ENABLED)
142    }
143}
144#[doc = "Field `mbiassel` reader - MMICBIAS Voltage Level Select"]
145pub type MBIASSEL_R = crate::FieldReader<MBIASSEL_A>;
146#[doc = "MMICBIAS Voltage Level Select\n\nValue on reset: 1"]
147#[derive(Clone, Copy, Debug, PartialEq, Eq)]
148#[repr(u8)]
149pub enum MBIASSEL_A {
150    #[doc = "0: 1.88 V"]
151    _1_88_V = 0,
152    #[doc = "1: 2.09 V"]
153    _2_09_V = 1,
154    #[doc = "2: 2.33 V"]
155    _2_33_V = 2,
156    #[doc = "3: 2.50 V"]
157    _2_50_V = 3,
158}
159impl From<MBIASSEL_A> for u8 {
160    #[inline(always)]
161    fn from(variant: MBIASSEL_A) -> Self {
162        variant as _
163    }
164}
165impl crate::FieldSpec for MBIASSEL_A {
166    type Ux = u8;
167}
168impl MBIASSEL_R {
169    #[doc = "Get enumerated values variant"]
170    #[inline(always)]
171    pub const fn variant(&self) -> MBIASSEL_A {
172        match self.bits {
173            0 => MBIASSEL_A::_1_88_V,
174            1 => MBIASSEL_A::_2_09_V,
175            2 => MBIASSEL_A::_2_33_V,
176            3 => MBIASSEL_A::_2_50_V,
177            _ => unreachable!(),
178        }
179    }
180    #[doc = "1.88 V"]
181    #[inline(always)]
182    pub fn is_1_88_v(&self) -> bool {
183        *self == MBIASSEL_A::_1_88_V
184    }
185    #[doc = "2.09 V"]
186    #[inline(always)]
187    pub fn is_2_09_v(&self) -> bool {
188        *self == MBIASSEL_A::_2_09_V
189    }
190    #[doc = "2.33 V"]
191    #[inline(always)]
192    pub fn is_2_33_v(&self) -> bool {
193        *self == MBIASSEL_A::_2_33_V
194    }
195    #[doc = "2.50 V"]
196    #[inline(always)]
197    pub fn is_2_50_v(&self) -> bool {
198        *self == MBIASSEL_A::_2_50_V
199    }
200}
201#[doc = "Field `mbiassel` writer - MMICBIAS Voltage Level Select"]
202pub type MBIASSEL_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, MBIASSEL_A>;
203impl<'a, REG> MBIASSEL_W<'a, REG>
204where
205    REG: crate::Writable + crate::RegisterSpec,
206    REG::Ux: From<u8>,
207{
208    #[doc = "1.88 V"]
209    #[inline(always)]
210    pub fn _1_88_v(self) -> &'a mut crate::W<REG> {
211        self.variant(MBIASSEL_A::_1_88_V)
212    }
213    #[doc = "2.09 V"]
214    #[inline(always)]
215    pub fn _2_09_v(self) -> &'a mut crate::W<REG> {
216        self.variant(MBIASSEL_A::_2_09_V)
217    }
218    #[doc = "2.33 V"]
219    #[inline(always)]
220    pub fn _2_33_v(self) -> &'a mut crate::W<REG> {
221        self.variant(MBIASSEL_A::_2_33_V)
222    }
223    #[doc = "2.50 V"]
224    #[inline(always)]
225    pub fn _2_50_v(self) -> &'a mut crate::W<REG> {
226        self.variant(MBIASSEL_A::_2_50_V)
227    }
228}
229#[doc = "Field `mmicbiasen` reader - Master Microphone Bias Enable"]
230pub type MMICBIASEN_R = crate::BitReader<MMICBIASEN_A>;
231#[doc = "Master Microphone Bias Enable\n\nValue on reset: 0"]
232#[derive(Clone, Copy, Debug, PartialEq, Eq)]
233pub enum MMICBIASEN_A {
234    #[doc = "0: Disabled"]
235    DISABLED = 0,
236    #[doc = "1: Enabled"]
237    ENABLED = 1,
238}
239impl From<MMICBIASEN_A> for bool {
240    #[inline(always)]
241    fn from(variant: MMICBIASEN_A) -> Self {
242        variant as u8 != 0
243    }
244}
245impl MMICBIASEN_R {
246    #[doc = "Get enumerated values variant"]
247    #[inline(always)]
248    pub const fn variant(&self) -> MMICBIASEN_A {
249        match self.bits {
250            false => MMICBIASEN_A::DISABLED,
251            true => MMICBIASEN_A::ENABLED,
252        }
253    }
254    #[doc = "Disabled"]
255    #[inline(always)]
256    pub fn is_disabled(&self) -> bool {
257        *self == MMICBIASEN_A::DISABLED
258    }
259    #[doc = "Enabled"]
260    #[inline(always)]
261    pub fn is_enabled(&self) -> bool {
262        *self == MMICBIASEN_A::ENABLED
263    }
264}
265#[doc = "Field `mmicbiasen` writer - Master Microphone Bias Enable"]
266pub type MMICBIASEN_W<'a, REG> = crate::BitWriter<'a, REG, MMICBIASEN_A>;
267impl<'a, REG> MMICBIASEN_W<'a, REG>
268where
269    REG: crate::Writable + crate::RegisterSpec,
270{
271    #[doc = "Disabled"]
272    #[inline(always)]
273    pub fn disabled(self) -> &'a mut crate::W<REG> {
274        self.variant(MMICBIASEN_A::DISABLED)
275    }
276    #[doc = "Enabled"]
277    #[inline(always)]
278    pub fn enabled(self) -> &'a mut crate::W<REG> {
279        self.variant(MMICBIASEN_A::ENABLED)
280    }
281}
282#[doc = "Field `hmic_bias_chopper_clk_sel` reader - HMIC BIAS Chopper Clock Select"]
283pub type HMIC_BIAS_CHOPPER_CLK_SEL_R = crate::FieldReader<HMIC_BIAS_CHOPPER_CLK_SEL_A>;
284#[doc = "HMIC BIAS Chopper Clock Select\n\nValue on reset: 0"]
285#[derive(Clone, Copy, Debug, PartialEq, Eq)]
286#[repr(u8)]
287pub enum HMIC_BIAS_CHOPPER_CLK_SEL_A {
288    #[doc = "0: 250 kHz"]
289    _250KHZ = 0,
290    #[doc = "1: 500 kHz"]
291    _500KHZ = 1,
292    #[doc = "2: 1 MHz"]
293    _1MHZ = 2,
294    #[doc = "3: 2 MHz"]
295    _2MHZ = 3,
296}
297impl From<HMIC_BIAS_CHOPPER_CLK_SEL_A> for u8 {
298    #[inline(always)]
299    fn from(variant: HMIC_BIAS_CHOPPER_CLK_SEL_A) -> Self {
300        variant as _
301    }
302}
303impl crate::FieldSpec for HMIC_BIAS_CHOPPER_CLK_SEL_A {
304    type Ux = u8;
305}
306impl HMIC_BIAS_CHOPPER_CLK_SEL_R {
307    #[doc = "Get enumerated values variant"]
308    #[inline(always)]
309    pub const fn variant(&self) -> HMIC_BIAS_CHOPPER_CLK_SEL_A {
310        match self.bits {
311            0 => HMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ,
312            1 => HMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ,
313            2 => HMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ,
314            3 => HMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ,
315            _ => unreachable!(),
316        }
317    }
318    #[doc = "250 kHz"]
319    #[inline(always)]
320    pub fn is_250khz(&self) -> bool {
321        *self == HMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ
322    }
323    #[doc = "500 kHz"]
324    #[inline(always)]
325    pub fn is_500khz(&self) -> bool {
326        *self == HMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ
327    }
328    #[doc = "1 MHz"]
329    #[inline(always)]
330    pub fn is_1mhz(&self) -> bool {
331        *self == HMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ
332    }
333    #[doc = "2 MHz"]
334    #[inline(always)]
335    pub fn is_2mhz(&self) -> bool {
336        *self == HMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ
337    }
338}
339#[doc = "Field `hmic_bias_chopper_clk_sel` writer - HMIC BIAS Chopper Clock Select"]
340pub type HMIC_BIAS_CHOPPER_CLK_SEL_W<'a, REG> =
341    crate::FieldWriterSafe<'a, REG, 2, HMIC_BIAS_CHOPPER_CLK_SEL_A>;
342impl<'a, REG> HMIC_BIAS_CHOPPER_CLK_SEL_W<'a, REG>
343where
344    REG: crate::Writable + crate::RegisterSpec,
345    REG::Ux: From<u8>,
346{
347    #[doc = "250 kHz"]
348    #[inline(always)]
349    pub fn _250khz(self) -> &'a mut crate::W<REG> {
350        self.variant(HMIC_BIAS_CHOPPER_CLK_SEL_A::_250KHZ)
351    }
352    #[doc = "500 kHz"]
353    #[inline(always)]
354    pub fn _500khz(self) -> &'a mut crate::W<REG> {
355        self.variant(HMIC_BIAS_CHOPPER_CLK_SEL_A::_500KHZ)
356    }
357    #[doc = "1 MHz"]
358    #[inline(always)]
359    pub fn _1mhz(self) -> &'a mut crate::W<REG> {
360        self.variant(HMIC_BIAS_CHOPPER_CLK_SEL_A::_1MHZ)
361    }
362    #[doc = "2 MHz"]
363    #[inline(always)]
364    pub fn _2mhz(self) -> &'a mut crate::W<REG> {
365        self.variant(HMIC_BIAS_CHOPPER_CLK_SEL_A::_2MHZ)
366    }
367}
368#[doc = "Field `hmic_bias_chopper_en` reader - HMIC BIAS Chopper Enable"]
369pub type HMIC_BIAS_CHOPPER_EN_R = crate::BitReader<HMIC_BIAS_CHOPPER_EN_A>;
370#[doc = "HMIC BIAS Chopper Enable\n\nValue on reset: 1"]
371#[derive(Clone, Copy, Debug, PartialEq, Eq)]
372pub enum HMIC_BIAS_CHOPPER_EN_A {
373    #[doc = "0: Disabled"]
374    DISABLED = 0,
375    #[doc = "1: Enabled"]
376    ENABLED = 1,
377}
378impl From<HMIC_BIAS_CHOPPER_EN_A> for bool {
379    #[inline(always)]
380    fn from(variant: HMIC_BIAS_CHOPPER_EN_A) -> Self {
381        variant as u8 != 0
382    }
383}
384impl HMIC_BIAS_CHOPPER_EN_R {
385    #[doc = "Get enumerated values variant"]
386    #[inline(always)]
387    pub const fn variant(&self) -> HMIC_BIAS_CHOPPER_EN_A {
388        match self.bits {
389            false => HMIC_BIAS_CHOPPER_EN_A::DISABLED,
390            true => HMIC_BIAS_CHOPPER_EN_A::ENABLED,
391        }
392    }
393    #[doc = "Disabled"]
394    #[inline(always)]
395    pub fn is_disabled(&self) -> bool {
396        *self == HMIC_BIAS_CHOPPER_EN_A::DISABLED
397    }
398    #[doc = "Enabled"]
399    #[inline(always)]
400    pub fn is_enabled(&self) -> bool {
401        *self == HMIC_BIAS_CHOPPER_EN_A::ENABLED
402    }
403}
404#[doc = "Field `hmic_bias_chopper_en` writer - HMIC BIAS Chopper Enable"]
405pub type HMIC_BIAS_CHOPPER_EN_W<'a, REG> = crate::BitWriter<'a, REG, HMIC_BIAS_CHOPPER_EN_A>;
406impl<'a, REG> HMIC_BIAS_CHOPPER_EN_W<'a, REG>
407where
408    REG: crate::Writable + crate::RegisterSpec,
409{
410    #[doc = "Disabled"]
411    #[inline(always)]
412    pub fn disabled(self) -> &'a mut crate::W<REG> {
413        self.variant(HMIC_BIAS_CHOPPER_EN_A::DISABLED)
414    }
415    #[doc = "Enabled"]
416    #[inline(always)]
417    pub fn enabled(self) -> &'a mut crate::W<REG> {
418        self.variant(HMIC_BIAS_CHOPPER_EN_A::ENABLED)
419    }
420}
421#[doc = "Field `hbiassel` reader - HMICBIAS Voltage Level Select"]
422pub type HBIASSEL_R = crate::FieldReader<HBIASSEL_A>;
423#[doc = "HMICBIAS Voltage Level Select\n\nValue on reset: 1"]
424#[derive(Clone, Copy, Debug, PartialEq, Eq)]
425#[repr(u8)]
426pub enum HBIASSEL_A {
427    #[doc = "0: 1.88 V"]
428    _1_88_V = 0,
429    #[doc = "1: 2.09 V"]
430    _2_09_V = 1,
431    #[doc = "2: 2.33 V"]
432    _2_33_V = 2,
433    #[doc = "3: 2.55 V"]
434    _2_55_V = 3,
435}
436impl From<HBIASSEL_A> for u8 {
437    #[inline(always)]
438    fn from(variant: HBIASSEL_A) -> Self {
439        variant as _
440    }
441}
442impl crate::FieldSpec for HBIASSEL_A {
443    type Ux = u8;
444}
445impl HBIASSEL_R {
446    #[doc = "Get enumerated values variant"]
447    #[inline(always)]
448    pub const fn variant(&self) -> HBIASSEL_A {
449        match self.bits {
450            0 => HBIASSEL_A::_1_88_V,
451            1 => HBIASSEL_A::_2_09_V,
452            2 => HBIASSEL_A::_2_33_V,
453            3 => HBIASSEL_A::_2_55_V,
454            _ => unreachable!(),
455        }
456    }
457    #[doc = "1.88 V"]
458    #[inline(always)]
459    pub fn is_1_88_v(&self) -> bool {
460        *self == HBIASSEL_A::_1_88_V
461    }
462    #[doc = "2.09 V"]
463    #[inline(always)]
464    pub fn is_2_09_v(&self) -> bool {
465        *self == HBIASSEL_A::_2_09_V
466    }
467    #[doc = "2.33 V"]
468    #[inline(always)]
469    pub fn is_2_33_v(&self) -> bool {
470        *self == HBIASSEL_A::_2_33_V
471    }
472    #[doc = "2.55 V"]
473    #[inline(always)]
474    pub fn is_2_55_v(&self) -> bool {
475        *self == HBIASSEL_A::_2_55_V
476    }
477}
478#[doc = "Field `hbiassel` writer - HMICBIAS Voltage Level Select"]
479pub type HBIASSEL_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, HBIASSEL_A>;
480impl<'a, REG> HBIASSEL_W<'a, REG>
481where
482    REG: crate::Writable + crate::RegisterSpec,
483    REG::Ux: From<u8>,
484{
485    #[doc = "1.88 V"]
486    #[inline(always)]
487    pub fn _1_88_v(self) -> &'a mut crate::W<REG> {
488        self.variant(HBIASSEL_A::_1_88_V)
489    }
490    #[doc = "2.09 V"]
491    #[inline(always)]
492    pub fn _2_09_v(self) -> &'a mut crate::W<REG> {
493        self.variant(HBIASSEL_A::_2_09_V)
494    }
495    #[doc = "2.33 V"]
496    #[inline(always)]
497    pub fn _2_33_v(self) -> &'a mut crate::W<REG> {
498        self.variant(HBIASSEL_A::_2_33_V)
499    }
500    #[doc = "2.55 V"]
501    #[inline(always)]
502    pub fn _2_55_v(self) -> &'a mut crate::W<REG> {
503        self.variant(HBIASSEL_A::_2_55_V)
504    }
505}
506#[doc = "Field `hmicbiasen` reader - Headphone Microphone Bias Enable"]
507pub type HMICBIASEN_R = crate::BitReader<HMICBIASEN_A>;
508#[doc = "Headphone Microphone Bias Enable\n\nValue on reset: 0"]
509#[derive(Clone, Copy, Debug, PartialEq, Eq)]
510pub enum HMICBIASEN_A {
511    #[doc = "0: Disabled"]
512    DISABLED = 0,
513    #[doc = "1: Enabled"]
514    ENABLED = 1,
515}
516impl From<HMICBIASEN_A> for bool {
517    #[inline(always)]
518    fn from(variant: HMICBIASEN_A) -> Self {
519        variant as u8 != 0
520    }
521}
522impl HMICBIASEN_R {
523    #[doc = "Get enumerated values variant"]
524    #[inline(always)]
525    pub const fn variant(&self) -> HMICBIASEN_A {
526        match self.bits {
527            false => HMICBIASEN_A::DISABLED,
528            true => HMICBIASEN_A::ENABLED,
529        }
530    }
531    #[doc = "Disabled"]
532    #[inline(always)]
533    pub fn is_disabled(&self) -> bool {
534        *self == HMICBIASEN_A::DISABLED
535    }
536    #[doc = "Enabled"]
537    #[inline(always)]
538    pub fn is_enabled(&self) -> bool {
539        *self == HMICBIASEN_A::ENABLED
540    }
541}
542#[doc = "Field `hmicbiasen` writer - Headphone Microphone Bias Enable"]
543pub type HMICBIASEN_W<'a, REG> = crate::BitWriter<'a, REG, HMICBIASEN_A>;
544impl<'a, REG> HMICBIASEN_W<'a, REG>
545where
546    REG: crate::Writable + crate::RegisterSpec,
547{
548    #[doc = "Disabled"]
549    #[inline(always)]
550    pub fn disabled(self) -> &'a mut crate::W<REG> {
551        self.variant(HMICBIASEN_A::DISABLED)
552    }
553    #[doc = "Enabled"]
554    #[inline(always)]
555    pub fn enabled(self) -> &'a mut crate::W<REG> {
556        self.variant(HMICBIASEN_A::ENABLED)
557    }
558}
559#[doc = "Field `micdetpl` reader - When this bit is 1and AUTOPLEN is 0, the MICDET is pulled down to GND."]
560pub type MICDETPL_R = crate::BitReader;
561#[doc = "Field `micdetpl` writer - When this bit is 1and AUTOPLEN is 0, the MICDET is pulled down to GND."]
562pub type MICDETPL_W<'a, REG> = crate::BitWriter<'a, REG>;
563#[doc = "Field `autoplen` reader - Enable the function to auto pull low MICDET when jack removal"]
564pub type AUTOPLEN_R = crate::BitReader<AUTOPLEN_A>;
565#[doc = "Enable the function to auto pull low MICDET when jack removal\n\nValue on reset: 0"]
566#[derive(Clone, Copy, Debug, PartialEq, Eq)]
567pub enum AUTOPLEN_A {
568    #[doc = "0: Disabled"]
569    DISABLED = 0,
570    #[doc = "1: Enabled"]
571    ENABLED = 1,
572}
573impl From<AUTOPLEN_A> for bool {
574    #[inline(always)]
575    fn from(variant: AUTOPLEN_A) -> Self {
576        variant as u8 != 0
577    }
578}
579impl AUTOPLEN_R {
580    #[doc = "Get enumerated values variant"]
581    #[inline(always)]
582    pub const fn variant(&self) -> AUTOPLEN_A {
583        match self.bits {
584            false => AUTOPLEN_A::DISABLED,
585            true => AUTOPLEN_A::ENABLED,
586        }
587    }
588    #[doc = "Disabled"]
589    #[inline(always)]
590    pub fn is_disabled(&self) -> bool {
591        *self == AUTOPLEN_A::DISABLED
592    }
593    #[doc = "Enabled"]
594    #[inline(always)]
595    pub fn is_enabled(&self) -> bool {
596        *self == AUTOPLEN_A::ENABLED
597    }
598}
599#[doc = "Field `autoplen` writer - Enable the function to auto pull low MICDET when jack removal"]
600pub type AUTOPLEN_W<'a, REG> = crate::BitWriter<'a, REG, AUTOPLEN_A>;
601impl<'a, REG> AUTOPLEN_W<'a, REG>
602where
603    REG: crate::Writable + crate::RegisterSpec,
604{
605    #[doc = "Disabled"]
606    #[inline(always)]
607    pub fn disabled(self) -> &'a mut crate::W<REG> {
608        self.variant(AUTOPLEN_A::DISABLED)
609    }
610    #[doc = "Enabled"]
611    #[inline(always)]
612    pub fn enabled(self) -> &'a mut crate::W<REG> {
613        self.variant(AUTOPLEN_A::ENABLED)
614    }
615}
616#[doc = "Field `det_mode` reader - MIC Detect Mode"]
617pub type DET_MODE_R = crate::BitReader<DET_MODE_A>;
618#[doc = "MIC Detect Mode\n\nValue on reset: 0"]
619#[derive(Clone, Copy, Debug, PartialEq, Eq)]
620pub enum DET_MODE_A {
621    #[doc = "0: Jack in pull low"]
622    LOW = 0,
623    #[doc = "1: Jack in pull high"]
624    HIGH = 1,
625}
626impl From<DET_MODE_A> for bool {
627    #[inline(always)]
628    fn from(variant: DET_MODE_A) -> Self {
629        variant as u8 != 0
630    }
631}
632impl DET_MODE_R {
633    #[doc = "Get enumerated values variant"]
634    #[inline(always)]
635    pub const fn variant(&self) -> DET_MODE_A {
636        match self.bits {
637            false => DET_MODE_A::LOW,
638            true => DET_MODE_A::HIGH,
639        }
640    }
641    #[doc = "Jack in pull low"]
642    #[inline(always)]
643    pub fn is_low(&self) -> bool {
644        *self == DET_MODE_A::LOW
645    }
646    #[doc = "Jack in pull high"]
647    #[inline(always)]
648    pub fn is_high(&self) -> bool {
649        *self == DET_MODE_A::HIGH
650    }
651}
652#[doc = "Field `det_mode` writer - MIC Detect Mode"]
653pub type DET_MODE_W<'a, REG> = crate::BitWriter<'a, REG, DET_MODE_A>;
654impl<'a, REG> DET_MODE_W<'a, REG>
655where
656    REG: crate::Writable + crate::RegisterSpec,
657{
658    #[doc = "Jack in pull low"]
659    #[inline(always)]
660    pub fn low(self) -> &'a mut crate::W<REG> {
661        self.variant(DET_MODE_A::LOW)
662    }
663    #[doc = "Jack in pull high"]
664    #[inline(always)]
665    pub fn high(self) -> &'a mut crate::W<REG> {
666        self.variant(DET_MODE_A::HIGH)
667    }
668}
669#[doc = "Field `popfree` reader - When this bit is 0, HBIAS MICADC is controlled by registor"]
670pub type POPFREE_R = crate::BitReader;
671#[doc = "Field `popfree` writer - When this bit is 0, HBIAS MICADC is controlled by registor"]
672pub type POPFREE_W<'a, REG> = crate::BitWriter<'a, REG>;
673#[doc = "Field `micadcen` reader - Microphone detect ADC enable"]
674pub type MICADCEN_R = crate::BitReader<MICADCEN_A>;
675#[doc = "Microphone detect ADC enable\n\nValue on reset: 0"]
676#[derive(Clone, Copy, Debug, PartialEq, Eq)]
677pub enum MICADCEN_A {
678    #[doc = "0: Disabled"]
679    DISABLED = 0,
680    #[doc = "1: Enabled"]
681    ENABLED = 1,
682}
683impl From<MICADCEN_A> for bool {
684    #[inline(always)]
685    fn from(variant: MICADCEN_A) -> Self {
686        variant as u8 != 0
687    }
688}
689impl MICADCEN_R {
690    #[doc = "Get enumerated values variant"]
691    #[inline(always)]
692    pub const fn variant(&self) -> MICADCEN_A {
693        match self.bits {
694            false => MICADCEN_A::DISABLED,
695            true => MICADCEN_A::ENABLED,
696        }
697    }
698    #[doc = "Disabled"]
699    #[inline(always)]
700    pub fn is_disabled(&self) -> bool {
701        *self == MICADCEN_A::DISABLED
702    }
703    #[doc = "Enabled"]
704    #[inline(always)]
705    pub fn is_enabled(&self) -> bool {
706        *self == MICADCEN_A::ENABLED
707    }
708}
709#[doc = "Field `micadcen` writer - Microphone detect ADC enable"]
710pub type MICADCEN_W<'a, REG> = crate::BitWriter<'a, REG, MICADCEN_A>;
711impl<'a, REG> MICADCEN_W<'a, REG>
712where
713    REG: crate::Writable + crate::RegisterSpec,
714{
715    #[doc = "Disabled"]
716    #[inline(always)]
717    pub fn disabled(self) -> &'a mut crate::W<REG> {
718        self.variant(MICADCEN_A::DISABLED)
719    }
720    #[doc = "Enabled"]
721    #[inline(always)]
722    pub fn enabled(self) -> &'a mut crate::W<REG> {
723        self.variant(MICADCEN_A::ENABLED)
724    }
725}
726#[doc = "Field `seldetadcdy` reader - Select the delay time to pull low the micdet when jack removal"]
727pub type SELDETADCDY_R = crate::FieldReader<SELDETADCDY_A>;
728#[doc = "Select the delay time to pull low the micdet when jack removal\n\nValue on reset: 0"]
729#[derive(Clone, Copy, Debug, PartialEq, Eq)]
730#[repr(u8)]
731pub enum SELDETADCDY_A {
732    #[doc = "0: 0.5 ms"]
733    _0_5_MS = 0,
734    #[doc = "1: 1 ms"]
735    _1_MS = 1,
736    #[doc = "2: 1.5 ms"]
737    _1_5_MS = 2,
738    #[doc = "3: 2 ms"]
739    _2_MS = 3,
740}
741impl From<SELDETADCDY_A> for u8 {
742    #[inline(always)]
743    fn from(variant: SELDETADCDY_A) -> Self {
744        variant as _
745    }
746}
747impl crate::FieldSpec for SELDETADCDY_A {
748    type Ux = u8;
749}
750impl SELDETADCDY_R {
751    #[doc = "Get enumerated values variant"]
752    #[inline(always)]
753    pub const fn variant(&self) -> SELDETADCDY_A {
754        match self.bits {
755            0 => SELDETADCDY_A::_0_5_MS,
756            1 => SELDETADCDY_A::_1_MS,
757            2 => SELDETADCDY_A::_1_5_MS,
758            3 => SELDETADCDY_A::_2_MS,
759            _ => unreachable!(),
760        }
761    }
762    #[doc = "0.5 ms"]
763    #[inline(always)]
764    pub fn is_0_5_ms(&self) -> bool {
765        *self == SELDETADCDY_A::_0_5_MS
766    }
767    #[doc = "1 ms"]
768    #[inline(always)]
769    pub fn is_1_ms(&self) -> bool {
770        *self == SELDETADCDY_A::_1_MS
771    }
772    #[doc = "1.5 ms"]
773    #[inline(always)]
774    pub fn is_1_5_ms(&self) -> bool {
775        *self == SELDETADCDY_A::_1_5_MS
776    }
777    #[doc = "2 ms"]
778    #[inline(always)]
779    pub fn is_2_ms(&self) -> bool {
780        *self == SELDETADCDY_A::_2_MS
781    }
782}
783#[doc = "Field `seldetadcdy` writer - Select the delay time to pull low the micdet when jack removal"]
784pub type SELDETADCDY_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, SELDETADCDY_A>;
785impl<'a, REG> SELDETADCDY_W<'a, REG>
786where
787    REG: crate::Writable + crate::RegisterSpec,
788    REG::Ux: From<u8>,
789{
790    #[doc = "0.5 ms"]
791    #[inline(always)]
792    pub fn _0_5_ms(self) -> &'a mut crate::W<REG> {
793        self.variant(SELDETADCDY_A::_0_5_MS)
794    }
795    #[doc = "1 ms"]
796    #[inline(always)]
797    pub fn _1_ms(self) -> &'a mut crate::W<REG> {
798        self.variant(SELDETADCDY_A::_1_MS)
799    }
800    #[doc = "1.5 ms"]
801    #[inline(always)]
802    pub fn _1_5_ms(self) -> &'a mut crate::W<REG> {
803        self.variant(SELDETADCDY_A::_1_5_MS)
804    }
805    #[doc = "2 ms"]
806    #[inline(always)]
807    pub fn _2_ms(self) -> &'a mut crate::W<REG> {
808        self.variant(SELDETADCDY_A::_2_MS)
809    }
810}
811#[doc = "Field `jackdeten` reader - Jack detect enable"]
812pub type JACKDETEN_R = crate::BitReader<JACKDETEN_A>;
813#[doc = "Jack detect enable\n\nValue on reset: 0"]
814#[derive(Clone, Copy, Debug, PartialEq, Eq)]
815pub enum JACKDETEN_A {
816    #[doc = "0: Disable"]
817    DISABLE = 0,
818    #[doc = "1: Enable"]
819    ENABLE = 1,
820}
821impl From<JACKDETEN_A> for bool {
822    #[inline(always)]
823    fn from(variant: JACKDETEN_A) -> Self {
824        variant as u8 != 0
825    }
826}
827impl JACKDETEN_R {
828    #[doc = "Get enumerated values variant"]
829    #[inline(always)]
830    pub const fn variant(&self) -> JACKDETEN_A {
831        match self.bits {
832            false => JACKDETEN_A::DISABLE,
833            true => JACKDETEN_A::ENABLE,
834        }
835    }
836    #[doc = "Disable"]
837    #[inline(always)]
838    pub fn is_disable(&self) -> bool {
839        *self == JACKDETEN_A::DISABLE
840    }
841    #[doc = "Enable"]
842    #[inline(always)]
843    pub fn is_enable(&self) -> bool {
844        *self == JACKDETEN_A::ENABLE
845    }
846}
847#[doc = "Field `jackdeten` writer - Jack detect enable"]
848pub type JACKDETEN_W<'a, REG> = crate::BitWriter<'a, REG, JACKDETEN_A>;
849impl<'a, REG> JACKDETEN_W<'a, REG>
850where
851    REG: crate::Writable + crate::RegisterSpec,
852{
853    #[doc = "Disable"]
854    #[inline(always)]
855    pub fn disable(self) -> &'a mut crate::W<REG> {
856        self.variant(JACKDETEN_A::DISABLE)
857    }
858    #[doc = "Enable"]
859    #[inline(always)]
860    pub fn enable(self) -> &'a mut crate::W<REG> {
861        self.variant(JACKDETEN_A::ENABLE)
862    }
863}
864#[doc = "Field `seldetadcbf` reader - Select the time to enable HBIAS before MICADC work"]
865pub type SELDETADCBF_R = crate::FieldReader<SELDETADCBF_A>;
866#[doc = "Select the time to enable HBIAS before MICADC work\n\nValue on reset: 0"]
867#[derive(Clone, Copy, Debug, PartialEq, Eq)]
868#[repr(u8)]
869pub enum SELDETADCBF_A {
870    #[doc = "0: 2 ms"]
871    _2_MS = 0,
872    #[doc = "1: 4 ms"]
873    _4_MS = 1,
874    #[doc = "2: 8 ms"]
875    _8_MS = 2,
876    #[doc = "3: 16 ms"]
877    _16_MS = 3,
878}
879impl From<SELDETADCBF_A> for u8 {
880    #[inline(always)]
881    fn from(variant: SELDETADCBF_A) -> Self {
882        variant as _
883    }
884}
885impl crate::FieldSpec for SELDETADCBF_A {
886    type Ux = u8;
887}
888impl SELDETADCBF_R {
889    #[doc = "Get enumerated values variant"]
890    #[inline(always)]
891    pub const fn variant(&self) -> SELDETADCBF_A {
892        match self.bits {
893            0 => SELDETADCBF_A::_2_MS,
894            1 => SELDETADCBF_A::_4_MS,
895            2 => SELDETADCBF_A::_8_MS,
896            3 => SELDETADCBF_A::_16_MS,
897            _ => unreachable!(),
898        }
899    }
900    #[doc = "2 ms"]
901    #[inline(always)]
902    pub fn is_2_ms(&self) -> bool {
903        *self == SELDETADCBF_A::_2_MS
904    }
905    #[doc = "4 ms"]
906    #[inline(always)]
907    pub fn is_4_ms(&self) -> bool {
908        *self == SELDETADCBF_A::_4_MS
909    }
910    #[doc = "8 ms"]
911    #[inline(always)]
912    pub fn is_8_ms(&self) -> bool {
913        *self == SELDETADCBF_A::_8_MS
914    }
915    #[doc = "16 ms"]
916    #[inline(always)]
917    pub fn is_16_ms(&self) -> bool {
918        *self == SELDETADCBF_A::_16_MS
919    }
920}
921#[doc = "Field `seldetadcbf` writer - Select the time to enable HBIAS before MICADC work"]
922pub type SELDETADCBF_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, SELDETADCBF_A>;
923impl<'a, REG> SELDETADCBF_W<'a, REG>
924where
925    REG: crate::Writable + crate::RegisterSpec,
926    REG::Ux: From<u8>,
927{
928    #[doc = "2 ms"]
929    #[inline(always)]
930    pub fn _2_ms(self) -> &'a mut crate::W<REG> {
931        self.variant(SELDETADCBF_A::_2_MS)
932    }
933    #[doc = "4 ms"]
934    #[inline(always)]
935    pub fn _4_ms(self) -> &'a mut crate::W<REG> {
936        self.variant(SELDETADCBF_A::_4_MS)
937    }
938    #[doc = "8 ms"]
939    #[inline(always)]
940    pub fn _8_ms(self) -> &'a mut crate::W<REG> {
941        self.variant(SELDETADCBF_A::_8_MS)
942    }
943    #[doc = "16 ms"]
944    #[inline(always)]
945    pub fn _16_ms(self) -> &'a mut crate::W<REG> {
946        self.variant(SELDETADCBF_A::_16_MS)
947    }
948}
949#[doc = "Field `seldetadcdb` reader - Select debounce time when jack removal"]
950pub type SELDETADCDB_R = crate::FieldReader<SELDETADCDB_A>;
951#[doc = "Select debounce time when jack removal\n\nValue on reset: 0"]
952#[derive(Clone, Copy, Debug, PartialEq, Eq)]
953#[repr(u8)]
954pub enum SELDETADCDB_A {
955    #[doc = "0: 128 ms"]
956    _128_MS = 0,
957    #[doc = "1: 256 ms"]
958    _256_MS = 1,
959    #[doc = "2: 512 ms"]
960    _512_MS = 2,
961    #[doc = "3: 1024 ms"]
962    _1024_MS = 3,
963}
964impl From<SELDETADCDB_A> for u8 {
965    #[inline(always)]
966    fn from(variant: SELDETADCDB_A) -> Self {
967        variant as _
968    }
969}
970impl crate::FieldSpec for SELDETADCDB_A {
971    type Ux = u8;
972}
973impl SELDETADCDB_R {
974    #[doc = "Get enumerated values variant"]
975    #[inline(always)]
976    pub const fn variant(&self) -> SELDETADCDB_A {
977        match self.bits {
978            0 => SELDETADCDB_A::_128_MS,
979            1 => SELDETADCDB_A::_256_MS,
980            2 => SELDETADCDB_A::_512_MS,
981            3 => SELDETADCDB_A::_1024_MS,
982            _ => unreachable!(),
983        }
984    }
985    #[doc = "128 ms"]
986    #[inline(always)]
987    pub fn is_128_ms(&self) -> bool {
988        *self == SELDETADCDB_A::_128_MS
989    }
990    #[doc = "256 ms"]
991    #[inline(always)]
992    pub fn is_256_ms(&self) -> bool {
993        *self == SELDETADCDB_A::_256_MS
994    }
995    #[doc = "512 ms"]
996    #[inline(always)]
997    pub fn is_512_ms(&self) -> bool {
998        *self == SELDETADCDB_A::_512_MS
999    }
1000    #[doc = "1024 ms"]
1001    #[inline(always)]
1002    pub fn is_1024_ms(&self) -> bool {
1003        *self == SELDETADCDB_A::_1024_MS
1004    }
1005}
1006#[doc = "Field `seldetadcdb` writer - Select debounce time when jack removal"]
1007pub type SELDETADCDB_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, SELDETADCDB_A>;
1008impl<'a, REG> SELDETADCDB_W<'a, REG>
1009where
1010    REG: crate::Writable + crate::RegisterSpec,
1011    REG::Ux: From<u8>,
1012{
1013    #[doc = "128 ms"]
1014    #[inline(always)]
1015    pub fn _128_ms(self) -> &'a mut crate::W<REG> {
1016        self.variant(SELDETADCDB_A::_128_MS)
1017    }
1018    #[doc = "256 ms"]
1019    #[inline(always)]
1020    pub fn _256_ms(self) -> &'a mut crate::W<REG> {
1021        self.variant(SELDETADCDB_A::_256_MS)
1022    }
1023    #[doc = "512 ms"]
1024    #[inline(always)]
1025    pub fn _512_ms(self) -> &'a mut crate::W<REG> {
1026        self.variant(SELDETADCDB_A::_512_MS)
1027    }
1028    #[doc = "1024 ms"]
1029    #[inline(always)]
1030    pub fn _1024_ms(self) -> &'a mut crate::W<REG> {
1031        self.variant(SELDETADCDB_A::_1024_MS)
1032    }
1033}
1034#[doc = "Field `seldetadcfs` reader - Select sample interval of the ADC sample\\\\ 2 ^ (SELDETADCFS + 1) ms"]
1035pub type SELDETADCFS_R = crate::FieldReader;
1036#[doc = "Field `seldetadcfs` writer - Select sample interval of the ADC sample\\\\ 2 ^ (SELDETADCFS + 1) ms"]
1037pub type SELDETADCFS_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
1038impl R {
1039    #[doc = "Bits 2:3 - MMIC BIAS Chopper Clock Select"]
1040    #[inline(always)]
1041    pub fn mmic_bias_chopper_clk_sel(&self) -> MMIC_BIAS_CHOPPER_CLK_SEL_R {
1042        MMIC_BIAS_CHOPPER_CLK_SEL_R::new(((self.bits >> 2) & 3) as u8)
1043    }
1044    #[doc = "Bit 4 - MMIC BIAS Chopper Enable"]
1045    #[inline(always)]
1046    pub fn mmic_bias_chopper_en(&self) -> MMIC_BIAS_CHOPPER_EN_R {
1047        MMIC_BIAS_CHOPPER_EN_R::new(((self.bits >> 4) & 1) != 0)
1048    }
1049    #[doc = "Bits 5:6 - MMICBIAS Voltage Level Select"]
1050    #[inline(always)]
1051    pub fn mbiassel(&self) -> MBIASSEL_R {
1052        MBIASSEL_R::new(((self.bits >> 5) & 3) as u8)
1053    }
1054    #[doc = "Bit 7 - Master Microphone Bias Enable"]
1055    #[inline(always)]
1056    pub fn mmicbiasen(&self) -> MMICBIASEN_R {
1057        MMICBIASEN_R::new(((self.bits >> 7) & 1) != 0)
1058    }
1059    #[doc = "Bits 10:11 - HMIC BIAS Chopper Clock Select"]
1060    #[inline(always)]
1061    pub fn hmic_bias_chopper_clk_sel(&self) -> HMIC_BIAS_CHOPPER_CLK_SEL_R {
1062        HMIC_BIAS_CHOPPER_CLK_SEL_R::new(((self.bits >> 10) & 3) as u8)
1063    }
1064    #[doc = "Bit 12 - HMIC BIAS Chopper Enable"]
1065    #[inline(always)]
1066    pub fn hmic_bias_chopper_en(&self) -> HMIC_BIAS_CHOPPER_EN_R {
1067        HMIC_BIAS_CHOPPER_EN_R::new(((self.bits >> 12) & 1) != 0)
1068    }
1069    #[doc = "Bits 13:14 - HMICBIAS Voltage Level Select"]
1070    #[inline(always)]
1071    pub fn hbiassel(&self) -> HBIASSEL_R {
1072        HBIASSEL_R::new(((self.bits >> 13) & 3) as u8)
1073    }
1074    #[doc = "Bit 15 - Headphone Microphone Bias Enable"]
1075    #[inline(always)]
1076    pub fn hmicbiasen(&self) -> HMICBIASEN_R {
1077        HMICBIASEN_R::new(((self.bits >> 15) & 1) != 0)
1078    }
1079    #[doc = "Bit 16 - When this bit is 1and AUTOPLEN is 0, the MICDET is pulled down to GND."]
1080    #[inline(always)]
1081    pub fn micdetpl(&self) -> MICDETPL_R {
1082        MICDETPL_R::new(((self.bits >> 16) & 1) != 0)
1083    }
1084    #[doc = "Bit 17 - Enable the function to auto pull low MICDET when jack removal"]
1085    #[inline(always)]
1086    pub fn autoplen(&self) -> AUTOPLEN_R {
1087        AUTOPLEN_R::new(((self.bits >> 17) & 1) != 0)
1088    }
1089    #[doc = "Bit 18 - MIC Detect Mode"]
1090    #[inline(always)]
1091    pub fn det_mode(&self) -> DET_MODE_R {
1092        DET_MODE_R::new(((self.bits >> 18) & 1) != 0)
1093    }
1094    #[doc = "Bit 19 - When this bit is 0, HBIAS MICADC is controlled by registor"]
1095    #[inline(always)]
1096    pub fn popfree(&self) -> POPFREE_R {
1097        POPFREE_R::new(((self.bits >> 19) & 1) != 0)
1098    }
1099    #[doc = "Bit 20 - Microphone detect ADC enable"]
1100    #[inline(always)]
1101    pub fn micadcen(&self) -> MICADCEN_R {
1102        MICADCEN_R::new(((self.bits >> 20) & 1) != 0)
1103    }
1104    #[doc = "Bits 21:22 - Select the delay time to pull low the micdet when jack removal"]
1105    #[inline(always)]
1106    pub fn seldetadcdy(&self) -> SELDETADCDY_R {
1107        SELDETADCDY_R::new(((self.bits >> 21) & 3) as u8)
1108    }
1109    #[doc = "Bit 23 - Jack detect enable"]
1110    #[inline(always)]
1111    pub fn jackdeten(&self) -> JACKDETEN_R {
1112        JACKDETEN_R::new(((self.bits >> 23) & 1) != 0)
1113    }
1114    #[doc = "Bits 24:25 - Select the time to enable HBIAS before MICADC work"]
1115    #[inline(always)]
1116    pub fn seldetadcbf(&self) -> SELDETADCBF_R {
1117        SELDETADCBF_R::new(((self.bits >> 24) & 3) as u8)
1118    }
1119    #[doc = "Bits 26:27 - Select debounce time when jack removal"]
1120    #[inline(always)]
1121    pub fn seldetadcdb(&self) -> SELDETADCDB_R {
1122        SELDETADCDB_R::new(((self.bits >> 26) & 3) as u8)
1123    }
1124    #[doc = "Bits 28:30 - Select sample interval of the ADC sample\\\\ 2 ^ (SELDETADCFS + 1) ms"]
1125    #[inline(always)]
1126    pub fn seldetadcfs(&self) -> SELDETADCFS_R {
1127        SELDETADCFS_R::new(((self.bits >> 28) & 7) as u8)
1128    }
1129}
1130impl W {
1131    #[doc = "Bits 2:3 - MMIC BIAS Chopper Clock Select"]
1132    #[inline(always)]
1133    #[must_use]
1134    pub fn mmic_bias_chopper_clk_sel(&mut self) -> MMIC_BIAS_CHOPPER_CLK_SEL_W<MICBIAS_SPEC> {
1135        MMIC_BIAS_CHOPPER_CLK_SEL_W::new(self, 2)
1136    }
1137    #[doc = "Bit 4 - MMIC BIAS Chopper Enable"]
1138    #[inline(always)]
1139    #[must_use]
1140    pub fn mmic_bias_chopper_en(&mut self) -> MMIC_BIAS_CHOPPER_EN_W<MICBIAS_SPEC> {
1141        MMIC_BIAS_CHOPPER_EN_W::new(self, 4)
1142    }
1143    #[doc = "Bits 5:6 - MMICBIAS Voltage Level Select"]
1144    #[inline(always)]
1145    #[must_use]
1146    pub fn mbiassel(&mut self) -> MBIASSEL_W<MICBIAS_SPEC> {
1147        MBIASSEL_W::new(self, 5)
1148    }
1149    #[doc = "Bit 7 - Master Microphone Bias Enable"]
1150    #[inline(always)]
1151    #[must_use]
1152    pub fn mmicbiasen(&mut self) -> MMICBIASEN_W<MICBIAS_SPEC> {
1153        MMICBIASEN_W::new(self, 7)
1154    }
1155    #[doc = "Bits 10:11 - HMIC BIAS Chopper Clock Select"]
1156    #[inline(always)]
1157    #[must_use]
1158    pub fn hmic_bias_chopper_clk_sel(&mut self) -> HMIC_BIAS_CHOPPER_CLK_SEL_W<MICBIAS_SPEC> {
1159        HMIC_BIAS_CHOPPER_CLK_SEL_W::new(self, 10)
1160    }
1161    #[doc = "Bit 12 - HMIC BIAS Chopper Enable"]
1162    #[inline(always)]
1163    #[must_use]
1164    pub fn hmic_bias_chopper_en(&mut self) -> HMIC_BIAS_CHOPPER_EN_W<MICBIAS_SPEC> {
1165        HMIC_BIAS_CHOPPER_EN_W::new(self, 12)
1166    }
1167    #[doc = "Bits 13:14 - HMICBIAS Voltage Level Select"]
1168    #[inline(always)]
1169    #[must_use]
1170    pub fn hbiassel(&mut self) -> HBIASSEL_W<MICBIAS_SPEC> {
1171        HBIASSEL_W::new(self, 13)
1172    }
1173    #[doc = "Bit 15 - Headphone Microphone Bias Enable"]
1174    #[inline(always)]
1175    #[must_use]
1176    pub fn hmicbiasen(&mut self) -> HMICBIASEN_W<MICBIAS_SPEC> {
1177        HMICBIASEN_W::new(self, 15)
1178    }
1179    #[doc = "Bit 16 - When this bit is 1and AUTOPLEN is 0, the MICDET is pulled down to GND."]
1180    #[inline(always)]
1181    #[must_use]
1182    pub fn micdetpl(&mut self) -> MICDETPL_W<MICBIAS_SPEC> {
1183        MICDETPL_W::new(self, 16)
1184    }
1185    #[doc = "Bit 17 - Enable the function to auto pull low MICDET when jack removal"]
1186    #[inline(always)]
1187    #[must_use]
1188    pub fn autoplen(&mut self) -> AUTOPLEN_W<MICBIAS_SPEC> {
1189        AUTOPLEN_W::new(self, 17)
1190    }
1191    #[doc = "Bit 18 - MIC Detect Mode"]
1192    #[inline(always)]
1193    #[must_use]
1194    pub fn det_mode(&mut self) -> DET_MODE_W<MICBIAS_SPEC> {
1195        DET_MODE_W::new(self, 18)
1196    }
1197    #[doc = "Bit 19 - When this bit is 0, HBIAS MICADC is controlled by registor"]
1198    #[inline(always)]
1199    #[must_use]
1200    pub fn popfree(&mut self) -> POPFREE_W<MICBIAS_SPEC> {
1201        POPFREE_W::new(self, 19)
1202    }
1203    #[doc = "Bit 20 - Microphone detect ADC enable"]
1204    #[inline(always)]
1205    #[must_use]
1206    pub fn micadcen(&mut self) -> MICADCEN_W<MICBIAS_SPEC> {
1207        MICADCEN_W::new(self, 20)
1208    }
1209    #[doc = "Bits 21:22 - Select the delay time to pull low the micdet when jack removal"]
1210    #[inline(always)]
1211    #[must_use]
1212    pub fn seldetadcdy(&mut self) -> SELDETADCDY_W<MICBIAS_SPEC> {
1213        SELDETADCDY_W::new(self, 21)
1214    }
1215    #[doc = "Bit 23 - Jack detect enable"]
1216    #[inline(always)]
1217    #[must_use]
1218    pub fn jackdeten(&mut self) -> JACKDETEN_W<MICBIAS_SPEC> {
1219        JACKDETEN_W::new(self, 23)
1220    }
1221    #[doc = "Bits 24:25 - Select the time to enable HBIAS before MICADC work"]
1222    #[inline(always)]
1223    #[must_use]
1224    pub fn seldetadcbf(&mut self) -> SELDETADCBF_W<MICBIAS_SPEC> {
1225        SELDETADCBF_W::new(self, 24)
1226    }
1227    #[doc = "Bits 26:27 - Select debounce time when jack removal"]
1228    #[inline(always)]
1229    #[must_use]
1230    pub fn seldetadcdb(&mut self) -> SELDETADCDB_W<MICBIAS_SPEC> {
1231        SELDETADCDB_W::new(self, 26)
1232    }
1233    #[doc = "Bits 28:30 - Select sample interval of the ADC sample\\\\ 2 ^ (SELDETADCFS + 1) ms"]
1234    #[inline(always)]
1235    #[must_use]
1236    pub fn seldetadcfs(&mut self) -> SELDETADCFS_W<MICBIAS_SPEC> {
1237        SELDETADCFS_W::new(self, 28)
1238    }
1239    #[doc = r" Writes raw bits to the register."]
1240    #[doc = r""]
1241    #[doc = r" # Safety"]
1242    #[doc = r""]
1243    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
1244    #[inline(always)]
1245    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1246        self.bits = bits;
1247        self
1248    }
1249}
1250#[doc = "MICBIAS Analog Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`micbias::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 [`micbias::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
1251pub struct MICBIAS_SPEC;
1252impl crate::RegisterSpec for MICBIAS_SPEC {
1253    type Ux = u32;
1254}
1255#[doc = "`read()` method returns [`micbias::R`](R) reader structure"]
1256impl crate::Readable for MICBIAS_SPEC {}
1257#[doc = "`write(|w| ..)` method takes [`micbias::W`](W) writer structure"]
1258impl crate::Writable for MICBIAS_SPEC {
1259    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1260    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1261}
1262#[doc = "`reset()` method sets micbias to value 0x4000_3030"]
1263impl crate::Resettable for MICBIAS_SPEC {
1264    const RESET_VALUE: Self::Ux = 0x4000_3030;
1265}