ra4m3/sysc/
trckcr.rs

1#[doc = "Register `TRCKCR` reader"]
2pub struct R(crate::R<TRCKCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TRCKCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TRCKCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TRCKCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TRCKCR` writer"]
17pub struct W(crate::W<TRCKCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TRCKCR_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<TRCKCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TRCKCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TRCK` reader - Trace Clock operating frequency select"]
38pub type TRCK_R = crate::FieldReader<u8, TRCK_A>;
39#[doc = "Trace Clock operating frequency select\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum TRCK_A {
43    #[doc = "0: /1"]
44    _0X0 = 0,
45    #[doc = "1: /2 (value after reset)"]
46    _0X1 = 1,
47    #[doc = "2: /4"]
48    _0X2 = 2,
49}
50impl From<TRCK_A> for u8 {
51    #[inline(always)]
52    fn from(variant: TRCK_A) -> Self {
53        variant as _
54    }
55}
56impl TRCK_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<TRCK_A> {
60        match self.bits {
61            0 => Some(TRCK_A::_0X0),
62            1 => Some(TRCK_A::_0X1),
63            2 => Some(TRCK_A::_0X2),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `_0X0`"]
68    #[inline(always)]
69    pub fn is_0x0(&self) -> bool {
70        *self == TRCK_A::_0X0
71    }
72    #[doc = "Checks if the value of the field is `_0X1`"]
73    #[inline(always)]
74    pub fn is_0x1(&self) -> bool {
75        *self == TRCK_A::_0X1
76    }
77    #[doc = "Checks if the value of the field is `_0X2`"]
78    #[inline(always)]
79    pub fn is_0x2(&self) -> bool {
80        *self == TRCK_A::_0X2
81    }
82}
83#[doc = "Field `TRCK` writer - Trace Clock operating frequency select"]
84pub type TRCK_W<'a, const O: u8> = crate::FieldWriter<'a, u8, TRCKCR_SPEC, u8, TRCK_A, 4, O>;
85impl<'a, const O: u8> TRCK_W<'a, O> {
86    #[doc = "/1"]
87    #[inline(always)]
88    pub fn _0x0(self) -> &'a mut W {
89        self.variant(TRCK_A::_0X0)
90    }
91    #[doc = "/2 (value after reset)"]
92    #[inline(always)]
93    pub fn _0x1(self) -> &'a mut W {
94        self.variant(TRCK_A::_0X1)
95    }
96    #[doc = "/4"]
97    #[inline(always)]
98    pub fn _0x2(self) -> &'a mut W {
99        self.variant(TRCK_A::_0X2)
100    }
101}
102#[doc = "Field `TRCKEN` reader - Trace Clock operating Enable"]
103pub type TRCKEN_R = crate::BitReader<TRCKEN_A>;
104#[doc = "Trace Clock operating Enable\n\nValue on reset: 0"]
105#[derive(Clone, Copy, Debug, PartialEq, Eq)]
106pub enum TRCKEN_A {
107    #[doc = "0: Stop"]
108    _0 = 0,
109    #[doc = "1: Operation enable"]
110    _1 = 1,
111}
112impl From<TRCKEN_A> for bool {
113    #[inline(always)]
114    fn from(variant: TRCKEN_A) -> Self {
115        variant as u8 != 0
116    }
117}
118impl TRCKEN_R {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub fn variant(&self) -> TRCKEN_A {
122        match self.bits {
123            false => TRCKEN_A::_0,
124            true => TRCKEN_A::_1,
125        }
126    }
127    #[doc = "Checks if the value of the field is `_0`"]
128    #[inline(always)]
129    pub fn is_0(&self) -> bool {
130        *self == TRCKEN_A::_0
131    }
132    #[doc = "Checks if the value of the field is `_1`"]
133    #[inline(always)]
134    pub fn is_1(&self) -> bool {
135        *self == TRCKEN_A::_1
136    }
137}
138#[doc = "Field `TRCKEN` writer - Trace Clock operating Enable"]
139pub type TRCKEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, TRCKCR_SPEC, TRCKEN_A, O>;
140impl<'a, const O: u8> TRCKEN_W<'a, O> {
141    #[doc = "Stop"]
142    #[inline(always)]
143    pub fn _0(self) -> &'a mut W {
144        self.variant(TRCKEN_A::_0)
145    }
146    #[doc = "Operation enable"]
147    #[inline(always)]
148    pub fn _1(self) -> &'a mut W {
149        self.variant(TRCKEN_A::_1)
150    }
151}
152impl R {
153    #[doc = "Bits 0:3 - Trace Clock operating frequency select"]
154    #[inline(always)]
155    pub fn trck(&self) -> TRCK_R {
156        TRCK_R::new(self.bits & 0x0f)
157    }
158    #[doc = "Bit 7 - Trace Clock operating Enable"]
159    #[inline(always)]
160    pub fn trcken(&self) -> TRCKEN_R {
161        TRCKEN_R::new(((self.bits >> 7) & 1) != 0)
162    }
163}
164impl W {
165    #[doc = "Bits 0:3 - Trace Clock operating frequency select"]
166    #[inline(always)]
167    #[must_use]
168    pub fn trck(&mut self) -> TRCK_W<0> {
169        TRCK_W::new(self)
170    }
171    #[doc = "Bit 7 - Trace Clock operating Enable"]
172    #[inline(always)]
173    #[must_use]
174    pub fn trcken(&mut self) -> TRCKEN_W<7> {
175        TRCKEN_W::new(self)
176    }
177    #[doc = "Writes raw bits to the register."]
178    #[inline(always)]
179    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
180        self.0.bits(bits);
181        self
182    }
183}
184#[doc = "Trace Clock 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 [trckcr](index.html) module"]
185pub struct TRCKCR_SPEC;
186impl crate::RegisterSpec for TRCKCR_SPEC {
187    type Ux = u8;
188}
189#[doc = "`read()` method returns [trckcr::R](R) reader structure"]
190impl crate::Readable for TRCKCR_SPEC {
191    type Reader = R;
192}
193#[doc = "`write(|w| ..)` method takes [trckcr::W](W) writer structure"]
194impl crate::Writable for TRCKCR_SPEC {
195    type Writer = W;
196    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
197    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
198}
199#[doc = "`reset()` method sets TRCKCR to value 0x01"]
200impl crate::Resettable for TRCKCR_SPEC {
201    const RESET_VALUE: Self::Ux = 0x01;
202}