nrf52832_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: 512"]
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 = "4294967295: Unspecified"]
29    UNSPECIFIED = 4294967295,
30}
31impl From<FLASH_A> for u32 {
32    #[inline(always)]
33    fn from(variant: FLASH_A) -> Self {
34        variant as _
35    }
36}
37impl FLASH_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub fn variant(&self) -> Option<FLASH_A> {
41        match self.bits {
42            128 => Some(FLASH_A::K128),
43            256 => Some(FLASH_A::K256),
44            512 => Some(FLASH_A::K512),
45            4294967295 => Some(FLASH_A::UNSPECIFIED),
46            _ => None,
47        }
48    }
49    #[doc = "Checks if the value of the field is `K128`"]
50    #[inline(always)]
51    pub fn is_k128(&self) -> bool {
52        *self == FLASH_A::K128
53    }
54    #[doc = "Checks if the value of the field is `K256`"]
55    #[inline(always)]
56    pub fn is_k256(&self) -> bool {
57        *self == FLASH_A::K256
58    }
59    #[doc = "Checks if the value of the field is `K512`"]
60    #[inline(always)]
61    pub fn is_k512(&self) -> bool {
62        *self == FLASH_A::K512
63    }
64    #[doc = "Checks if the value of the field is `UNSPECIFIED`"]
65    #[inline(always)]
66    pub fn is_unspecified(&self) -> bool {
67        *self == FLASH_A::UNSPECIFIED
68    }
69}
70impl R {
71    #[doc = "Bits 0:31 - Flash variant"]
72    #[inline(always)]
73    pub fn flash(&self) -> FLASH_R {
74        FLASH_R::new(self.bits)
75    }
76}
77#[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"]
78pub struct FLASH_SPEC;
79impl crate::RegisterSpec for FLASH_SPEC {
80    type Ux = u32;
81}
82#[doc = "`read()` method returns [flash::R](R) reader structure"]
83impl crate::Readable for FLASH_SPEC {
84    type Reader = R;
85}
86#[doc = "`reset()` method sets FLASH to value 0x0200"]
87impl crate::Resettable for FLASH_SPEC {
88    #[inline(always)]
89    fn reset_value() -> Self::Ux {
90        0x0200
91    }
92}