Skip to main content

mcxa_pac/lpi2c0/
verid.rs

1#[doc = "Register `VERID` reader"]
2pub type R = crate::R<VeridSpec>;
3#[doc = "Feature Specification Number\n\nValue on reset: 3"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6#[repr(u16)]
7pub enum Feature {
8    #[doc = "2: Controller only, with standard feature set"]
9    MasterOnly = 2,
10    #[doc = "3: Controller and target, with standard feature set"]
11    MasterAndSlave = 3,
12}
13impl From<Feature> for u16 {
14    #[inline(always)]
15    fn from(variant: Feature) -> Self {
16        variant as _
17    }
18}
19impl crate::FieldSpec for Feature {
20    type Ux = u16;
21}
22impl crate::IsEnum for Feature {}
23#[doc = "Field `FEATURE` reader - Feature Specification Number"]
24pub type FeatureR = crate::FieldReader<Feature>;
25impl FeatureR {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> Option<Feature> {
29        match self.bits {
30            2 => Some(Feature::MasterOnly),
31            3 => Some(Feature::MasterAndSlave),
32            _ => None,
33        }
34    }
35    #[doc = "Controller only, with standard feature set"]
36    #[inline(always)]
37    pub fn is_master_only(&self) -> bool {
38        *self == Feature::MasterOnly
39    }
40    #[doc = "Controller and target, with standard feature set"]
41    #[inline(always)]
42    pub fn is_master_and_slave(&self) -> bool {
43        *self == Feature::MasterAndSlave
44    }
45}
46#[doc = "Field `MINOR` reader - Minor Version Number"]
47pub type MinorR = crate::FieldReader;
48#[doc = "Field `MAJOR` reader - Major Version Number"]
49pub type MajorR = crate::FieldReader;
50impl R {
51    #[doc = "Bits 0:15 - Feature Specification Number"]
52    #[inline(always)]
53    pub fn feature(&self) -> FeatureR {
54        FeatureR::new((self.bits & 0xffff) as u16)
55    }
56    #[doc = "Bits 16:23 - Minor Version Number"]
57    #[inline(always)]
58    pub fn minor(&self) -> MinorR {
59        MinorR::new(((self.bits >> 16) & 0xff) as u8)
60    }
61    #[doc = "Bits 24:31 - Major Version Number"]
62    #[inline(always)]
63    pub fn major(&self) -> MajorR {
64        MajorR::new(((self.bits >> 24) & 0xff) as u8)
65    }
66}
67#[cfg(feature = "debug")]
68impl core::fmt::Debug for R {
69    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
70        f.debug_struct("VERID")
71            .field("feature", &self.feature())
72            .field("minor", &self.minor())
73            .field("major", &self.major())
74            .finish()
75    }
76}
77#[doc = "Version ID\n\nYou can [`read`](crate::Reg::read) this register and get [`verid::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
78pub struct VeridSpec;
79impl crate::RegisterSpec for VeridSpec {
80    type Ux = u32;
81}
82#[doc = "`read()` method returns [`verid::R`](R) reader structure"]
83impl crate::Readable for VeridSpec {}
84#[doc = "`reset()` method sets VERID to value 0x0103_0003"]
85impl crate::Resettable for VeridSpec {
86    const RESET_VALUE: u32 = 0x0103_0003;
87}