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
#[doc = "Reader of register DMCFG"] pub type R = crate::R<u32, super::DMCFG>; #[doc = "Writer for register DMCFG"] pub type W = crate::W<u32, super::DMCFG>; #[doc = "Register DMCFG `reset()`'s with value 0"] impl crate::ResetValue for super::DMCFG { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `DMG`"] pub type DMG_R = crate::R<u8, u8>; #[doc = "Write proxy for field `DMG`"] pub struct DMG_W<'a> { w: &'a mut W, } impl<'a> DMG_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) | ((value as u32) & 0xff); self.w } } #[doc = "Reader of field `DMR`"] pub type DMR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `DMR`"] pub struct DMR_W<'a> { w: &'a mut W, } impl<'a> DMR_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 & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8); self.w } } #[doc = "Reader of field `DMCR`"] pub type DMCR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `DMCR`"] pub struct DMCR_W<'a> { w: &'a mut W, } impl<'a> DMCR_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 & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16); self.w } } #[doc = "Delta Modulator Conversion Resolution.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum CRMODE_A { #[doc = "0: 10-bit delta modulator"] DM10 = 0, #[doc = "1: 12-bit delta modulator"] DM12 = 1, #[doc = "2: 14-bit delta modulator"] DM14 = 2, #[doc = "3: 16-bit delta modulator"] DM16 = 3, } impl From<CRMODE_A> for u8 { #[inline(always)] fn from(variant: CRMODE_A) -> Self { variant as _ } } #[doc = "Reader of field `CRMODE`"] pub type CRMODE_R = crate::R<u8, CRMODE_A>; impl CRMODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CRMODE_A { match self.bits { 0 => CRMODE_A::DM10, 1 => CRMODE_A::DM12, 2 => CRMODE_A::DM14, 3 => CRMODE_A::DM16, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `DM10`"] #[inline(always)] pub fn is_dm10(&self) -> bool { *self == CRMODE_A::DM10 } #[doc = "Checks if the value of the field is `DM12`"] #[inline(always)] pub fn is_dm12(&self) -> bool { *self == CRMODE_A::DM12 } #[doc = "Checks if the value of the field is `DM14`"] #[inline(always)] pub fn is_dm14(&self) -> bool { *self == CRMODE_A::DM14 } #[doc = "Checks if the value of the field is `DM16`"] #[inline(always)] pub fn is_dm16(&self) -> bool { *self == CRMODE_A::DM16 } } #[doc = "Write proxy for field `CRMODE`"] pub struct CRMODE_W<'a> { w: &'a mut W, } impl<'a> CRMODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CRMODE_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "10-bit delta modulator"] #[inline(always)] pub fn dm10(self) -> &'a mut W { self.variant(CRMODE_A::DM10) } #[doc = "12-bit delta modulator"] #[inline(always)] pub fn dm12(self) -> &'a mut W { self.variant(CRMODE_A::DM12) } #[doc = "14-bit delta modulator"] #[inline(always)] pub fn dm14(self) -> &'a mut W { self.variant(CRMODE_A::DM14) } #[doc = "16-bit delta modulator"] #[inline(always)] pub fn dm16(self) -> &'a mut W { self.variant(CRMODE_A::DM16) } #[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 & !(0x03 << 20)) | (((value as u32) & 0x03) << 20); self.w } } #[doc = "Reader of field `DMGRDIS`"] pub type DMGRDIS_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DMGRDIS`"] pub struct DMGRDIS_W<'a> { w: &'a mut W, } impl<'a> DMGRDIS_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 << 28)) | (((value as u32) & 0x01) << 28); self.w } } impl R { #[doc = "Bits 0:7 - Delta Modulator Gain Step"] #[inline(always)] pub fn dmg(&self) -> DMG_R { DMG_R::new((self.bits & 0xff) as u8) } #[doc = "Bits 8:11 - Delta Modulator Gain Reduction Interval"] #[inline(always)] pub fn dmr(&self) -> DMR_R { DMR_R::new(((self.bits >> 8) & 0x0f) as u8) } #[doc = "Bits 16:19 - Delta Modulator Conversion Rate"] #[inline(always)] pub fn dmcr(&self) -> DMCR_R { DMCR_R::new(((self.bits >> 16) & 0x0f) as u8) } #[doc = "Bits 20:21 - Delta Modulator Conversion Resolution."] #[inline(always)] pub fn crmode(&self) -> CRMODE_R { CRMODE_R::new(((self.bits >> 20) & 0x03) as u8) } #[doc = "Bit 28 - Delta Modulation Gain Step Reduction Disable"] #[inline(always)] pub fn dmgrdis(&self) -> DMGRDIS_R { DMGRDIS_R::new(((self.bits >> 28) & 0x01) != 0) } } impl W { #[doc = "Bits 0:7 - Delta Modulator Gain Step"] #[inline(always)] pub fn dmg(&mut self) -> DMG_W { DMG_W { w: self } } #[doc = "Bits 8:11 - Delta Modulator Gain Reduction Interval"] #[inline(always)] pub fn dmr(&mut self) -> DMR_W { DMR_W { w: self } } #[doc = "Bits 16:19 - Delta Modulator Conversion Rate"] #[inline(always)] pub fn dmcr(&mut self) -> DMCR_W { DMCR_W { w: self } } #[doc = "Bits 20:21 - Delta Modulator Conversion Resolution."] #[inline(always)] pub fn crmode(&mut self) -> CRMODE_W { CRMODE_W { w: self } } #[doc = "Bit 28 - Delta Modulation Gain Step Reduction Disable"] #[inline(always)] pub fn dmgrdis(&mut self) -> DMGRDIS_W { DMGRDIS_W { w: self } } }