esp32s2/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 `RDATA` reader - Data received"]
6pub type RDATA_R = crate::FieldReader;
7#[doc = "Field `SLAVE_TX_DATA` reader - The data sent by slave"]
8pub type SLAVE_TX_DATA_R = crate::FieldReader;
9#[doc = "Field `SLAVE_TX_DATA` writer - The data sent by slave"]
10pub type SLAVE_TX_DATA_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
11#[doc = "Field `DONE` reader - RTC I2C transmission is done."]
12pub type DONE_R = crate::BitReader;
13impl R {
14    #[doc = "Bits 0:7 - Data received"]
15    #[inline(always)]
16    pub fn rdata(&self) -> RDATA_R {
17        RDATA_R::new((self.bits & 0xff) as u8)
18    }
19    #[doc = "Bits 8:15 - The 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 - RTC I2C transmission is done."]
25    #[inline(always)]
26    pub fn done(&self) -> DONE_R {
27        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("rdata", &self.rdata())
35            .field("slave_tx_data", &self.slave_tx_data())
36            .field("done", &self.done())
37            .finish()
38    }
39}
40impl W {
41    #[doc = "Bits 8:15 - The data sent by slave"]
42    #[inline(always)]
43    pub fn slave_tx_data(&mut self) -> SLAVE_TX_DATA_W<DATA_SPEC> {
44        SLAVE_TX_DATA_W::new(self, 8)
45    }
46}
47#[doc = "RTC I2C read data\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)."]
48pub struct DATA_SPEC;
49impl crate::RegisterSpec for DATA_SPEC {
50    type Ux = u32;
51}
52#[doc = "`read()` method returns [`data::R`](R) reader structure"]
53impl crate::Readable for DATA_SPEC {}
54#[doc = "`write(|w| ..)` method takes [`data::W`](W) writer structure"]
55impl crate::Writable for DATA_SPEC {
56    type Safety = crate::Unsafe;
57}
58#[doc = "`reset()` method sets DATA to value 0"]
59impl crate::Resettable for DATA_SPEC {}