atsam4e8e_pac/pioe/
pcmr.rs

1#[doc = "Register `PCMR` reader"]
2pub struct R(crate::R<PCMR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PCMR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PCMR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PCMR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PCMR` writer"]
17pub struct W(crate::W<PCMR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PCMR_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<PCMR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PCMR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PCEN` reader - Parallel Capture Mode Enable"]
38pub type PCEN_R = crate::BitReader<bool>;
39#[doc = "Field `PCEN` writer - Parallel Capture Mode Enable"]
40pub type PCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCMR_SPEC, bool, O>;
41#[doc = "Field `DSIZE` reader - Parallel Capture Mode Data Size"]
42pub type DSIZE_R = crate::FieldReader<u8, DSIZE_A>;
43#[doc = "Parallel Capture Mode Data Size\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum DSIZE_A {
47    #[doc = "0: The reception data in the PIO_PCRHR is a byte (8-bit)"]
48    BYTE = 0,
49    #[doc = "1: The reception data in the PIO_PCRHR is a half-word (16-bit)"]
50    HALFWORD = 1,
51    #[doc = "2: The reception data in the PIO_PCRHR is a word (32-bit)"]
52    WORD = 2,
53}
54impl From<DSIZE_A> for u8 {
55    #[inline(always)]
56    fn from(variant: DSIZE_A) -> Self {
57        variant as _
58    }
59}
60impl DSIZE_R {
61    #[doc = "Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> Option<DSIZE_A> {
64        match self.bits {
65            0 => Some(DSIZE_A::BYTE),
66            1 => Some(DSIZE_A::HALFWORD),
67            2 => Some(DSIZE_A::WORD),
68            _ => None,
69        }
70    }
71    #[doc = "Checks if the value of the field is `BYTE`"]
72    #[inline(always)]
73    pub fn is_byte(&self) -> bool {
74        *self == DSIZE_A::BYTE
75    }
76    #[doc = "Checks if the value of the field is `HALFWORD`"]
77    #[inline(always)]
78    pub fn is_halfword(&self) -> bool {
79        *self == DSIZE_A::HALFWORD
80    }
81    #[doc = "Checks if the value of the field is `WORD`"]
82    #[inline(always)]
83    pub fn is_word(&self) -> bool {
84        *self == DSIZE_A::WORD
85    }
86}
87#[doc = "Field `DSIZE` writer - Parallel Capture Mode Data Size"]
88pub type DSIZE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PCMR_SPEC, u8, DSIZE_A, 2, O>;
89impl<'a, const O: u8> DSIZE_W<'a, O> {
90    #[doc = "The reception data in the PIO_PCRHR is a byte (8-bit)"]
91    #[inline(always)]
92    pub fn byte(self) -> &'a mut W {
93        self.variant(DSIZE_A::BYTE)
94    }
95    #[doc = "The reception data in the PIO_PCRHR is a half-word (16-bit)"]
96    #[inline(always)]
97    pub fn halfword(self) -> &'a mut W {
98        self.variant(DSIZE_A::HALFWORD)
99    }
100    #[doc = "The reception data in the PIO_PCRHR is a word (32-bit)"]
101    #[inline(always)]
102    pub fn word(self) -> &'a mut W {
103        self.variant(DSIZE_A::WORD)
104    }
105}
106#[doc = "Field `ALWYS` reader - Parallel Capture Mode Always Sampling"]
107pub type ALWYS_R = crate::BitReader<bool>;
108#[doc = "Field `ALWYS` writer - Parallel Capture Mode Always Sampling"]
109pub type ALWYS_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCMR_SPEC, bool, O>;
110#[doc = "Field `HALFS` reader - Parallel Capture Mode Half Sampling"]
111pub type HALFS_R = crate::BitReader<bool>;
112#[doc = "Field `HALFS` writer - Parallel Capture Mode Half Sampling"]
113pub type HALFS_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCMR_SPEC, bool, O>;
114#[doc = "Field `FRSTS` reader - Parallel Capture Mode First Sample"]
115pub type FRSTS_R = crate::BitReader<bool>;
116#[doc = "Field `FRSTS` writer - Parallel Capture Mode First Sample"]
117pub type FRSTS_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCMR_SPEC, bool, O>;
118impl R {
119    #[doc = "Bit 0 - Parallel Capture Mode Enable"]
120    #[inline(always)]
121    pub fn pcen(&self) -> PCEN_R {
122        PCEN_R::new((self.bits & 1) != 0)
123    }
124    #[doc = "Bits 4:5 - Parallel Capture Mode Data Size"]
125    #[inline(always)]
126    pub fn dsize(&self) -> DSIZE_R {
127        DSIZE_R::new(((self.bits >> 4) & 3) as u8)
128    }
129    #[doc = "Bit 9 - Parallel Capture Mode Always Sampling"]
130    #[inline(always)]
131    pub fn alwys(&self) -> ALWYS_R {
132        ALWYS_R::new(((self.bits >> 9) & 1) != 0)
133    }
134    #[doc = "Bit 10 - Parallel Capture Mode Half Sampling"]
135    #[inline(always)]
136    pub fn halfs(&self) -> HALFS_R {
137        HALFS_R::new(((self.bits >> 10) & 1) != 0)
138    }
139    #[doc = "Bit 11 - Parallel Capture Mode First Sample"]
140    #[inline(always)]
141    pub fn frsts(&self) -> FRSTS_R {
142        FRSTS_R::new(((self.bits >> 11) & 1) != 0)
143    }
144}
145impl W {
146    #[doc = "Bit 0 - Parallel Capture Mode Enable"]
147    #[inline(always)]
148    #[must_use]
149    pub fn pcen(&mut self) -> PCEN_W<0> {
150        PCEN_W::new(self)
151    }
152    #[doc = "Bits 4:5 - Parallel Capture Mode Data Size"]
153    #[inline(always)]
154    #[must_use]
155    pub fn dsize(&mut self) -> DSIZE_W<4> {
156        DSIZE_W::new(self)
157    }
158    #[doc = "Bit 9 - Parallel Capture Mode Always Sampling"]
159    #[inline(always)]
160    #[must_use]
161    pub fn alwys(&mut self) -> ALWYS_W<9> {
162        ALWYS_W::new(self)
163    }
164    #[doc = "Bit 10 - Parallel Capture Mode Half Sampling"]
165    #[inline(always)]
166    #[must_use]
167    pub fn halfs(&mut self) -> HALFS_W<10> {
168        HALFS_W::new(self)
169    }
170    #[doc = "Bit 11 - Parallel Capture Mode First Sample"]
171    #[inline(always)]
172    #[must_use]
173    pub fn frsts(&mut self) -> FRSTS_W<11> {
174        FRSTS_W::new(self)
175    }
176    #[doc = "Writes raw bits to the register."]
177    #[inline(always)]
178    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
179        self.0.bits(bits);
180        self
181    }
182}
183#[doc = "Parallel Capture Mode Register\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 [pcmr](index.html) module"]
184pub struct PCMR_SPEC;
185impl crate::RegisterSpec for PCMR_SPEC {
186    type Ux = u32;
187}
188#[doc = "`read()` method returns [pcmr::R](R) reader structure"]
189impl crate::Readable for PCMR_SPEC {
190    type Reader = R;
191}
192#[doc = "`write(|w| ..)` method takes [pcmr::W](W) writer structure"]
193impl crate::Writable for PCMR_SPEC {
194    type Writer = W;
195    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
196    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
197}
198#[doc = "`reset()` method sets PCMR to value 0"]
199impl crate::Resettable for PCMR_SPEC {
200    const RESET_VALUE: Self::Ux = 0;
201}