efm32pg22_pac/efm32pg22c200/devinfo/
extinfo.rs

1#[doc = "Register `EXTINFO` reader"]
2pub struct R(crate::R<EXTINFO_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EXTINFO_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EXTINFO_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EXTINFO_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `TYPE` reader - Type"]
17pub type TYPE_R = crate::FieldReader<u8, TYPE_A>;
18#[doc = "Type\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20#[repr(u8)]
21pub enum TYPE_A {
22    #[doc = "255: NONE"]
23    NONE = 255,
24}
25impl From<TYPE_A> for u8 {
26    #[inline(always)]
27    fn from(variant: TYPE_A) -> Self {
28        variant as _
29    }
30}
31impl TYPE_R {
32    #[doc = "Get enumerated values variant"]
33    #[inline(always)]
34    pub fn variant(&self) -> Option<TYPE_A> {
35        match self.bits {
36            255 => Some(TYPE_A::NONE),
37            _ => None,
38        }
39    }
40    #[doc = "Checks if the value of the field is `NONE`"]
41    #[inline(always)]
42    pub fn is_none(&self) -> bool {
43        *self == TYPE_A::NONE
44    }
45}
46#[doc = "Field `CONNECTION` reader - Connection"]
47pub type CONNECTION_R = crate::FieldReader<u8, CONNECTION_A>;
48#[doc = "Connection\n\nValue on reset: 0"]
49#[derive(Clone, Copy, Debug, PartialEq, Eq)]
50#[repr(u8)]
51pub enum CONNECTION_A {
52    #[doc = "0: SPI control interface"]
53    SPI = 0,
54    #[doc = "255: No interface"]
55    NONE = 255,
56}
57impl From<CONNECTION_A> for u8 {
58    #[inline(always)]
59    fn from(variant: CONNECTION_A) -> Self {
60        variant as _
61    }
62}
63impl CONNECTION_R {
64    #[doc = "Get enumerated values variant"]
65    #[inline(always)]
66    pub fn variant(&self) -> Option<CONNECTION_A> {
67        match self.bits {
68            0 => Some(CONNECTION_A::SPI),
69            255 => Some(CONNECTION_A::NONE),
70            _ => None,
71        }
72    }
73    #[doc = "Checks if the value of the field is `SPI`"]
74    #[inline(always)]
75    pub fn is_spi(&self) -> bool {
76        *self == CONNECTION_A::SPI
77    }
78    #[doc = "Checks if the value of the field is `NONE`"]
79    #[inline(always)]
80    pub fn is_none(&self) -> bool {
81        *self == CONNECTION_A::NONE
82    }
83}
84#[doc = "Field `REV` reader - Revision"]
85pub type REV_R = crate::FieldReader<u8, u8>;
86impl R {
87    #[doc = "Bits 0:7 - Type"]
88    #[inline(always)]
89    pub fn type_(&self) -> TYPE_R {
90        TYPE_R::new((self.bits & 0xff) as u8)
91    }
92    #[doc = "Bits 8:15 - Connection"]
93    #[inline(always)]
94    pub fn connection(&self) -> CONNECTION_R {
95        CONNECTION_R::new(((self.bits >> 8) & 0xff) as u8)
96    }
97    #[doc = "Bits 16:23 - Revision"]
98    #[inline(always)]
99    pub fn rev(&self) -> REV_R {
100        REV_R::new(((self.bits >> 16) & 0xff) as u8)
101    }
102}
103#[doc = "External component 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 [extinfo](index.html) module"]
104pub struct EXTINFO_SPEC;
105impl crate::RegisterSpec for EXTINFO_SPEC {
106    type Ux = u32;
107}
108#[doc = "`read()` method returns [extinfo::R](R) reader structure"]
109impl crate::Readable for EXTINFO_SPEC {
110    type Reader = R;
111}
112#[doc = "`reset()` method sets EXTINFO to value 0"]
113impl crate::Resettable for EXTINFO_SPEC {
114    const RESET_VALUE: Self::Ux = 0;
115}