1#[doc = "Register `SPI2_CONF` reader"]
2pub type R = crate::R<SPI2_CONF_SPEC>;
3#[doc = "Register `SPI2_CONF` writer"]
4pub type W = crate::W<SPI2_CONF_SPEC>;
5#[doc = "Field `SPI2_CLK_EN` reader - Set 1 to enable spi2 apb clock"]
6pub type SPI2_CLK_EN_R = crate::BitReader;
7#[doc = "Field `SPI2_CLK_EN` writer - Set 1 to enable spi2 apb clock"]
8pub type SPI2_CLK_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SPI2_RST_EN` reader - Set 0 to reset spi2 module"]
10pub type SPI2_RST_EN_R = crate::BitReader;
11#[doc = "Field `SPI2_RST_EN` writer - Set 0 to reset spi2 module"]
12pub type SPI2_RST_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `SPI2_READY` reader - Query this field after reset spi2 module"]
14pub type SPI2_READY_R = crate::BitReader;
15impl R {
16 #[doc = "Bit 0 - Set 1 to enable spi2 apb clock"]
17 #[inline(always)]
18 pub fn spi2_clk_en(&self) -> SPI2_CLK_EN_R {
19 SPI2_CLK_EN_R::new((self.bits & 1) != 0)
20 }
21 #[doc = "Bit 1 - Set 0 to reset spi2 module"]
22 #[inline(always)]
23 pub fn spi2_rst_en(&self) -> SPI2_RST_EN_R {
24 SPI2_RST_EN_R::new(((self.bits >> 1) & 1) != 0)
25 }
26 #[doc = "Bit 2 - Query this field after reset spi2 module"]
27 #[inline(always)]
28 pub fn spi2_ready(&self) -> SPI2_READY_R {
29 SPI2_READY_R::new(((self.bits >> 2) & 1) != 0)
30 }
31}
32#[cfg(feature = "impl-register-debug")]
33impl core::fmt::Debug for R {
34 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
35 f.debug_struct("SPI2_CONF")
36 .field("spi2_clk_en", &self.spi2_clk_en())
37 .field("spi2_rst_en", &self.spi2_rst_en())
38 .field("spi2_ready", &self.spi2_ready())
39 .finish()
40 }
41}
42impl W {
43 #[doc = "Bit 0 - Set 1 to enable spi2 apb clock"]
44 #[inline(always)]
45 pub fn spi2_clk_en(&mut self) -> SPI2_CLK_EN_W<SPI2_CONF_SPEC> {
46 SPI2_CLK_EN_W::new(self, 0)
47 }
48 #[doc = "Bit 1 - Set 0 to reset spi2 module"]
49 #[inline(always)]
50 pub fn spi2_rst_en(&mut self) -> SPI2_RST_EN_W<SPI2_CONF_SPEC> {
51 SPI2_RST_EN_W::new(self, 1)
52 }
53}
54#[doc = "SPI2 configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`spi2_conf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`spi2_conf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct SPI2_CONF_SPEC;
56impl crate::RegisterSpec for SPI2_CONF_SPEC {
57 type Ux = u32;
58}
59#[doc = "`read()` method returns [`spi2_conf::R`](R) reader structure"]
60impl crate::Readable for SPI2_CONF_SPEC {}
61#[doc = "`write(|w| ..)` method takes [`spi2_conf::W`](W) writer structure"]
62impl crate::Writable for SPI2_CONF_SPEC {
63 type Safety = crate::Unsafe;
64 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
65 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
66}
67#[doc = "`reset()` method sets SPI2_CONF to value 0x05"]
68impl crate::Resettable for SPI2_CONF_SPEC {
69 const RESET_VALUE: u32 = 0x05;
70}