d1_pac/i2s_pcm/
fsin_extcfg.rs

1#[doc = "Register `fsin_extcfg` reader"]
2pub type R = crate::R<FSIN_EXTCFG_SPEC>;
3#[doc = "Register `fsin_extcfg` writer"]
4pub type W = crate::W<FSIN_EXTCFG_SPEC>;
5#[doc = "Field `cyclenum` reader - The Cycle Number of Pulse Extend.\n\nThe cycle is BCLK and is at least 1."]
6pub type CYCLENUM_R = crate::FieldReader<u16>;
7#[doc = "Field `cyclenum` writer - The Cycle Number of Pulse Extend.\n\nThe cycle is BCLK and is at least 1."]
8pub type CYCLENUM_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
9#[doc = "Field `extend` reader - Extend the bit when using ASRC."]
10pub type EXTEND_R = crate::BitReader<EXTEND_A>;
11#[doc = "Extend the bit when using ASRC.\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq, Eq)]
13pub enum EXTEND_A {
14    #[doc = "0: Disable"]
15    DISABLE = 0,
16    #[doc = "1: Enable"]
17    ENABLE = 1,
18}
19impl From<EXTEND_A> for bool {
20    #[inline(always)]
21    fn from(variant: EXTEND_A) -> Self {
22        variant as u8 != 0
23    }
24}
25impl EXTEND_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> EXTEND_A {
29        match self.bits {
30            false => EXTEND_A::DISABLE,
31            true => EXTEND_A::ENABLE,
32        }
33    }
34    #[doc = "Disable"]
35    #[inline(always)]
36    pub fn is_disable(&self) -> bool {
37        *self == EXTEND_A::DISABLE
38    }
39    #[doc = "Enable"]
40    #[inline(always)]
41    pub fn is_enable(&self) -> bool {
42        *self == EXTEND_A::ENABLE
43    }
44}
45#[doc = "Field `extend` writer - Extend the bit when using ASRC."]
46pub type EXTEND_W<'a, REG> = crate::BitWriter<'a, REG, EXTEND_A>;
47impl<'a, REG> EXTEND_W<'a, REG>
48where
49    REG: crate::Writable + crate::RegisterSpec,
50{
51    #[doc = "Disable"]
52    #[inline(always)]
53    pub fn disable(self) -> &'a mut crate::W<REG> {
54        self.variant(EXTEND_A::DISABLE)
55    }
56    #[doc = "Enable"]
57    #[inline(always)]
58    pub fn enable(self) -> &'a mut crate::W<REG> {
59        self.variant(EXTEND_A::ENABLE)
60    }
61}
62impl R {
63    #[doc = "Bits 0:15 - The Cycle Number of Pulse Extend.\n\nThe cycle is BCLK and is at least 1."]
64    #[inline(always)]
65    pub fn cyclenum(&self) -> CYCLENUM_R {
66        CYCLENUM_R::new((self.bits & 0xffff) as u16)
67    }
68    #[doc = "Bit 16 - Extend the bit when using ASRC."]
69    #[inline(always)]
70    pub fn extend(&self) -> EXTEND_R {
71        EXTEND_R::new(((self.bits >> 16) & 1) != 0)
72    }
73}
74impl W {
75    #[doc = "Bits 0:15 - The Cycle Number of Pulse Extend.\n\nThe cycle is BCLK and is at least 1."]
76    #[inline(always)]
77    #[must_use]
78    pub fn cyclenum(&mut self) -> CYCLENUM_W<FSIN_EXTCFG_SPEC> {
79        CYCLENUM_W::new(self, 0)
80    }
81    #[doc = "Bit 16 - Extend the bit when using ASRC."]
82    #[inline(always)]
83    #[must_use]
84    pub fn extend(&mut self) -> EXTEND_W<FSIN_EXTCFG_SPEC> {
85        EXTEND_W::new(self, 16)
86    }
87    #[doc = r" Writes raw bits to the register."]
88    #[doc = r""]
89    #[doc = r" # Safety"]
90    #[doc = r""]
91    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
92    #[inline(always)]
93    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
94        self.bits = bits;
95        self
96    }
97}
98#[doc = "ASRC Input Sample Pulse Extend Configuration Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`fsin_extcfg::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 [`fsin_extcfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct FSIN_EXTCFG_SPEC;
100impl crate::RegisterSpec for FSIN_EXTCFG_SPEC {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`fsin_extcfg::R`](R) reader structure"]
104impl crate::Readable for FSIN_EXTCFG_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`fsin_extcfg::W`](W) writer structure"]
106impl crate::Writable for FSIN_EXTCFG_SPEC {
107    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
108    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
109}
110#[doc = "`reset()` method sets fsin_extcfg to value 0"]
111impl crate::Resettable for FSIN_EXTCFG_SPEC {
112    const RESET_VALUE: Self::Ux = 0;
113}