esp32s3/i2s0/
rx_conf1.rs

1#[doc = "Register `RX_CONF1` reader"]
2pub type R = crate::R<RX_CONF1_SPEC>;
3#[doc = "Register `RX_CONF1` writer"]
4pub type W = crate::W<RX_CONF1_SPEC>;
5#[doc = "Field `RX_TDM_WS_WIDTH` reader - The width of rx_ws_out in TDM mode is (I2S_RX_TDM_WS_WIDTH\\[6:0\\] +1) * T_bck"]
6pub type RX_TDM_WS_WIDTH_R = crate::FieldReader;
7#[doc = "Field `RX_TDM_WS_WIDTH` writer - The width of rx_ws_out in TDM mode is (I2S_RX_TDM_WS_WIDTH\\[6:0\\] +1) * T_bck"]
8pub type RX_TDM_WS_WIDTH_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9#[doc = "Field `RX_BCK_DIV_NUM` reader - Bit clock configuration bits in receiver mode."]
10pub type RX_BCK_DIV_NUM_R = crate::FieldReader;
11#[doc = "Field `RX_BCK_DIV_NUM` writer - Bit clock configuration bits in receiver mode."]
12pub type RX_BCK_DIV_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
13#[doc = "Field `RX_BITS_MOD` reader - Set the bits to configure the valid data bit length of I2S receiver channel. 7: all the valid channel data is in 8-bit-mode. 15: all the valid channel data is in 16-bit-mode. 23: all the valid channel data is in 24-bit-mode. 31:all the valid channel data is in 32-bit-mode."]
14pub type RX_BITS_MOD_R = crate::FieldReader;
15#[doc = "Field `RX_BITS_MOD` writer - Set the bits to configure the valid data bit length of I2S receiver channel. 7: all the valid channel data is in 8-bit-mode. 15: all the valid channel data is in 16-bit-mode. 23: all the valid channel data is in 24-bit-mode. 31:all the valid channel data is in 32-bit-mode."]
16pub type RX_BITS_MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
17#[doc = "Field `RX_HALF_SAMPLE_BITS` reader - I2S Rx half sample bits -1."]
18pub type RX_HALF_SAMPLE_BITS_R = crate::FieldReader;
19#[doc = "Field `RX_HALF_SAMPLE_BITS` writer - I2S Rx half sample bits -1."]
20pub type RX_HALF_SAMPLE_BITS_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
21#[doc = "Field `RX_TDM_CHAN_BITS` reader - The Rx bit number for each channel minus 1in TDM mode."]
22pub type RX_TDM_CHAN_BITS_R = crate::FieldReader;
23#[doc = "Field `RX_TDM_CHAN_BITS` writer - The Rx bit number for each channel minus 1in TDM mode."]
24pub type RX_TDM_CHAN_BITS_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
25#[doc = "Field `RX_MSB_SHIFT` reader - Set this bit to enable receiver in Phillips standard mode"]
26pub type RX_MSB_SHIFT_R = crate::BitReader;
27#[doc = "Field `RX_MSB_SHIFT` writer - Set this bit to enable receiver in Phillips standard mode"]
28pub type RX_MSB_SHIFT_W<'a, REG> = crate::BitWriter<'a, REG>;
29impl R {
30    #[doc = "Bits 0:6 - The width of rx_ws_out in TDM mode is (I2S_RX_TDM_WS_WIDTH\\[6:0\\] +1) * T_bck"]
31    #[inline(always)]
32    pub fn rx_tdm_ws_width(&self) -> RX_TDM_WS_WIDTH_R {
33        RX_TDM_WS_WIDTH_R::new((self.bits & 0x7f) as u8)
34    }
35    #[doc = "Bits 7:12 - Bit clock configuration bits in receiver mode."]
36    #[inline(always)]
37    pub fn rx_bck_div_num(&self) -> RX_BCK_DIV_NUM_R {
38        RX_BCK_DIV_NUM_R::new(((self.bits >> 7) & 0x3f) as u8)
39    }
40    #[doc = "Bits 13:17 - Set the bits to configure the valid data bit length of I2S receiver channel. 7: all the valid channel data is in 8-bit-mode. 15: all the valid channel data is in 16-bit-mode. 23: all the valid channel data is in 24-bit-mode. 31:all the valid channel data is in 32-bit-mode."]
41    #[inline(always)]
42    pub fn rx_bits_mod(&self) -> RX_BITS_MOD_R {
43        RX_BITS_MOD_R::new(((self.bits >> 13) & 0x1f) as u8)
44    }
45    #[doc = "Bits 18:23 - I2S Rx half sample bits -1."]
46    #[inline(always)]
47    pub fn rx_half_sample_bits(&self) -> RX_HALF_SAMPLE_BITS_R {
48        RX_HALF_SAMPLE_BITS_R::new(((self.bits >> 18) & 0x3f) as u8)
49    }
50    #[doc = "Bits 24:28 - The Rx bit number for each channel minus 1in TDM mode."]
51    #[inline(always)]
52    pub fn rx_tdm_chan_bits(&self) -> RX_TDM_CHAN_BITS_R {
53        RX_TDM_CHAN_BITS_R::new(((self.bits >> 24) & 0x1f) as u8)
54    }
55    #[doc = "Bit 29 - Set this bit to enable receiver in Phillips standard mode"]
56    #[inline(always)]
57    pub fn rx_msb_shift(&self) -> RX_MSB_SHIFT_R {
58        RX_MSB_SHIFT_R::new(((self.bits >> 29) & 1) != 0)
59    }
60}
61#[cfg(feature = "impl-register-debug")]
62impl core::fmt::Debug for R {
63    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64        f.debug_struct("RX_CONF1")
65            .field("rx_tdm_ws_width", &self.rx_tdm_ws_width())
66            .field("rx_bck_div_num", &self.rx_bck_div_num())
67            .field("rx_bits_mod", &self.rx_bits_mod())
68            .field("rx_half_sample_bits", &self.rx_half_sample_bits())
69            .field("rx_tdm_chan_bits", &self.rx_tdm_chan_bits())
70            .field("rx_msb_shift", &self.rx_msb_shift())
71            .finish()
72    }
73}
74impl W {
75    #[doc = "Bits 0:6 - The width of rx_ws_out in TDM mode is (I2S_RX_TDM_WS_WIDTH\\[6:0\\] +1) * T_bck"]
76    #[inline(always)]
77    pub fn rx_tdm_ws_width(&mut self) -> RX_TDM_WS_WIDTH_W<RX_CONF1_SPEC> {
78        RX_TDM_WS_WIDTH_W::new(self, 0)
79    }
80    #[doc = "Bits 7:12 - Bit clock configuration bits in receiver mode."]
81    #[inline(always)]
82    pub fn rx_bck_div_num(&mut self) -> RX_BCK_DIV_NUM_W<RX_CONF1_SPEC> {
83        RX_BCK_DIV_NUM_W::new(self, 7)
84    }
85    #[doc = "Bits 13:17 - Set the bits to configure the valid data bit length of I2S receiver channel. 7: all the valid channel data is in 8-bit-mode. 15: all the valid channel data is in 16-bit-mode. 23: all the valid channel data is in 24-bit-mode. 31:all the valid channel data is in 32-bit-mode."]
86    #[inline(always)]
87    pub fn rx_bits_mod(&mut self) -> RX_BITS_MOD_W<RX_CONF1_SPEC> {
88        RX_BITS_MOD_W::new(self, 13)
89    }
90    #[doc = "Bits 18:23 - I2S Rx half sample bits -1."]
91    #[inline(always)]
92    pub fn rx_half_sample_bits(&mut self) -> RX_HALF_SAMPLE_BITS_W<RX_CONF1_SPEC> {
93        RX_HALF_SAMPLE_BITS_W::new(self, 18)
94    }
95    #[doc = "Bits 24:28 - The Rx bit number for each channel minus 1in TDM mode."]
96    #[inline(always)]
97    pub fn rx_tdm_chan_bits(&mut self) -> RX_TDM_CHAN_BITS_W<RX_CONF1_SPEC> {
98        RX_TDM_CHAN_BITS_W::new(self, 24)
99    }
100    #[doc = "Bit 29 - Set this bit to enable receiver in Phillips standard mode"]
101    #[inline(always)]
102    pub fn rx_msb_shift(&mut self) -> RX_MSB_SHIFT_W<RX_CONF1_SPEC> {
103        RX_MSB_SHIFT_W::new(self, 29)
104    }
105}
106#[doc = "I2S RX configure register 1\n\nYou can [`read`](crate::Reg::read) this register and get [`rx_conf1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rx_conf1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct RX_CONF1_SPEC;
108impl crate::RegisterSpec for RX_CONF1_SPEC {
109    type Ux = u32;
110}
111#[doc = "`read()` method returns [`rx_conf1::R`](R) reader structure"]
112impl crate::Readable for RX_CONF1_SPEC {}
113#[doc = "`write(|w| ..)` method takes [`rx_conf1::W`](W) writer structure"]
114impl crate::Writable for RX_CONF1_SPEC {
115    type Safety = crate::Unsafe;
116}
117#[doc = "`reset()` method sets RX_CONF1 to value 0x2f3d_e300"]
118impl crate::Resettable for RX_CONF1_SPEC {
119    const RESET_VALUE: u32 = 0x2f3d_e300;
120}