esp32p4/i2c0/
scl_sp_conf.rs

1#[doc = "Register `SCL_SP_CONF` reader"]
2pub type R = crate::R<SCL_SP_CONF_SPEC>;
3#[doc = "Register `SCL_SP_CONF` writer"]
4pub type W = crate::W<SCL_SP_CONF_SPEC>;
5#[doc = "Field `SCL_RST_SLV_EN` reader - Configures to send out SCL pulses when I2C master is IDLE. The number of pulses equals to reg_scl_rst_slv_num\\[4:0\\]."]
6pub type SCL_RST_SLV_EN_R = crate::BitReader;
7#[doc = "Field `SCL_RST_SLV_EN` writer - Configures to send out SCL pulses when I2C master is IDLE. The number of pulses equals to reg_scl_rst_slv_num\\[4:0\\]."]
8pub type SCL_RST_SLV_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SCL_RST_SLV_NUM` reader - Configure the pulses of SCL generated in I2C master mode. Valid when reg_scl_rst_slv_en is 1. Measurement unit: i2c_sclk"]
10pub type SCL_RST_SLV_NUM_R = crate::FieldReader;
11#[doc = "Field `SCL_RST_SLV_NUM` writer - Configure the pulses of SCL generated in I2C master mode. Valid when reg_scl_rst_slv_en is 1. Measurement unit: i2c_sclk"]
12pub type SCL_RST_SLV_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13#[doc = "Field `SCL_PD_EN` reader - Configures to power down the I2C output SCL line. 0: Not power down. 1: Power down. Valid only when reg_scl_force_out is 1."]
14pub type SCL_PD_EN_R = crate::BitReader;
15#[doc = "Field `SCL_PD_EN` writer - Configures to power down the I2C output SCL line. 0: Not power down. 1: Power down. Valid only when reg_scl_force_out is 1."]
16pub type SCL_PD_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SDA_PD_EN` reader - Configures to power down the I2C output SDA line. 0: Not power down. 1: Power down. Valid only when reg_sda_force_out is 1."]
18pub type SDA_PD_EN_R = crate::BitReader;
19#[doc = "Field `SDA_PD_EN` writer - Configures to power down the I2C output SDA line. 0: Not power down. 1: Power down. Valid only when reg_sda_force_out is 1."]
20pub type SDA_PD_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bit 0 - Configures to send out SCL pulses when I2C master is IDLE. The number of pulses equals to reg_scl_rst_slv_num\\[4:0\\]."]
23    #[inline(always)]
24    pub fn scl_rst_slv_en(&self) -> SCL_RST_SLV_EN_R {
25        SCL_RST_SLV_EN_R::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bits 1:5 - Configure the pulses of SCL generated in I2C master mode. Valid when reg_scl_rst_slv_en is 1. Measurement unit: i2c_sclk"]
28    #[inline(always)]
29    pub fn scl_rst_slv_num(&self) -> SCL_RST_SLV_NUM_R {
30        SCL_RST_SLV_NUM_R::new(((self.bits >> 1) & 0x1f) as u8)
31    }
32    #[doc = "Bit 6 - Configures to power down the I2C output SCL line. 0: Not power down. 1: Power down. Valid only when reg_scl_force_out is 1."]
33    #[inline(always)]
34    pub fn scl_pd_en(&self) -> SCL_PD_EN_R {
35        SCL_PD_EN_R::new(((self.bits >> 6) & 1) != 0)
36    }
37    #[doc = "Bit 7 - Configures to power down the I2C output SDA line. 0: Not power down. 1: Power down. Valid only when reg_sda_force_out is 1."]
38    #[inline(always)]
39    pub fn sda_pd_en(&self) -> SDA_PD_EN_R {
40        SDA_PD_EN_R::new(((self.bits >> 7) & 1) != 0)
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("SCL_SP_CONF")
47            .field(
48                "scl_rst_slv_en",
49                &format_args!("{}", self.scl_rst_slv_en().bit()),
50            )
51            .field(
52                "scl_rst_slv_num",
53                &format_args!("{}", self.scl_rst_slv_num().bits()),
54            )
55            .field("scl_pd_en", &format_args!("{}", self.scl_pd_en().bit()))
56            .field("sda_pd_en", &format_args!("{}", self.sda_pd_en().bit()))
57            .finish()
58    }
59}
60#[cfg(feature = "impl-register-debug")]
61impl core::fmt::Debug for crate::generic::Reg<SCL_SP_CONF_SPEC> {
62    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
63        core::fmt::Debug::fmt(&self.read(), f)
64    }
65}
66impl W {
67    #[doc = "Bit 0 - Configures to send out SCL pulses when I2C master is IDLE. The number of pulses equals to reg_scl_rst_slv_num\\[4:0\\]."]
68    #[inline(always)]
69    #[must_use]
70    pub fn scl_rst_slv_en(&mut self) -> SCL_RST_SLV_EN_W<SCL_SP_CONF_SPEC> {
71        SCL_RST_SLV_EN_W::new(self, 0)
72    }
73    #[doc = "Bits 1:5 - Configure the pulses of SCL generated in I2C master mode. Valid when reg_scl_rst_slv_en is 1. Measurement unit: i2c_sclk"]
74    #[inline(always)]
75    #[must_use]
76    pub fn scl_rst_slv_num(&mut self) -> SCL_RST_SLV_NUM_W<SCL_SP_CONF_SPEC> {
77        SCL_RST_SLV_NUM_W::new(self, 1)
78    }
79    #[doc = "Bit 6 - Configures to power down the I2C output SCL line. 0: Not power down. 1: Power down. Valid only when reg_scl_force_out is 1."]
80    #[inline(always)]
81    #[must_use]
82    pub fn scl_pd_en(&mut self) -> SCL_PD_EN_W<SCL_SP_CONF_SPEC> {
83        SCL_PD_EN_W::new(self, 6)
84    }
85    #[doc = "Bit 7 - Configures to power down the I2C output SDA line. 0: Not power down. 1: Power down. Valid only when reg_sda_force_out is 1."]
86    #[inline(always)]
87    #[must_use]
88    pub fn sda_pd_en(&mut self) -> SDA_PD_EN_W<SCL_SP_CONF_SPEC> {
89        SDA_PD_EN_W::new(self, 7)
90    }
91}
92#[doc = "Power configuration register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`scl_sp_conf::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 [`scl_sp_conf::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
93pub struct SCL_SP_CONF_SPEC;
94impl crate::RegisterSpec for SCL_SP_CONF_SPEC {
95    type Ux = u32;
96}
97#[doc = "`read()` method returns [`scl_sp_conf::R`](R) reader structure"]
98impl crate::Readable for SCL_SP_CONF_SPEC {}
99#[doc = "`write(|w| ..)` method takes [`scl_sp_conf::W`](W) writer structure"]
100impl crate::Writable for SCL_SP_CONF_SPEC {
101    type Safety = crate::Unsafe;
102    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
103    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
104}
105#[doc = "`reset()` method sets SCL_SP_CONF to value 0"]
106impl crate::Resettable for SCL_SP_CONF_SPEC {
107    const RESET_VALUE: u32 = 0;
108}