atsam4lc4b_pac/pevc/
chmx.rs

1#[doc = "Register `CHMX%s` reader"]
2pub struct R(crate::R<CHMX_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CHMX_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CHMX_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CHMX_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CHMX%s` writer"]
17pub struct W(crate::W<CHMX_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CHMX_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<CHMX_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CHMX_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EVMX` reader - Event Multiplexer"]
38pub type EVMX_R = crate::FieldReader<u8, EVMXSELECT_A>;
39#[doc = "Event Multiplexer\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum EVMXSELECT_A {
43    #[doc = "0: Event 0"]
44    _0X00 = 0,
45    #[doc = "1: Event 1"]
46    _0X01 = 1,
47}
48impl From<EVMXSELECT_A> for u8 {
49    #[inline(always)]
50    fn from(variant: EVMXSELECT_A) -> Self {
51        variant as _
52    }
53}
54impl EVMX_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<EVMXSELECT_A> {
58        match self.bits {
59            0 => Some(EVMXSELECT_A::_0X00),
60            1 => Some(EVMXSELECT_A::_0X01),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `_0X00`"]
65    #[inline(always)]
66    pub fn is_0x00(&self) -> bool {
67        *self == EVMXSELECT_A::_0X00
68    }
69    #[doc = "Checks if the value of the field is `_0X01`"]
70    #[inline(always)]
71    pub fn is_0x01(&self) -> bool {
72        *self == EVMXSELECT_A::_0X01
73    }
74}
75#[doc = "Field `EVMX` writer - Event Multiplexer"]
76pub type EVMX_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CHMX_SPEC, u8, EVMXSELECT_A, 6, O>;
77impl<'a, const O: u8> EVMX_W<'a, O> {
78    #[doc = "Event 0"]
79    #[inline(always)]
80    pub fn _0x00(self) -> &'a mut W {
81        self.variant(EVMXSELECT_A::_0X00)
82    }
83    #[doc = "Event 1"]
84    #[inline(always)]
85    pub fn _0x01(self) -> &'a mut W {
86        self.variant(EVMXSELECT_A::_0X01)
87    }
88}
89#[doc = "Field `SMX` reader - Software Event Multiplexer"]
90pub type SMX_R = crate::BitReader<SMXSELECT_A>;
91#[doc = "Software Event Multiplexer\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum SMXSELECT_A {
94    #[doc = "0: Hardware events"]
95    _0 = 0,
96    #[doc = "1: Software event"]
97    _1 = 1,
98}
99impl From<SMXSELECT_A> for bool {
100    #[inline(always)]
101    fn from(variant: SMXSELECT_A) -> Self {
102        variant as u8 != 0
103    }
104}
105impl SMX_R {
106    #[doc = "Get enumerated values variant"]
107    #[inline(always)]
108    pub fn variant(&self) -> SMXSELECT_A {
109        match self.bits {
110            false => SMXSELECT_A::_0,
111            true => SMXSELECT_A::_1,
112        }
113    }
114    #[doc = "Checks if the value of the field is `_0`"]
115    #[inline(always)]
116    pub fn is_0(&self) -> bool {
117        *self == SMXSELECT_A::_0
118    }
119    #[doc = "Checks if the value of the field is `_1`"]
120    #[inline(always)]
121    pub fn is_1(&self) -> bool {
122        *self == SMXSELECT_A::_1
123    }
124}
125#[doc = "Field `SMX` writer - Software Event Multiplexer"]
126pub type SMX_W<'a, const O: u8> = crate::BitWriter<'a, u32, CHMX_SPEC, SMXSELECT_A, O>;
127impl<'a, const O: u8> SMX_W<'a, O> {
128    #[doc = "Hardware events"]
129    #[inline(always)]
130    pub fn _0(self) -> &'a mut W {
131        self.variant(SMXSELECT_A::_0)
132    }
133    #[doc = "Software event"]
134    #[inline(always)]
135    pub fn _1(self) -> &'a mut W {
136        self.variant(SMXSELECT_A::_1)
137    }
138}
139impl R {
140    #[doc = "Bits 0:5 - Event Multiplexer"]
141    #[inline(always)]
142    pub fn evmx(&self) -> EVMX_R {
143        EVMX_R::new((self.bits & 0x3f) as u8)
144    }
145    #[doc = "Bit 8 - Software Event Multiplexer"]
146    #[inline(always)]
147    pub fn smx(&self) -> SMX_R {
148        SMX_R::new(((self.bits >> 8) & 1) != 0)
149    }
150}
151impl W {
152    #[doc = "Bits 0:5 - Event Multiplexer"]
153    #[inline(always)]
154    #[must_use]
155    pub fn evmx(&mut self) -> EVMX_W<0> {
156        EVMX_W::new(self)
157    }
158    #[doc = "Bit 8 - Software Event Multiplexer"]
159    #[inline(always)]
160    #[must_use]
161    pub fn smx(&mut self) -> SMX_W<8> {
162        SMX_W::new(self)
163    }
164    #[doc = "Writes raw bits to the register."]
165    #[inline(always)]
166    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
167        self.0.bits(bits);
168        self
169    }
170}
171#[doc = "Channel Multiplexer\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 [chmx](index.html) module"]
172pub struct CHMX_SPEC;
173impl crate::RegisterSpec for CHMX_SPEC {
174    type Ux = u32;
175}
176#[doc = "`read()` method returns [chmx::R](R) reader structure"]
177impl crate::Readable for CHMX_SPEC {
178    type Reader = R;
179}
180#[doc = "`write(|w| ..)` method takes [chmx::W](W) writer structure"]
181impl crate::Writable for CHMX_SPEC {
182    type Writer = W;
183    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
184    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185}
186#[doc = "`reset()` method sets CHMX%s to value 0"]
187impl crate::Resettable for CHMX_SPEC {
188    const RESET_VALUE: Self::Ux = 0;
189}