efm32pg22_pac/efm32pg22c200/devinfo/
part.rs

1#[doc = "Register `PART` reader"]
2pub struct R(crate::R<PART_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PART_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PART_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PART_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `DEVICENUM` reader - Device Number"]
17pub type DEVICENUM_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `FAMILYNUM` reader - Device Family"]
19pub type FAMILYNUM_R = crate::FieldReader<u8, u8>;
20#[doc = "Field `FAMILY` reader - Device Family"]
21pub type FAMILY_R = crate::FieldReader<u8, FAMILY_A>;
22#[doc = "Device Family\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24#[repr(u8)]
25pub enum FAMILY_A {
26    #[doc = "0: Flex Gecko"]
27    FG = 0,
28    #[doc = "1: Mighty Gecko"]
29    MG = 1,
30    #[doc = "2: Blue Gecko"]
31    BG = 2,
32    #[doc = "5: Pearl Gecko"]
33    PG = 5,
34}
35impl From<FAMILY_A> for u8 {
36    #[inline(always)]
37    fn from(variant: FAMILY_A) -> Self {
38        variant as _
39    }
40}
41impl FAMILY_R {
42    #[doc = "Get enumerated values variant"]
43    #[inline(always)]
44    pub fn variant(&self) -> Option<FAMILY_A> {
45        match self.bits {
46            0 => Some(FAMILY_A::FG),
47            1 => Some(FAMILY_A::MG),
48            2 => Some(FAMILY_A::BG),
49            5 => Some(FAMILY_A::PG),
50            _ => None,
51        }
52    }
53    #[doc = "Checks if the value of the field is `FG`"]
54    #[inline(always)]
55    pub fn is_fg(&self) -> bool {
56        *self == FAMILY_A::FG
57    }
58    #[doc = "Checks if the value of the field is `MG`"]
59    #[inline(always)]
60    pub fn is_mg(&self) -> bool {
61        *self == FAMILY_A::MG
62    }
63    #[doc = "Checks if the value of the field is `BG`"]
64    #[inline(always)]
65    pub fn is_bg(&self) -> bool {
66        *self == FAMILY_A::BG
67    }
68    #[doc = "Checks if the value of the field is `PG`"]
69    #[inline(always)]
70    pub fn is_pg(&self) -> bool {
71        *self == FAMILY_A::PG
72    }
73}
74impl R {
75    #[doc = "Bits 0:15 - Device Number"]
76    #[inline(always)]
77    pub fn devicenum(&self) -> DEVICENUM_R {
78        DEVICENUM_R::new((self.bits & 0xffff) as u16)
79    }
80    #[doc = "Bits 16:21 - Device Family"]
81    #[inline(always)]
82    pub fn familynum(&self) -> FAMILYNUM_R {
83        FAMILYNUM_R::new(((self.bits >> 16) & 0x3f) as u8)
84    }
85    #[doc = "Bits 24:29 - Device Family"]
86    #[inline(always)]
87    pub fn family(&self) -> FAMILY_R {
88        FAMILY_R::new(((self.bits >> 24) & 0x3f) as u8)
89    }
90}
91#[doc = "Part description\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 [part](index.html) module"]
92pub struct PART_SPEC;
93impl crate::RegisterSpec for PART_SPEC {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [part::R](R) reader structure"]
97impl crate::Readable for PART_SPEC {
98    type Reader = R;
99}
100#[doc = "`reset()` method sets PART to value 0"]
101impl crate::Resettable for PART_SPEC {
102    const RESET_VALUE: Self::Ux = 0;
103}