esp32/i2s0/
sample_rate_conf.rs

1#[doc = "Register `SAMPLE_RATE_CONF` reader"]
2pub type R = crate::R<SAMPLE_RATE_CONF_SPEC>;
3#[doc = "Register `SAMPLE_RATE_CONF` writer"]
4pub type W = crate::W<SAMPLE_RATE_CONF_SPEC>;
5#[doc = "Field `TX_BCK_DIV_NUM` reader - "]
6pub type TX_BCK_DIV_NUM_R = crate::FieldReader;
7#[doc = "Field `TX_BCK_DIV_NUM` writer - "]
8pub type TX_BCK_DIV_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9#[doc = "Field `RX_BCK_DIV_NUM` reader - "]
10pub type RX_BCK_DIV_NUM_R = crate::FieldReader;
11#[doc = "Field `RX_BCK_DIV_NUM` writer - "]
12pub type RX_BCK_DIV_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
13#[doc = "Field `TX_BITS_MOD` reader - "]
14pub type TX_BITS_MOD_R = crate::FieldReader;
15#[doc = "Field `TX_BITS_MOD` writer - "]
16pub type TX_BITS_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
17#[doc = "Field `RX_BITS_MOD` reader - "]
18pub type RX_BITS_MOD_R = crate::FieldReader;
19#[doc = "Field `RX_BITS_MOD` writer - "]
20pub type RX_BITS_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
21impl R {
22    #[doc = "Bits 0:5"]
23    #[inline(always)]
24    pub fn tx_bck_div_num(&self) -> TX_BCK_DIV_NUM_R {
25        TX_BCK_DIV_NUM_R::new((self.bits & 0x3f) as u8)
26    }
27    #[doc = "Bits 6:11"]
28    #[inline(always)]
29    pub fn rx_bck_div_num(&self) -> RX_BCK_DIV_NUM_R {
30        RX_BCK_DIV_NUM_R::new(((self.bits >> 6) & 0x3f) as u8)
31    }
32    #[doc = "Bits 12:17"]
33    #[inline(always)]
34    pub fn tx_bits_mod(&self) -> TX_BITS_MOD_R {
35        TX_BITS_MOD_R::new(((self.bits >> 12) & 0x3f) as u8)
36    }
37    #[doc = "Bits 18:23"]
38    #[inline(always)]
39    pub fn rx_bits_mod(&self) -> RX_BITS_MOD_R {
40        RX_BITS_MOD_R::new(((self.bits >> 18) & 0x3f) as u8)
41    }
42}
43#[cfg(feature = "impl-register-debug")]
44impl core::fmt::Debug for R {
45    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
46        f.debug_struct("SAMPLE_RATE_CONF")
47            .field("tx_bck_div_num", &self.tx_bck_div_num())
48            .field("rx_bck_div_num", &self.rx_bck_div_num())
49            .field("tx_bits_mod", &self.tx_bits_mod())
50            .field("rx_bits_mod", &self.rx_bits_mod())
51            .finish()
52    }
53}
54impl W {
55    #[doc = "Bits 0:5"]
56    #[inline(always)]
57    pub fn tx_bck_div_num(&mut self) -> TX_BCK_DIV_NUM_W<SAMPLE_RATE_CONF_SPEC> {
58        TX_BCK_DIV_NUM_W::new(self, 0)
59    }
60    #[doc = "Bits 6:11"]
61    #[inline(always)]
62    pub fn rx_bck_div_num(&mut self) -> RX_BCK_DIV_NUM_W<SAMPLE_RATE_CONF_SPEC> {
63        RX_BCK_DIV_NUM_W::new(self, 6)
64    }
65    #[doc = "Bits 12:17"]
66    #[inline(always)]
67    pub fn tx_bits_mod(&mut self) -> TX_BITS_MOD_W<SAMPLE_RATE_CONF_SPEC> {
68        TX_BITS_MOD_W::new(self, 12)
69    }
70    #[doc = "Bits 18:23"]
71    #[inline(always)]
72    pub fn rx_bits_mod(&mut self) -> RX_BITS_MOD_W<SAMPLE_RATE_CONF_SPEC> {
73        RX_BITS_MOD_W::new(self, 18)
74    }
75}
76#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`sample_rate_conf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sample_rate_conf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
77pub struct SAMPLE_RATE_CONF_SPEC;
78impl crate::RegisterSpec for SAMPLE_RATE_CONF_SPEC {
79    type Ux = u32;
80}
81#[doc = "`read()` method returns [`sample_rate_conf::R`](R) reader structure"]
82impl crate::Readable for SAMPLE_RATE_CONF_SPEC {}
83#[doc = "`write(|w| ..)` method takes [`sample_rate_conf::W`](W) writer structure"]
84impl crate::Writable for SAMPLE_RATE_CONF_SPEC {
85    type Safety = crate::Unsafe;
86    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
87    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
88}
89#[doc = "`reset()` method sets SAMPLE_RATE_CONF to value 0x0041_0186"]
90impl crate::Resettable for SAMPLE_RATE_CONF_SPEC {
91    const RESET_VALUE: u32 = 0x0041_0186;
92}