ra4e1/pfs/
p10pfs_by.rs

1#[doc = "Register `P10%sPFS_BY` reader"]
2pub struct R(crate::R<P10PFS_BY_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<P10PFS_BY_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<P10PFS_BY_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<P10PFS_BY_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `P10%sPFS_BY` writer"]
17pub struct W(crate::W<P10PFS_BY_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<P10PFS_BY_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<P10PFS_BY_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<P10PFS_BY_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PODR` reader - Port Output Data"]
38pub type PODR_R = crate::BitReader<PODR_A>;
39#[doc = "Port Output Data\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum PODR_A {
42    #[doc = "0: Output low"]
43    _0 = 0,
44    #[doc = "1: Output high"]
45    _1 = 1,
46}
47impl From<PODR_A> for bool {
48    #[inline(always)]
49    fn from(variant: PODR_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl PODR_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> PODR_A {
57        match self.bits {
58            false => PODR_A::_0,
59            true => PODR_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 == PODR_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 == PODR_A::_1
71    }
72}
73#[doc = "Field `PODR` writer - Port Output Data"]
74pub type PODR_W<'a, const O: u8> = crate::BitWriter<'a, u8, P10PFS_BY_SPEC, PODR_A, O>;
75impl<'a, const O: u8> PODR_W<'a, O> {
76    #[doc = "Output low"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(PODR_A::_0)
80    }
81    #[doc = "Output high"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(PODR_A::_1)
85    }
86}
87#[doc = "Field `PIDR` reader - Port State"]
88pub type PIDR_R = crate::BitReader<PIDR_A>;
89#[doc = "Port State\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum PIDR_A {
92    #[doc = "0: Low level"]
93    _0 = 0,
94    #[doc = "1: High level"]
95    _1 = 1,
96}
97impl From<PIDR_A> for bool {
98    #[inline(always)]
99    fn from(variant: PIDR_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl PIDR_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> PIDR_A {
107        match self.bits {
108            false => PIDR_A::_0,
109            true => PIDR_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 == PIDR_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 == PIDR_A::_1
121    }
122}
123#[doc = "Field `PDR` reader - Port Direction"]
124pub type PDR_R = crate::BitReader<PDR_A>;
125#[doc = "Port Direction\n\nValue on reset: 0"]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum PDR_A {
128    #[doc = "0: Input (functions as an input pin)"]
129    _0 = 0,
130    #[doc = "1: Output (functions as an output pin)"]
131    _1 = 1,
132}
133impl From<PDR_A> for bool {
134    #[inline(always)]
135    fn from(variant: PDR_A) -> Self {
136        variant as u8 != 0
137    }
138}
139impl PDR_R {
140    #[doc = "Get enumerated values variant"]
141    #[inline(always)]
142    pub fn variant(&self) -> PDR_A {
143        match self.bits {
144            false => PDR_A::_0,
145            true => PDR_A::_1,
146        }
147    }
148    #[doc = "Checks if the value of the field is `_0`"]
149    #[inline(always)]
150    pub fn is_0(&self) -> bool {
151        *self == PDR_A::_0
152    }
153    #[doc = "Checks if the value of the field is `_1`"]
154    #[inline(always)]
155    pub fn is_1(&self) -> bool {
156        *self == PDR_A::_1
157    }
158}
159#[doc = "Field `PDR` writer - Port Direction"]
160pub type PDR_W<'a, const O: u8> = crate::BitWriter<'a, u8, P10PFS_BY_SPEC, PDR_A, O>;
161impl<'a, const O: u8> PDR_W<'a, O> {
162    #[doc = "Input (functions as an input pin)"]
163    #[inline(always)]
164    pub fn _0(self) -> &'a mut W {
165        self.variant(PDR_A::_0)
166    }
167    #[doc = "Output (functions as an output pin)"]
168    #[inline(always)]
169    pub fn _1(self) -> &'a mut W {
170        self.variant(PDR_A::_1)
171    }
172}
173#[doc = "Field `PCR` reader - Pull-up Control"]
174pub type PCR_R = crate::BitReader<PCR_A>;
175#[doc = "Pull-up Control\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum PCR_A {
178    #[doc = "0: Disable input pull-up"]
179    _0 = 0,
180    #[doc = "1: Enable input pull-up"]
181    _1 = 1,
182}
183impl From<PCR_A> for bool {
184    #[inline(always)]
185    fn from(variant: PCR_A) -> Self {
186        variant as u8 != 0
187    }
188}
189impl PCR_R {
190    #[doc = "Get enumerated values variant"]
191    #[inline(always)]
192    pub fn variant(&self) -> PCR_A {
193        match self.bits {
194            false => PCR_A::_0,
195            true => PCR_A::_1,
196        }
197    }
198    #[doc = "Checks if the value of the field is `_0`"]
199    #[inline(always)]
200    pub fn is_0(&self) -> bool {
201        *self == PCR_A::_0
202    }
203    #[doc = "Checks if the value of the field is `_1`"]
204    #[inline(always)]
205    pub fn is_1(&self) -> bool {
206        *self == PCR_A::_1
207    }
208}
209#[doc = "Field `PCR` writer - Pull-up Control"]
210pub type PCR_W<'a, const O: u8> = crate::BitWriter<'a, u8, P10PFS_BY_SPEC, PCR_A, O>;
211impl<'a, const O: u8> PCR_W<'a, O> {
212    #[doc = "Disable input pull-up"]
213    #[inline(always)]
214    pub fn _0(self) -> &'a mut W {
215        self.variant(PCR_A::_0)
216    }
217    #[doc = "Enable input pull-up"]
218    #[inline(always)]
219    pub fn _1(self) -> &'a mut W {
220        self.variant(PCR_A::_1)
221    }
222}
223#[doc = "Field `NCODR` reader - N-Channel Open-Drain Control"]
224pub type NCODR_R = crate::BitReader<NCODR_A>;
225#[doc = "N-Channel Open-Drain Control\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum NCODR_A {
228    #[doc = "0: Output CMOS"]
229    _0 = 0,
230    #[doc = "1: Output NMOS open-drain"]
231    _1 = 1,
232}
233impl From<NCODR_A> for bool {
234    #[inline(always)]
235    fn from(variant: NCODR_A) -> Self {
236        variant as u8 != 0
237    }
238}
239impl NCODR_R {
240    #[doc = "Get enumerated values variant"]
241    #[inline(always)]
242    pub fn variant(&self) -> NCODR_A {
243        match self.bits {
244            false => NCODR_A::_0,
245            true => NCODR_A::_1,
246        }
247    }
248    #[doc = "Checks if the value of the field is `_0`"]
249    #[inline(always)]
250    pub fn is_0(&self) -> bool {
251        *self == NCODR_A::_0
252    }
253    #[doc = "Checks if the value of the field is `_1`"]
254    #[inline(always)]
255    pub fn is_1(&self) -> bool {
256        *self == NCODR_A::_1
257    }
258}
259#[doc = "Field `NCODR` writer - N-Channel Open-Drain Control"]
260pub type NCODR_W<'a, const O: u8> = crate::BitWriter<'a, u8, P10PFS_BY_SPEC, NCODR_A, O>;
261impl<'a, const O: u8> NCODR_W<'a, O> {
262    #[doc = "Output CMOS"]
263    #[inline(always)]
264    pub fn _0(self) -> &'a mut W {
265        self.variant(NCODR_A::_0)
266    }
267    #[doc = "Output NMOS open-drain"]
268    #[inline(always)]
269    pub fn _1(self) -> &'a mut W {
270        self.variant(NCODR_A::_1)
271    }
272}
273impl R {
274    #[doc = "Bit 0 - Port Output Data"]
275    #[inline(always)]
276    pub fn podr(&self) -> PODR_R {
277        PODR_R::new((self.bits & 1) != 0)
278    }
279    #[doc = "Bit 1 - Port State"]
280    #[inline(always)]
281    pub fn pidr(&self) -> PIDR_R {
282        PIDR_R::new(((self.bits >> 1) & 1) != 0)
283    }
284    #[doc = "Bit 2 - Port Direction"]
285    #[inline(always)]
286    pub fn pdr(&self) -> PDR_R {
287        PDR_R::new(((self.bits >> 2) & 1) != 0)
288    }
289    #[doc = "Bit 4 - Pull-up Control"]
290    #[inline(always)]
291    pub fn pcr(&self) -> PCR_R {
292        PCR_R::new(((self.bits >> 4) & 1) != 0)
293    }
294    #[doc = "Bit 6 - N-Channel Open-Drain Control"]
295    #[inline(always)]
296    pub fn ncodr(&self) -> NCODR_R {
297        NCODR_R::new(((self.bits >> 6) & 1) != 0)
298    }
299}
300impl W {
301    #[doc = "Bit 0 - Port Output Data"]
302    #[inline(always)]
303    #[must_use]
304    pub fn podr(&mut self) -> PODR_W<0> {
305        PODR_W::new(self)
306    }
307    #[doc = "Bit 2 - Port Direction"]
308    #[inline(always)]
309    #[must_use]
310    pub fn pdr(&mut self) -> PDR_W<2> {
311        PDR_W::new(self)
312    }
313    #[doc = "Bit 4 - Pull-up Control"]
314    #[inline(always)]
315    #[must_use]
316    pub fn pcr(&mut self) -> PCR_W<4> {
317        PCR_W::new(self)
318    }
319    #[doc = "Bit 6 - N-Channel Open-Drain Control"]
320    #[inline(always)]
321    #[must_use]
322    pub fn ncodr(&mut self) -> NCODR_W<6> {
323        NCODR_W::new(self)
324    }
325    #[doc = "Writes raw bits to the register."]
326    #[inline(always)]
327    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
328        self.0.bits(bits);
329        self
330    }
331}
332#[doc = "Port 10%s Pin Function Select 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 [p10pfs_by](index.html) module"]
333pub struct P10PFS_BY_SPEC;
334impl crate::RegisterSpec for P10PFS_BY_SPEC {
335    type Ux = u8;
336}
337#[doc = "`read()` method returns [p10pfs_by::R](R) reader structure"]
338impl crate::Readable for P10PFS_BY_SPEC {
339    type Reader = R;
340}
341#[doc = "`write(|w| ..)` method takes [p10pfs_by::W](W) writer structure"]
342impl crate::Writable for P10PFS_BY_SPEC {
343    type Writer = W;
344    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
345    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
346}
347#[doc = "`reset()` method sets P10%sPFS_BY to value 0"]
348impl crate::Resettable for P10PFS_BY_SPEC {
349    const RESET_VALUE: Self::Ux = 0;
350}