ra2a1/cac/
castr.rs

1#[doc = "Register `CASTR` reader"]
2pub struct R(crate::R<CASTR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CASTR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CASTR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CASTR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `FERRF` reader - Frequency Error Flag"]
17pub type FERRF_R = crate::BitReader<FERRF_A>;
18#[doc = "Frequency Error Flag\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum FERRF_A {
21    #[doc = "0: The clock frequency is within the range corresponding to the settings."]
22    _0 = 0,
23    #[doc = "1: The clock frequency has deviated beyond the range corresponding to the settings (frequency error)."]
24    _1 = 1,
25}
26impl From<FERRF_A> for bool {
27    #[inline(always)]
28    fn from(variant: FERRF_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl FERRF_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> FERRF_A {
36        match self.bits {
37            false => FERRF_A::_0,
38            true => FERRF_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == FERRF_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == FERRF_A::_1
50    }
51}
52#[doc = "Field `MENDF` reader - Measurement End Flag"]
53pub type MENDF_R = crate::BitReader<MENDF_A>;
54#[doc = "Measurement End Flag\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum MENDF_A {
57    #[doc = "0: Measurement is in progress."]
58    _0 = 0,
59    #[doc = "1: Measurement has ended."]
60    _1 = 1,
61}
62impl From<MENDF_A> for bool {
63    #[inline(always)]
64    fn from(variant: MENDF_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl MENDF_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> MENDF_A {
72        match self.bits {
73            false => MENDF_A::_0,
74            true => MENDF_A::_1,
75        }
76    }
77    #[doc = "Checks if the value of the field is `_0`"]
78    #[inline(always)]
79    pub fn is_0(&self) -> bool {
80        *self == MENDF_A::_0
81    }
82    #[doc = "Checks if the value of the field is `_1`"]
83    #[inline(always)]
84    pub fn is_1(&self) -> bool {
85        *self == MENDF_A::_1
86    }
87}
88#[doc = "Field `OVFF` reader - Counter Overflow Flag"]
89pub type OVFF_R = crate::BitReader<OVFF_A>;
90#[doc = "Counter Overflow Flag\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum OVFF_A {
93    #[doc = "0: The counter has not overflowed."]
94    _0 = 0,
95    #[doc = "1: The counter has overflowed."]
96    _1 = 1,
97}
98impl From<OVFF_A> for bool {
99    #[inline(always)]
100    fn from(variant: OVFF_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl OVFF_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> OVFF_A {
108        match self.bits {
109            false => OVFF_A::_0,
110            true => OVFF_A::_1,
111        }
112    }
113    #[doc = "Checks if the value of the field is `_0`"]
114    #[inline(always)]
115    pub fn is_0(&self) -> bool {
116        *self == OVFF_A::_0
117    }
118    #[doc = "Checks if the value of the field is `_1`"]
119    #[inline(always)]
120    pub fn is_1(&self) -> bool {
121        *self == OVFF_A::_1
122    }
123}
124impl R {
125    #[doc = "Bit 0 - Frequency Error Flag"]
126    #[inline(always)]
127    pub fn ferrf(&self) -> FERRF_R {
128        FERRF_R::new((self.bits & 1) != 0)
129    }
130    #[doc = "Bit 1 - Measurement End Flag"]
131    #[inline(always)]
132    pub fn mendf(&self) -> MENDF_R {
133        MENDF_R::new(((self.bits >> 1) & 1) != 0)
134    }
135    #[doc = "Bit 2 - Counter Overflow Flag"]
136    #[inline(always)]
137    pub fn ovff(&self) -> OVFF_R {
138        OVFF_R::new(((self.bits >> 2) & 1) != 0)
139    }
140}
141#[doc = "CAC Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [castr](index.html) module"]
142pub struct CASTR_SPEC;
143impl crate::RegisterSpec for CASTR_SPEC {
144    type Ux = u8;
145}
146#[doc = "`read()` method returns [castr::R](R) reader structure"]
147impl crate::Readable for CASTR_SPEC {
148    type Reader = R;
149}
150#[doc = "`reset()` method sets CASTR to value 0"]
151impl crate::Resettable for CASTR_SPEC {
152    const RESET_VALUE: Self::Ux = 0;
153}