mk20d7/pte/pdor/
mod.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::PDOR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = "Possible values of the field `PDO`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum PDOR {
48    #[doc = "Logic level 0 is driven on pin provided pin is configured for General Purpose Output."]
49    _0,
50    #[doc = "Logic level 1 is driven on pin provided pin is configured for General Purpose Output."]
51    _1,
52    #[doc = r" Reserved"]
53    _Reserved(u32),
54}
55impl PDOR {
56    #[doc = r" Value of the field as raw bits"]
57    #[inline]
58    pub fn bits(&self) -> u32 {
59        match *self {
60            PDOR::_0 => 0,
61            PDOR::_1 => 1,
62            PDOR::_Reserved(bits) => bits,
63        }
64    }
65    #[allow(missing_docs)]
66    #[doc(hidden)]
67    #[inline]
68    pub fn _from(value: u32) -> PDOR {
69        match value {
70            0 => PDOR::_0,
71            1 => PDOR::_1,
72            i => PDOR::_Reserved(i),
73        }
74    }
75    #[doc = "Checks if the value of the field is `_0`"]
76    #[inline]
77    pub fn is_0(&self) -> bool {
78        *self == PDOR::_0
79    }
80    #[doc = "Checks if the value of the field is `_1`"]
81    #[inline]
82    pub fn is_1(&self) -> bool {
83        *self == PDOR::_1
84    }
85}
86#[doc = "Values that can be written to the field `PDO`"]
87pub enum PDOW {
88    #[doc = "Logic level 0 is driven on pin provided pin is configured for General Purpose Output."]
89    _0,
90    #[doc = "Logic level 1 is driven on pin provided pin is configured for General Purpose Output."]
91    _1,
92}
93impl PDOW {
94    #[allow(missing_docs)]
95    #[doc(hidden)]
96    #[inline]
97    pub fn _bits(&self) -> u32 {
98        match *self {
99            PDOW::_0 => 0,
100            PDOW::_1 => 1,
101        }
102    }
103}
104#[doc = r" Proxy"]
105pub struct _PDOW<'a> {
106    w: &'a mut W,
107}
108impl<'a> _PDOW<'a> {
109    #[doc = r" Writes `variant` to the field"]
110    #[inline]
111    pub fn variant(self, variant: PDOW) -> &'a mut W {
112        unsafe { self.bits(variant._bits()) }
113    }
114    #[doc = "Logic level 0 is driven on pin provided pin is configured for General Purpose Output."]
115    #[inline]
116    pub fn _0(self) -> &'a mut W {
117        self.variant(PDOW::_0)
118    }
119    #[doc = "Logic level 1 is driven on pin provided pin is configured for General Purpose Output."]
120    #[inline]
121    pub fn _1(self) -> &'a mut W {
122        self.variant(PDOW::_1)
123    }
124    #[doc = r" Writes raw bits to the field"]
125    #[inline]
126    pub unsafe fn bits(self, value: u32) -> &'a mut W {
127        const MASK: u32 = 4294967295;
128        const OFFSET: u8 = 0;
129        self.w.bits &= !((MASK as u32) << OFFSET);
130        self.w.bits |= ((value & MASK) as u32) << OFFSET;
131        self.w
132    }
133}
134impl R {
135    #[doc = r" Value of the register as raw bits"]
136    #[inline]
137    pub fn bits(&self) -> u32 {
138        self.bits
139    }
140    #[doc = "Bits 0:31 - Port Data Output"]
141    #[inline]
142    pub fn pdo(&self) -> PDOR {
143        PDOR::_from({
144            const MASK: u32 = 4294967295;
145            const OFFSET: u8 = 0;
146            ((self.bits >> OFFSET) & MASK as u32) as u32
147        })
148    }
149}
150impl W {
151    #[doc = r" Reset value of the register"]
152    #[inline]
153    pub fn reset_value() -> W {
154        W { bits: 0 }
155    }
156    #[doc = r" Writes raw bits to the register"]
157    #[inline]
158    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
159        self.bits = bits;
160        self
161    }
162    #[doc = "Bits 0:31 - Port Data Output"]
163    #[inline]
164    pub fn pdo(&mut self) -> _PDOW {
165        _PDOW { w: self }
166    }
167}