d1_pac/i2s_pcm/
asrcmancfg.rs

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