esp32h2/pcr/
i2s_conf.rs

1#[doc = "Register `I2S_CONF` reader"]
2pub type R = crate::R<I2S_CONF_SPEC>;
3#[doc = "Register `I2S_CONF` writer"]
4pub type W = crate::W<I2S_CONF_SPEC>;
5#[doc = "Field `I2S_CLK_EN` reader - Set 1 to enable i2s apb clock"]
6pub type I2S_CLK_EN_R = crate::BitReader;
7#[doc = "Field `I2S_CLK_EN` writer - Set 1 to enable i2s apb clock"]
8pub type I2S_CLK_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `I2S_RST_EN` reader - Set 0 to reset i2s module"]
10pub type I2S_RST_EN_R = crate::BitReader;
11#[doc = "Field `I2S_RST_EN` writer - Set 0 to reset i2s module"]
12pub type I2S_RST_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `I2S_RX_READY` reader - Query this field before using i2s rx function, after reset i2s module"]
14pub type I2S_RX_READY_R = crate::BitReader;
15#[doc = "Field `I2S_TX_READY` reader - Query this field before using i2s tx function, after reset i2s module"]
16pub type I2S_TX_READY_R = crate::BitReader;
17impl R {
18    #[doc = "Bit 0 - Set 1 to enable i2s apb clock"]
19    #[inline(always)]
20    pub fn i2s_clk_en(&self) -> I2S_CLK_EN_R {
21        I2S_CLK_EN_R::new((self.bits & 1) != 0)
22    }
23    #[doc = "Bit 1 - Set 0 to reset i2s module"]
24    #[inline(always)]
25    pub fn i2s_rst_en(&self) -> I2S_RST_EN_R {
26        I2S_RST_EN_R::new(((self.bits >> 1) & 1) != 0)
27    }
28    #[doc = "Bit 2 - Query this field before using i2s rx function, after reset i2s module"]
29    #[inline(always)]
30    pub fn i2s_rx_ready(&self) -> I2S_RX_READY_R {
31        I2S_RX_READY_R::new(((self.bits >> 2) & 1) != 0)
32    }
33    #[doc = "Bit 3 - Query this field before using i2s tx function, after reset i2s module"]
34    #[inline(always)]
35    pub fn i2s_tx_ready(&self) -> I2S_TX_READY_R {
36        I2S_TX_READY_R::new(((self.bits >> 3) & 1) != 0)
37    }
38}
39#[cfg(feature = "impl-register-debug")]
40impl core::fmt::Debug for R {
41    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
42        f.debug_struct("I2S_CONF")
43            .field("i2s_clk_en", &self.i2s_clk_en())
44            .field("i2s_rst_en", &self.i2s_rst_en())
45            .field("i2s_rx_ready", &self.i2s_rx_ready())
46            .field("i2s_tx_ready", &self.i2s_tx_ready())
47            .finish()
48    }
49}
50impl W {
51    #[doc = "Bit 0 - Set 1 to enable i2s apb clock"]
52    #[inline(always)]
53    pub fn i2s_clk_en(&mut self) -> I2S_CLK_EN_W<I2S_CONF_SPEC> {
54        I2S_CLK_EN_W::new(self, 0)
55    }
56    #[doc = "Bit 1 - Set 0 to reset i2s module"]
57    #[inline(always)]
58    pub fn i2s_rst_en(&mut self) -> I2S_RST_EN_W<I2S_CONF_SPEC> {
59        I2S_RST_EN_W::new(self, 1)
60    }
61}
62#[doc = "I2S configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`i2s_conf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`i2s_conf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
63pub struct I2S_CONF_SPEC;
64impl crate::RegisterSpec for I2S_CONF_SPEC {
65    type Ux = u32;
66}
67#[doc = "`read()` method returns [`i2s_conf::R`](R) reader structure"]
68impl crate::Readable for I2S_CONF_SPEC {}
69#[doc = "`write(|w| ..)` method takes [`i2s_conf::W`](W) writer structure"]
70impl crate::Writable for I2S_CONF_SPEC {
71    type Safety = crate::Unsafe;
72    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
73    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
74}
75#[doc = "`reset()` method sets I2S_CONF to value 0x0d"]
76impl crate::Resettable for I2S_CONF_SPEC {
77    const RESET_VALUE: u32 = 0x0d;
78}