nrf52840_pac/ficr/info/
flash.rs

1#[doc = "Register `FLASH` reader"]
2pub struct R(crate::R<FLASH_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FLASH_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FLASH_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FLASH_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `FLASH` reader - Flash variant"]
17pub type FLASH_R = crate::FieldReader<u32, FLASH_A>;
18#[doc = "Flash variant\n\nValue on reset: 4294967295"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u32)]
21pub enum FLASH_A {
22    #[doc = "128: 128 kByte FLASH"]
23    K128 = 128,
24    #[doc = "256: 256 kByte FLASH"]
25    K256 = 256,
26    #[doc = "512: 512 kByte FLASH"]
27    K512 = 512,
28    #[doc = "1024: 1 MByte FLASH"]
29    K1024 = 1024,
30    #[doc = "2048: 2 MByte FLASH"]
31    K2048 = 2048,
32    #[doc = "4294967295: Unspecified"]
33    UNSPECIFIED = 4294967295,
34}
35impl From<FLASH_A> for u32 {
36    #[inline(always)]
37    fn from(variant: FLASH_A) -> Self {
38        variant as _
39    }
40}
41impl FLASH_R {
42    #[doc = "Get enumerated values variant"]
43    #[inline(always)]
44    pub fn variant(&self) -> Option<FLASH_A> {
45        match self.bits {
46            128 => Some(FLASH_A::K128),
47            256 => Some(FLASH_A::K256),
48            512 => Some(FLASH_A::K512),
49            1024 => Some(FLASH_A::K1024),
50            2048 => Some(FLASH_A::K2048),
51            4294967295 => Some(FLASH_A::UNSPECIFIED),
52            _ => None,
53        }
54    }
55    #[doc = "Checks if the value of the field is `K128`"]
56    #[inline(always)]
57    pub fn is_k128(&self) -> bool {
58        *self == FLASH_A::K128
59    }
60    #[doc = "Checks if the value of the field is `K256`"]
61    #[inline(always)]
62    pub fn is_k256(&self) -> bool {
63        *self == FLASH_A::K256
64    }
65    #[doc = "Checks if the value of the field is `K512`"]
66    #[inline(always)]
67    pub fn is_k512(&self) -> bool {
68        *self == FLASH_A::K512
69    }
70    #[doc = "Checks if the value of the field is `K1024`"]
71    #[inline(always)]
72    pub fn is_k1024(&self) -> bool {
73        *self == FLASH_A::K1024
74    }
75    #[doc = "Checks if the value of the field is `K2048`"]
76    #[inline(always)]
77    pub fn is_k2048(&self) -> bool {
78        *self == FLASH_A::K2048
79    }
80    #[doc = "Checks if the value of the field is `UNSPECIFIED`"]
81    #[inline(always)]
82    pub fn is_unspecified(&self) -> bool {
83        *self == FLASH_A::UNSPECIFIED
84    }
85}
86impl R {
87    #[doc = "Bits 0:31 - Flash variant"]
88    #[inline(always)]
89    pub fn flash(&self) -> FLASH_R {
90        FLASH_R::new(self.bits)
91    }
92}
93#[doc = "Flash variant\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 [flash](index.html) module"]
94pub struct FLASH_SPEC;
95impl crate::RegisterSpec for FLASH_SPEC {
96    type Ux = u32;
97}
98#[doc = "`read()` method returns [flash::R](R) reader structure"]
99impl crate::Readable for FLASH_SPEC {
100    type Reader = R;
101}
102#[doc = "`reset()` method sets FLASH to value 0xffff_ffff"]
103impl crate::Resettable for FLASH_SPEC {
104    #[inline(always)]
105    fn reset_value() -> Self::Ux {
106        0xffff_ffff
107    }
108}