xmc4700/can/
id.rs

1#[doc = "Register `ID` reader"]
2pub type R = crate::R<ID_SPEC>;
3#[doc = "Field `MOD_REV` reader - Module Revision Number"]
4pub type MOD_REV_R = crate::FieldReader;
5#[doc = "Module Type\n\nValue on reset: 192"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum MOD_TYPE_A {
9    #[doc = "192: Define the module as a 32-bit module."]
10    VALUE1 = 192,
11}
12impl From<MOD_TYPE_A> for u8 {
13    #[inline(always)]
14    fn from(variant: MOD_TYPE_A) -> Self {
15        variant as _
16    }
17}
18impl crate::FieldSpec for MOD_TYPE_A {
19    type Ux = u8;
20}
21impl crate::IsEnum for MOD_TYPE_A {}
22#[doc = "Field `MOD_TYPE` reader - Module Type"]
23pub type MOD_TYPE_R = crate::FieldReader<MOD_TYPE_A>;
24impl MOD_TYPE_R {
25    #[doc = "Get enumerated values variant"]
26    #[inline(always)]
27    pub const fn variant(&self) -> Option<MOD_TYPE_A> {
28        match self.bits {
29            192 => Some(MOD_TYPE_A::VALUE1),
30            _ => None,
31        }
32    }
33    #[doc = "Define the module as a 32-bit module."]
34    #[inline(always)]
35    pub fn is_value1(&self) -> bool {
36        *self == MOD_TYPE_A::VALUE1
37    }
38}
39#[doc = "Field `MOD_NUMBER` reader - Module Number Value"]
40pub type MOD_NUMBER_R = crate::FieldReader<u16>;
41impl R {
42    #[doc = "Bits 0:7 - Module Revision Number"]
43    #[inline(always)]
44    pub fn mod_rev(&self) -> MOD_REV_R {
45        MOD_REV_R::new((self.bits & 0xff) as u8)
46    }
47    #[doc = "Bits 8:15 - Module Type"]
48    #[inline(always)]
49    pub fn mod_type(&self) -> MOD_TYPE_R {
50        MOD_TYPE_R::new(((self.bits >> 8) & 0xff) as u8)
51    }
52    #[doc = "Bits 16:31 - Module Number Value"]
53    #[inline(always)]
54    pub fn mod_number(&self) -> MOD_NUMBER_R {
55        MOD_NUMBER_R::new(((self.bits >> 16) & 0xffff) as u16)
56    }
57}
58#[doc = "Module Identification Register\n\nYou can [`read`](crate::Reg::read) this register and get [`id::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
59pub struct ID_SPEC;
60impl crate::RegisterSpec for ID_SPEC {
61    type Ux = u32;
62}
63#[doc = "`read()` method returns [`id::R`](R) reader structure"]
64impl crate::Readable for ID_SPEC {}
65#[doc = "`reset()` method sets ID to value 0x00b5_c000"]
66impl crate::Resettable for ID_SPEC {
67    const RESET_VALUE: u32 = 0x00b5_c000;
68}