nrf52840_pac/qspi/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `DPM` reader - Deep power-down mode (DPM) status of external flash."]
17pub type DPM_R = crate::BitReader<DPM_A>;
18#[doc = "Deep power-down mode (DPM) status of external flash.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20pub enum DPM_A {
21    #[doc = "0: External flash is not in DPM."]
22    DISABLED = 0,
23    #[doc = "1: External flash is in DPM."]
24    ENABLED = 1,
25}
26impl From<DPM_A> for bool {
27    #[inline(always)]
28    fn from(variant: DPM_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl DPM_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> DPM_A {
36        match self.bits {
37            false => DPM_A::DISABLED,
38            true => DPM_A::ENABLED,
39        }
40    }
41    #[doc = "Checks if the value of the field is `DISABLED`"]
42    #[inline(always)]
43    pub fn is_disabled(&self) -> bool {
44        *self == DPM_A::DISABLED
45    }
46    #[doc = "Checks if the value of the field is `ENABLED`"]
47    #[inline(always)]
48    pub fn is_enabled(&self) -> bool {
49        *self == DPM_A::ENABLED
50    }
51}
52#[doc = "Field `READY` reader - Ready status."]
53pub type READY_R = crate::BitReader<READY_A>;
54#[doc = "Ready status.\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq)]
56pub enum READY_A {
57    #[doc = "1: QSPI peripheral is ready. It is allowed to trigger new tasks, writing custom instructions or enter/exit DPM."]
58    READY = 1,
59    #[doc = "0: QSPI peripheral is busy. It is not allowed to trigger any new tasks, writing custom instructions or enter/exit DPM."]
60    BUSY = 0,
61}
62impl From<READY_A> for bool {
63    #[inline(always)]
64    fn from(variant: READY_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl READY_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> READY_A {
72        match self.bits {
73            true => READY_A::READY,
74            false => READY_A::BUSY,
75        }
76    }
77    #[doc = "Checks if the value of the field is `READY`"]
78    #[inline(always)]
79    pub fn is_ready(&self) -> bool {
80        *self == READY_A::READY
81    }
82    #[doc = "Checks if the value of the field is `BUSY`"]
83    #[inline(always)]
84    pub fn is_busy(&self) -> bool {
85        *self == READY_A::BUSY
86    }
87}
88#[doc = "Field `SREG` reader - Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte."]
89pub type SREG_R = crate::FieldReader<u8, u8>;
90impl R {
91    #[doc = "Bit 2 - Deep power-down mode (DPM) status of external flash."]
92    #[inline(always)]
93    pub fn dpm(&self) -> DPM_R {
94        DPM_R::new(((self.bits >> 2) & 1) != 0)
95    }
96    #[doc = "Bit 3 - Ready status."]
97    #[inline(always)]
98    pub fn ready(&self) -> READY_R {
99        READY_R::new(((self.bits >> 3) & 1) != 0)
100    }
101    #[doc = "Bits 24:31 - Value of external flash device Status Register. When the external flash has two bytes status register this field includes the value of the low byte."]
102    #[inline(always)]
103    pub fn sreg(&self) -> SREG_R {
104        SREG_R::new(((self.bits >> 24) & 0xff) as u8)
105    }
106}
107#[doc = "Status register.\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"]
108pub struct STATUS_SPEC;
109impl crate::RegisterSpec for STATUS_SPEC {
110    type Ux = u32;
111}
112#[doc = "`read()` method returns [status::R](R) reader structure"]
113impl crate::Readable for STATUS_SPEC {
114    type Reader = R;
115}
116#[doc = "`reset()` method sets STATUS to value 0"]
117impl crate::Resettable for STATUS_SPEC {
118    #[inline(always)]
119    fn reset_value() -> Self::Ux {
120        0
121    }
122}