esp32s3_ulp/rtc_i2c/
data.rs

1#[doc = "Register `DATA` reader"]
2pub type R = crate::R<DATA_SPEC>;
3#[doc = "Register `DATA` writer"]
4pub type W = crate::W<DATA_SPEC>;
5#[doc = "Field `I2C_RDATA` reader - data received"]
6pub type I2C_RDATA_R = crate::FieldReader;
7#[doc = "Field `SLAVE_TX_DATA` reader - data sent by slave"]
8pub type SLAVE_TX_DATA_R = crate::FieldReader;
9#[doc = "Field `SLAVE_TX_DATA` writer - data sent by slave"]
10pub type SLAVE_TX_DATA_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
11#[doc = "Field `I2C_DONE` reader - i2c done"]
12pub type I2C_DONE_R = crate::BitReader;
13impl R {
14    #[doc = "Bits 0:7 - data received"]
15    #[inline(always)]
16    pub fn i2c_rdata(&self) -> I2C_RDATA_R {
17        I2C_RDATA_R::new((self.bits & 0xff) as u8)
18    }
19    #[doc = "Bits 8:15 - data sent by slave"]
20    #[inline(always)]
21    pub fn slave_tx_data(&self) -> SLAVE_TX_DATA_R {
22        SLAVE_TX_DATA_R::new(((self.bits >> 8) & 0xff) as u8)
23    }
24    #[doc = "Bit 31 - i2c done"]
25    #[inline(always)]
26    pub fn i2c_done(&self) -> I2C_DONE_R {
27        I2C_DONE_R::new(((self.bits >> 31) & 1) != 0)
28    }
29}
30#[cfg(feature = "impl-register-debug")]
31impl core::fmt::Debug for R {
32    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
33        f.debug_struct("DATA")
34            .field("i2c_rdata", &self.i2c_rdata())
35            .field("slave_tx_data", &self.slave_tx_data())
36            .field("i2c_done", &self.i2c_done())
37            .finish()
38    }
39}
40impl W {
41    #[doc = "Bits 8:15 - data sent by slave"]
42    #[inline(always)]
43    #[must_use]
44    pub fn slave_tx_data(&mut self) -> SLAVE_TX_DATA_W<DATA_SPEC> {
45        SLAVE_TX_DATA_W::new(self, 8)
46    }
47}
48#[doc = "get i2c data status\n\nYou can [`read`](crate::Reg::read) this register and get [`data::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`data::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
49pub struct DATA_SPEC;
50impl crate::RegisterSpec for DATA_SPEC {
51    type Ux = u32;
52}
53#[doc = "`read()` method returns [`data::R`](R) reader structure"]
54impl crate::Readable for DATA_SPEC {}
55#[doc = "`write(|w| ..)` method takes [`data::W`](W) writer structure"]
56impl crate::Writable for DATA_SPEC {
57    type Safety = crate::Unsafe;
58    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
59    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
60}
61#[doc = "`reset()` method sets DATA to value 0"]
62impl crate::Resettable for DATA_SPEC {
63    const RESET_VALUE: u32 = 0;
64}