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
#[doc = "Reader of register TCR"] pub type R = crate::R<u32, super::TCR>; #[doc = "Writer for register TCR"] pub type W = crate::W<u32, super::TCR>; #[doc = "Register TCR `reset()`'s with value 0"] impl crate::ResetValue for super::TCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Time Compensation Register\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum TCR_A { #[doc = "128: Time Prescaler Register overflows every 32896 clock cycles."] _10000000 = 128, #[doc = "255: Time Prescaler Register overflows every 32769 clock cycles."] _11111111 = 255, #[doc = "0: Time Prescaler Register overflows every 32768 clock cycles."] _0 = 0, #[doc = "1: Time Prescaler Register overflows every 32767 clock cycles."] _1 = 1, #[doc = "127: Time Prescaler Register overflows every 32641 clock cycles."] _1111111 = 127, } impl From<TCR_A> for u8 { #[inline(always)] fn from(variant: TCR_A) -> Self { variant as _ } } #[doc = "Reader of field `TCR`"] pub type TCR_R = crate::R<u8, TCR_A>; impl TCR_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, TCR_A> { use crate::Variant::*; match self.bits { 128 => Val(TCR_A::_10000000), 255 => Val(TCR_A::_11111111), 0 => Val(TCR_A::_0), 1 => Val(TCR_A::_1), 127 => Val(TCR_A::_1111111), i => Res(i), } } #[doc = "Checks if the value of the field is `_10000000`"] #[inline(always)] pub fn is_10000000(&self) -> bool { *self == TCR_A::_10000000 } #[doc = "Checks if the value of the field is `_11111111`"] #[inline(always)] pub fn is_11111111(&self) -> bool { *self == TCR_A::_11111111 } #[doc = "Checks if the value of the field is `_0`"] #[inline(always)] pub fn is_0(&self) -> bool { *self == TCR_A::_0 } #[doc = "Checks if the value of the field is `_1`"] #[inline(always)] pub fn is_1(&self) -> bool { *self == TCR_A::_1 } #[doc = "Checks if the value of the field is `_1111111`"] #[inline(always)] pub fn is_1111111(&self) -> bool { *self == TCR_A::_1111111 } } #[doc = "Write proxy for field `TCR`"] pub struct TCR_W<'a> { w: &'a mut W, } impl<'a> TCR_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TCR_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Time Prescaler Register overflows every 32896 clock cycles."] #[inline(always)] pub fn _10000000(self) -> &'a mut W { self.variant(TCR_A::_10000000) } #[doc = "Time Prescaler Register overflows every 32769 clock cycles."] #[inline(always)] pub fn _11111111(self) -> &'a mut W { self.variant(TCR_A::_11111111) } #[doc = "Time Prescaler Register overflows every 32768 clock cycles."] #[inline(always)] pub fn _0(self) -> &'a mut W { self.variant(TCR_A::_0) } #[doc = "Time Prescaler Register overflows every 32767 clock cycles."] #[inline(always)] pub fn _1(self) -> &'a mut W { self.variant(TCR_A::_1) } #[doc = "Time Prescaler Register overflows every 32641 clock cycles."] #[inline(always)] pub fn _1111111(self) -> &'a mut W { self.variant(TCR_A::_1111111) } #[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 u32) & 0xff); self.w } } #[doc = "Reader of field `CIR`"] pub type CIR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `CIR`"] pub struct CIR_W<'a> { w: &'a mut W, } impl<'a> CIR_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 & !(0xff << 8)) | (((value as u32) & 0xff) << 8); self.w } } #[doc = "Reader of field `TCV`"] pub type TCV_R = crate::R<u8, u8>; #[doc = "Reader of field `CIC`"] pub type CIC_R = crate::R<u8, u8>; impl R { #[doc = "Bits 0:7 - Time Compensation Register"] #[inline(always)] pub fn tcr(&self) -> TCR_R { TCR_R::new((self.bits & 0xff) as u8) } #[doc = "Bits 8:15 - Compensation Interval Register"] #[inline(always)] pub fn cir(&self) -> CIR_R { CIR_R::new(((self.bits >> 8) & 0xff) as u8) } #[doc = "Bits 16:23 - Time Compensation Value"] #[inline(always)] pub fn tcv(&self) -> TCV_R { TCV_R::new(((self.bits >> 16) & 0xff) as u8) } #[doc = "Bits 24:31 - Compensation Interval Counter"] #[inline(always)] pub fn cic(&self) -> CIC_R { CIC_R::new(((self.bits >> 24) & 0xff) as u8) } } impl W { #[doc = "Bits 0:7 - Time Compensation Register"] #[inline(always)] pub fn tcr(&mut self) -> TCR_W { TCR_W { w: self } } #[doc = "Bits 8:15 - Compensation Interval Register"] #[inline(always)] pub fn cir(&mut self) -> CIR_W { CIR_W { w: self } } }