esp32p4/spi2/
din_mode.rs

1#[doc = "Register `DIN_MODE` reader"]
2pub type R = crate::R<DIN_MODE_SPEC>;
3#[doc = "Register `DIN_MODE` writer"]
4pub type W = crate::W<DIN_MODE_SPEC>;
5#[doc = "Field `DIN0_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
6pub type DIN0_MODE_R = crate::FieldReader;
7#[doc = "Field `DIN0_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
8pub type DIN0_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `DIN1_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
10pub type DIN1_MODE_R = crate::FieldReader;
11#[doc = "Field `DIN1_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
12pub type DIN1_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `DIN2_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
14pub type DIN2_MODE_R = crate::FieldReader;
15#[doc = "Field `DIN2_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
16pub type DIN2_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `DIN3_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
18pub type DIN3_MODE_R = crate::FieldReader;
19#[doc = "Field `DIN3_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
20pub type DIN3_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21#[doc = "Field `DIN4_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
22pub type DIN4_MODE_R = crate::FieldReader;
23#[doc = "Field `DIN4_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
24pub type DIN4_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `DIN5_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
26pub type DIN5_MODE_R = crate::FieldReader;
27#[doc = "Field `DIN5_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
28pub type DIN5_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29#[doc = "Field `DIN6_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
30pub type DIN6_MODE_R = crate::FieldReader;
31#[doc = "Field `DIN6_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
32pub type DIN6_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
33#[doc = "Field `DIN7_MODE` reader - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
34pub type DIN7_MODE_R = crate::FieldReader;
35#[doc = "Field `DIN7_MODE` writer - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
36pub type DIN7_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
37#[doc = "Field `TIMING_HCLK_ACTIVE` reader - 1:enable hclk in SPI input timing module. 0: disable it. Can be configured in CONF state."]
38pub type TIMING_HCLK_ACTIVE_R = crate::BitReader;
39#[doc = "Field `TIMING_HCLK_ACTIVE` writer - 1:enable hclk in SPI input timing module. 0: disable it. Can be configured in CONF state."]
40pub type TIMING_HCLK_ACTIVE_W<'a, REG> = crate::BitWriter<'a, REG>;
41impl R {
42    #[doc = "Bits 0:1 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
43    #[inline(always)]
44    pub fn din0_mode(&self) -> DIN0_MODE_R {
45        DIN0_MODE_R::new((self.bits & 3) as u8)
46    }
47    #[doc = "Bits 2:3 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
48    #[inline(always)]
49    pub fn din1_mode(&self) -> DIN1_MODE_R {
50        DIN1_MODE_R::new(((self.bits >> 2) & 3) as u8)
51    }
52    #[doc = "Bits 4:5 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
53    #[inline(always)]
54    pub fn din2_mode(&self) -> DIN2_MODE_R {
55        DIN2_MODE_R::new(((self.bits >> 4) & 3) as u8)
56    }
57    #[doc = "Bits 6:7 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
58    #[inline(always)]
59    pub fn din3_mode(&self) -> DIN3_MODE_R {
60        DIN3_MODE_R::new(((self.bits >> 6) & 3) as u8)
61    }
62    #[doc = "Bits 8:9 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
63    #[inline(always)]
64    pub fn din4_mode(&self) -> DIN4_MODE_R {
65        DIN4_MODE_R::new(((self.bits >> 8) & 3) as u8)
66    }
67    #[doc = "Bits 10:11 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
68    #[inline(always)]
69    pub fn din5_mode(&self) -> DIN5_MODE_R {
70        DIN5_MODE_R::new(((self.bits >> 10) & 3) as u8)
71    }
72    #[doc = "Bits 12:13 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
73    #[inline(always)]
74    pub fn din6_mode(&self) -> DIN6_MODE_R {
75        DIN6_MODE_R::new(((self.bits >> 12) & 3) as u8)
76    }
77    #[doc = "Bits 14:15 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
78    #[inline(always)]
79    pub fn din7_mode(&self) -> DIN7_MODE_R {
80        DIN7_MODE_R::new(((self.bits >> 14) & 3) as u8)
81    }
82    #[doc = "Bit 16 - 1:enable hclk in SPI input timing module. 0: disable it. Can be configured in CONF state."]
83    #[inline(always)]
84    pub fn timing_hclk_active(&self) -> TIMING_HCLK_ACTIVE_R {
85        TIMING_HCLK_ACTIVE_R::new(((self.bits >> 16) & 1) != 0)
86    }
87}
88#[cfg(feature = "impl-register-debug")]
89impl core::fmt::Debug for R {
90    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
91        f.debug_struct("DIN_MODE")
92            .field("din0_mode", &format_args!("{}", self.din0_mode().bits()))
93            .field("din1_mode", &format_args!("{}", self.din1_mode().bits()))
94            .field("din2_mode", &format_args!("{}", self.din2_mode().bits()))
95            .field("din3_mode", &format_args!("{}", self.din3_mode().bits()))
96            .field("din4_mode", &format_args!("{}", self.din4_mode().bits()))
97            .field("din5_mode", &format_args!("{}", self.din5_mode().bits()))
98            .field("din6_mode", &format_args!("{}", self.din6_mode().bits()))
99            .field("din7_mode", &format_args!("{}", self.din7_mode().bits()))
100            .field(
101                "timing_hclk_active",
102                &format_args!("{}", self.timing_hclk_active().bit()),
103            )
104            .finish()
105    }
106}
107#[cfg(feature = "impl-register-debug")]
108impl core::fmt::Debug for crate::generic::Reg<DIN_MODE_SPEC> {
109    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
110        core::fmt::Debug::fmt(&self.read(), f)
111    }
112}
113impl W {
114    #[doc = "Bits 0:1 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
115    #[inline(always)]
116    #[must_use]
117    pub fn din0_mode(&mut self) -> DIN0_MODE_W<DIN_MODE_SPEC> {
118        DIN0_MODE_W::new(self, 0)
119    }
120    #[doc = "Bits 2:3 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
121    #[inline(always)]
122    #[must_use]
123    pub fn din1_mode(&mut self) -> DIN1_MODE_W<DIN_MODE_SPEC> {
124        DIN1_MODE_W::new(self, 2)
125    }
126    #[doc = "Bits 4:5 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
127    #[inline(always)]
128    #[must_use]
129    pub fn din2_mode(&mut self) -> DIN2_MODE_W<DIN_MODE_SPEC> {
130        DIN2_MODE_W::new(self, 4)
131    }
132    #[doc = "Bits 6:7 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
133    #[inline(always)]
134    #[must_use]
135    pub fn din3_mode(&mut self) -> DIN3_MODE_W<DIN_MODE_SPEC> {
136        DIN3_MODE_W::new(self, 6)
137    }
138    #[doc = "Bits 8:9 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
139    #[inline(always)]
140    #[must_use]
141    pub fn din4_mode(&mut self) -> DIN4_MODE_W<DIN_MODE_SPEC> {
142        DIN4_MODE_W::new(self, 8)
143    }
144    #[doc = "Bits 10:11 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
145    #[inline(always)]
146    #[must_use]
147    pub fn din5_mode(&mut self) -> DIN5_MODE_W<DIN_MODE_SPEC> {
148        DIN5_MODE_W::new(self, 10)
149    }
150    #[doc = "Bits 12:13 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
151    #[inline(always)]
152    #[must_use]
153    pub fn din6_mode(&mut self) -> DIN6_MODE_W<DIN_MODE_SPEC> {
154        DIN6_MODE_W::new(self, 12)
155    }
156    #[doc = "Bits 14:15 - the input signals are delayed by SPI module clock cycles, 0: input without delayed, 1: input with the posedge of clk_apb,2 input with the negedge of clk_apb, 3: input with the spi_clk. Can be configured in CONF state."]
157    #[inline(always)]
158    #[must_use]
159    pub fn din7_mode(&mut self) -> DIN7_MODE_W<DIN_MODE_SPEC> {
160        DIN7_MODE_W::new(self, 14)
161    }
162    #[doc = "Bit 16 - 1:enable hclk in SPI input timing module. 0: disable it. Can be configured in CONF state."]
163    #[inline(always)]
164    #[must_use]
165    pub fn timing_hclk_active(&mut self) -> TIMING_HCLK_ACTIVE_W<DIN_MODE_SPEC> {
166        TIMING_HCLK_ACTIVE_W::new(self, 16)
167    }
168}
169#[doc = "SPI input delay mode configuration\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`din_mode::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`din_mode::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
170pub struct DIN_MODE_SPEC;
171impl crate::RegisterSpec for DIN_MODE_SPEC {
172    type Ux = u32;
173}
174#[doc = "`read()` method returns [`din_mode::R`](R) reader structure"]
175impl crate::Readable for DIN_MODE_SPEC {}
176#[doc = "`write(|w| ..)` method takes [`din_mode::W`](W) writer structure"]
177impl crate::Writable for DIN_MODE_SPEC {
178    type Safety = crate::Unsafe;
179    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
180    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
181}
182#[doc = "`reset()` method sets DIN_MODE to value 0"]
183impl crate::Resettable for DIN_MODE_SPEC {
184    const RESET_VALUE: u32 = 0;
185}