1#[doc = "Register `TCR` reader"]
2pub struct R(crate::R<TCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TCR` writer"]
17pub struct W(crate::W<TCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TCR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<TCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TSTE` reader - CAN Test Mode Enable"]
38pub type TSTE_R = crate::BitReader<TSTE_A>;
39#[doc = "CAN Test Mode Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TSTE_A {
42 #[doc = "0: CAN test mode disabled"]
43 _0 = 0,
44 #[doc = "1: CAN test mode enabled"]
45 _1 = 1,
46}
47impl From<TSTE_A> for bool {
48 #[inline(always)]
49 fn from(variant: TSTE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl TSTE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> TSTE_A {
57 match self.bits {
58 false => TSTE_A::_0,
59 true => TSTE_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == TSTE_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == TSTE_A::_1
71 }
72}
73#[doc = "Field `TSTE` writer - CAN Test Mode Enable"]
74pub type TSTE_W<'a, const O: u8> = crate::BitWriter<'a, u8, TCR_SPEC, TSTE_A, O>;
75impl<'a, const O: u8> TSTE_W<'a, O> {
76 #[doc = "CAN test mode disabled"]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(TSTE_A::_0)
80 }
81 #[doc = "CAN test mode enabled"]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(TSTE_A::_1)
85 }
86}
87#[doc = "Field `TSTM` reader - CAN Test Mode Select"]
88pub type TSTM_R = crate::FieldReader<u8, TSTM_A>;
89#[doc = "CAN Test Mode Select\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91#[repr(u8)]
92pub enum TSTM_A {
93 #[doc = "0: Other than CAN test mode"]
94 _00 = 0,
95 #[doc = "1: Listen-only mode"]
96 _01 = 1,
97 #[doc = "2: Self-test mode 0 (external loopback)"]
98 _10 = 2,
99 #[doc = "3: Self-test mode 1 (internal loopback)"]
100 _11 = 3,
101}
102impl From<TSTM_A> for u8 {
103 #[inline(always)]
104 fn from(variant: TSTM_A) -> Self {
105 variant as _
106 }
107}
108impl TSTM_R {
109 #[doc = "Get enumerated values variant"]
110 #[inline(always)]
111 pub fn variant(&self) -> TSTM_A {
112 match self.bits {
113 0 => TSTM_A::_00,
114 1 => TSTM_A::_01,
115 2 => TSTM_A::_10,
116 3 => TSTM_A::_11,
117 _ => unreachable!(),
118 }
119 }
120 #[doc = "Checks if the value of the field is `_00`"]
121 #[inline(always)]
122 pub fn is_00(&self) -> bool {
123 *self == TSTM_A::_00
124 }
125 #[doc = "Checks if the value of the field is `_01`"]
126 #[inline(always)]
127 pub fn is_01(&self) -> bool {
128 *self == TSTM_A::_01
129 }
130 #[doc = "Checks if the value of the field is `_10`"]
131 #[inline(always)]
132 pub fn is_10(&self) -> bool {
133 *self == TSTM_A::_10
134 }
135 #[doc = "Checks if the value of the field is `_11`"]
136 #[inline(always)]
137 pub fn is_11(&self) -> bool {
138 *self == TSTM_A::_11
139 }
140}
141#[doc = "Field `TSTM` writer - CAN Test Mode Select"]
142pub type TSTM_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, TCR_SPEC, u8, TSTM_A, 2, O>;
143impl<'a, const O: u8> TSTM_W<'a, O> {
144 #[doc = "Other than CAN test mode"]
145 #[inline(always)]
146 pub fn _00(self) -> &'a mut W {
147 self.variant(TSTM_A::_00)
148 }
149 #[doc = "Listen-only mode"]
150 #[inline(always)]
151 pub fn _01(self) -> &'a mut W {
152 self.variant(TSTM_A::_01)
153 }
154 #[doc = "Self-test mode 0 (external loopback)"]
155 #[inline(always)]
156 pub fn _10(self) -> &'a mut W {
157 self.variant(TSTM_A::_10)
158 }
159 #[doc = "Self-test mode 1 (internal loopback)"]
160 #[inline(always)]
161 pub fn _11(self) -> &'a mut W {
162 self.variant(TSTM_A::_11)
163 }
164}
165impl R {
166 #[doc = "Bit 0 - CAN Test Mode Enable"]
167 #[inline(always)]
168 pub fn tste(&self) -> TSTE_R {
169 TSTE_R::new((self.bits & 1) != 0)
170 }
171 #[doc = "Bits 1:2 - CAN Test Mode Select"]
172 #[inline(always)]
173 pub fn tstm(&self) -> TSTM_R {
174 TSTM_R::new((self.bits >> 1) & 3)
175 }
176}
177impl W {
178 #[doc = "Bit 0 - CAN Test Mode Enable"]
179 #[inline(always)]
180 #[must_use]
181 pub fn tste(&mut self) -> TSTE_W<0> {
182 TSTE_W::new(self)
183 }
184 #[doc = "Bits 1:2 - CAN Test Mode Select"]
185 #[inline(always)]
186 #[must_use]
187 pub fn tstm(&mut self) -> TSTM_W<1> {
188 TSTM_W::new(self)
189 }
190 #[doc = "Writes raw bits to the register."]
191 #[inline(always)]
192 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
193 self.0.bits(bits);
194 self
195 }
196}
197#[doc = "Test Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [tcr](index.html) module"]
198pub struct TCR_SPEC;
199impl crate::RegisterSpec for TCR_SPEC {
200 type Ux = u8;
201}
202#[doc = "`read()` method returns [tcr::R](R) reader structure"]
203impl crate::Readable for TCR_SPEC {
204 type Reader = R;
205}
206#[doc = "`write(|w| ..)` method takes [tcr::W](W) writer structure"]
207impl crate::Writable for TCR_SPEC {
208 type Writer = W;
209 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
210 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
211}
212#[doc = "`reset()` method sets TCR to value 0"]
213impl crate::Resettable for TCR_SPEC {
214 const RESET_VALUE: Self::Ux = 0;
215}