k22f/gpioe/
pdor.rs

1#[doc = "Reader of register PDOR"]
2pub type R = crate::R<u32, super::PDOR>;
3#[doc = "Writer for register PDOR"]
4pub type W = crate::W<u32, super::PDOR>;
5#[doc = "Register PDOR `reset()`'s with value 0"]
6impl crate::ResetValue for super::PDOR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Port Data Output\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u32)]
16pub enum PDO_A {
17    #[doc = "0: Logic level 0 is driven on pin, provided pin is configured for general-purpose output."]
18    _0 = 0,
19    #[doc = "1: Logic level 1 is driven on pin, provided pin is configured for general-purpose output."]
20    _1 = 1,
21}
22impl From<PDO_A> for u32 {
23    #[inline(always)]
24    fn from(variant: PDO_A) -> Self {
25        variant as _
26    }
27}
28#[doc = "Reader of field `PDO`"]
29pub type PDO_R = crate::R<u32, PDO_A>;
30impl PDO_R {
31    #[doc = r"Get enumerated values variant"]
32    #[inline(always)]
33    pub fn variant(&self) -> crate::Variant<u32, PDO_A> {
34        use crate::Variant::*;
35        match self.bits {
36            0 => Val(PDO_A::_0),
37            1 => Val(PDO_A::_1),
38            i => Res(i),
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == PDO_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == PDO_A::_1
50    }
51}
52#[doc = "Write proxy for field `PDO`"]
53pub struct PDO_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> PDO_W<'a> {
57    #[doc = r"Writes `variant` to the field"]
58    #[inline(always)]
59    pub fn variant(self, variant: PDO_A) -> &'a mut W {
60        unsafe { self.bits(variant.into()) }
61    }
62    #[doc = "Logic level 0 is driven on pin, provided pin is configured for general-purpose output."]
63    #[inline(always)]
64    pub fn _0(self) -> &'a mut W {
65        self.variant(PDO_A::_0)
66    }
67    #[doc = "Logic level 1 is driven on pin, provided pin is configured for general-purpose output."]
68    #[inline(always)]
69    pub fn _1(self) -> &'a mut W {
70        self.variant(PDO_A::_1)
71    }
72    #[doc = r"Writes raw bits to the field"]
73    #[inline(always)]
74    pub unsafe fn bits(self, value: u32) -> &'a mut W {
75        self.w.bits = (self.w.bits & !0xffff_ffff) | ((value as u32) & 0xffff_ffff);
76        self.w
77    }
78}
79impl R {
80    #[doc = "Bits 0:31 - Port Data Output"]
81    #[inline(always)]
82    pub fn pdo(&self) -> PDO_R {
83        PDO_R::new((self.bits & 0xffff_ffff) as u32)
84    }
85}
86impl W {
87    #[doc = "Bits 0:31 - Port Data Output"]
88    #[inline(always)]
89    pub fn pdo(&mut self) -> PDO_W {
90        PDO_W { w: self }
91    }
92}