atsam4lc2b_pac/pevc/
evs.rs

1#[doc = "Register `EVS%s` reader"]
2pub struct R(crate::R<EVS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EVS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EVS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EVS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EVS%s` writer"]
17pub struct W(crate::W<EVS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EVS_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<EVS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EVS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EN` reader - Event Shaper Enable"]
38pub type EN_R = crate::BitReader<ENSELECT_A>;
39#[doc = "Event Shaper Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum ENSELECT_A {
42    #[doc = "0: No Action"]
43    _0 = 0,
44    #[doc = "1: Event Shaper enable"]
45    _1 = 1,
46}
47impl From<ENSELECT_A> for bool {
48    #[inline(always)]
49    fn from(variant: ENSELECT_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl EN_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> ENSELECT_A {
57        match self.bits {
58            false => ENSELECT_A::_0,
59            true => ENSELECT_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == ENSELECT_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == ENSELECT_A::_1
71    }
72}
73#[doc = "Field `EN` writer - Event Shaper Enable"]
74pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVS_SPEC, ENSELECT_A, O>;
75impl<'a, const O: u8> EN_W<'a, O> {
76    #[doc = "No Action"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(ENSELECT_A::_0)
80    }
81    #[doc = "Event Shaper enable"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(ENSELECT_A::_1)
85    }
86}
87#[doc = "Field `IGFR` reader - Input Glitch Filter Rise"]
88pub type IGFR_R = crate::BitReader<IGFRSELECT_A>;
89#[doc = "Input Glitch Filter Rise\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum IGFRSELECT_A {
92    #[doc = "0: No Action"]
93    _0 = 0,
94    #[doc = "1: Input Glitch Filter : a rising edge on event input will raise trigger output"]
95    _1 = 1,
96}
97impl From<IGFRSELECT_A> for bool {
98    #[inline(always)]
99    fn from(variant: IGFRSELECT_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl IGFR_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> IGFRSELECT_A {
107        match self.bits {
108            false => IGFRSELECT_A::_0,
109            true => IGFRSELECT_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == IGFRSELECT_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == IGFRSELECT_A::_1
121    }
122}
123#[doc = "Field `IGFR` writer - Input Glitch Filter Rise"]
124pub type IGFR_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVS_SPEC, IGFRSELECT_A, O>;
125impl<'a, const O: u8> IGFR_W<'a, O> {
126    #[doc = "No Action"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(IGFRSELECT_A::_0)
130    }
131    #[doc = "Input Glitch Filter : a rising edge on event input will raise trigger output"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(IGFRSELECT_A::_1)
135    }
136}
137#[doc = "Field `IGFF` reader - Input Glitch Filter Fall"]
138pub type IGFF_R = crate::BitReader<IGFFSELECT_A>;
139#[doc = "Input Glitch Filter Fall\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum IGFFSELECT_A {
142    #[doc = "0: No Action"]
143    _0 = 0,
144    #[doc = "1: Input Glitch Filter : a falling edge on event input will raise trigger output"]
145    _1 = 1,
146}
147impl From<IGFFSELECT_A> for bool {
148    #[inline(always)]
149    fn from(variant: IGFFSELECT_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl IGFF_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> IGFFSELECT_A {
157        match self.bits {
158            false => IGFFSELECT_A::_0,
159            true => IGFFSELECT_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == IGFFSELECT_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == IGFFSELECT_A::_1
171    }
172}
173#[doc = "Field `IGFF` writer - Input Glitch Filter Fall"]
174pub type IGFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVS_SPEC, IGFFSELECT_A, O>;
175impl<'a, const O: u8> IGFF_W<'a, O> {
176    #[doc = "No Action"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(IGFFSELECT_A::_0)
180    }
181    #[doc = "Input Glitch Filter : a falling edge on event input will raise trigger output"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(IGFFSELECT_A::_1)
185    }
186}
187#[doc = "Field `IGFON` reader - Input Glitch Filter Status"]
188pub type IGFON_R = crate::BitReader<bool>;
189#[doc = "Field `IGFON` writer - Input Glitch Filter Status"]
190pub type IGFON_W<'a, const O: u8> = crate::BitWriter<'a, u32, EVS_SPEC, bool, O>;
191impl R {
192    #[doc = "Bit 0 - Event Shaper Enable"]
193    #[inline(always)]
194    pub fn en(&self) -> EN_R {
195        EN_R::new((self.bits & 1) != 0)
196    }
197    #[doc = "Bit 16 - Input Glitch Filter Rise"]
198    #[inline(always)]
199    pub fn igfr(&self) -> IGFR_R {
200        IGFR_R::new(((self.bits >> 16) & 1) != 0)
201    }
202    #[doc = "Bit 17 - Input Glitch Filter Fall"]
203    #[inline(always)]
204    pub fn igff(&self) -> IGFF_R {
205        IGFF_R::new(((self.bits >> 17) & 1) != 0)
206    }
207    #[doc = "Bit 18 - Input Glitch Filter Status"]
208    #[inline(always)]
209    pub fn igfon(&self) -> IGFON_R {
210        IGFON_R::new(((self.bits >> 18) & 1) != 0)
211    }
212}
213impl W {
214    #[doc = "Bit 0 - Event Shaper Enable"]
215    #[inline(always)]
216    #[must_use]
217    pub fn en(&mut self) -> EN_W<0> {
218        EN_W::new(self)
219    }
220    #[doc = "Bit 16 - Input Glitch Filter Rise"]
221    #[inline(always)]
222    #[must_use]
223    pub fn igfr(&mut self) -> IGFR_W<16> {
224        IGFR_W::new(self)
225    }
226    #[doc = "Bit 17 - Input Glitch Filter Fall"]
227    #[inline(always)]
228    #[must_use]
229    pub fn igff(&mut self) -> IGFF_W<17> {
230        IGFF_W::new(self)
231    }
232    #[doc = "Bit 18 - Input Glitch Filter Status"]
233    #[inline(always)]
234    #[must_use]
235    pub fn igfon(&mut self) -> IGFON_W<18> {
236        IGFON_W::new(self)
237    }
238    #[doc = "Writes raw bits to the register."]
239    #[inline(always)]
240    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
241        self.0.bits(bits);
242        self
243    }
244}
245#[doc = "Event Shaper\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 [evs](index.html) module"]
246pub struct EVS_SPEC;
247impl crate::RegisterSpec for EVS_SPEC {
248    type Ux = u32;
249}
250#[doc = "`read()` method returns [evs::R](R) reader structure"]
251impl crate::Readable for EVS_SPEC {
252    type Reader = R;
253}
254#[doc = "`write(|w| ..)` method takes [evs::W](W) writer structure"]
255impl crate::Writable for EVS_SPEC {
256    type Writer = W;
257    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
258    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
259}
260#[doc = "`reset()` method sets EVS%s to value 0"]
261impl crate::Resettable for EVS_SPEC {
262    const RESET_VALUE: Self::Ux = 0;
263}