esp32c2/spi2/
slave1.rs

1#[doc = "Register `SLAVE1` reader"]
2pub type R = crate::R<SLAVE1_SPEC>;
3#[doc = "Register `SLAVE1` writer"]
4pub type W = crate::W<SLAVE1_SPEC>;
5#[doc = "Field `SLV_DATA_BITLEN` reader - The transferred data bit length in SPI slave FD and HD mode."]
6pub type SLV_DATA_BITLEN_R = crate::FieldReader<u32>;
7#[doc = "Field `SLV_DATA_BITLEN` writer - The transferred data bit length in SPI slave FD and HD mode."]
8pub type SLV_DATA_BITLEN_W<'a, REG> = crate::FieldWriter<'a, REG, 18, u32>;
9#[doc = "Field `SLV_LAST_COMMAND` reader - In the slave mode it is the value of command."]
10pub type SLV_LAST_COMMAND_R = crate::FieldReader;
11#[doc = "Field `SLV_LAST_COMMAND` writer - In the slave mode it is the value of command."]
12pub type SLV_LAST_COMMAND_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `SLV_LAST_ADDR` reader - In the slave mode it is the value of address."]
14pub type SLV_LAST_ADDR_R = crate::FieldReader;
15#[doc = "Field `SLV_LAST_ADDR` writer - In the slave mode it is the value of address."]
16pub type SLV_LAST_ADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
17impl R {
18    #[doc = "Bits 0:17 - The transferred data bit length in SPI slave FD and HD mode."]
19    #[inline(always)]
20    pub fn slv_data_bitlen(&self) -> SLV_DATA_BITLEN_R {
21        SLV_DATA_BITLEN_R::new(self.bits & 0x0003_ffff)
22    }
23    #[doc = "Bits 18:25 - In the slave mode it is the value of command."]
24    #[inline(always)]
25    pub fn slv_last_command(&self) -> SLV_LAST_COMMAND_R {
26        SLV_LAST_COMMAND_R::new(((self.bits >> 18) & 0xff) as u8)
27    }
28    #[doc = "Bits 26:31 - In the slave mode it is the value of address."]
29    #[inline(always)]
30    pub fn slv_last_addr(&self) -> SLV_LAST_ADDR_R {
31        SLV_LAST_ADDR_R::new(((self.bits >> 26) & 0x3f) as u8)
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("SLAVE1")
38            .field("slv_data_bitlen", &self.slv_data_bitlen())
39            .field("slv_last_command", &self.slv_last_command())
40            .field("slv_last_addr", &self.slv_last_addr())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bits 0:17 - The transferred data bit length in SPI slave FD and HD mode."]
46    #[inline(always)]
47    pub fn slv_data_bitlen(&mut self) -> SLV_DATA_BITLEN_W<SLAVE1_SPEC> {
48        SLV_DATA_BITLEN_W::new(self, 0)
49    }
50    #[doc = "Bits 18:25 - In the slave mode it is the value of command."]
51    #[inline(always)]
52    pub fn slv_last_command(&mut self) -> SLV_LAST_COMMAND_W<SLAVE1_SPEC> {
53        SLV_LAST_COMMAND_W::new(self, 18)
54    }
55    #[doc = "Bits 26:31 - In the slave mode it is the value of address."]
56    #[inline(always)]
57    pub fn slv_last_addr(&mut self) -> SLV_LAST_ADDR_W<SLAVE1_SPEC> {
58        SLV_LAST_ADDR_W::new(self, 26)
59    }
60}
61#[doc = "SPI slave control register 1\n\nYou can [`read`](crate::Reg::read) this register and get [`slave1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`slave1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
62pub struct SLAVE1_SPEC;
63impl crate::RegisterSpec for SLAVE1_SPEC {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [`slave1::R`](R) reader structure"]
67impl crate::Readable for SLAVE1_SPEC {}
68#[doc = "`write(|w| ..)` method takes [`slave1::W`](W) writer structure"]
69impl crate::Writable for SLAVE1_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 SLAVE1 to value 0"]
75impl crate::Resettable for SLAVE1_SPEC {
76    const RESET_VALUE: u32 = 0;
77}