efm32pg22_pac/efm32pg22c200/timer4_ns/
dtcfg.rs1#[doc = "Register `DTCFG` reader"]
2pub struct R(crate::R<DTCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DTCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DTCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DTCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DTCFG` writer"]
17pub struct W(crate::W<DTCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DTCFG_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<DTCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DTCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DTEN` reader - DTI Enable"]
38pub type DTEN_R = crate::BitReader<bool>;
39#[doc = "Field `DTEN` writer - DTI Enable"]
40pub type DTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCFG_SPEC, bool, O>;
41#[doc = "Field `DTDAS` reader - DTI Automatic Start-up Functionality"]
42pub type DTDAS_R = crate::BitReader<DTDAS_A>;
43#[doc = "DTI Automatic Start-up Functionality\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum DTDAS_A {
46 #[doc = "0: No DTI restart on debugger exit"]
47 NORESTART = 0,
48 #[doc = "1: DTI restart on debugger exit"]
49 RESTART = 1,
50}
51impl From<DTDAS_A> for bool {
52 #[inline(always)]
53 fn from(variant: DTDAS_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl DTDAS_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> DTDAS_A {
61 match self.bits {
62 false => DTDAS_A::NORESTART,
63 true => DTDAS_A::RESTART,
64 }
65 }
66 #[doc = "Checks if the value of the field is `NORESTART`"]
67 #[inline(always)]
68 pub fn is_norestart(&self) -> bool {
69 *self == DTDAS_A::NORESTART
70 }
71 #[doc = "Checks if the value of the field is `RESTART`"]
72 #[inline(always)]
73 pub fn is_restart(&self) -> bool {
74 *self == DTDAS_A::RESTART
75 }
76}
77#[doc = "Field `DTDAS` writer - DTI Automatic Start-up Functionality"]
78pub type DTDAS_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCFG_SPEC, DTDAS_A, O>;
79impl<'a, const O: u8> DTDAS_W<'a, O> {
80 #[doc = "No DTI restart on debugger exit"]
81 #[inline(always)]
82 pub fn norestart(self) -> &'a mut W {
83 self.variant(DTDAS_A::NORESTART)
84 }
85 #[doc = "DTI restart on debugger exit"]
86 #[inline(always)]
87 pub fn restart(self) -> &'a mut W {
88 self.variant(DTDAS_A::RESTART)
89 }
90}
91#[doc = "Field `DTAR` reader - DTI Always Run"]
92pub type DTAR_R = crate::BitReader<bool>;
93#[doc = "Field `DTAR` writer - DTI Always Run"]
94pub type DTAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCFG_SPEC, bool, O>;
95#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
96pub type DTFATS_R = crate::BitReader<bool>;
97#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
98pub type DTFATS_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCFG_SPEC, bool, O>;
99#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
100pub type DTPRSEN_R = crate::BitReader<bool>;
101#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
102pub type DTPRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCFG_SPEC, bool, O>;
103impl R {
104 #[doc = "Bit 0 - DTI Enable"]
105 #[inline(always)]
106 pub fn dten(&self) -> DTEN_R {
107 DTEN_R::new((self.bits & 1) != 0)
108 }
109 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
110 #[inline(always)]
111 pub fn dtdas(&self) -> DTDAS_R {
112 DTDAS_R::new(((self.bits >> 1) & 1) != 0)
113 }
114 #[doc = "Bit 9 - DTI Always Run"]
115 #[inline(always)]
116 pub fn dtar(&self) -> DTAR_R {
117 DTAR_R::new(((self.bits >> 9) & 1) != 0)
118 }
119 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
120 #[inline(always)]
121 pub fn dtfats(&self) -> DTFATS_R {
122 DTFATS_R::new(((self.bits >> 10) & 1) != 0)
123 }
124 #[doc = "Bit 11 - DTI PRS Source Enable"]
125 #[inline(always)]
126 pub fn dtprsen(&self) -> DTPRSEN_R {
127 DTPRSEN_R::new(((self.bits >> 11) & 1) != 0)
128 }
129}
130impl W {
131 #[doc = "Bit 0 - DTI Enable"]
132 #[inline(always)]
133 #[must_use]
134 pub fn dten(&mut self) -> DTEN_W<0> {
135 DTEN_W::new(self)
136 }
137 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
138 #[inline(always)]
139 #[must_use]
140 pub fn dtdas(&mut self) -> DTDAS_W<1> {
141 DTDAS_W::new(self)
142 }
143 #[doc = "Bit 9 - DTI Always Run"]
144 #[inline(always)]
145 #[must_use]
146 pub fn dtar(&mut self) -> DTAR_W<9> {
147 DTAR_W::new(self)
148 }
149 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
150 #[inline(always)]
151 #[must_use]
152 pub fn dtfats(&mut self) -> DTFATS_W<10> {
153 DTFATS_W::new(self)
154 }
155 #[doc = "Bit 11 - DTI PRS Source Enable"]
156 #[inline(always)]
157 #[must_use]
158 pub fn dtprsen(&mut self) -> DTPRSEN_W<11> {
159 DTPRSEN_W::new(self)
160 }
161 #[doc = "Writes raw bits to the register."]
162 #[inline(always)]
163 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
164 self.0.bits(bits);
165 self
166 }
167}
168#[doc = "No Description\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 [dtcfg](index.html) module"]
169pub struct DTCFG_SPEC;
170impl crate::RegisterSpec for DTCFG_SPEC {
171 type Ux = u32;
172}
173#[doc = "`read()` method returns [dtcfg::R](R) reader structure"]
174impl crate::Readable for DTCFG_SPEC {
175 type Reader = R;
176}
177#[doc = "`write(|w| ..)` method takes [dtcfg::W](W) writer structure"]
178impl crate::Writable for DTCFG_SPEC {
179 type Writer = W;
180 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
181 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
182}
183#[doc = "`reset()` method sets DTCFG to value 0"]
184impl crate::Resettable for DTCFG_SPEC {
185 const RESET_VALUE: Self::Ux = 0;
186}