efm32pg1b_pac/usart0/
timecmp1.rs1pub type R = crate::R<TIMECMP1rs>;
3pub type W = crate::W<TIMECMP1rs>;
5pub type TcmpvalR = crate::FieldReader;
7pub type TcmpvalW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14#[repr(u8)]
15pub enum TSTART {
16 Disable = 0,
18 Txeof = 1,
20 Txc = 2,
22 Rxact = 3,
24 Rxeof = 4,
26}
27impl From<TSTART> for u8 {
28 #[inline(always)]
29 fn from(variant: TSTART) -> Self {
30 variant as _
31 }
32}
33impl crate::FieldSpec for TSTART {
34 type Ux = u8;
35}
36impl crate::IsEnum for TSTART {}
37pub type TstartR = crate::FieldReader<TSTART>;
39impl TstartR {
40 #[inline(always)]
42 pub const fn variant(&self) -> Option<TSTART> {
43 match self.bits {
44 0 => Some(TSTART::Disable),
45 1 => Some(TSTART::Txeof),
46 2 => Some(TSTART::Txc),
47 3 => Some(TSTART::Rxact),
48 4 => Some(TSTART::Rxeof),
49 _ => None,
50 }
51 }
52 #[inline(always)]
54 pub fn is_disable(&self) -> bool {
55 *self == TSTART::Disable
56 }
57 #[inline(always)]
59 pub fn is_txeof(&self) -> bool {
60 *self == TSTART::Txeof
61 }
62 #[inline(always)]
64 pub fn is_txc(&self) -> bool {
65 *self == TSTART::Txc
66 }
67 #[inline(always)]
69 pub fn is_rxact(&self) -> bool {
70 *self == TSTART::Rxact
71 }
72 #[inline(always)]
74 pub fn is_rxeof(&self) -> bool {
75 *self == TSTART::Rxeof
76 }
77}
78pub type TstartW<'a, REG> = crate::FieldWriter<'a, REG, 3, TSTART>;
80impl<'a, REG> TstartW<'a, REG>
81where
82 REG: crate::Writable + crate::RegisterSpec,
83 REG::Ux: From<u8>,
84{
85 #[inline(always)]
87 pub fn disable(self) -> &'a mut crate::W<REG> {
88 self.variant(TSTART::Disable)
89 }
90 #[inline(always)]
92 pub fn txeof(self) -> &'a mut crate::W<REG> {
93 self.variant(TSTART::Txeof)
94 }
95 #[inline(always)]
97 pub fn txc(self) -> &'a mut crate::W<REG> {
98 self.variant(TSTART::Txc)
99 }
100 #[inline(always)]
102 pub fn rxact(self) -> &'a mut crate::W<REG> {
103 self.variant(TSTART::Rxact)
104 }
105 #[inline(always)]
107 pub fn rxeof(self) -> &'a mut crate::W<REG> {
108 self.variant(TSTART::Rxeof)
109 }
110}
111#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116#[repr(u8)]
117pub enum TSTOP {
118 Tcmp1 = 0,
120 Txst = 1,
122 Rxact = 2,
124 Rxactn = 3,
126}
127impl From<TSTOP> for u8 {
128 #[inline(always)]
129 fn from(variant: TSTOP) -> Self {
130 variant as _
131 }
132}
133impl crate::FieldSpec for TSTOP {
134 type Ux = u8;
135}
136impl crate::IsEnum for TSTOP {}
137pub type TstopR = crate::FieldReader<TSTOP>;
139impl TstopR {
140 #[inline(always)]
142 pub const fn variant(&self) -> Option<TSTOP> {
143 match self.bits {
144 0 => Some(TSTOP::Tcmp1),
145 1 => Some(TSTOP::Txst),
146 2 => Some(TSTOP::Rxact),
147 3 => Some(TSTOP::Rxactn),
148 _ => None,
149 }
150 }
151 #[inline(always)]
153 pub fn is_tcmp1(&self) -> bool {
154 *self == TSTOP::Tcmp1
155 }
156 #[inline(always)]
158 pub fn is_txst(&self) -> bool {
159 *self == TSTOP::Txst
160 }
161 #[inline(always)]
163 pub fn is_rxact(&self) -> bool {
164 *self == TSTOP::Rxact
165 }
166 #[inline(always)]
168 pub fn is_rxactn(&self) -> bool {
169 *self == TSTOP::Rxactn
170 }
171}
172pub type TstopW<'a, REG> = crate::FieldWriter<'a, REG, 3, TSTOP>;
174impl<'a, REG> TstopW<'a, REG>
175where
176 REG: crate::Writable + crate::RegisterSpec,
177 REG::Ux: From<u8>,
178{
179 #[inline(always)]
181 pub fn tcmp1(self) -> &'a mut crate::W<REG> {
182 self.variant(TSTOP::Tcmp1)
183 }
184 #[inline(always)]
186 pub fn txst(self) -> &'a mut crate::W<REG> {
187 self.variant(TSTOP::Txst)
188 }
189 #[inline(always)]
191 pub fn rxact(self) -> &'a mut crate::W<REG> {
192 self.variant(TSTOP::Rxact)
193 }
194 #[inline(always)]
196 pub fn rxactn(self) -> &'a mut crate::W<REG> {
197 self.variant(TSTOP::Rxactn)
198 }
199}
200pub type RestartenR = crate::BitReader;
202pub type RestartenW<'a, REG> = crate::BitWriter<'a, REG>;
204impl R {
205 #[inline(always)]
207 pub fn tcmpval(&self) -> TcmpvalR {
208 TcmpvalR::new((self.bits & 0xff) as u8)
209 }
210 #[inline(always)]
212 pub fn tstart(&self) -> TstartR {
213 TstartR::new(((self.bits >> 16) & 7) as u8)
214 }
215 #[inline(always)]
217 pub fn tstop(&self) -> TstopR {
218 TstopR::new(((self.bits >> 20) & 7) as u8)
219 }
220 #[inline(always)]
222 pub fn restarten(&self) -> RestartenR {
223 RestartenR::new(((self.bits >> 24) & 1) != 0)
224 }
225}
226impl core::fmt::Debug for R {
227 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
228 f.debug_struct("TIMECMP1")
229 .field("tcmpval", &self.tcmpval())
230 .field("tstart", &self.tstart())
231 .field("tstop", &self.tstop())
232 .field("restarten", &self.restarten())
233 .finish()
234 }
235}
236impl W {
237 #[inline(always)]
239 pub fn tcmpval(&mut self) -> TcmpvalW<TIMECMP1rs> {
240 TcmpvalW::new(self, 0)
241 }
242 #[inline(always)]
244 pub fn tstart(&mut self) -> TstartW<TIMECMP1rs> {
245 TstartW::new(self, 16)
246 }
247 #[inline(always)]
249 pub fn tstop(&mut self) -> TstopW<TIMECMP1rs> {
250 TstopW::new(self, 20)
251 }
252 #[inline(always)]
254 pub fn restarten(&mut self) -> RestartenW<TIMECMP1rs> {
255 RestartenW::new(self, 24)
256 }
257}
258pub struct TIMECMP1rs;
262impl crate::RegisterSpec for TIMECMP1rs {
263 type Ux = u32;
264}
265impl crate::Readable for TIMECMP1rs {}
267impl crate::Writable for TIMECMP1rs {
269 type Safety = crate::Unsafe;
270 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
271 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
272}
273impl crate::Resettable for TIMECMP1rs {
275 const RESET_VALUE: u32 = 0;
276}