nrf51_pac/ficr/
ppfc.rs

1#[doc = "Register `PPFC` reader"]
2pub struct R(crate::R<PPFC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PPFC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PPFC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PPFC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `PPFC` reader - Pre-programmed factory code present."]
17pub type PPFC_R = crate::FieldReader<u8, PPFC_A>;
18#[doc = "Pre-programmed factory code present.\n\nValue on reset: 255"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20#[repr(u8)]
21pub enum PPFC_A {
22    #[doc = "255: Not present."]
23    NOT_PRESENT = 255,
24    #[doc = "0: Present."]
25    PRESENT = 0,
26}
27impl From<PPFC_A> for u8 {
28    #[inline(always)]
29    fn from(variant: PPFC_A) -> Self {
30        variant as _
31    }
32}
33impl PPFC_R {
34    #[doc = "Get enumerated values variant"]
35    #[inline(always)]
36    pub fn variant(&self) -> Option<PPFC_A> {
37        match self.bits {
38            255 => Some(PPFC_A::NOT_PRESENT),
39            0 => Some(PPFC_A::PRESENT),
40            _ => None,
41        }
42    }
43    #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
44    #[inline(always)]
45    pub fn is_not_present(&self) -> bool {
46        *self == PPFC_A::NOT_PRESENT
47    }
48    #[doc = "Checks if the value of the field is `PRESENT`"]
49    #[inline(always)]
50    pub fn is_present(&self) -> bool {
51        *self == PPFC_A::PRESENT
52    }
53}
54impl R {
55    #[doc = "Bits 0:7 - Pre-programmed factory code present."]
56    #[inline(always)]
57    pub fn ppfc(&self) -> PPFC_R {
58        PPFC_R::new((self.bits & 0xff) as u8)
59    }
60}
61#[doc = "Pre-programmed factory code present.\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 [ppfc](index.html) module"]
62pub struct PPFC_SPEC;
63impl crate::RegisterSpec for PPFC_SPEC {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [ppfc::R](R) reader structure"]
67impl crate::Readable for PPFC_SPEC {
68    type Reader = R;
69}
70#[doc = "`reset()` method sets PPFC to value 0xffff_ffff"]
71impl crate::Resettable for PPFC_SPEC {
72    #[inline(always)]
73    fn reset_value() -> Self::Ux {
74        0xffff_ffff
75    }
76}