d1_pac/i2s_pcm/
asrcratiostat.rs

1#[doc = "Register `asrcratiostat` reader"]
2pub type R = crate::R<ASRCRATIOSTAT_SPEC>;
3#[doc = "Register `asrcratiostat` writer"]
4pub type W = crate::W<ASRCRATIOSTAT_SPEC>;
5#[doc = "Field `adapt_comput_value` reader - Adaptive Ratio Computational Value"]
6pub type ADAPT_COMPUT_VALUE_R = crate::FieldReader<u32>;
7#[doc = "Field `adapt_comput_value` writer - Adaptive Ratio Computational Value"]
8pub type ADAPT_COMPUT_VALUE_W<'a, REG> = crate::FieldWriter<'a, REG, 26, u32>;
9#[doc = "Field `adapt_comput_lock` reader - Adaptive Ratio Computational Lock"]
10pub type ADAPT_COMPUT_LOCK_R = crate::BitReader<ADAPT_COMPUT_LOCK_A>;
11#[doc = "Adaptive Ratio Computational Lock\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq, Eq)]
13pub enum ADAPT_COMPUT_LOCK_A {
14    #[doc = "0: Disable"]
15    UNLOCKED = 0,
16    #[doc = "1: Enable"]
17    LOCKED = 1,
18}
19impl From<ADAPT_COMPUT_LOCK_A> for bool {
20    #[inline(always)]
21    fn from(variant: ADAPT_COMPUT_LOCK_A) -> Self {
22        variant as u8 != 0
23    }
24}
25impl ADAPT_COMPUT_LOCK_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> ADAPT_COMPUT_LOCK_A {
29        match self.bits {
30            false => ADAPT_COMPUT_LOCK_A::UNLOCKED,
31            true => ADAPT_COMPUT_LOCK_A::LOCKED,
32        }
33    }
34    #[doc = "Disable"]
35    #[inline(always)]
36    pub fn is_unlocked(&self) -> bool {
37        *self == ADAPT_COMPUT_LOCK_A::UNLOCKED
38    }
39    #[doc = "Enable"]
40    #[inline(always)]
41    pub fn is_locked(&self) -> bool {
42        *self == ADAPT_COMPUT_LOCK_A::LOCKED
43    }
44}
45#[doc = "Field `adapt_comput_lock` writer - Adaptive Ratio Computational Lock"]
46pub type ADAPT_COMPUT_LOCK_W<'a, REG> = crate::BitWriter<'a, REG, ADAPT_COMPUT_LOCK_A>;
47impl<'a, REG> ADAPT_COMPUT_LOCK_W<'a, REG>
48where
49    REG: crate::Writable + crate::RegisterSpec,
50{
51    #[doc = "Disable"]
52    #[inline(always)]
53    pub fn unlocked(self) -> &'a mut crate::W<REG> {
54        self.variant(ADAPT_COMPUT_LOCK_A::UNLOCKED)
55    }
56    #[doc = "Enable"]
57    #[inline(always)]
58    pub fn locked(self) -> &'a mut crate::W<REG> {
59        self.variant(ADAPT_COMPUT_LOCK_A::LOCKED)
60    }
61}
62#[doc = "Field `asrc_buf_overflow_sta` reader - ASRC Receive Data Buffer Overflow State\n\nIt can control thye mute with lock."]
63pub type ASRC_BUF_OVERFLOW_STA_R = crate::BitReader<ASRC_BUF_OVERFLOW_STA_A>;
64#[doc = "ASRC Receive Data Buffer Overflow State\n\nIt can control thye mute with lock.\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum ASRC_BUF_OVERFLOW_STA_A {
67    #[doc = "0: Disable"]
68    NO_OVERFLOW = 0,
69    #[doc = "1: Enable"]
70    OVERFLOW = 1,
71}
72impl From<ASRC_BUF_OVERFLOW_STA_A> for bool {
73    #[inline(always)]
74    fn from(variant: ASRC_BUF_OVERFLOW_STA_A) -> Self {
75        variant as u8 != 0
76    }
77}
78impl ASRC_BUF_OVERFLOW_STA_R {
79    #[doc = "Get enumerated values variant"]
80    #[inline(always)]
81    pub const fn variant(&self) -> ASRC_BUF_OVERFLOW_STA_A {
82        match self.bits {
83            false => ASRC_BUF_OVERFLOW_STA_A::NO_OVERFLOW,
84            true => ASRC_BUF_OVERFLOW_STA_A::OVERFLOW,
85        }
86    }
87    #[doc = "Disable"]
88    #[inline(always)]
89    pub fn is_no_overflow(&self) -> bool {
90        *self == ASRC_BUF_OVERFLOW_STA_A::NO_OVERFLOW
91    }
92    #[doc = "Enable"]
93    #[inline(always)]
94    pub fn is_overflow(&self) -> bool {
95        *self == ASRC_BUF_OVERFLOW_STA_A::OVERFLOW
96    }
97}
98#[doc = "Field `asrc_buf_overflow_sta` writer - ASRC Receive Data Buffer Overflow State\n\nIt can control thye mute with lock."]
99pub type ASRC_BUF_OVERFLOW_STA_W<'a, REG> = crate::BitWriter<'a, REG, ASRC_BUF_OVERFLOW_STA_A>;
100impl<'a, REG> ASRC_BUF_OVERFLOW_STA_W<'a, REG>
101where
102    REG: crate::Writable + crate::RegisterSpec,
103{
104    #[doc = "Disable"]
105    #[inline(always)]
106    pub fn no_overflow(self) -> &'a mut crate::W<REG> {
107        self.variant(ASRC_BUF_OVERFLOW_STA_A::NO_OVERFLOW)
108    }
109    #[doc = "Enable"]
110    #[inline(always)]
111    pub fn overflow(self) -> &'a mut crate::W<REG> {
112        self.variant(ASRC_BUF_OVERFLOW_STA_A::OVERFLOW)
113    }
114}
115impl R {
116    #[doc = "Bits 0:25 - Adaptive Ratio Computational Value"]
117    #[inline(always)]
118    pub fn adapt_comput_value(&self) -> ADAPT_COMPUT_VALUE_R {
119        ADAPT_COMPUT_VALUE_R::new(self.bits & 0x03ff_ffff)
120    }
121    #[doc = "Bit 28 - Adaptive Ratio Computational Lock"]
122    #[inline(always)]
123    pub fn adapt_comput_lock(&self) -> ADAPT_COMPUT_LOCK_R {
124        ADAPT_COMPUT_LOCK_R::new(((self.bits >> 28) & 1) != 0)
125    }
126    #[doc = "Bit 29 - ASRC Receive Data Buffer Overflow State\n\nIt can control thye mute with lock."]
127    #[inline(always)]
128    pub fn asrc_buf_overflow_sta(&self) -> ASRC_BUF_OVERFLOW_STA_R {
129        ASRC_BUF_OVERFLOW_STA_R::new(((self.bits >> 29) & 1) != 0)
130    }
131}
132impl W {
133    #[doc = "Bits 0:25 - Adaptive Ratio Computational Value"]
134    #[inline(always)]
135    #[must_use]
136    pub fn adapt_comput_value(&mut self) -> ADAPT_COMPUT_VALUE_W<ASRCRATIOSTAT_SPEC> {
137        ADAPT_COMPUT_VALUE_W::new(self, 0)
138    }
139    #[doc = "Bit 28 - Adaptive Ratio Computational Lock"]
140    #[inline(always)]
141    #[must_use]
142    pub fn adapt_comput_lock(&mut self) -> ADAPT_COMPUT_LOCK_W<ASRCRATIOSTAT_SPEC> {
143        ADAPT_COMPUT_LOCK_W::new(self, 28)
144    }
145    #[doc = "Bit 29 - ASRC Receive Data Buffer Overflow State\n\nIt can control thye mute with lock."]
146    #[inline(always)]
147    #[must_use]
148    pub fn asrc_buf_overflow_sta(&mut self) -> ASRC_BUF_OVERFLOW_STA_W<ASRCRATIOSTAT_SPEC> {
149        ASRC_BUF_OVERFLOW_STA_W::new(self, 29)
150    }
151    #[doc = r" Writes raw bits to the register."]
152    #[doc = r""]
153    #[doc = r" # Safety"]
154    #[doc = r""]
155    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
156    #[inline(always)]
157    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
158        self.bits = bits;
159        self
160    }
161}
162#[doc = "ASRC Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`asrcratiostat::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 [`asrcratiostat::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
163pub struct ASRCRATIOSTAT_SPEC;
164impl crate::RegisterSpec for ASRCRATIOSTAT_SPEC {
165    type Ux = u32;
166}
167#[doc = "`read()` method returns [`asrcratiostat::R`](R) reader structure"]
168impl crate::Readable for ASRCRATIOSTAT_SPEC {}
169#[doc = "`write(|w| ..)` method takes [`asrcratiostat::W`](W) writer structure"]
170impl crate::Writable for ASRCRATIOSTAT_SPEC {
171    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
172    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
173}
174#[doc = "`reset()` method sets asrcratiostat to value 0"]
175impl crate::Resettable for ASRCRATIOSTAT_SPEC {
176    const RESET_VALUE: Self::Ux = 0;
177}