esp32s2/spi0/
flash_sus_ctrl.rs

1#[doc = "Register `FLASH_SUS_CTRL` reader"]
2pub type R = crate::R<FLASH_SUS_CTRL_SPEC>;
3#[doc = "Register `FLASH_SUS_CTRL` writer"]
4pub type W = crate::W<FLASH_SUS_CTRL_SPEC>;
5#[doc = "Field `FLASH_PES_EN` reader - "]
6pub type FLASH_PES_EN_R = crate::BitReader;
7#[doc = "Field `FLASH_PES_EN` writer - "]
8pub type FLASH_PES_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `FLASH_PER_COMMAND` reader - "]
10pub type FLASH_PER_COMMAND_R = crate::FieldReader;
11#[doc = "Field `FLASH_PER_COMMAND` writer - "]
12pub type FLASH_PER_COMMAND_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `FLASH_PES_COMMAND` reader - "]
14pub type FLASH_PES_COMMAND_R = crate::FieldReader;
15#[doc = "Field `FLASH_PES_COMMAND` writer - "]
16pub type FLASH_PES_COMMAND_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
17impl R {
18    #[doc = "Bit 0"]
19    #[inline(always)]
20    pub fn flash_pes_en(&self) -> FLASH_PES_EN_R {
21        FLASH_PES_EN_R::new((self.bits & 1) != 0)
22    }
23    #[doc = "Bits 1:8"]
24    #[inline(always)]
25    pub fn flash_per_command(&self) -> FLASH_PER_COMMAND_R {
26        FLASH_PER_COMMAND_R::new(((self.bits >> 1) & 0xff) as u8)
27    }
28    #[doc = "Bits 9:16"]
29    #[inline(always)]
30    pub fn flash_pes_command(&self) -> FLASH_PES_COMMAND_R {
31        FLASH_PES_COMMAND_R::new(((self.bits >> 9) & 0xff) 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("FLASH_SUS_CTRL")
38            .field("flash_pes_command", &self.flash_pes_command())
39            .field("flash_per_command", &self.flash_per_command())
40            .field("flash_pes_en", &self.flash_pes_en())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bit 0"]
46    #[inline(always)]
47    pub fn flash_pes_en(&mut self) -> FLASH_PES_EN_W<FLASH_SUS_CTRL_SPEC> {
48        FLASH_PES_EN_W::new(self, 0)
49    }
50    #[doc = "Bits 1:8"]
51    #[inline(always)]
52    pub fn flash_per_command(&mut self) -> FLASH_PER_COMMAND_W<FLASH_SUS_CTRL_SPEC> {
53        FLASH_PER_COMMAND_W::new(self, 1)
54    }
55    #[doc = "Bits 9:16"]
56    #[inline(always)]
57    pub fn flash_pes_command(&mut self) -> FLASH_PES_COMMAND_W<FLASH_SUS_CTRL_SPEC> {
58        FLASH_PES_COMMAND_W::new(self, 9)
59    }
60}
61#[doc = "SPI Memory Flash Suspend Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`flash_sus_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`flash_sus_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
62pub struct FLASH_SUS_CTRL_SPEC;
63impl crate::RegisterSpec for FLASH_SUS_CTRL_SPEC {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [`flash_sus_ctrl::R`](R) reader structure"]
67impl crate::Readable for FLASH_SUS_CTRL_SPEC {}
68#[doc = "`write(|w| ..)` method takes [`flash_sus_ctrl::W`](W) writer structure"]
69impl crate::Writable for FLASH_SUS_CTRL_SPEC {
70    type Safety = crate::Unsafe;
71}
72#[doc = "`reset()` method sets FLASH_SUS_CTRL to value 0"]
73impl crate::Resettable for FLASH_SUS_CTRL_SPEC {}