xmc4800/ecat0/
al_control.rs

1#[doc = "Register `AL_CONTROL` reader"]
2pub type R = crate::R<AL_CONTROL_SPEC>;
3#[doc = "Initiate State Transition of the Device StateMachine\n\nValue on reset: 1"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum IST_A {
7    #[doc = "1: Request Init State"]
8    VALUE1 = 1,
9    #[doc = "2: Request Pre-Operational State"]
10    VALUE2 = 2,
11    #[doc = "3: Request Bootstrap State"]
12    VALUE3 = 3,
13    #[doc = "4: Request Safe-Operational State"]
14    VALUE4 = 4,
15    #[doc = "8: Request Operational State"]
16    VALUE5 = 8,
17}
18impl From<IST_A> for u8 {
19    #[inline(always)]
20    fn from(variant: IST_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for IST_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for IST_A {}
28#[doc = "Field `IST` reader - Initiate State Transition of the Device StateMachine"]
29pub type IST_R = crate::FieldReader<IST_A>;
30impl IST_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Option<IST_A> {
34        match self.bits {
35            1 => Some(IST_A::VALUE1),
36            2 => Some(IST_A::VALUE2),
37            3 => Some(IST_A::VALUE3),
38            4 => Some(IST_A::VALUE4),
39            8 => Some(IST_A::VALUE5),
40            _ => None,
41        }
42    }
43    #[doc = "Request Init State"]
44    #[inline(always)]
45    pub fn is_value1(&self) -> bool {
46        *self == IST_A::VALUE1
47    }
48    #[doc = "Request Pre-Operational State"]
49    #[inline(always)]
50    pub fn is_value2(&self) -> bool {
51        *self == IST_A::VALUE2
52    }
53    #[doc = "Request Bootstrap State"]
54    #[inline(always)]
55    pub fn is_value3(&self) -> bool {
56        *self == IST_A::VALUE3
57    }
58    #[doc = "Request Safe-Operational State"]
59    #[inline(always)]
60    pub fn is_value4(&self) -> bool {
61        *self == IST_A::VALUE4
62    }
63    #[doc = "Request Operational State"]
64    #[inline(always)]
65    pub fn is_value5(&self) -> bool {
66        *self == IST_A::VALUE5
67    }
68}
69#[doc = "Error Ind Ack\n\nValue on reset: 0"]
70#[derive(Clone, Copy, Debug, PartialEq, Eq)]
71pub enum EIA_A {
72    #[doc = "0: No Ack of Error Ind in AL status register"]
73    VALUE1 = 0,
74    #[doc = "1: Ack of Error Ind in AL status register"]
75    VALUE2 = 1,
76}
77impl From<EIA_A> for bool {
78    #[inline(always)]
79    fn from(variant: EIA_A) -> Self {
80        variant as u8 != 0
81    }
82}
83#[doc = "Field `EIA` reader - Error Ind Ack"]
84pub type EIA_R = crate::BitReader<EIA_A>;
85impl EIA_R {
86    #[doc = "Get enumerated values variant"]
87    #[inline(always)]
88    pub const fn variant(&self) -> EIA_A {
89        match self.bits {
90            false => EIA_A::VALUE1,
91            true => EIA_A::VALUE2,
92        }
93    }
94    #[doc = "No Ack of Error Ind in AL status register"]
95    #[inline(always)]
96    pub fn is_value1(&self) -> bool {
97        *self == EIA_A::VALUE1
98    }
99    #[doc = "Ack of Error Ind in AL status register"]
100    #[inline(always)]
101    pub fn is_value2(&self) -> bool {
102        *self == EIA_A::VALUE2
103    }
104}
105#[doc = "Device Identification\n\nValue on reset: 0"]
106#[derive(Clone, Copy, Debug, PartialEq, Eq)]
107pub enum DID_A {
108    #[doc = "0: No request"]
109    VALUE1 = 0,
110    #[doc = "1: Device Identification request"]
111    VALUE2 = 1,
112}
113impl From<DID_A> for bool {
114    #[inline(always)]
115    fn from(variant: DID_A) -> Self {
116        variant as u8 != 0
117    }
118}
119#[doc = "Field `DID` reader - Device Identification"]
120pub type DID_R = crate::BitReader<DID_A>;
121impl DID_R {
122    #[doc = "Get enumerated values variant"]
123    #[inline(always)]
124    pub const fn variant(&self) -> DID_A {
125        match self.bits {
126            false => DID_A::VALUE1,
127            true => DID_A::VALUE2,
128        }
129    }
130    #[doc = "No request"]
131    #[inline(always)]
132    pub fn is_value1(&self) -> bool {
133        *self == DID_A::VALUE1
134    }
135    #[doc = "Device Identification request"]
136    #[inline(always)]
137    pub fn is_value2(&self) -> bool {
138        *self == DID_A::VALUE2
139    }
140}
141impl R {
142    #[doc = "Bits 0:3 - Initiate State Transition of the Device StateMachine"]
143    #[inline(always)]
144    pub fn ist(&self) -> IST_R {
145        IST_R::new((self.bits & 0x0f) as u8)
146    }
147    #[doc = "Bit 4 - Error Ind Ack"]
148    #[inline(always)]
149    pub fn eia(&self) -> EIA_R {
150        EIA_R::new(((self.bits >> 4) & 1) != 0)
151    }
152    #[doc = "Bit 5 - Device Identification"]
153    #[inline(always)]
154    pub fn did(&self) -> DID_R {
155        DID_R::new(((self.bits >> 5) & 1) != 0)
156    }
157}
158#[doc = "AL Control\n\nYou can [`read`](crate::Reg::read) this register and get [`al_control::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
159pub struct AL_CONTROL_SPEC;
160impl crate::RegisterSpec for AL_CONTROL_SPEC {
161    type Ux = u16;
162}
163#[doc = "`read()` method returns [`al_control::R`](R) reader structure"]
164impl crate::Readable for AL_CONTROL_SPEC {}
165#[doc = "`reset()` method sets AL_CONTROL to value 0x01"]
166impl crate::Resettable for AL_CONTROL_SPEC {
167    const RESET_VALUE: u16 = 0x01;
168}