efm32gg12b110_pac/idac0/
curprog.rs1#[doc = "Register `CURPROG` reader"]
2pub struct R(crate::R<CURPROG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CURPROG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CURPROG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CURPROG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CURPROG` writer"]
17pub struct W(crate::W<CURPROG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CURPROG_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<CURPROG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CURPROG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Current Range Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RANGESEL_A {
41 #[doc = "0: Current range set to 0 - 1.6 uA."]
42 RANGE0 = 0,
43 #[doc = "1: Current range set to 1.6 - 4.7 uA."]
44 RANGE1 = 1,
45 #[doc = "2: Current range set to 0.5 - 16 uA."]
46 RANGE2 = 2,
47 #[doc = "3: Current range set to 2 - 64 uA."]
48 RANGE3 = 3,
49}
50impl From<RANGESEL_A> for u8 {
51 #[inline(always)]
52 fn from(variant: RANGESEL_A) -> Self {
53 variant as _
54 }
55}
56#[doc = "Field `RANGESEL` reader - Current Range Select"]
57pub type RANGESEL_R = crate::FieldReader<u8, RANGESEL_A>;
58impl RANGESEL_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> RANGESEL_A {
62 match self.bits {
63 0 => RANGESEL_A::RANGE0,
64 1 => RANGESEL_A::RANGE1,
65 2 => RANGESEL_A::RANGE2,
66 3 => RANGESEL_A::RANGE3,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `RANGE0`"]
71 #[inline(always)]
72 pub fn is_range0(&self) -> bool {
73 *self == RANGESEL_A::RANGE0
74 }
75 #[doc = "Checks if the value of the field is `RANGE1`"]
76 #[inline(always)]
77 pub fn is_range1(&self) -> bool {
78 *self == RANGESEL_A::RANGE1
79 }
80 #[doc = "Checks if the value of the field is `RANGE2`"]
81 #[inline(always)]
82 pub fn is_range2(&self) -> bool {
83 *self == RANGESEL_A::RANGE2
84 }
85 #[doc = "Checks if the value of the field is `RANGE3`"]
86 #[inline(always)]
87 pub fn is_range3(&self) -> bool {
88 *self == RANGESEL_A::RANGE3
89 }
90}
91#[doc = "Field `RANGESEL` writer - Current Range Select"]
92pub type RANGESEL_W<'a> = crate::FieldWriterSafe<'a, u32, CURPROG_SPEC, u8, RANGESEL_A, 2, 0>;
93impl<'a> RANGESEL_W<'a> {
94 #[doc = "Current range set to 0 - 1.6 uA."]
95 #[inline(always)]
96 pub fn range0(self) -> &'a mut W {
97 self.variant(RANGESEL_A::RANGE0)
98 }
99 #[doc = "Current range set to 1.6 - 4.7 uA."]
100 #[inline(always)]
101 pub fn range1(self) -> &'a mut W {
102 self.variant(RANGESEL_A::RANGE1)
103 }
104 #[doc = "Current range set to 0.5 - 16 uA."]
105 #[inline(always)]
106 pub fn range2(self) -> &'a mut W {
107 self.variant(RANGESEL_A::RANGE2)
108 }
109 #[doc = "Current range set to 2 - 64 uA."]
110 #[inline(always)]
111 pub fn range3(self) -> &'a mut W {
112 self.variant(RANGESEL_A::RANGE3)
113 }
114}
115#[doc = "Field `STEPSEL` reader - Current Step Size Select"]
116pub type STEPSEL_R = crate::FieldReader<u8, u8>;
117#[doc = "Field `STEPSEL` writer - Current Step Size Select"]
118pub type STEPSEL_W<'a> = crate::FieldWriter<'a, u32, CURPROG_SPEC, u8, u8, 5, 8>;
119#[doc = "Field `TUNING` reader - Tune the Current to Given Accuracy"]
120pub type TUNING_R = crate::FieldReader<u8, u8>;
121#[doc = "Field `TUNING` writer - Tune the Current to Given Accuracy"]
122pub type TUNING_W<'a> = crate::FieldWriter<'a, u32, CURPROG_SPEC, u8, u8, 8, 16>;
123impl R {
124 #[doc = "Bits 0:1 - Current Range Select"]
125 #[inline(always)]
126 pub fn rangesel(&self) -> RANGESEL_R {
127 RANGESEL_R::new((self.bits & 3) as u8)
128 }
129 #[doc = "Bits 8:12 - Current Step Size Select"]
130 #[inline(always)]
131 pub fn stepsel(&self) -> STEPSEL_R {
132 STEPSEL_R::new(((self.bits >> 8) & 0x1f) as u8)
133 }
134 #[doc = "Bits 16:23 - Tune the Current to Given Accuracy"]
135 #[inline(always)]
136 pub fn tuning(&self) -> TUNING_R {
137 TUNING_R::new(((self.bits >> 16) & 0xff) as u8)
138 }
139}
140impl W {
141 #[doc = "Bits 0:1 - Current Range Select"]
142 #[inline(always)]
143 pub fn rangesel(&mut self) -> RANGESEL_W {
144 RANGESEL_W::new(self)
145 }
146 #[doc = "Bits 8:12 - Current Step Size Select"]
147 #[inline(always)]
148 pub fn stepsel(&mut self) -> STEPSEL_W {
149 STEPSEL_W::new(self)
150 }
151 #[doc = "Bits 16:23 - Tune the Current to Given Accuracy"]
152 #[inline(always)]
153 pub fn tuning(&mut self) -> TUNING_W {
154 TUNING_W::new(self)
155 }
156 #[doc = "Writes raw bits to the register."]
157 #[inline(always)]
158 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
159 self.0.bits(bits);
160 self
161 }
162}
163#[doc = "Current Programming Register\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 [curprog](index.html) module"]
164pub struct CURPROG_SPEC;
165impl crate::RegisterSpec for CURPROG_SPEC {
166 type Ux = u32;
167}
168#[doc = "`read()` method returns [curprog::R](R) reader structure"]
169impl crate::Readable for CURPROG_SPEC {
170 type Reader = R;
171}
172#[doc = "`write(|w| ..)` method takes [curprog::W](W) writer structure"]
173impl crate::Writable for CURPROG_SPEC {
174 type Writer = W;
175}
176#[doc = "`reset()` method sets CURPROG to value 0x009b_0000"]
177impl crate::Resettable for CURPROG_SPEC {
178 #[inline(always)]
179 fn reset_value() -> Self::Ux {
180 0x009b_0000
181 }
182}