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 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
#[doc = "Reader of register PCHCTRL[%s]"] pub type R = crate::R<u32, super::PCHCTRL>; #[doc = "Writer for register PCHCTRL[%s]"] pub type W = crate::W<u32, super::PCHCTRL>; #[doc = "Register PCHCTRL[%s] `reset()`'s with value 0"] impl crate::ResetValue for super::PCHCTRL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Possible values of the field `GEN`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum GEN_A { #[doc = "Generic clock generator 0"] GCLK0, #[doc = "Generic clock generator 1"] GCLK1, #[doc = "Generic clock generator 2"] GCLK2, #[doc = "Generic clock generator 3"] GCLK3, #[doc = "Generic clock generator 4"] GCLK4, } impl crate::ToBits<u8> for GEN_A { #[inline(always)] fn _bits(&self) -> u8 { match *self { GEN_A::GCLK0 => 0, GEN_A::GCLK1 => 1, GEN_A::GCLK2 => 2, GEN_A::GCLK3 => 3, GEN_A::GCLK4 => 4, } } } #[doc = "Reader of field `GEN`"] pub type GEN_R = crate::R<u8, GEN_A>; impl GEN_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, GEN_A> { use crate::Variant::*; match self.bits { 0 => Val(GEN_A::GCLK0), 1 => Val(GEN_A::GCLK1), 2 => Val(GEN_A::GCLK2), 3 => Val(GEN_A::GCLK3), 4 => Val(GEN_A::GCLK4), i => Res(i), } } #[doc = "Checks if the value of the field is `GCLK0`"] #[inline(always)] pub fn is_gclk0(&self) -> bool { *self == GEN_A::GCLK0 } #[doc = "Checks if the value of the field is `GCLK1`"] #[inline(always)] pub fn is_gclk1(&self) -> bool { *self == GEN_A::GCLK1 } #[doc = "Checks if the value of the field is `GCLK2`"] #[inline(always)] pub fn is_gclk2(&self) -> bool { *self == GEN_A::GCLK2 } #[doc = "Checks if the value of the field is `GCLK3`"] #[inline(always)] pub fn is_gclk3(&self) -> bool { *self == GEN_A::GCLK3 } #[doc = "Checks if the value of the field is `GCLK4`"] #[inline(always)] pub fn is_gclk4(&self) -> bool { *self == GEN_A::GCLK4 } } #[doc = "Write proxy for field `GEN`"] pub struct GEN_W<'a> { w: &'a mut W, } impl<'a> GEN_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: GEN_A) -> &'a mut W { use crate::ToBits; unsafe { self.bits(variant._bits()) } } #[doc = "Generic clock generator 0"] #[inline(always)] pub fn gclk0(self) -> &'a mut W { self.variant(GEN_A::GCLK0) } #[doc = "Generic clock generator 1"] #[inline(always)] pub fn gclk1(self) -> &'a mut W { self.variant(GEN_A::GCLK1) } #[doc = "Generic clock generator 2"] #[inline(always)] pub fn gclk2(self) -> &'a mut W { self.variant(GEN_A::GCLK2) } #[doc = "Generic clock generator 3"] #[inline(always)] pub fn gclk3(self) -> &'a mut W { self.variant(GEN_A::GCLK3) } #[doc = "Generic clock generator 4"] #[inline(always)] pub fn gclk4(self) -> &'a mut W { self.variant(GEN_A::GCLK4) } #[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 & !0x07) | ((value as u32) & 0x07); self.w } } #[doc = "Reader of field `CHEN`"] pub type CHEN_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CHEN`"] pub struct CHEN_W<'a> { w: &'a mut W, } impl<'a> CHEN_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Reader of field `WRTLOCK`"] pub type WRTLOCK_R = crate::R<bool, bool>; #[doc = "Write proxy for field `WRTLOCK`"] pub struct WRTLOCK_W<'a> { w: &'a mut W, } impl<'a> WRTLOCK_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } impl R { #[doc = "Bits 0:2 - Generic Clock Generator"] #[inline(always)] pub fn gen(&self) -> GEN_R { GEN_R::new((self.bits & 0x07) as u8) } #[doc = "Bit 6 - Channel Enable"] #[inline(always)] pub fn chen(&self) -> CHEN_R { CHEN_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - Write Lock"] #[inline(always)] pub fn wrtlock(&self) -> WRTLOCK_R { WRTLOCK_R::new(((self.bits >> 7) & 0x01) != 0) } } impl W { #[doc = "Bits 0:2 - Generic Clock Generator"] #[inline(always)] pub fn gen(&mut self) -> GEN_W { GEN_W { w: self } } #[doc = "Bit 6 - Channel Enable"] #[inline(always)] pub fn chen(&mut self) -> CHEN_W { CHEN_W { w: self } } #[doc = "Bit 7 - Write Lock"] #[inline(always)] pub fn wrtlock(&mut self) -> WRTLOCK_W { WRTLOCK_W { w: self } } }