ra6t1/adc121/
adwinmon.rs

1#[doc = "Register `ADWINMON` reader"]
2pub struct R(crate::R<ADWINMON_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADWINMON_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADWINMON_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADWINMON_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `MONCOMB` reader - Combination result monitor This bit indicates the combination result. This bit is valid when both window A operation and window B operation are enabled."]
17pub type MONCOMB_R = crate::BitReader<MONCOMB_A>;
18#[doc = "Combination result monitor This bit indicates the combination result. This bit is valid when both window A operation and window B operation are enabled.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum MONCOMB_A {
21    #[doc = "0: Window A / window B composite conditions are not met."]
22    _0 = 0,
23    #[doc = "1: Window A / window B composite conditions are met."]
24    _1 = 1,
25}
26impl From<MONCOMB_A> for bool {
27    #[inline(always)]
28    fn from(variant: MONCOMB_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl MONCOMB_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> MONCOMB_A {
36        match self.bits {
37            false => MONCOMB_A::_0,
38            true => MONCOMB_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 == MONCOMB_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 == MONCOMB_A::_1
50    }
51}
52#[doc = "Field `MONCMPA` reader - Comparison Result Monitor A"]
53pub type MONCMPA_R = crate::BitReader<MONCMPA_A>;
54#[doc = "Comparison Result Monitor A\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum MONCMPA_A {
57    #[doc = "0: Window A comparison conditions are not met."]
58    _0 = 0,
59    #[doc = "1: Window A comparison conditions are met."]
60    _1 = 1,
61}
62impl From<MONCMPA_A> for bool {
63    #[inline(always)]
64    fn from(variant: MONCMPA_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl MONCMPA_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> MONCMPA_A {
72        match self.bits {
73            false => MONCMPA_A::_0,
74            true => MONCMPA_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 == MONCMPA_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 == MONCMPA_A::_1
86    }
87}
88#[doc = "Field `MONCMPB` reader - Comparison Result Monitor B"]
89pub type MONCMPB_R = crate::BitReader<MONCMPB_A>;
90#[doc = "Comparison Result Monitor B\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum MONCMPB_A {
93    #[doc = "0: Window B comparison conditions are not met."]
94    _0 = 0,
95    #[doc = "1: Window B comparison conditions are met."]
96    _1 = 1,
97}
98impl From<MONCMPB_A> for bool {
99    #[inline(always)]
100    fn from(variant: MONCMPB_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl MONCMPB_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> MONCMPB_A {
108        match self.bits {
109            false => MONCMPB_A::_0,
110            true => MONCMPB_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 == MONCMPB_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 == MONCMPB_A::_1
122    }
123}
124impl R {
125    #[doc = "Bit 0 - Combination result monitor This bit indicates the combination result. This bit is valid when both window A operation and window B operation are enabled."]
126    #[inline(always)]
127    pub fn moncomb(&self) -> MONCOMB_R {
128        MONCOMB_R::new((self.bits & 1) != 0)
129    }
130    #[doc = "Bit 4 - Comparison Result Monitor A"]
131    #[inline(always)]
132    pub fn moncmpa(&self) -> MONCMPA_R {
133        MONCMPA_R::new(((self.bits >> 4) & 1) != 0)
134    }
135    #[doc = "Bit 5 - Comparison Result Monitor B"]
136    #[inline(always)]
137    pub fn moncmpb(&self) -> MONCMPB_R {
138        MONCMPB_R::new(((self.bits >> 5) & 1) != 0)
139    }
140}
141#[doc = "A/D Compare Function Window A/B Status Monitor 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 [adwinmon](index.html) module"]
142pub struct ADWINMON_SPEC;
143impl crate::RegisterSpec for ADWINMON_SPEC {
144    type Ux = u8;
145}
146#[doc = "`read()` method returns [adwinmon::R](R) reader structure"]
147impl crate::Readable for ADWINMON_SPEC {
148    type Reader = R;
149}
150#[doc = "`reset()` method sets ADWINMON to value 0"]
151impl crate::Resettable for ADWINMON_SPEC {
152    const RESET_VALUE: Self::Ux = 0;
153}