esp32/sens/
sar_i2c_ctrl.rs

1#[doc = "Register `SAR_I2C_CTRL` reader"]
2pub type R = crate::R<SAR_I2C_CTRL_SPEC>;
3#[doc = "Register `SAR_I2C_CTRL` writer"]
4pub type W = crate::W<SAR_I2C_CTRL_SPEC>;
5#[doc = "Field `SAR_I2C_CTRL` reader - I2C control data only active when reg_sar_i2c_start_force = 1"]
6pub type SAR_I2C_CTRL_R = crate::FieldReader<u32>;
7#[doc = "Field `SAR_I2C_CTRL` writer - I2C control data only active when reg_sar_i2c_start_force = 1"]
8pub type SAR_I2C_CTRL_W<'a, REG> = crate::FieldWriter<'a, REG, 28, u32>;
9#[doc = "Field `SAR_I2C_START` reader - start I2C only active when reg_sar_i2c_start_force = 1"]
10pub type SAR_I2C_START_R = crate::BitReader;
11#[doc = "Field `SAR_I2C_START` writer - start I2C only active when reg_sar_i2c_start_force = 1"]
12pub type SAR_I2C_START_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `SAR_I2C_START_FORCE` reader - 1: I2C started by SW 0: I2C started by FSM"]
14pub type SAR_I2C_START_FORCE_R = crate::BitReader;
15#[doc = "Field `SAR_I2C_START_FORCE` writer - 1: I2C started by SW 0: I2C started by FSM"]
16pub type SAR_I2C_START_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bits 0:27 - I2C control data only active when reg_sar_i2c_start_force = 1"]
19    #[inline(always)]
20    pub fn sar_i2c_ctrl(&self) -> SAR_I2C_CTRL_R {
21        SAR_I2C_CTRL_R::new(self.bits & 0x0fff_ffff)
22    }
23    #[doc = "Bit 28 - start I2C only active when reg_sar_i2c_start_force = 1"]
24    #[inline(always)]
25    pub fn sar_i2c_start(&self) -> SAR_I2C_START_R {
26        SAR_I2C_START_R::new(((self.bits >> 28) & 1) != 0)
27    }
28    #[doc = "Bit 29 - 1: I2C started by SW 0: I2C started by FSM"]
29    #[inline(always)]
30    pub fn sar_i2c_start_force(&self) -> SAR_I2C_START_FORCE_R {
31        SAR_I2C_START_FORCE_R::new(((self.bits >> 29) & 1) != 0)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("SAR_I2C_CTRL")
38            .field("sar_i2c_ctrl", &self.sar_i2c_ctrl())
39            .field("sar_i2c_start", &self.sar_i2c_start())
40            .field("sar_i2c_start_force", &self.sar_i2c_start_force())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bits 0:27 - I2C control data only active when reg_sar_i2c_start_force = 1"]
46    #[inline(always)]
47    pub fn sar_i2c_ctrl(&mut self) -> SAR_I2C_CTRL_W<SAR_I2C_CTRL_SPEC> {
48        SAR_I2C_CTRL_W::new(self, 0)
49    }
50    #[doc = "Bit 28 - start I2C only active when reg_sar_i2c_start_force = 1"]
51    #[inline(always)]
52    pub fn sar_i2c_start(&mut self) -> SAR_I2C_START_W<SAR_I2C_CTRL_SPEC> {
53        SAR_I2C_START_W::new(self, 28)
54    }
55    #[doc = "Bit 29 - 1: I2C started by SW 0: I2C started by FSM"]
56    #[inline(always)]
57    pub fn sar_i2c_start_force(&mut self) -> SAR_I2C_START_FORCE_W<SAR_I2C_CTRL_SPEC> {
58        SAR_I2C_START_FORCE_W::new(self, 29)
59    }
60}
61#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`sar_i2c_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sar_i2c_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
62pub struct SAR_I2C_CTRL_SPEC;
63impl crate::RegisterSpec for SAR_I2C_CTRL_SPEC {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [`sar_i2c_ctrl::R`](R) reader structure"]
67impl crate::Readable for SAR_I2C_CTRL_SPEC {}
68#[doc = "`write(|w| ..)` method takes [`sar_i2c_ctrl::W`](W) writer structure"]
69impl crate::Writable for SAR_I2C_CTRL_SPEC {
70    type Safety = crate::Unsafe;
71    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
72    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
73}
74#[doc = "`reset()` method sets SAR_I2C_CTRL to value 0"]
75impl crate::Resettable for SAR_I2C_CTRL_SPEC {
76    const RESET_VALUE: u32 = 0;
77}