efm32pg22_pac/efm32pg22c200/devinfo/
pkginfo.rs

1#[doc = "Register `PKGINFO` reader"]
2pub struct R(crate::R<PKGINFO_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PKGINFO_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PKGINFO_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PKGINFO_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `TEMPGRADE` reader - Temperature Grade"]
17pub type TEMPGRADE_R = crate::FieldReader<u8, TEMPGRADE_A>;
18#[doc = "Temperature Grade\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20#[repr(u8)]
21pub enum TEMPGRADE_A {
22    #[doc = "0: -40 to 85 degC"]
23    N40TO85 = 0,
24    #[doc = "1: -40 to 125 degC"]
25    N40TO125 = 1,
26    #[doc = "2: -40 to 105 degC"]
27    N40TO105 = 2,
28    #[doc = "3: 0 to 70 degC"]
29    N0TO70 = 3,
30}
31impl From<TEMPGRADE_A> for u8 {
32    #[inline(always)]
33    fn from(variant: TEMPGRADE_A) -> Self {
34        variant as _
35    }
36}
37impl TEMPGRADE_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub fn variant(&self) -> Option<TEMPGRADE_A> {
41        match self.bits {
42            0 => Some(TEMPGRADE_A::N40TO85),
43            1 => Some(TEMPGRADE_A::N40TO125),
44            2 => Some(TEMPGRADE_A::N40TO105),
45            3 => Some(TEMPGRADE_A::N0TO70),
46            _ => None,
47        }
48    }
49    #[doc = "Checks if the value of the field is `N40TO85`"]
50    #[inline(always)]
51    pub fn is_n40to85(&self) -> bool {
52        *self == TEMPGRADE_A::N40TO85
53    }
54    #[doc = "Checks if the value of the field is `N40TO125`"]
55    #[inline(always)]
56    pub fn is_n40to125(&self) -> bool {
57        *self == TEMPGRADE_A::N40TO125
58    }
59    #[doc = "Checks if the value of the field is `N40TO105`"]
60    #[inline(always)]
61    pub fn is_n40to105(&self) -> bool {
62        *self == TEMPGRADE_A::N40TO105
63    }
64    #[doc = "Checks if the value of the field is `N0TO70`"]
65    #[inline(always)]
66    pub fn is_n0to70(&self) -> bool {
67        *self == TEMPGRADE_A::N0TO70
68    }
69}
70#[doc = "Field `PKGTYPE` reader - Package Type"]
71pub type PKGTYPE_R = crate::FieldReader<u8, PKGTYPE_A>;
72#[doc = "Package Type\n\nValue on reset: 0"]
73#[derive(Clone, Copy, Debug, PartialEq, Eq)]
74#[repr(u8)]
75pub enum PKGTYPE_A {
76    #[doc = "74: WLCSP package"]
77    WLCSP = 74,
78    #[doc = "76: BGA package"]
79    BGA = 76,
80    #[doc = "77: QFN package"]
81    QFN = 77,
82    #[doc = "81: QFP package"]
83    QFP = 81,
84}
85impl From<PKGTYPE_A> for u8 {
86    #[inline(always)]
87    fn from(variant: PKGTYPE_A) -> Self {
88        variant as _
89    }
90}
91impl PKGTYPE_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub fn variant(&self) -> Option<PKGTYPE_A> {
95        match self.bits {
96            74 => Some(PKGTYPE_A::WLCSP),
97            76 => Some(PKGTYPE_A::BGA),
98            77 => Some(PKGTYPE_A::QFN),
99            81 => Some(PKGTYPE_A::QFP),
100            _ => None,
101        }
102    }
103    #[doc = "Checks if the value of the field is `WLCSP`"]
104    #[inline(always)]
105    pub fn is_wlcsp(&self) -> bool {
106        *self == PKGTYPE_A::WLCSP
107    }
108    #[doc = "Checks if the value of the field is `BGA`"]
109    #[inline(always)]
110    pub fn is_bga(&self) -> bool {
111        *self == PKGTYPE_A::BGA
112    }
113    #[doc = "Checks if the value of the field is `QFN`"]
114    #[inline(always)]
115    pub fn is_qfn(&self) -> bool {
116        *self == PKGTYPE_A::QFN
117    }
118    #[doc = "Checks if the value of the field is `QFP`"]
119    #[inline(always)]
120    pub fn is_qfp(&self) -> bool {
121        *self == PKGTYPE_A::QFP
122    }
123}
124#[doc = "Field `PINCOUNT` reader - Pin Count"]
125pub type PINCOUNT_R = crate::FieldReader<u8, u8>;
126impl R {
127    #[doc = "Bits 0:7 - Temperature Grade"]
128    #[inline(always)]
129    pub fn tempgrade(&self) -> TEMPGRADE_R {
130        TEMPGRADE_R::new((self.bits & 0xff) as u8)
131    }
132    #[doc = "Bits 8:15 - Package Type"]
133    #[inline(always)]
134    pub fn pkgtype(&self) -> PKGTYPE_R {
135        PKGTYPE_R::new(((self.bits >> 8) & 0xff) as u8)
136    }
137    #[doc = "Bits 16:23 - Pin Count"]
138    #[inline(always)]
139    pub fn pincount(&self) -> PINCOUNT_R {
140        PINCOUNT_R::new(((self.bits >> 16) & 0xff) as u8)
141    }
142}
143#[doc = "Miscellaneous device information\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 [pkginfo](index.html) module"]
144pub struct PKGINFO_SPEC;
145impl crate::RegisterSpec for PKGINFO_SPEC {
146    type Ux = u32;
147}
148#[doc = "`read()` method returns [pkginfo::R](R) reader structure"]
149impl crate::Readable for PKGINFO_SPEC {
150    type Reader = R;
151}
152#[doc = "`reset()` method sets PKGINFO to value 0"]
153impl crate::Resettable for PKGINFO_SPEC {
154    const RESET_VALUE: Self::Ux = 0;
155}