1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#[doc = "Reader of register KPCR"]
pub type R = crate::R<u16, super::KPCR>;
#[doc = "Writer for register KPCR"]
pub type W = crate::W<u16, super::KPCR>;
#[doc = "Register KPCR `reset()`'s with value 0"]
impl crate::ResetValue for super::KPCR {
    type Type = u16;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "Keypad Row Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum KRE_A {
    #[doc = "0: Row is not included in the keypad key press detect."]
    KRE_0 = 0,
    #[doc = "1: Row is included in the keypad key press detect."]
    KRE_1 = 1,
}
impl From<KRE_A> for u8 {
    #[inline(always)]
    fn from(variant: KRE_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `KRE`"]
pub type KRE_R = crate::R<u8, KRE_A>;
impl KRE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, KRE_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(KRE_A::KRE_0),
            1 => Val(KRE_A::KRE_1),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `KRE_0`"]
    #[inline(always)]
    pub fn is_kre_0(&self) -> bool {
        *self == KRE_A::KRE_0
    }
    #[doc = "Checks if the value of the field is `KRE_1`"]
    #[inline(always)]
    pub fn is_kre_1(&self) -> bool {
        *self == KRE_A::KRE_1
    }
}
#[doc = "Write proxy for field `KRE`"]
pub struct KRE_W<'a> {
    w: &'a mut W,
}
impl<'a> KRE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: KRE_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Row is not included in the keypad key press detect."]
    #[inline(always)]
    pub fn kre_0(self) -> &'a mut W {
        self.variant(KRE_A::KRE_0)
    }
    #[doc = "Row is included in the keypad key press detect."]
    #[inline(always)]
    pub fn kre_1(self) -> &'a mut W {
        self.variant(KRE_A::KRE_1)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xff) | ((value as u16) & 0xff);
        self.w
    }
}
#[doc = "Keypad Column Strobe Open-Drain Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum KCO_A {
    #[doc = "0: Column strobe output is totem pole drive."]
    TOTEM_POLE = 0,
    #[doc = "1: Column strobe output is open drain."]
    OPEN_DRAIN = 1,
}
impl From<KCO_A> for u8 {
    #[inline(always)]
    fn from(variant: KCO_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `KCO`"]
pub type KCO_R = crate::R<u8, KCO_A>;
impl KCO_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, KCO_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(KCO_A::TOTEM_POLE),
            1 => Val(KCO_A::OPEN_DRAIN),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `TOTEM_POLE`"]
    #[inline(always)]
    pub fn is_totem_pole(&self) -> bool {
        *self == KCO_A::TOTEM_POLE
    }
    #[doc = "Checks if the value of the field is `OPEN_DRAIN`"]
    #[inline(always)]
    pub fn is_open_drain(&self) -> bool {
        *self == KCO_A::OPEN_DRAIN
    }
}
#[doc = "Write proxy for field `KCO`"]
pub struct KCO_W<'a> {
    w: &'a mut W,
}
impl<'a> KCO_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: KCO_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Column strobe output is totem pole drive."]
    #[inline(always)]
    pub fn totem_pole(self) -> &'a mut W {
        self.variant(KCO_A::TOTEM_POLE)
    }
    #[doc = "Column strobe output is open drain."]
    #[inline(always)]
    pub fn open_drain(self) -> &'a mut W {
        self.variant(KCO_A::OPEN_DRAIN)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0xff << 8)) | (((value as u16) & 0xff) << 8);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:7 - Keypad Row Enable"]
    #[inline(always)]
    pub fn kre(&self) -> KRE_R {
        KRE_R::new((self.bits & 0xff) as u8)
    }
    #[doc = "Bits 8:15 - Keypad Column Strobe Open-Drain Enable"]
    #[inline(always)]
    pub fn kco(&self) -> KCO_R {
        KCO_R::new(((self.bits >> 8) & 0xff) as u8)
    }
}
impl W {
    #[doc = "Bits 0:7 - Keypad Row Enable"]
    #[inline(always)]
    pub fn kre(&mut self) -> KRE_W {
        KRE_W { w: self }
    }
    #[doc = "Bits 8:15 - Keypad Column Strobe Open-Drain Enable"]
    #[inline(always)]
    pub fn kco(&mut self) -> KCO_W {
        KCO_W { w: self }
    }
}