efm32pg12b500_pac/csen/
dmcfg.rs1#[doc = "Register `DMCFG` reader"]
2pub struct R(crate::R<DMCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DMCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DMCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DMCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DMCFG` writer"]
17pub struct W(crate::W<DMCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DMCFG_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<DMCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DMCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DMG` reader - Delta Modulator Gain Step"]
38pub type DMG_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `DMG` writer - Delta Modulator Gain Step"]
40pub type DMG_W<'a> = crate::FieldWriter<'a, u32, DMCFG_SPEC, u8, u8, 8, 0>;
41#[doc = "Field `DMR` reader - Delta Modulator Gain Reduction Interval"]
42pub type DMR_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `DMR` writer - Delta Modulator Gain Reduction Interval"]
44pub type DMR_W<'a> = crate::FieldWriter<'a, u32, DMCFG_SPEC, u8, u8, 4, 8>;
45#[doc = "Field `DMCR` reader - Delta Modulator Conversion Rate"]
46pub type DMCR_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `DMCR` writer - Delta Modulator Conversion Rate"]
48pub type DMCR_W<'a> = crate::FieldWriter<'a, u32, DMCFG_SPEC, u8, u8, 4, 16>;
49#[doc = "Delta Modulator Conversion Resolution.\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51#[repr(u8)]
52pub enum CRMODE_A {
53 #[doc = "0: 10-bit delta modulator"]
54 DM10 = 0,
55 #[doc = "1: 12-bit delta modulator"]
56 DM12 = 1,
57 #[doc = "2: 14-bit delta modulator"]
58 DM14 = 2,
59 #[doc = "3: 16-bit delta modulator"]
60 DM16 = 3,
61}
62impl From<CRMODE_A> for u8 {
63 #[inline(always)]
64 fn from(variant: CRMODE_A) -> Self {
65 variant as _
66 }
67}
68#[doc = "Field `CRMODE` reader - Delta Modulator Conversion Resolution."]
69pub type CRMODE_R = crate::FieldReader<u8, CRMODE_A>;
70impl CRMODE_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> CRMODE_A {
74 match self.bits {
75 0 => CRMODE_A::DM10,
76 1 => CRMODE_A::DM12,
77 2 => CRMODE_A::DM14,
78 3 => CRMODE_A::DM16,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `DM10`"]
83 #[inline(always)]
84 pub fn is_dm10(&self) -> bool {
85 *self == CRMODE_A::DM10
86 }
87 #[doc = "Checks if the value of the field is `DM12`"]
88 #[inline(always)]
89 pub fn is_dm12(&self) -> bool {
90 *self == CRMODE_A::DM12
91 }
92 #[doc = "Checks if the value of the field is `DM14`"]
93 #[inline(always)]
94 pub fn is_dm14(&self) -> bool {
95 *self == CRMODE_A::DM14
96 }
97 #[doc = "Checks if the value of the field is `DM16`"]
98 #[inline(always)]
99 pub fn is_dm16(&self) -> bool {
100 *self == CRMODE_A::DM16
101 }
102}
103#[doc = "Field `CRMODE` writer - Delta Modulator Conversion Resolution."]
104pub type CRMODE_W<'a> = crate::FieldWriterSafe<'a, u32, DMCFG_SPEC, u8, CRMODE_A, 2, 20>;
105impl<'a> CRMODE_W<'a> {
106 #[doc = "10-bit delta modulator"]
107 #[inline(always)]
108 pub fn dm10(self) -> &'a mut W {
109 self.variant(CRMODE_A::DM10)
110 }
111 #[doc = "12-bit delta modulator"]
112 #[inline(always)]
113 pub fn dm12(self) -> &'a mut W {
114 self.variant(CRMODE_A::DM12)
115 }
116 #[doc = "14-bit delta modulator"]
117 #[inline(always)]
118 pub fn dm14(self) -> &'a mut W {
119 self.variant(CRMODE_A::DM14)
120 }
121 #[doc = "16-bit delta modulator"]
122 #[inline(always)]
123 pub fn dm16(self) -> &'a mut W {
124 self.variant(CRMODE_A::DM16)
125 }
126}
127#[doc = "Field `DMGRDIS` reader - Delta Modulation Gain Step Reduction Disable"]
128pub type DMGRDIS_R = crate::BitReader<bool>;
129#[doc = "Field `DMGRDIS` writer - Delta Modulation Gain Step Reduction Disable"]
130pub type DMGRDIS_W<'a> = crate::BitWriter<'a, u32, DMCFG_SPEC, bool, 28>;
131impl R {
132 #[doc = "Bits 0:7 - Delta Modulator Gain Step"]
133 #[inline(always)]
134 pub fn dmg(&self) -> DMG_R {
135 DMG_R::new((self.bits & 0xff) as u8)
136 }
137 #[doc = "Bits 8:11 - Delta Modulator Gain Reduction Interval"]
138 #[inline(always)]
139 pub fn dmr(&self) -> DMR_R {
140 DMR_R::new(((self.bits >> 8) & 0x0f) as u8)
141 }
142 #[doc = "Bits 16:19 - Delta Modulator Conversion Rate"]
143 #[inline(always)]
144 pub fn dmcr(&self) -> DMCR_R {
145 DMCR_R::new(((self.bits >> 16) & 0x0f) as u8)
146 }
147 #[doc = "Bits 20:21 - Delta Modulator Conversion Resolution."]
148 #[inline(always)]
149 pub fn crmode(&self) -> CRMODE_R {
150 CRMODE_R::new(((self.bits >> 20) & 3) as u8)
151 }
152 #[doc = "Bit 28 - Delta Modulation Gain Step Reduction Disable"]
153 #[inline(always)]
154 pub fn dmgrdis(&self) -> DMGRDIS_R {
155 DMGRDIS_R::new(((self.bits >> 28) & 1) != 0)
156 }
157}
158impl W {
159 #[doc = "Bits 0:7 - Delta Modulator Gain Step"]
160 #[inline(always)]
161 pub fn dmg(&mut self) -> DMG_W {
162 DMG_W::new(self)
163 }
164 #[doc = "Bits 8:11 - Delta Modulator Gain Reduction Interval"]
165 #[inline(always)]
166 pub fn dmr(&mut self) -> DMR_W {
167 DMR_W::new(self)
168 }
169 #[doc = "Bits 16:19 - Delta Modulator Conversion Rate"]
170 #[inline(always)]
171 pub fn dmcr(&mut self) -> DMCR_W {
172 DMCR_W::new(self)
173 }
174 #[doc = "Bits 20:21 - Delta Modulator Conversion Resolution."]
175 #[inline(always)]
176 pub fn crmode(&mut self) -> CRMODE_W {
177 CRMODE_W::new(self)
178 }
179 #[doc = "Bit 28 - Delta Modulation Gain Step Reduction Disable"]
180 #[inline(always)]
181 pub fn dmgrdis(&mut self) -> DMGRDIS_W {
182 DMGRDIS_W::new(self)
183 }
184 #[doc = "Writes raw bits to the register."]
185 #[inline(always)]
186 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
187 self.0.bits(bits);
188 self
189 }
190}
191#[doc = "Delta Modulation Configuration\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dmcfg](index.html) module"]
192pub struct DMCFG_SPEC;
193impl crate::RegisterSpec for DMCFG_SPEC {
194 type Ux = u32;
195}
196#[doc = "`read()` method returns [dmcfg::R](R) reader structure"]
197impl crate::Readable for DMCFG_SPEC {
198 type Reader = R;
199}
200#[doc = "`write(|w| ..)` method takes [dmcfg::W](W) writer structure"]
201impl crate::Writable for DMCFG_SPEC {
202 type Writer = W;
203}
204#[doc = "`reset()` method sets DMCFG to value 0"]
205impl crate::Resettable for DMCFG_SPEC {
206 #[inline(always)]
207 fn reset_value() -> Self::Ux {
208 0
209 }
210}