esp32s2_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 `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    #[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 = "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)."]
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}