esp32c2/spi0/
fsm.rs

1#[doc = "Register `FSM` reader"]
2pub type R = crate::R<FSM_SPEC>;
3#[doc = "Register `FSM` writer"]
4pub type W = crate::W<FSM_SPEC>;
5#[doc = "Field `CSPI_ST` reader - The current status of SPI0 slave FSM: spi0_slv_st. 0: idle state, 1: preparation state, 2: send command state, 3: send address state, 4: wait state, 5: read data state, 6:write data state, 7: done state, 8: read data end state."]
6pub type CSPI_ST_R = crate::FieldReader;
7#[doc = "Field `EM_ST` reader - The current status of SPI0 master FSM: spi0_mst_st. 0: idle state, 1:EM_CACHE_GRANT , 2: program/erase suspend state, 3: SPI0 read data state, 4: wait cache/EDMA sent data is stored in SPI0 TX FIFO, 5: SPI0 write data state."]
8pub type EM_ST_R = crate::FieldReader;
9#[doc = "Field `CSPI_LOCK_DELAY_TIME` reader - The lock delay time of SPI0/1 arbiter by spi0_slv_st, after PER is sent by SPI1."]
10pub type CSPI_LOCK_DELAY_TIME_R = crate::FieldReader;
11#[doc = "Field `CSPI_LOCK_DELAY_TIME` writer - The lock delay time of SPI0/1 arbiter by spi0_slv_st, after PER is sent by SPI1."]
12pub type CSPI_LOCK_DELAY_TIME_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13impl R {
14    #[doc = "Bits 0:3 - The current status of SPI0 slave FSM: spi0_slv_st. 0: idle state, 1: preparation state, 2: send command state, 3: send address state, 4: wait state, 5: read data state, 6:write data state, 7: done state, 8: read data end state."]
15    #[inline(always)]
16    pub fn cspi_st(&self) -> CSPI_ST_R {
17        CSPI_ST_R::new((self.bits & 0x0f) as u8)
18    }
19    #[doc = "Bits 4:6 - The current status of SPI0 master FSM: spi0_mst_st. 0: idle state, 1:EM_CACHE_GRANT , 2: program/erase suspend state, 3: SPI0 read data state, 4: wait cache/EDMA sent data is stored in SPI0 TX FIFO, 5: SPI0 write data state."]
20    #[inline(always)]
21    pub fn em_st(&self) -> EM_ST_R {
22        EM_ST_R::new(((self.bits >> 4) & 7) as u8)
23    }
24    #[doc = "Bits 7:11 - The lock delay time of SPI0/1 arbiter by spi0_slv_st, after PER is sent by SPI1."]
25    #[inline(always)]
26    pub fn cspi_lock_delay_time(&self) -> CSPI_LOCK_DELAY_TIME_R {
27        CSPI_LOCK_DELAY_TIME_R::new(((self.bits >> 7) & 0x1f) as u8)
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("FSM")
34            .field("cspi_st", &self.cspi_st())
35            .field("em_st", &self.em_st())
36            .field("cspi_lock_delay_time", &self.cspi_lock_delay_time())
37            .finish()
38    }
39}
40impl W {
41    #[doc = "Bits 7:11 - The lock delay time of SPI0/1 arbiter by spi0_slv_st, after PER is sent by SPI1."]
42    #[inline(always)]
43    pub fn cspi_lock_delay_time(&mut self) -> CSPI_LOCK_DELAY_TIME_W<FSM_SPEC> {
44        CSPI_LOCK_DELAY_TIME_W::new(self, 7)
45    }
46}
47#[doc = "SPI0 FSM status register\n\nYou can [`read`](crate::Reg::read) this register and get [`fsm::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fsm::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
48pub struct FSM_SPEC;
49impl crate::RegisterSpec for FSM_SPEC {
50    type Ux = u32;
51}
52#[doc = "`read()` method returns [`fsm::R`](R) reader structure"]
53impl crate::Readable for FSM_SPEC {}
54#[doc = "`write(|w| ..)` method takes [`fsm::W`](W) writer structure"]
55impl crate::Writable for FSM_SPEC {
56    type Safety = crate::Unsafe;
57    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
58    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
59}
60#[doc = "`reset()` method sets FSM to value 0x0200"]
61impl crate::Resettable for FSM_SPEC {
62    const RESET_VALUE: u32 = 0x0200;
63}