eos_s3/aud/
voice_config.rs

1#[doc = "Register `VOICE_CONFIG` reader"]
2pub struct R(crate::R<VOICE_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<VOICE_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<VOICE_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<VOICE_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `VOICE_CONFIG` writer"]
17pub struct W(crate::W<VOICE_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<VOICE_CONFIG_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<VOICE_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<VOICE_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Select the source for digital mic signal\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum DMIC_SEL_A {
40    #[doc = "0: DMIC source is PDM"]
41    PDM = 0,
42    #[doc = "1: DMIC source is I2S"]
43    I2S = 1,
44}
45impl From<DMIC_SEL_A> for bool {
46    #[inline(always)]
47    fn from(variant: DMIC_SEL_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `DMIC_SEL` reader - Select the source for digital mic signal"]
52pub struct DMIC_SEL_R(crate::FieldReader<bool, DMIC_SEL_A>);
53impl DMIC_SEL_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        DMIC_SEL_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> DMIC_SEL_A {
61        match self.bits {
62            false => DMIC_SEL_A::PDM,
63            true => DMIC_SEL_A::I2S,
64        }
65    }
66    #[doc = "Checks if the value of the field is `PDM`"]
67    #[inline(always)]
68    pub fn is_pdm(&self) -> bool {
69        **self == DMIC_SEL_A::PDM
70    }
71    #[doc = "Checks if the value of the field is `I2S`"]
72    #[inline(always)]
73    pub fn is_i2s(&self) -> bool {
74        **self == DMIC_SEL_A::I2S
75    }
76}
77impl core::ops::Deref for DMIC_SEL_R {
78    type Target = crate::FieldReader<bool, DMIC_SEL_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `DMIC_SEL` writer - Select the source for digital mic signal"]
85pub struct DMIC_SEL_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> DMIC_SEL_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: DMIC_SEL_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "DMIC source is PDM"]
95    #[inline(always)]
96    pub fn pdm(self) -> &'a mut W {
97        self.variant(DMIC_SEL_A::PDM)
98    }
99    #[doc = "DMIC source is I2S"]
100    #[inline(always)]
101    pub fn i2s(self) -> &'a mut W {
102        self.variant(DMIC_SEL_A::I2S)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118        self.w
119    }
120}
121#[doc = "Select between external or internal sensory LSPD\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum LPSD_SEL_A {
124    #[doc = "0: Use internal sensory LPSD"]
125    INTERNAL = 0,
126    #[doc = "1: Use external sensory LPSD"]
127    EXTERNAL = 1,
128}
129impl From<LPSD_SEL_A> for bool {
130    #[inline(always)]
131    fn from(variant: LPSD_SEL_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `LPSD_SEL` reader - Select between external or internal sensory LSPD"]
136pub struct LPSD_SEL_R(crate::FieldReader<bool, LPSD_SEL_A>);
137impl LPSD_SEL_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        LPSD_SEL_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> LPSD_SEL_A {
145        match self.bits {
146            false => LPSD_SEL_A::INTERNAL,
147            true => LPSD_SEL_A::EXTERNAL,
148        }
149    }
150    #[doc = "Checks if the value of the field is `INTERNAL`"]
151    #[inline(always)]
152    pub fn is_internal(&self) -> bool {
153        **self == LPSD_SEL_A::INTERNAL
154    }
155    #[doc = "Checks if the value of the field is `EXTERNAL`"]
156    #[inline(always)]
157    pub fn is_external(&self) -> bool {
158        **self == LPSD_SEL_A::EXTERNAL
159    }
160}
161impl core::ops::Deref for LPSD_SEL_R {
162    type Target = crate::FieldReader<bool, LPSD_SEL_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `LPSD_SEL` writer - Select between external or internal sensory LSPD"]
169pub struct LPSD_SEL_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> LPSD_SEL_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: LPSD_SEL_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "Use internal sensory LPSD"]
179    #[inline(always)]
180    pub fn internal(self) -> &'a mut W {
181        self.variant(LPSD_SEL_A::INTERNAL)
182    }
183    #[doc = "Use external sensory LPSD"]
184    #[inline(always)]
185    pub fn external(self) -> &'a mut W {
186        self.variant(LPSD_SEL_A::EXTERNAL)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits =
202            (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
203        self.w
204    }
205}
206#[doc = "Select either monoaural or stereo mode\n\nValue on reset: 0"]
207#[derive(Clone, Copy, Debug, PartialEq)]
208pub enum MODE_SEL_A {
209    #[doc = "0: Audio mode selected as Mono"]
210    MONO = 0,
211    #[doc = "1: Audio mode selected as Stereo"]
212    STEREO = 1,
213}
214impl From<MODE_SEL_A> for bool {
215    #[inline(always)]
216    fn from(variant: MODE_SEL_A) -> Self {
217        variant as u8 != 0
218    }
219}
220#[doc = "Field `MODE_SEL` reader - Select either monoaural or stereo mode"]
221pub struct MODE_SEL_R(crate::FieldReader<bool, MODE_SEL_A>);
222impl MODE_SEL_R {
223    #[inline(always)]
224    pub(crate) fn new(bits: bool) -> Self {
225        MODE_SEL_R(crate::FieldReader::new(bits))
226    }
227    #[doc = r"Get enumerated values variant"]
228    #[inline(always)]
229    pub fn variant(&self) -> MODE_SEL_A {
230        match self.bits {
231            false => MODE_SEL_A::MONO,
232            true => MODE_SEL_A::STEREO,
233        }
234    }
235    #[doc = "Checks if the value of the field is `MONO`"]
236    #[inline(always)]
237    pub fn is_mono(&self) -> bool {
238        **self == MODE_SEL_A::MONO
239    }
240    #[doc = "Checks if the value of the field is `STEREO`"]
241    #[inline(always)]
242    pub fn is_stereo(&self) -> bool {
243        **self == MODE_SEL_A::STEREO
244    }
245}
246impl core::ops::Deref for MODE_SEL_R {
247    type Target = crate::FieldReader<bool, MODE_SEL_A>;
248    #[inline(always)]
249    fn deref(&self) -> &Self::Target {
250        &self.0
251    }
252}
253#[doc = "Field `MODE_SEL` writer - Select either monoaural or stereo mode"]
254pub struct MODE_SEL_W<'a> {
255    w: &'a mut W,
256}
257impl<'a> MODE_SEL_W<'a> {
258    #[doc = r"Writes `variant` to the field"]
259    #[inline(always)]
260    pub fn variant(self, variant: MODE_SEL_A) -> &'a mut W {
261        self.bit(variant.into())
262    }
263    #[doc = "Audio mode selected as Mono"]
264    #[inline(always)]
265    pub fn mono(self) -> &'a mut W {
266        self.variant(MODE_SEL_A::MONO)
267    }
268    #[doc = "Audio mode selected as Stereo"]
269    #[inline(always)]
270    pub fn stereo(self) -> &'a mut W {
271        self.variant(MODE_SEL_A::STEREO)
272    }
273    #[doc = r"Sets the field bit"]
274    #[inline(always)]
275    pub fn set_bit(self) -> &'a mut W {
276        self.bit(true)
277    }
278    #[doc = r"Clears the field bit"]
279    #[inline(always)]
280    pub fn clear_bit(self) -> &'a mut W {
281        self.bit(false)
282    }
283    #[doc = r"Writes raw bits to the field"]
284    #[inline(always)]
285    pub fn bit(self, value: bool) -> &'a mut W {
286        self.w.bits =
287            (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
288        self.w
289    }
290}
291#[doc = "Select either right channel in mono mode or left channel\n\nValue on reset: 0"]
292#[derive(Clone, Copy, Debug, PartialEq)]
293pub enum MONO_CHN_SEL_A {
294    #[doc = "0: Left channel in mono mode"]
295    LEFT_CHANNEL = 0,
296    #[doc = "1: Right channel in mono mode"]
297    RIGHT_CHANNEL = 1,
298}
299impl From<MONO_CHN_SEL_A> for bool {
300    #[inline(always)]
301    fn from(variant: MONO_CHN_SEL_A) -> Self {
302        variant as u8 != 0
303    }
304}
305#[doc = "Field `MONO_CHN_SEL` reader - Select either right channel in mono mode or left channel"]
306pub struct MONO_CHN_SEL_R(crate::FieldReader<bool, MONO_CHN_SEL_A>);
307impl MONO_CHN_SEL_R {
308    #[inline(always)]
309    pub(crate) fn new(bits: bool) -> Self {
310        MONO_CHN_SEL_R(crate::FieldReader::new(bits))
311    }
312    #[doc = r"Get enumerated values variant"]
313    #[inline(always)]
314    pub fn variant(&self) -> MONO_CHN_SEL_A {
315        match self.bits {
316            false => MONO_CHN_SEL_A::LEFT_CHANNEL,
317            true => MONO_CHN_SEL_A::RIGHT_CHANNEL,
318        }
319    }
320    #[doc = "Checks if the value of the field is `LEFT_CHANNEL`"]
321    #[inline(always)]
322    pub fn is_left_channel(&self) -> bool {
323        **self == MONO_CHN_SEL_A::LEFT_CHANNEL
324    }
325    #[doc = "Checks if the value of the field is `RIGHT_CHANNEL`"]
326    #[inline(always)]
327    pub fn is_right_channel(&self) -> bool {
328        **self == MONO_CHN_SEL_A::RIGHT_CHANNEL
329    }
330}
331impl core::ops::Deref for MONO_CHN_SEL_R {
332    type Target = crate::FieldReader<bool, MONO_CHN_SEL_A>;
333    #[inline(always)]
334    fn deref(&self) -> &Self::Target {
335        &self.0
336    }
337}
338#[doc = "Field `MONO_CHN_SEL` writer - Select either right channel in mono mode or left channel"]
339pub struct MONO_CHN_SEL_W<'a> {
340    w: &'a mut W,
341}
342impl<'a> MONO_CHN_SEL_W<'a> {
343    #[doc = r"Writes `variant` to the field"]
344    #[inline(always)]
345    pub fn variant(self, variant: MONO_CHN_SEL_A) -> &'a mut W {
346        self.bit(variant.into())
347    }
348    #[doc = "Left channel in mono mode"]
349    #[inline(always)]
350    pub fn left_channel(self) -> &'a mut W {
351        self.variant(MONO_CHN_SEL_A::LEFT_CHANNEL)
352    }
353    #[doc = "Right channel in mono mode"]
354    #[inline(always)]
355    pub fn right_channel(self) -> &'a mut W {
356        self.variant(MONO_CHN_SEL_A::RIGHT_CHANNEL)
357    }
358    #[doc = r"Sets the field bit"]
359    #[inline(always)]
360    pub fn set_bit(self) -> &'a mut W {
361        self.bit(true)
362    }
363    #[doc = r"Clears the field bit"]
364    #[inline(always)]
365    pub fn clear_bit(self) -> &'a mut W {
366        self.bit(false)
367    }
368    #[doc = r"Writes raw bits to the field"]
369    #[inline(always)]
370    pub fn bit(self, value: bool) -> &'a mut W {
371        self.w.bits =
372            (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
373        self.w
374    }
375}
376#[doc = "Field `I2S_DS_EN` reader - Set to enable the I2S Deep Sleep mode"]
377pub struct I2S_DS_EN_R(crate::FieldReader<bool, bool>);
378impl I2S_DS_EN_R {
379    #[inline(always)]
380    pub(crate) fn new(bits: bool) -> Self {
381        I2S_DS_EN_R(crate::FieldReader::new(bits))
382    }
383}
384impl core::ops::Deref for I2S_DS_EN_R {
385    type Target = crate::FieldReader<bool, bool>;
386    #[inline(always)]
387    fn deref(&self) -> &Self::Target {
388        &self.0
389    }
390}
391#[doc = "Field `I2S_DS_EN` writer - Set to enable the I2S Deep Sleep mode"]
392pub struct I2S_DS_EN_W<'a> {
393    w: &'a mut W,
394}
395impl<'a> I2S_DS_EN_W<'a> {
396    #[doc = r"Sets the field bit"]
397    #[inline(always)]
398    pub fn set_bit(self) -> &'a mut W {
399        self.bit(true)
400    }
401    #[doc = r"Clears the field bit"]
402    #[inline(always)]
403    pub fn clear_bit(self) -> &'a mut W {
404        self.bit(false)
405    }
406    #[doc = r"Writes raw bits to the field"]
407    #[inline(always)]
408    pub fn bit(self, value: bool) -> &'a mut W {
409        self.w.bits =
410            (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
411        self.w
412    }
413}
414#[doc = "Choose the PDM voice scenario\n\nValue on reset: 0"]
415#[derive(Clone, Copy, Debug, PartialEq)]
416#[repr(u8)]
417pub enum PDM_VOICE_SCENARIO_A {
418    #[doc = "0: Choose voice scenario 1"]
419    SCENARIO1 = 0,
420    #[doc = "1: Choose voice scenario 2"]
421    SCENARIO2 = 1,
422    #[doc = "2: Choose voice scenario 3 mode 1"]
423    SCENARIO3_MODE1 = 2,
424    #[doc = "3: Choose voice scenario 3 mode 2"]
425    SCENARIO3_MODE2 = 3,
426    #[doc = "4: Choose voice scenario 3 mode 3"]
427    SCENARIO3_MODE3 = 4,
428}
429impl From<PDM_VOICE_SCENARIO_A> for u8 {
430    #[inline(always)]
431    fn from(variant: PDM_VOICE_SCENARIO_A) -> Self {
432        variant as _
433    }
434}
435#[doc = "Field `PDM_VOICE_SCENARIO` reader - Choose the PDM voice scenario"]
436pub struct PDM_VOICE_SCENARIO_R(crate::FieldReader<u8, PDM_VOICE_SCENARIO_A>);
437impl PDM_VOICE_SCENARIO_R {
438    #[inline(always)]
439    pub(crate) fn new(bits: u8) -> Self {
440        PDM_VOICE_SCENARIO_R(crate::FieldReader::new(bits))
441    }
442    #[doc = r"Get enumerated values variant"]
443    #[inline(always)]
444    pub fn variant(&self) -> Option<PDM_VOICE_SCENARIO_A> {
445        match self.bits {
446            0 => Some(PDM_VOICE_SCENARIO_A::SCENARIO1),
447            1 => Some(PDM_VOICE_SCENARIO_A::SCENARIO2),
448            2 => Some(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE1),
449            3 => Some(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE2),
450            4 => Some(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE3),
451            _ => None,
452        }
453    }
454    #[doc = "Checks if the value of the field is `SCENARIO1`"]
455    #[inline(always)]
456    pub fn is_scenario1(&self) -> bool {
457        **self == PDM_VOICE_SCENARIO_A::SCENARIO1
458    }
459    #[doc = "Checks if the value of the field is `SCENARIO2`"]
460    #[inline(always)]
461    pub fn is_scenario2(&self) -> bool {
462        **self == PDM_VOICE_SCENARIO_A::SCENARIO2
463    }
464    #[doc = "Checks if the value of the field is `SCENARIO3_MODE1`"]
465    #[inline(always)]
466    pub fn is_scenario3_mode1(&self) -> bool {
467        **self == PDM_VOICE_SCENARIO_A::SCENARIO3_MODE1
468    }
469    #[doc = "Checks if the value of the field is `SCENARIO3_MODE2`"]
470    #[inline(always)]
471    pub fn is_scenario3_mode2(&self) -> bool {
472        **self == PDM_VOICE_SCENARIO_A::SCENARIO3_MODE2
473    }
474    #[doc = "Checks if the value of the field is `SCENARIO3_MODE3`"]
475    #[inline(always)]
476    pub fn is_scenario3_mode3(&self) -> bool {
477        **self == PDM_VOICE_SCENARIO_A::SCENARIO3_MODE3
478    }
479}
480impl core::ops::Deref for PDM_VOICE_SCENARIO_R {
481    type Target = crate::FieldReader<u8, PDM_VOICE_SCENARIO_A>;
482    #[inline(always)]
483    fn deref(&self) -> &Self::Target {
484        &self.0
485    }
486}
487#[doc = "Field `PDM_VOICE_SCENARIO` writer - Choose the PDM voice scenario"]
488pub struct PDM_VOICE_SCENARIO_W<'a> {
489    w: &'a mut W,
490}
491impl<'a> PDM_VOICE_SCENARIO_W<'a> {
492    #[doc = r"Writes `variant` to the field"]
493    #[inline(always)]
494    pub fn variant(self, variant: PDM_VOICE_SCENARIO_A) -> &'a mut W {
495        unsafe { self.bits(variant.into()) }
496    }
497    #[doc = "Choose voice scenario 1"]
498    #[inline(always)]
499    pub fn scenario1(self) -> &'a mut W {
500        self.variant(PDM_VOICE_SCENARIO_A::SCENARIO1)
501    }
502    #[doc = "Choose voice scenario 2"]
503    #[inline(always)]
504    pub fn scenario2(self) -> &'a mut W {
505        self.variant(PDM_VOICE_SCENARIO_A::SCENARIO2)
506    }
507    #[doc = "Choose voice scenario 3 mode 1"]
508    #[inline(always)]
509    pub fn scenario3_mode1(self) -> &'a mut W {
510        self.variant(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE1)
511    }
512    #[doc = "Choose voice scenario 3 mode 2"]
513    #[inline(always)]
514    pub fn scenario3_mode2(self) -> &'a mut W {
515        self.variant(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE2)
516    }
517    #[doc = "Choose voice scenario 3 mode 3"]
518    #[inline(always)]
519    pub fn scenario3_mode3(self) -> &'a mut W {
520        self.variant(PDM_VOICE_SCENARIO_A::SCENARIO3_MODE3)
521    }
522    #[doc = r"Writes raw bits to the field"]
523    #[inline(always)]
524    pub unsafe fn bits(self, value: u8) -> &'a mut W {
525        self.w.bits =
526            (self.w.bits & !(0x07 << 5)) | ((value as u32 & 0x07) << 5);
527        self.w
528    }
529}
530#[doc = "Set to switch mic to AP\n\nValue on reset: 0"]
531#[derive(Clone, Copy, Debug, PartialEq)]
532pub enum PDM_MIC_SWITCH_TO_AP_A {
533    #[doc = "0: Don't switch to AP"]
534    NO_SWITCH = 0,
535    #[doc = "1: Switch to AP"]
536    SWITCH = 1,
537}
538impl From<PDM_MIC_SWITCH_TO_AP_A> for bool {
539    #[inline(always)]
540    fn from(variant: PDM_MIC_SWITCH_TO_AP_A) -> Self {
541        variant as u8 != 0
542    }
543}
544#[doc = "Field `PDM_MIC_SWITCH_TO_AP` reader - Set to switch mic to AP"]
545pub struct PDM_MIC_SWITCH_TO_AP_R(
546    crate::FieldReader<bool, PDM_MIC_SWITCH_TO_AP_A>,
547);
548impl PDM_MIC_SWITCH_TO_AP_R {
549    #[inline(always)]
550    pub(crate) fn new(bits: bool) -> Self {
551        PDM_MIC_SWITCH_TO_AP_R(crate::FieldReader::new(bits))
552    }
553    #[doc = r"Get enumerated values variant"]
554    #[inline(always)]
555    pub fn variant(&self) -> PDM_MIC_SWITCH_TO_AP_A {
556        match self.bits {
557            false => PDM_MIC_SWITCH_TO_AP_A::NO_SWITCH,
558            true => PDM_MIC_SWITCH_TO_AP_A::SWITCH,
559        }
560    }
561    #[doc = "Checks if the value of the field is `NO_SWITCH`"]
562    #[inline(always)]
563    pub fn is_no_switch(&self) -> bool {
564        **self == PDM_MIC_SWITCH_TO_AP_A::NO_SWITCH
565    }
566    #[doc = "Checks if the value of the field is `SWITCH`"]
567    #[inline(always)]
568    pub fn is_switch(&self) -> bool {
569        **self == PDM_MIC_SWITCH_TO_AP_A::SWITCH
570    }
571}
572impl core::ops::Deref for PDM_MIC_SWITCH_TO_AP_R {
573    type Target = crate::FieldReader<bool, PDM_MIC_SWITCH_TO_AP_A>;
574    #[inline(always)]
575    fn deref(&self) -> &Self::Target {
576        &self.0
577    }
578}
579#[doc = "Field `PDM_MIC_SWITCH_TO_AP` writer - Set to switch mic to AP"]
580pub struct PDM_MIC_SWITCH_TO_AP_W<'a> {
581    w: &'a mut W,
582}
583impl<'a> PDM_MIC_SWITCH_TO_AP_W<'a> {
584    #[doc = r"Writes `variant` to the field"]
585    #[inline(always)]
586    pub fn variant(self, variant: PDM_MIC_SWITCH_TO_AP_A) -> &'a mut W {
587        self.bit(variant.into())
588    }
589    #[doc = "Don't switch to AP"]
590    #[inline(always)]
591    pub fn no_switch(self) -> &'a mut W {
592        self.variant(PDM_MIC_SWITCH_TO_AP_A::NO_SWITCH)
593    }
594    #[doc = "Switch to AP"]
595    #[inline(always)]
596    pub fn switch(self) -> &'a mut W {
597        self.variant(PDM_MIC_SWITCH_TO_AP_A::SWITCH)
598    }
599    #[doc = r"Sets the field bit"]
600    #[inline(always)]
601    pub fn set_bit(self) -> &'a mut W {
602        self.bit(true)
603    }
604    #[doc = r"Clears the field bit"]
605    #[inline(always)]
606    pub fn clear_bit(self) -> &'a mut W {
607        self.bit(false)
608    }
609    #[doc = r"Writes raw bits to the field"]
610    #[inline(always)]
611    pub fn bit(self, value: bool) -> &'a mut W {
612        self.w.bits =
613            (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
614        self.w
615    }
616}
617#[doc = "Field `LPSD_USE_DC_BLOCK` reader - Set to use LPSD DC Block"]
618pub struct LPSD_USE_DC_BLOCK_R(crate::FieldReader<bool, bool>);
619impl LPSD_USE_DC_BLOCK_R {
620    #[inline(always)]
621    pub(crate) fn new(bits: bool) -> Self {
622        LPSD_USE_DC_BLOCK_R(crate::FieldReader::new(bits))
623    }
624}
625impl core::ops::Deref for LPSD_USE_DC_BLOCK_R {
626    type Target = crate::FieldReader<bool, bool>;
627    #[inline(always)]
628    fn deref(&self) -> &Self::Target {
629        &self.0
630    }
631}
632#[doc = "Field `LPSD_USE_DC_BLOCK` writer - Set to use LPSD DC Block"]
633pub struct LPSD_USE_DC_BLOCK_W<'a> {
634    w: &'a mut W,
635}
636impl<'a> LPSD_USE_DC_BLOCK_W<'a> {
637    #[doc = r"Sets the field bit"]
638    #[inline(always)]
639    pub fn set_bit(self) -> &'a mut W {
640        self.bit(true)
641    }
642    #[doc = r"Clears the field bit"]
643    #[inline(always)]
644    pub fn clear_bit(self) -> &'a mut W {
645        self.bit(false)
646    }
647    #[doc = r"Writes raw bits to the field"]
648    #[inline(always)]
649    pub fn bit(self, value: bool) -> &'a mut W {
650        self.w.bits =
651            (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
652        self.w
653    }
654}
655#[doc = "Choose the channel pcm data for LPSD in stereo mode\n\nValue on reset: 0"]
656#[derive(Clone, Copy, Debug, PartialEq)]
657pub enum LPSD_MUX_A {
658    #[doc = "0: Left channel pcm data to LPSD in stereo mode"]
659    LEFT_CHANNEL = 0,
660    #[doc = "1: Right channel pcm data to LPSD in stereo mode"]
661    RIGHT_CHANNEL = 1,
662}
663impl From<LPSD_MUX_A> for bool {
664    #[inline(always)]
665    fn from(variant: LPSD_MUX_A) -> Self {
666        variant as u8 != 0
667    }
668}
669#[doc = "Field `LPSD_MUX` reader - Choose the channel pcm data for LPSD in stereo mode"]
670pub struct LPSD_MUX_R(crate::FieldReader<bool, LPSD_MUX_A>);
671impl LPSD_MUX_R {
672    #[inline(always)]
673    pub(crate) fn new(bits: bool) -> Self {
674        LPSD_MUX_R(crate::FieldReader::new(bits))
675    }
676    #[doc = r"Get enumerated values variant"]
677    #[inline(always)]
678    pub fn variant(&self) -> LPSD_MUX_A {
679        match self.bits {
680            false => LPSD_MUX_A::LEFT_CHANNEL,
681            true => LPSD_MUX_A::RIGHT_CHANNEL,
682        }
683    }
684    #[doc = "Checks if the value of the field is `LEFT_CHANNEL`"]
685    #[inline(always)]
686    pub fn is_left_channel(&self) -> bool {
687        **self == LPSD_MUX_A::LEFT_CHANNEL
688    }
689    #[doc = "Checks if the value of the field is `RIGHT_CHANNEL`"]
690    #[inline(always)]
691    pub fn is_right_channel(&self) -> bool {
692        **self == LPSD_MUX_A::RIGHT_CHANNEL
693    }
694}
695impl core::ops::Deref for LPSD_MUX_R {
696    type Target = crate::FieldReader<bool, LPSD_MUX_A>;
697    #[inline(always)]
698    fn deref(&self) -> &Self::Target {
699        &self.0
700    }
701}
702#[doc = "Field `LPSD_MUX` writer - Choose the channel pcm data for LPSD in stereo mode"]
703pub struct LPSD_MUX_W<'a> {
704    w: &'a mut W,
705}
706impl<'a> LPSD_MUX_W<'a> {
707    #[doc = r"Writes `variant` to the field"]
708    #[inline(always)]
709    pub fn variant(self, variant: LPSD_MUX_A) -> &'a mut W {
710        self.bit(variant.into())
711    }
712    #[doc = "Left channel pcm data to LPSD in stereo mode"]
713    #[inline(always)]
714    pub fn left_channel(self) -> &'a mut W {
715        self.variant(LPSD_MUX_A::LEFT_CHANNEL)
716    }
717    #[doc = "Right channel pcm data to LPSD in stereo mode"]
718    #[inline(always)]
719    pub fn right_channel(self) -> &'a mut W {
720        self.variant(LPSD_MUX_A::RIGHT_CHANNEL)
721    }
722    #[doc = r"Sets the field bit"]
723    #[inline(always)]
724    pub fn set_bit(self) -> &'a mut W {
725        self.bit(true)
726    }
727    #[doc = r"Clears the field bit"]
728    #[inline(always)]
729    pub fn clear_bit(self) -> &'a mut W {
730        self.bit(false)
731    }
732    #[doc = r"Writes raw bits to the field"]
733    #[inline(always)]
734    pub fn bit(self, value: bool) -> &'a mut W {
735        self.w.bits =
736            (self.w.bits & !(0x01 << 10)) | ((value as u32 & 0x01) << 10);
737        self.w
738    }
739}
740#[doc = "Set to disable HW LPSD\n\nValue on reset: 0"]
741#[derive(Clone, Copy, Debug, PartialEq)]
742pub enum LPSD_NO_A {
743    #[doc = "0: Enable hardware LPSD"]
744    ENABLE_HW = 0,
745    #[doc = "1: Disable HW LPSD"]
746    DISABLE_HW = 1,
747}
748impl From<LPSD_NO_A> for bool {
749    #[inline(always)]
750    fn from(variant: LPSD_NO_A) -> Self {
751        variant as u8 != 0
752    }
753}
754#[doc = "Field `LPSD_NO` reader - Set to disable HW LPSD"]
755pub struct LPSD_NO_R(crate::FieldReader<bool, LPSD_NO_A>);
756impl LPSD_NO_R {
757    #[inline(always)]
758    pub(crate) fn new(bits: bool) -> Self {
759        LPSD_NO_R(crate::FieldReader::new(bits))
760    }
761    #[doc = r"Get enumerated values variant"]
762    #[inline(always)]
763    pub fn variant(&self) -> LPSD_NO_A {
764        match self.bits {
765            false => LPSD_NO_A::ENABLE_HW,
766            true => LPSD_NO_A::DISABLE_HW,
767        }
768    }
769    #[doc = "Checks if the value of the field is `ENABLE_HW`"]
770    #[inline(always)]
771    pub fn is_enable_hw(&self) -> bool {
772        **self == LPSD_NO_A::ENABLE_HW
773    }
774    #[doc = "Checks if the value of the field is `DISABLE_HW`"]
775    #[inline(always)]
776    pub fn is_disable_hw(&self) -> bool {
777        **self == LPSD_NO_A::DISABLE_HW
778    }
779}
780impl core::ops::Deref for LPSD_NO_R {
781    type Target = crate::FieldReader<bool, LPSD_NO_A>;
782    #[inline(always)]
783    fn deref(&self) -> &Self::Target {
784        &self.0
785    }
786}
787#[doc = "Field `LPSD_NO` writer - Set to disable HW LPSD"]
788pub struct LPSD_NO_W<'a> {
789    w: &'a mut W,
790}
791impl<'a> LPSD_NO_W<'a> {
792    #[doc = r"Writes `variant` to the field"]
793    #[inline(always)]
794    pub fn variant(self, variant: LPSD_NO_A) -> &'a mut W {
795        self.bit(variant.into())
796    }
797    #[doc = "Enable hardware LPSD"]
798    #[inline(always)]
799    pub fn enable_hw(self) -> &'a mut W {
800        self.variant(LPSD_NO_A::ENABLE_HW)
801    }
802    #[doc = "Disable HW LPSD"]
803    #[inline(always)]
804    pub fn disable_hw(self) -> &'a mut W {
805        self.variant(LPSD_NO_A::DISABLE_HW)
806    }
807    #[doc = r"Sets the field bit"]
808    #[inline(always)]
809    pub fn set_bit(self) -> &'a mut W {
810        self.bit(true)
811    }
812    #[doc = r"Clears the field bit"]
813    #[inline(always)]
814    pub fn clear_bit(self) -> &'a mut W {
815        self.bit(false)
816    }
817    #[doc = r"Writes raw bits to the field"]
818    #[inline(always)]
819    pub fn bit(self, value: bool) -> &'a mut W {
820        self.w.bits =
821            (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
822        self.w
823    }
824}
825#[doc = "Field `I2S_FPGA_EN` reader - Set to enable the FPGA I2S"]
826pub struct I2S_FPGA_EN_R(crate::FieldReader<bool, bool>);
827impl I2S_FPGA_EN_R {
828    #[inline(always)]
829    pub(crate) fn new(bits: bool) -> Self {
830        I2S_FPGA_EN_R(crate::FieldReader::new(bits))
831    }
832}
833impl core::ops::Deref for I2S_FPGA_EN_R {
834    type Target = crate::FieldReader<bool, bool>;
835    #[inline(always)]
836    fn deref(&self) -> &Self::Target {
837        &self.0
838    }
839}
840#[doc = "Field `I2S_FPGA_EN` writer - Set to enable the FPGA I2S"]
841pub struct I2S_FPGA_EN_W<'a> {
842    w: &'a mut W,
843}
844impl<'a> I2S_FPGA_EN_W<'a> {
845    #[doc = r"Sets the field bit"]
846    #[inline(always)]
847    pub fn set_bit(self) -> &'a mut W {
848        self.bit(true)
849    }
850    #[doc = r"Clears the field bit"]
851    #[inline(always)]
852    pub fn clear_bit(self) -> &'a mut W {
853        self.bit(false)
854    }
855    #[doc = r"Writes raw bits to the field"]
856    #[inline(always)]
857    pub fn bit(self, value: bool) -> &'a mut W {
858        self.w.bits =
859            (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
860        self.w
861    }
862}
863#[doc = "Field `DIV_AP` reader - AP_PDM_CKO_IN frequency divide-down ratio for AP clock detection"]
864pub struct DIV_AP_R(crate::FieldReader<u8, u8>);
865impl DIV_AP_R {
866    #[inline(always)]
867    pub(crate) fn new(bits: u8) -> Self {
868        DIV_AP_R(crate::FieldReader::new(bits))
869    }
870}
871impl core::ops::Deref for DIV_AP_R {
872    type Target = crate::FieldReader<u8, u8>;
873    #[inline(always)]
874    fn deref(&self) -> &Self::Target {
875        &self.0
876    }
877}
878#[doc = "Field `DIV_AP` writer - AP_PDM_CKO_IN frequency divide-down ratio for AP clock detection"]
879pub struct DIV_AP_W<'a> {
880    w: &'a mut W,
881}
882impl<'a> DIV_AP_W<'a> {
883    #[doc = r"Writes raw bits to the field"]
884    #[inline(always)]
885    pub unsafe fn bits(self, value: u8) -> &'a mut W {
886        self.w.bits =
887            (self.w.bits & !(0x07 << 15)) | ((value as u32 & 0x07) << 15);
888        self.w
889    }
890}
891#[doc = "Field `DIV_WD` reader - AP_PDM_CKO_IN clock detection window range"]
892pub struct DIV_WD_R(crate::FieldReader<u8, u8>);
893impl DIV_WD_R {
894    #[inline(always)]
895    pub(crate) fn new(bits: u8) -> Self {
896        DIV_WD_R(crate::FieldReader::new(bits))
897    }
898}
899impl core::ops::Deref for DIV_WD_R {
900    type Target = crate::FieldReader<u8, u8>;
901    #[inline(always)]
902    fn deref(&self) -> &Self::Target {
903        &self.0
904    }
905}
906#[doc = "Field `DIV_WD` writer - AP_PDM_CKO_IN clock detection window range"]
907pub struct DIV_WD_W<'a> {
908    w: &'a mut W,
909}
910impl<'a> DIV_WD_W<'a> {
911    #[doc = r"Writes raw bits to the field"]
912    #[inline(always)]
913    pub unsafe fn bits(self, value: u8) -> &'a mut W {
914        self.w.bits =
915            (self.w.bits & !(0x3f << 18)) | ((value as u32 & 0x3f) << 18);
916        self.w
917    }
918}
919#[doc = "Field `FIFO_0_CLEAR` reader - Set to flush FIFO"]
920pub struct FIFO_0_CLEAR_R(crate::FieldReader<bool, bool>);
921impl FIFO_0_CLEAR_R {
922    #[inline(always)]
923    pub(crate) fn new(bits: bool) -> Self {
924        FIFO_0_CLEAR_R(crate::FieldReader::new(bits))
925    }
926}
927impl core::ops::Deref for FIFO_0_CLEAR_R {
928    type Target = crate::FieldReader<bool, bool>;
929    #[inline(always)]
930    fn deref(&self) -> &Self::Target {
931        &self.0
932    }
933}
934#[doc = "Field `FIFO_0_CLEAR` writer - Set to flush FIFO"]
935pub struct FIFO_0_CLEAR_W<'a> {
936    w: &'a mut W,
937}
938impl<'a> FIFO_0_CLEAR_W<'a> {
939    #[doc = r"Sets the field bit"]
940    #[inline(always)]
941    pub fn set_bit(self) -> &'a mut W {
942        self.bit(true)
943    }
944    #[doc = r"Clears the field bit"]
945    #[inline(always)]
946    pub fn clear_bit(self) -> &'a mut W {
947        self.bit(false)
948    }
949    #[doc = r"Writes raw bits to the field"]
950    #[inline(always)]
951    pub fn bit(self, value: bool) -> &'a mut W {
952        self.w.bits =
953            (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
954        self.w
955    }
956}
957#[doc = "Field `FIFO_1_CLEAR` reader - Set to Flush FIFO"]
958pub struct FIFO_1_CLEAR_R(crate::FieldReader<bool, bool>);
959impl FIFO_1_CLEAR_R {
960    #[inline(always)]
961    pub(crate) fn new(bits: bool) -> Self {
962        FIFO_1_CLEAR_R(crate::FieldReader::new(bits))
963    }
964}
965impl core::ops::Deref for FIFO_1_CLEAR_R {
966    type Target = crate::FieldReader<bool, bool>;
967    #[inline(always)]
968    fn deref(&self) -> &Self::Target {
969        &self.0
970    }
971}
972#[doc = "Field `FIFO_1_CLEAR` writer - Set to Flush FIFO"]
973pub struct FIFO_1_CLEAR_W<'a> {
974    w: &'a mut W,
975}
976impl<'a> FIFO_1_CLEAR_W<'a> {
977    #[doc = r"Sets the field bit"]
978    #[inline(always)]
979    pub fn set_bit(self) -> &'a mut W {
980        self.bit(true)
981    }
982    #[doc = r"Clears the field bit"]
983    #[inline(always)]
984    pub fn clear_bit(self) -> &'a mut W {
985        self.bit(false)
986    }
987    #[doc = r"Writes raw bits to the field"]
988    #[inline(always)]
989    pub fn bit(self, value: bool) -> &'a mut W {
990        self.w.bits =
991            (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
992        self.w
993    }
994}
995#[doc = "Control the masking of the interrupt\n\nValue on reset: 0"]
996#[derive(Clone, Copy, Debug, PartialEq)]
997pub enum LPSD_VOICE_DETECTED_MASK_A {
998    #[doc = "0: Unmask the interrupt"]
999    UNMASK = 0,
1000    #[doc = "1: Mask the interrupt"]
1001    MASK = 1,
1002}
1003impl From<LPSD_VOICE_DETECTED_MASK_A> for bool {
1004    #[inline(always)]
1005    fn from(variant: LPSD_VOICE_DETECTED_MASK_A) -> Self {
1006        variant as u8 != 0
1007    }
1008}
1009#[doc = "Field `LPSD_VOICE_DETECTED_MASK` reader - Control the masking of the interrupt"]
1010pub struct LPSD_VOICE_DETECTED_MASK_R(
1011    crate::FieldReader<bool, LPSD_VOICE_DETECTED_MASK_A>,
1012);
1013impl LPSD_VOICE_DETECTED_MASK_R {
1014    #[inline(always)]
1015    pub(crate) fn new(bits: bool) -> Self {
1016        LPSD_VOICE_DETECTED_MASK_R(crate::FieldReader::new(bits))
1017    }
1018    #[doc = r"Get enumerated values variant"]
1019    #[inline(always)]
1020    pub fn variant(&self) -> LPSD_VOICE_DETECTED_MASK_A {
1021        match self.bits {
1022            false => LPSD_VOICE_DETECTED_MASK_A::UNMASK,
1023            true => LPSD_VOICE_DETECTED_MASK_A::MASK,
1024        }
1025    }
1026    #[doc = "Checks if the value of the field is `UNMASK`"]
1027    #[inline(always)]
1028    pub fn is_unmask(&self) -> bool {
1029        **self == LPSD_VOICE_DETECTED_MASK_A::UNMASK
1030    }
1031    #[doc = "Checks if the value of the field is `MASK`"]
1032    #[inline(always)]
1033    pub fn is_mask(&self) -> bool {
1034        **self == LPSD_VOICE_DETECTED_MASK_A::MASK
1035    }
1036}
1037impl core::ops::Deref for LPSD_VOICE_DETECTED_MASK_R {
1038    type Target = crate::FieldReader<bool, LPSD_VOICE_DETECTED_MASK_A>;
1039    #[inline(always)]
1040    fn deref(&self) -> &Self::Target {
1041        &self.0
1042    }
1043}
1044#[doc = "Field `LPSD_VOICE_DETECTED_MASK` writer - Control the masking of the interrupt"]
1045pub struct LPSD_VOICE_DETECTED_MASK_W<'a> {
1046    w: &'a mut W,
1047}
1048impl<'a> LPSD_VOICE_DETECTED_MASK_W<'a> {
1049    #[doc = r"Writes `variant` to the field"]
1050    #[inline(always)]
1051    pub fn variant(self, variant: LPSD_VOICE_DETECTED_MASK_A) -> &'a mut W {
1052        self.bit(variant.into())
1053    }
1054    #[doc = "Unmask the interrupt"]
1055    #[inline(always)]
1056    pub fn unmask(self) -> &'a mut W {
1057        self.variant(LPSD_VOICE_DETECTED_MASK_A::UNMASK)
1058    }
1059    #[doc = "Mask the interrupt"]
1060    #[inline(always)]
1061    pub fn mask(self) -> &'a mut W {
1062        self.variant(LPSD_VOICE_DETECTED_MASK_A::MASK)
1063    }
1064    #[doc = r"Sets the field bit"]
1065    #[inline(always)]
1066    pub fn set_bit(self) -> &'a mut W {
1067        self.bit(true)
1068    }
1069    #[doc = r"Clears the field bit"]
1070    #[inline(always)]
1071    pub fn clear_bit(self) -> &'a mut W {
1072        self.bit(false)
1073    }
1074    #[doc = r"Writes raw bits to the field"]
1075    #[inline(always)]
1076    pub fn bit(self, value: bool) -> &'a mut W {
1077        self.w.bits =
1078            (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
1079        self.w
1080    }
1081}
1082#[doc = "Control the masking of the interrupt"]
1083pub type DMIC_VOICE_DETECTED_MASK_A = LPSD_VOICE_DETECTED_MASK_A;
1084#[doc = "Field `DMIC_VOICE_DETECTED_MASK` reader - Control the masking of the interrupt"]
1085pub type DMIC_VOICE_DETECTED_MASK_R = LPSD_VOICE_DETECTED_MASK_R;
1086#[doc = "Field `DMIC_VOICE_DETECTED_MASK` writer - Control the masking of the interrupt"]
1087pub struct DMIC_VOICE_DETECTED_MASK_W<'a> {
1088    w: &'a mut W,
1089}
1090impl<'a> DMIC_VOICE_DETECTED_MASK_W<'a> {
1091    #[doc = r"Writes `variant` to the field"]
1092    #[inline(always)]
1093    pub fn variant(self, variant: DMIC_VOICE_DETECTED_MASK_A) -> &'a mut W {
1094        self.bit(variant.into())
1095    }
1096    #[doc = "Unmask the interrupt"]
1097    #[inline(always)]
1098    pub fn unmask(self) -> &'a mut W {
1099        self.variant(DMIC_VOICE_DETECTED_MASK_A::UNMASK)
1100    }
1101    #[doc = "Mask the interrupt"]
1102    #[inline(always)]
1103    pub fn mask(self) -> &'a mut W {
1104        self.variant(DMIC_VOICE_DETECTED_MASK_A::MASK)
1105    }
1106    #[doc = r"Sets the field bit"]
1107    #[inline(always)]
1108    pub fn set_bit(self) -> &'a mut W {
1109        self.bit(true)
1110    }
1111    #[doc = r"Clears the field bit"]
1112    #[inline(always)]
1113    pub fn clear_bit(self) -> &'a mut W {
1114        self.bit(false)
1115    }
1116    #[doc = r"Writes raw bits to the field"]
1117    #[inline(always)]
1118    pub fn bit(self, value: bool) -> &'a mut W {
1119        self.w.bits =
1120            (self.w.bits & !(0x01 << 27)) | ((value as u32 & 0x01) << 27);
1121        self.w
1122    }
1123}
1124#[doc = "Control the masking of the interrupt"]
1125pub type DMAC_BLK_DONE_MASK_A = LPSD_VOICE_DETECTED_MASK_A;
1126#[doc = "Field `DMAC_BLK_DONE_MASK` reader - Control the masking of the interrupt"]
1127pub type DMAC_BLK_DONE_MASK_R = LPSD_VOICE_DETECTED_MASK_R;
1128#[doc = "Field `DMAC_BLK_DONE_MASK` writer - Control the masking of the interrupt"]
1129pub struct DMAC_BLK_DONE_MASK_W<'a> {
1130    w: &'a mut W,
1131}
1132impl<'a> DMAC_BLK_DONE_MASK_W<'a> {
1133    #[doc = r"Writes `variant` to the field"]
1134    #[inline(always)]
1135    pub fn variant(self, variant: DMAC_BLK_DONE_MASK_A) -> &'a mut W {
1136        self.bit(variant.into())
1137    }
1138    #[doc = "Unmask the interrupt"]
1139    #[inline(always)]
1140    pub fn unmask(self) -> &'a mut W {
1141        self.variant(DMAC_BLK_DONE_MASK_A::UNMASK)
1142    }
1143    #[doc = "Mask the interrupt"]
1144    #[inline(always)]
1145    pub fn mask(self) -> &'a mut W {
1146        self.variant(DMAC_BLK_DONE_MASK_A::MASK)
1147    }
1148    #[doc = r"Sets the field bit"]
1149    #[inline(always)]
1150    pub fn set_bit(self) -> &'a mut W {
1151        self.bit(true)
1152    }
1153    #[doc = r"Clears the field bit"]
1154    #[inline(always)]
1155    pub fn clear_bit(self) -> &'a mut W {
1156        self.bit(false)
1157    }
1158    #[doc = r"Writes raw bits to the field"]
1159    #[inline(always)]
1160    pub fn bit(self, value: bool) -> &'a mut W {
1161        self.w.bits =
1162            (self.w.bits & !(0x01 << 28)) | ((value as u32 & 0x01) << 28);
1163        self.w
1164    }
1165}
1166#[doc = "Control the masking of the interrupt"]
1167pub type DMAC_BUF_DONE_MASK_A = LPSD_VOICE_DETECTED_MASK_A;
1168#[doc = "Field `DMAC_BUF_DONE_MASK` reader - Control the masking of the interrupt"]
1169pub type DMAC_BUF_DONE_MASK_R = LPSD_VOICE_DETECTED_MASK_R;
1170#[doc = "Field `DMAC_BUF_DONE_MASK` writer - Control the masking of the interrupt"]
1171pub struct DMAC_BUF_DONE_MASK_W<'a> {
1172    w: &'a mut W,
1173}
1174impl<'a> DMAC_BUF_DONE_MASK_W<'a> {
1175    #[doc = r"Writes `variant` to the field"]
1176    #[inline(always)]
1177    pub fn variant(self, variant: DMAC_BUF_DONE_MASK_A) -> &'a mut W {
1178        self.bit(variant.into())
1179    }
1180    #[doc = "Unmask the interrupt"]
1181    #[inline(always)]
1182    pub fn unmask(self) -> &'a mut W {
1183        self.variant(DMAC_BUF_DONE_MASK_A::UNMASK)
1184    }
1185    #[doc = "Mask the interrupt"]
1186    #[inline(always)]
1187    pub fn mask(self) -> &'a mut W {
1188        self.variant(DMAC_BUF_DONE_MASK_A::MASK)
1189    }
1190    #[doc = r"Sets the field bit"]
1191    #[inline(always)]
1192    pub fn set_bit(self) -> &'a mut W {
1193        self.bit(true)
1194    }
1195    #[doc = r"Clears the field bit"]
1196    #[inline(always)]
1197    pub fn clear_bit(self) -> &'a mut W {
1198        self.bit(false)
1199    }
1200    #[doc = r"Writes raw bits to the field"]
1201    #[inline(always)]
1202    pub fn bit(self, value: bool) -> &'a mut W {
1203        self.w.bits =
1204            (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
1205        self.w
1206    }
1207}
1208#[doc = "Control the masking of the interrupt"]
1209pub type AP_PDM_CLK_IB_MASK_A = LPSD_VOICE_DETECTED_MASK_A;
1210#[doc = "Field `AP_PDM_CLK_IB_MASK` reader - Control the masking of the interrupt"]
1211pub type AP_PDM_CLK_IB_MASK_R = LPSD_VOICE_DETECTED_MASK_R;
1212#[doc = "Field `AP_PDM_CLK_IB_MASK` writer - Control the masking of the interrupt"]
1213pub struct AP_PDM_CLK_IB_MASK_W<'a> {
1214    w: &'a mut W,
1215}
1216impl<'a> AP_PDM_CLK_IB_MASK_W<'a> {
1217    #[doc = r"Writes `variant` to the field"]
1218    #[inline(always)]
1219    pub fn variant(self, variant: AP_PDM_CLK_IB_MASK_A) -> &'a mut W {
1220        self.bit(variant.into())
1221    }
1222    #[doc = "Unmask the interrupt"]
1223    #[inline(always)]
1224    pub fn unmask(self) -> &'a mut W {
1225        self.variant(AP_PDM_CLK_IB_MASK_A::UNMASK)
1226    }
1227    #[doc = "Mask the interrupt"]
1228    #[inline(always)]
1229    pub fn mask(self) -> &'a mut W {
1230        self.variant(AP_PDM_CLK_IB_MASK_A::MASK)
1231    }
1232    #[doc = r"Sets the field bit"]
1233    #[inline(always)]
1234    pub fn set_bit(self) -> &'a mut W {
1235        self.bit(true)
1236    }
1237    #[doc = r"Clears the field bit"]
1238    #[inline(always)]
1239    pub fn clear_bit(self) -> &'a mut W {
1240        self.bit(false)
1241    }
1242    #[doc = r"Writes raw bits to the field"]
1243    #[inline(always)]
1244    pub fn bit(self, value: bool) -> &'a mut W {
1245        self.w.bits =
1246            (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
1247        self.w
1248    }
1249}
1250#[doc = "Control the masking of the interrupt"]
1251pub type AP_PDM_CLK_OFF_MASK_A = LPSD_VOICE_DETECTED_MASK_A;
1252#[doc = "Field `AP_PDM_CLK_OFF_MASK` reader - Control the masking of the interrupt"]
1253pub type AP_PDM_CLK_OFF_MASK_R = LPSD_VOICE_DETECTED_MASK_R;
1254#[doc = "Field `AP_PDM_CLK_OFF_MASK` writer - Control the masking of the interrupt"]
1255pub struct AP_PDM_CLK_OFF_MASK_W<'a> {
1256    w: &'a mut W,
1257}
1258impl<'a> AP_PDM_CLK_OFF_MASK_W<'a> {
1259    #[doc = r"Writes `variant` to the field"]
1260    #[inline(always)]
1261    pub fn variant(self, variant: AP_PDM_CLK_OFF_MASK_A) -> &'a mut W {
1262        self.bit(variant.into())
1263    }
1264    #[doc = "Unmask the interrupt"]
1265    #[inline(always)]
1266    pub fn unmask(self) -> &'a mut W {
1267        self.variant(AP_PDM_CLK_OFF_MASK_A::UNMASK)
1268    }
1269    #[doc = "Mask the interrupt"]
1270    #[inline(always)]
1271    pub fn mask(self) -> &'a mut W {
1272        self.variant(AP_PDM_CLK_OFF_MASK_A::MASK)
1273    }
1274    #[doc = r"Sets the field bit"]
1275    #[inline(always)]
1276    pub fn set_bit(self) -> &'a mut W {
1277        self.bit(true)
1278    }
1279    #[doc = r"Clears the field bit"]
1280    #[inline(always)]
1281    pub fn clear_bit(self) -> &'a mut W {
1282        self.bit(false)
1283    }
1284    #[doc = r"Writes raw bits to the field"]
1285    #[inline(always)]
1286    pub fn bit(self, value: bool) -> &'a mut W {
1287        self.w.bits =
1288            (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
1289        self.w
1290    }
1291}
1292impl R {
1293    #[doc = "Bit 0 - Select the source for digital mic signal"]
1294    #[inline(always)]
1295    pub fn dmic_sel(&self) -> DMIC_SEL_R {
1296        DMIC_SEL_R::new((self.bits & 0x01) != 0)
1297    }
1298    #[doc = "Bit 1 - Select between external or internal sensory LSPD"]
1299    #[inline(always)]
1300    pub fn lpsd_sel(&self) -> LPSD_SEL_R {
1301        LPSD_SEL_R::new(((self.bits >> 1) & 0x01) != 0)
1302    }
1303    #[doc = "Bit 2 - Select either monoaural or stereo mode"]
1304    #[inline(always)]
1305    pub fn mode_sel(&self) -> MODE_SEL_R {
1306        MODE_SEL_R::new(((self.bits >> 2) & 0x01) != 0)
1307    }
1308    #[doc = "Bit 3 - Select either right channel in mono mode or left channel"]
1309    #[inline(always)]
1310    pub fn mono_chn_sel(&self) -> MONO_CHN_SEL_R {
1311        MONO_CHN_SEL_R::new(((self.bits >> 3) & 0x01) != 0)
1312    }
1313    #[doc = "Bit 4 - Set to enable the I2S Deep Sleep mode"]
1314    #[inline(always)]
1315    pub fn i2s_ds_en(&self) -> I2S_DS_EN_R {
1316        I2S_DS_EN_R::new(((self.bits >> 4) & 0x01) != 0)
1317    }
1318    #[doc = "Bits 5:7 - Choose the PDM voice scenario"]
1319    #[inline(always)]
1320    pub fn pdm_voice_scenario(&self) -> PDM_VOICE_SCENARIO_R {
1321        PDM_VOICE_SCENARIO_R::new(((self.bits >> 5) & 0x07) as u8)
1322    }
1323    #[doc = "Bit 8 - Set to switch mic to AP"]
1324    #[inline(always)]
1325    pub fn pdm_mic_switch_to_ap(&self) -> PDM_MIC_SWITCH_TO_AP_R {
1326        PDM_MIC_SWITCH_TO_AP_R::new(((self.bits >> 8) & 0x01) != 0)
1327    }
1328    #[doc = "Bit 9 - Set to use LPSD DC Block"]
1329    #[inline(always)]
1330    pub fn lpsd_use_dc_block(&self) -> LPSD_USE_DC_BLOCK_R {
1331        LPSD_USE_DC_BLOCK_R::new(((self.bits >> 9) & 0x01) != 0)
1332    }
1333    #[doc = "Bit 10 - Choose the channel pcm data for LPSD in stereo mode"]
1334    #[inline(always)]
1335    pub fn lpsd_mux(&self) -> LPSD_MUX_R {
1336        LPSD_MUX_R::new(((self.bits >> 10) & 0x01) != 0)
1337    }
1338    #[doc = "Bit 11 - Set to disable HW LPSD"]
1339    #[inline(always)]
1340    pub fn lpsd_no(&self) -> LPSD_NO_R {
1341        LPSD_NO_R::new(((self.bits >> 11) & 0x01) != 0)
1342    }
1343    #[doc = "Bit 12 - Set to enable the FPGA I2S"]
1344    #[inline(always)]
1345    pub fn i2s_fpga_en(&self) -> I2S_FPGA_EN_R {
1346        I2S_FPGA_EN_R::new(((self.bits >> 12) & 0x01) != 0)
1347    }
1348    #[doc = "Bits 15:17 - AP_PDM_CKO_IN frequency divide-down ratio for AP clock detection"]
1349    #[inline(always)]
1350    pub fn div_ap(&self) -> DIV_AP_R {
1351        DIV_AP_R::new(((self.bits >> 15) & 0x07) as u8)
1352    }
1353    #[doc = "Bits 18:23 - AP_PDM_CKO_IN clock detection window range"]
1354    #[inline(always)]
1355    pub fn div_wd(&self) -> DIV_WD_R {
1356        DIV_WD_R::new(((self.bits >> 18) & 0x3f) as u8)
1357    }
1358    #[doc = "Bit 24 - Set to flush FIFO"]
1359    #[inline(always)]
1360    pub fn fifo_0_clear(&self) -> FIFO_0_CLEAR_R {
1361        FIFO_0_CLEAR_R::new(((self.bits >> 24) & 0x01) != 0)
1362    }
1363    #[doc = "Bit 25 - Set to Flush FIFO"]
1364    #[inline(always)]
1365    pub fn fifo_1_clear(&self) -> FIFO_1_CLEAR_R {
1366        FIFO_1_CLEAR_R::new(((self.bits >> 25) & 0x01) != 0)
1367    }
1368    #[doc = "Bit 26 - Control the masking of the interrupt"]
1369    #[inline(always)]
1370    pub fn lpsd_voice_detected_mask(&self) -> LPSD_VOICE_DETECTED_MASK_R {
1371        LPSD_VOICE_DETECTED_MASK_R::new(((self.bits >> 26) & 0x01) != 0)
1372    }
1373    #[doc = "Bit 27 - Control the masking of the interrupt"]
1374    #[inline(always)]
1375    pub fn dmic_voice_detected_mask(&self) -> DMIC_VOICE_DETECTED_MASK_R {
1376        DMIC_VOICE_DETECTED_MASK_R::new(((self.bits >> 27) & 0x01) != 0)
1377    }
1378    #[doc = "Bit 28 - Control the masking of the interrupt"]
1379    #[inline(always)]
1380    pub fn dmac_blk_done_mask(&self) -> DMAC_BLK_DONE_MASK_R {
1381        DMAC_BLK_DONE_MASK_R::new(((self.bits >> 28) & 0x01) != 0)
1382    }
1383    #[doc = "Bit 29 - Control the masking of the interrupt"]
1384    #[inline(always)]
1385    pub fn dmac_buf_done_mask(&self) -> DMAC_BUF_DONE_MASK_R {
1386        DMAC_BUF_DONE_MASK_R::new(((self.bits >> 29) & 0x01) != 0)
1387    }
1388    #[doc = "Bit 30 - Control the masking of the interrupt"]
1389    #[inline(always)]
1390    pub fn ap_pdm_clk_ib_mask(&self) -> AP_PDM_CLK_IB_MASK_R {
1391        AP_PDM_CLK_IB_MASK_R::new(((self.bits >> 30) & 0x01) != 0)
1392    }
1393    #[doc = "Bit 31 - Control the masking of the interrupt"]
1394    #[inline(always)]
1395    pub fn ap_pdm_clk_off_mask(&self) -> AP_PDM_CLK_OFF_MASK_R {
1396        AP_PDM_CLK_OFF_MASK_R::new(((self.bits >> 31) & 0x01) != 0)
1397    }
1398}
1399impl W {
1400    #[doc = "Bit 0 - Select the source for digital mic signal"]
1401    #[inline(always)]
1402    pub fn dmic_sel(&mut self) -> DMIC_SEL_W {
1403        DMIC_SEL_W { w: self }
1404    }
1405    #[doc = "Bit 1 - Select between external or internal sensory LSPD"]
1406    #[inline(always)]
1407    pub fn lpsd_sel(&mut self) -> LPSD_SEL_W {
1408        LPSD_SEL_W { w: self }
1409    }
1410    #[doc = "Bit 2 - Select either monoaural or stereo mode"]
1411    #[inline(always)]
1412    pub fn mode_sel(&mut self) -> MODE_SEL_W {
1413        MODE_SEL_W { w: self }
1414    }
1415    #[doc = "Bit 3 - Select either right channel in mono mode or left channel"]
1416    #[inline(always)]
1417    pub fn mono_chn_sel(&mut self) -> MONO_CHN_SEL_W {
1418        MONO_CHN_SEL_W { w: self }
1419    }
1420    #[doc = "Bit 4 - Set to enable the I2S Deep Sleep mode"]
1421    #[inline(always)]
1422    pub fn i2s_ds_en(&mut self) -> I2S_DS_EN_W {
1423        I2S_DS_EN_W { w: self }
1424    }
1425    #[doc = "Bits 5:7 - Choose the PDM voice scenario"]
1426    #[inline(always)]
1427    pub fn pdm_voice_scenario(&mut self) -> PDM_VOICE_SCENARIO_W {
1428        PDM_VOICE_SCENARIO_W { w: self }
1429    }
1430    #[doc = "Bit 8 - Set to switch mic to AP"]
1431    #[inline(always)]
1432    pub fn pdm_mic_switch_to_ap(&mut self) -> PDM_MIC_SWITCH_TO_AP_W {
1433        PDM_MIC_SWITCH_TO_AP_W { w: self }
1434    }
1435    #[doc = "Bit 9 - Set to use LPSD DC Block"]
1436    #[inline(always)]
1437    pub fn lpsd_use_dc_block(&mut self) -> LPSD_USE_DC_BLOCK_W {
1438        LPSD_USE_DC_BLOCK_W { w: self }
1439    }
1440    #[doc = "Bit 10 - Choose the channel pcm data for LPSD in stereo mode"]
1441    #[inline(always)]
1442    pub fn lpsd_mux(&mut self) -> LPSD_MUX_W {
1443        LPSD_MUX_W { w: self }
1444    }
1445    #[doc = "Bit 11 - Set to disable HW LPSD"]
1446    #[inline(always)]
1447    pub fn lpsd_no(&mut self) -> LPSD_NO_W {
1448        LPSD_NO_W { w: self }
1449    }
1450    #[doc = "Bit 12 - Set to enable the FPGA I2S"]
1451    #[inline(always)]
1452    pub fn i2s_fpga_en(&mut self) -> I2S_FPGA_EN_W {
1453        I2S_FPGA_EN_W { w: self }
1454    }
1455    #[doc = "Bits 15:17 - AP_PDM_CKO_IN frequency divide-down ratio for AP clock detection"]
1456    #[inline(always)]
1457    pub fn div_ap(&mut self) -> DIV_AP_W {
1458        DIV_AP_W { w: self }
1459    }
1460    #[doc = "Bits 18:23 - AP_PDM_CKO_IN clock detection window range"]
1461    #[inline(always)]
1462    pub fn div_wd(&mut self) -> DIV_WD_W {
1463        DIV_WD_W { w: self }
1464    }
1465    #[doc = "Bit 24 - Set to flush FIFO"]
1466    #[inline(always)]
1467    pub fn fifo_0_clear(&mut self) -> FIFO_0_CLEAR_W {
1468        FIFO_0_CLEAR_W { w: self }
1469    }
1470    #[doc = "Bit 25 - Set to Flush FIFO"]
1471    #[inline(always)]
1472    pub fn fifo_1_clear(&mut self) -> FIFO_1_CLEAR_W {
1473        FIFO_1_CLEAR_W { w: self }
1474    }
1475    #[doc = "Bit 26 - Control the masking of the interrupt"]
1476    #[inline(always)]
1477    pub fn lpsd_voice_detected_mask(&mut self) -> LPSD_VOICE_DETECTED_MASK_W {
1478        LPSD_VOICE_DETECTED_MASK_W { w: self }
1479    }
1480    #[doc = "Bit 27 - Control the masking of the interrupt"]
1481    #[inline(always)]
1482    pub fn dmic_voice_detected_mask(&mut self) -> DMIC_VOICE_DETECTED_MASK_W {
1483        DMIC_VOICE_DETECTED_MASK_W { w: self }
1484    }
1485    #[doc = "Bit 28 - Control the masking of the interrupt"]
1486    #[inline(always)]
1487    pub fn dmac_blk_done_mask(&mut self) -> DMAC_BLK_DONE_MASK_W {
1488        DMAC_BLK_DONE_MASK_W { w: self }
1489    }
1490    #[doc = "Bit 29 - Control the masking of the interrupt"]
1491    #[inline(always)]
1492    pub fn dmac_buf_done_mask(&mut self) -> DMAC_BUF_DONE_MASK_W {
1493        DMAC_BUF_DONE_MASK_W { w: self }
1494    }
1495    #[doc = "Bit 30 - Control the masking of the interrupt"]
1496    #[inline(always)]
1497    pub fn ap_pdm_clk_ib_mask(&mut self) -> AP_PDM_CLK_IB_MASK_W {
1498        AP_PDM_CLK_IB_MASK_W { w: self }
1499    }
1500    #[doc = "Bit 31 - Control the masking of the interrupt"]
1501    #[inline(always)]
1502    pub fn ap_pdm_clk_off_mask(&mut self) -> AP_PDM_CLK_OFF_MASK_W {
1503        AP_PDM_CLK_OFF_MASK_W { w: self }
1504    }
1505    #[doc = "Writes raw bits to the register."]
1506    #[inline(always)]
1507    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1508        self.0.bits(bits);
1509        self
1510    }
1511}
1512#[doc = "Audio system configure 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 [voice_config](index.html) module"]
1513pub struct VOICE_CONFIG_SPEC;
1514impl crate::RegisterSpec for VOICE_CONFIG_SPEC {
1515    type Ux = u32;
1516}
1517#[doc = "`read()` method returns [voice_config::R](R) reader structure"]
1518impl crate::Readable for VOICE_CONFIG_SPEC {
1519    type Reader = R;
1520}
1521#[doc = "`write(|w| ..)` method takes [voice_config::W](W) writer structure"]
1522impl crate::Writable for VOICE_CONFIG_SPEC {
1523    type Writer = W;
1524}
1525#[doc = "`reset()` method sets VOICE_CONFIG to value 0x0041_0000"]
1526impl crate::Resettable for VOICE_CONFIG_SPEC {
1527    #[inline(always)]
1528    fn reset_value() -> Self::Ux {
1529        0x0041_0000
1530    }
1531}