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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
#[doc = "Reader of register LFXOCTRL"] pub type R = crate::R<u32, super::LFXOCTRL>; #[doc = "Writer for register LFXOCTRL"] pub type W = crate::W<u32, super::LFXOCTRL>; #[doc = "Register LFXOCTRL `reset()`'s with value 0x0700_9000"] impl crate::ResetValue for super::LFXOCTRL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0x0700_9000 } } #[doc = "Reader of field `TUNING`"] pub type TUNING_R = crate::R<u8, u8>; #[doc = "Write proxy for field `TUNING`"] pub struct TUNING_W<'a> { w: &'a mut W, } impl<'a> TUNING_W<'a> { #[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 & !0x7f) | ((value as u32) & 0x7f); self.w } } #[doc = "LFXO Mode\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum MODE_A { #[doc = "0: 32768 Hz crystal oscillator"] XTAL = 0, #[doc = "1: An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32768 Hz)."] BUFEXTCLK = 1, #[doc = "2: Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."] DIGEXTCLK = 2, } impl From<MODE_A> for u8 { #[inline(always)] fn from(variant: MODE_A) -> Self { variant as _ } } #[doc = "Reader of field `MODE`"] pub type MODE_R = crate::R<u8, MODE_A>; impl MODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, MODE_A> { use crate::Variant::*; match self.bits { 0 => Val(MODE_A::XTAL), 1 => Val(MODE_A::BUFEXTCLK), 2 => Val(MODE_A::DIGEXTCLK), i => Res(i), } } #[doc = "Checks if the value of the field is `XTAL`"] #[inline(always)] pub fn is_xtal(&self) -> bool { *self == MODE_A::XTAL } #[doc = "Checks if the value of the field is `BUFEXTCLK`"] #[inline(always)] pub fn is_bufextclk(&self) -> bool { *self == MODE_A::BUFEXTCLK } #[doc = "Checks if the value of the field is `DIGEXTCLK`"] #[inline(always)] pub fn is_digextclk(&self) -> bool { *self == MODE_A::DIGEXTCLK } } #[doc = "Write proxy for field `MODE`"] pub struct MODE_W<'a> { w: &'a mut W, } impl<'a> MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: MODE_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "32768 Hz crystal oscillator"] #[inline(always)] pub fn xtal(self) -> &'a mut W { self.variant(MODE_A::XTAL) } #[doc = "An AC coupled buffer is coupled in series with LFXTAL_N pin, suitable for external sinus wave (32768 Hz)."] #[inline(always)] pub fn bufextclk(self) -> &'a mut W { self.variant(MODE_A::BUFEXTCLK) } #[doc = "Digital external clock on LFXTAL_N pin. Oscillator is effectively bypassed."] #[inline(always)] pub fn digextclk(self) -> &'a mut W { self.variant(MODE_A::DIGEXTCLK) } #[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 & !(0x03 << 8)) | (((value as u32) & 0x03) << 8); self.w } } #[doc = "Reader of field `GAIN`"] pub type GAIN_R = crate::R<u8, u8>; #[doc = "Write proxy for field `GAIN`"] pub struct GAIN_W<'a> { w: &'a mut W, } impl<'a> GAIN_W<'a> { #[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 & !(0x03 << 11)) | (((value as u32) & 0x03) << 11); self.w } } #[doc = "Reader of field `HIGHAMPL`"] pub type HIGHAMPL_R = crate::R<bool, bool>; #[doc = "Write proxy for field `HIGHAMPL`"] pub struct HIGHAMPL_W<'a> { w: &'a mut W, } impl<'a> HIGHAMPL_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 << 14)) | (((value as u32) & 0x01) << 14); self.w } } #[doc = "Reader of field `AGC`"] pub type AGC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `AGC`"] pub struct AGC_W<'a> { w: &'a mut W, } impl<'a> AGC_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 << 15)) | (((value as u32) & 0x01) << 15); self.w } } #[doc = "Reader of field `CUR`"] pub type CUR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `CUR`"] pub struct CUR_W<'a> { w: &'a mut W, } impl<'a> CUR_W<'a> { #[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 & !(0x03 << 16)) | (((value as u32) & 0x03) << 16); self.w } } #[doc = "Reader of field `BUFCUR`"] pub type BUFCUR_R = crate::R<bool, bool>; #[doc = "Write proxy for field `BUFCUR`"] pub struct BUFCUR_W<'a> { w: &'a mut W, } impl<'a> BUFCUR_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 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "LFXO Timeout\n\nValue on reset: 7"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum TIMEOUT_A { #[doc = "0: Timeout period of 2 cycles"] _2CYCLES = 0, #[doc = "1: Timeout period of 256 cycles"] _256CYCLES = 1, #[doc = "2: Timeout period of 1024 cycles"] _1KCYCLES = 2, #[doc = "3: Timeout period of 2048 cycles"] _2KCYCLES = 3, #[doc = "4: Timeout period of 4096 cycles"] _4KCYCLES = 4, #[doc = "5: Timeout period of 8192 cycles"] _8KCYCLES = 5, #[doc = "6: Timeout period of 16384 cycles"] _16KCYCLES = 6, #[doc = "7: Timeout period of 32768 cycles"] _32KCYCLES = 7, } impl From<TIMEOUT_A> for u8 { #[inline(always)] fn from(variant: TIMEOUT_A) -> Self { variant as _ } } #[doc = "Reader of field `TIMEOUT`"] pub type TIMEOUT_R = crate::R<u8, TIMEOUT_A>; impl TIMEOUT_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TIMEOUT_A { match self.bits { 0 => TIMEOUT_A::_2CYCLES, 1 => TIMEOUT_A::_256CYCLES, 2 => TIMEOUT_A::_1KCYCLES, 3 => TIMEOUT_A::_2KCYCLES, 4 => TIMEOUT_A::_4KCYCLES, 5 => TIMEOUT_A::_8KCYCLES, 6 => TIMEOUT_A::_16KCYCLES, 7 => TIMEOUT_A::_32KCYCLES, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `_2CYCLES`"] #[inline(always)] pub fn is_2cycles(&self) -> bool { *self == TIMEOUT_A::_2CYCLES } #[doc = "Checks if the value of the field is `_256CYCLES`"] #[inline(always)] pub fn is_256cycles(&self) -> bool { *self == TIMEOUT_A::_256CYCLES } #[doc = "Checks if the value of the field is `_1KCYCLES`"] #[inline(always)] pub fn is_1kcycles(&self) -> bool { *self == TIMEOUT_A::_1KCYCLES } #[doc = "Checks if the value of the field is `_2KCYCLES`"] #[inline(always)] pub fn is_2kcycles(&self) -> bool { *self == TIMEOUT_A::_2KCYCLES } #[doc = "Checks if the value of the field is `_4KCYCLES`"] #[inline(always)] pub fn is_4kcycles(&self) -> bool { *self == TIMEOUT_A::_4KCYCLES } #[doc = "Checks if the value of the field is `_8KCYCLES`"] #[inline(always)] pub fn is_8kcycles(&self) -> bool { *self == TIMEOUT_A::_8KCYCLES } #[doc = "Checks if the value of the field is `_16KCYCLES`"] #[inline(always)] pub fn is_16kcycles(&self) -> bool { *self == TIMEOUT_A::_16KCYCLES } #[doc = "Checks if the value of the field is `_32KCYCLES`"] #[inline(always)] pub fn is_32kcycles(&self) -> bool { *self == TIMEOUT_A::_32KCYCLES } } #[doc = "Write proxy for field `TIMEOUT`"] pub struct TIMEOUT_W<'a> { w: &'a mut W, } impl<'a> TIMEOUT_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TIMEOUT_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Timeout period of 2 cycles"] #[inline(always)] pub fn _2cycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_2CYCLES) } #[doc = "Timeout period of 256 cycles"] #[inline(always)] pub fn _256cycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_256CYCLES) } #[doc = "Timeout period of 1024 cycles"] #[inline(always)] pub fn _1kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_1KCYCLES) } #[doc = "Timeout period of 2048 cycles"] #[inline(always)] pub fn _2kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_2KCYCLES) } #[doc = "Timeout period of 4096 cycles"] #[inline(always)] pub fn _4kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_4KCYCLES) } #[doc = "Timeout period of 8192 cycles"] #[inline(always)] pub fn _8kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_8KCYCLES) } #[doc = "Timeout period of 16384 cycles"] #[inline(always)] pub fn _16kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_16KCYCLES) } #[doc = "Timeout period of 32768 cycles"] #[inline(always)] pub fn _32kcycles(self) -> &'a mut W { self.variant(TIMEOUT_A::_32KCYCLES) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 24)) | (((value as u32) & 0x07) << 24); self.w } } impl R { #[doc = "Bits 0:6 - LFXO Internal Capacitor Array Tuning Value"] #[inline(always)] pub fn tuning(&self) -> TUNING_R { TUNING_R::new((self.bits & 0x7f) as u8) } #[doc = "Bits 8:9 - LFXO Mode"] #[inline(always)] pub fn mode(&self) -> MODE_R { MODE_R::new(((self.bits >> 8) & 0x03) as u8) } #[doc = "Bits 11:12 - LFXO Startup Gain"] #[inline(always)] pub fn gain(&self) -> GAIN_R { GAIN_R::new(((self.bits >> 11) & 0x03) as u8) } #[doc = "Bit 14 - LFXO High XTAL Oscillation Amplitude Enable"] #[inline(always)] pub fn highampl(&self) -> HIGHAMPL_R { HIGHAMPL_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 15 - LFXO AGC Enable"] #[inline(always)] pub fn agc(&self) -> AGC_R { AGC_R::new(((self.bits >> 15) & 0x01) != 0) } #[doc = "Bits 16:17 - LFXO Current Trim"] #[inline(always)] pub fn cur(&self) -> CUR_R { CUR_R::new(((self.bits >> 16) & 0x03) as u8) } #[doc = "Bit 20 - LFXO Buffer Bias Current"] #[inline(always)] pub fn bufcur(&self) -> BUFCUR_R { BUFCUR_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bits 24:26 - LFXO Timeout"] #[inline(always)] pub fn timeout(&self) -> TIMEOUT_R { TIMEOUT_R::new(((self.bits >> 24) & 0x07) as u8) } } impl W { #[doc = "Bits 0:6 - LFXO Internal Capacitor Array Tuning Value"] #[inline(always)] pub fn tuning(&mut self) -> TUNING_W { TUNING_W { w: self } } #[doc = "Bits 8:9 - LFXO Mode"] #[inline(always)] pub fn mode(&mut self) -> MODE_W { MODE_W { w: self } } #[doc = "Bits 11:12 - LFXO Startup Gain"] #[inline(always)] pub fn gain(&mut self) -> GAIN_W { GAIN_W { w: self } } #[doc = "Bit 14 - LFXO High XTAL Oscillation Amplitude Enable"] #[inline(always)] pub fn highampl(&mut self) -> HIGHAMPL_W { HIGHAMPL_W { w: self } } #[doc = "Bit 15 - LFXO AGC Enable"] #[inline(always)] pub fn agc(&mut self) -> AGC_W { AGC_W { w: self } } #[doc = "Bits 16:17 - LFXO Current Trim"] #[inline(always)] pub fn cur(&mut self) -> CUR_W { CUR_W { w: self } } #[doc = "Bit 20 - LFXO Buffer Bias Current"] #[inline(always)] pub fn bufcur(&mut self) -> BUFCUR_W { BUFCUR_W { w: self } } #[doc = "Bits 24:26 - LFXO Timeout"] #[inline(always)] pub fn timeout(&mut self) -> TIMEOUT_W { TIMEOUT_W { w: self } } }