mcxa_pac/freqme0/
ctrl_r.rs1#[doc = "Register `CTRL_R` reader"]
2pub type R = crate::R<CtrlRSpec>;
3#[doc = "Field `RESULT` reader - Indicates the measurement result-either the target clock counter value (for Frequency Measurement mode) or pulse width measurement (for Pulse Width Measurement mode)"]
4pub type ResultR = crate::FieldReader<u32>;
5#[doc = "Measurement In Progress\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum MeasureInProgress {
9 #[doc = "0: Complete"]
10 CycleDone = 0,
11 #[doc = "1: In progress"]
12 InProgress = 1,
13}
14impl From<MeasureInProgress> for bool {
15 #[inline(always)]
16 fn from(variant: MeasureInProgress) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `MEASURE_IN_PROGRESS` reader - Measurement In Progress"]
21pub type MeasureInProgressR = crate::BitReader<MeasureInProgress>;
22impl MeasureInProgressR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> MeasureInProgress {
26 match self.bits {
27 false => MeasureInProgress::CycleDone,
28 true => MeasureInProgress::InProgress,
29 }
30 }
31 #[doc = "Complete"]
32 #[inline(always)]
33 pub fn is_cycle_done(&self) -> bool {
34 *self == MeasureInProgress::CycleDone
35 }
36 #[doc = "In progress"]
37 #[inline(always)]
38 pub fn is_in_progress(&self) -> bool {
39 *self == MeasureInProgress::InProgress
40 }
41}
42impl R {
43 #[doc = "Bits 0:30 - Indicates the measurement result-either the target clock counter value (for Frequency Measurement mode) or pulse width measurement (for Pulse Width Measurement mode)"]
44 #[inline(always)]
45 pub fn result(&self) -> ResultR {
46 ResultR::new(self.bits & 0x7fff_ffff)
47 }
48 #[doc = "Bit 31 - Measurement In Progress"]
49 #[inline(always)]
50 pub fn measure_in_progress(&self) -> MeasureInProgressR {
51 MeasureInProgressR::new(((self.bits >> 31) & 1) != 0)
52 }
53}
54#[cfg(feature = "debug")]
55impl core::fmt::Debug for R {
56 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57 f.debug_struct("CTRL_R")
58 .field("result", &self.result())
59 .field("measure_in_progress", &self.measure_in_progress())
60 .finish()
61 }
62}
63#[doc = "Control (in Read mode)\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl_r::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
64pub struct CtrlRSpec;
65impl crate::RegisterSpec for CtrlRSpec {
66 type Ux = u32;
67}
68#[doc = "`read()` method returns [`ctrl_r::R`](R) reader structure"]
69impl crate::Readable for CtrlRSpec {}
70#[doc = "`reset()` method sets CTRL_R to value 0"]
71impl crate::Resettable for CtrlRSpec {}