stm32wb_pac/adc/
smpr2.rs

1#[doc = "Reader of register SMPR2"]
2pub type R = crate::R<u32, super::SMPR2>;
3#[doc = "Writer for register SMPR2"]
4pub type W = crate::W<u32, super::SMPR2>;
5#[doc = "Register SMPR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::SMPR2 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SMP18`"]
14pub type SMP18_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SMP18`"]
16pub struct SMP18_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SMP18_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x07 << 24)) | (((value as u32) & 0x07) << 24);
24        self.w
25    }
26}
27#[doc = "Reader of field `SMP17`"]
28pub type SMP17_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SMP17`"]
30pub struct SMP17_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SMP17_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x07 << 21)) | (((value as u32) & 0x07) << 21);
38        self.w
39    }
40}
41#[doc = "Reader of field `SMP16`"]
42pub type SMP16_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `SMP16`"]
44pub struct SMP16_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> SMP16_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x07 << 18)) | (((value as u32) & 0x07) << 18);
52        self.w
53    }
54}
55#[doc = "Reader of field `SMP15`"]
56pub type SMP15_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `SMP15`"]
58pub struct SMP15_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> SMP15_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x07 << 15)) | (((value as u32) & 0x07) << 15);
66        self.w
67    }
68}
69#[doc = "Reader of field `SMP14`"]
70pub type SMP14_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `SMP14`"]
72pub struct SMP14_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> SMP14_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x07 << 12)) | (((value as u32) & 0x07) << 12);
80        self.w
81    }
82}
83#[doc = "Reader of field `SMP13`"]
84pub type SMP13_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `SMP13`"]
86pub struct SMP13_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> SMP13_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x07 << 9)) | (((value as u32) & 0x07) << 9);
94        self.w
95    }
96}
97#[doc = "Reader of field `SMP12`"]
98pub type SMP12_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `SMP12`"]
100pub struct SMP12_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> SMP12_W<'a> {
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub unsafe fn bits(self, value: u8) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x07 << 6)) | (((value as u32) & 0x07) << 6);
108        self.w
109    }
110}
111#[doc = "Reader of field `SMP11`"]
112pub type SMP11_R = crate::R<u8, u8>;
113#[doc = "Write proxy for field `SMP11`"]
114pub struct SMP11_W<'a> {
115    w: &'a mut W,
116}
117impl<'a> SMP11_W<'a> {
118    #[doc = r"Writes raw bits to the field"]
119    #[inline(always)]
120    pub unsafe fn bits(self, value: u8) -> &'a mut W {
121        self.w.bits = (self.w.bits & !(0x07 << 3)) | (((value as u32) & 0x07) << 3);
122        self.w
123    }
124}
125#[doc = "Reader of field `SMP10`"]
126pub type SMP10_R = crate::R<u8, u8>;
127#[doc = "Write proxy for field `SMP10`"]
128pub struct SMP10_W<'a> {
129    w: &'a mut W,
130}
131impl<'a> SMP10_W<'a> {
132    #[doc = r"Writes raw bits to the field"]
133    #[inline(always)]
134    pub unsafe fn bits(self, value: u8) -> &'a mut W {
135        self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
136        self.w
137    }
138}
139impl R {
140    #[doc = "Bits 24:26 - ADC channel 18 sampling time selection"]
141    #[inline(always)]
142    pub fn smp18(&self) -> SMP18_R {
143        SMP18_R::new(((self.bits >> 24) & 0x07) as u8)
144    }
145    #[doc = "Bits 21:23 - ADC channel 17 sampling time selection"]
146    #[inline(always)]
147    pub fn smp17(&self) -> SMP17_R {
148        SMP17_R::new(((self.bits >> 21) & 0x07) as u8)
149    }
150    #[doc = "Bits 18:20 - ADC channel 16 sampling time selection"]
151    #[inline(always)]
152    pub fn smp16(&self) -> SMP16_R {
153        SMP16_R::new(((self.bits >> 18) & 0x07) as u8)
154    }
155    #[doc = "Bits 15:17 - ADC channel 15 sampling time selection"]
156    #[inline(always)]
157    pub fn smp15(&self) -> SMP15_R {
158        SMP15_R::new(((self.bits >> 15) & 0x07) as u8)
159    }
160    #[doc = "Bits 12:14 - ADC channel 14 sampling time selection"]
161    #[inline(always)]
162    pub fn smp14(&self) -> SMP14_R {
163        SMP14_R::new(((self.bits >> 12) & 0x07) as u8)
164    }
165    #[doc = "Bits 9:11 - ADC channel 13 sampling time selection"]
166    #[inline(always)]
167    pub fn smp13(&self) -> SMP13_R {
168        SMP13_R::new(((self.bits >> 9) & 0x07) as u8)
169    }
170    #[doc = "Bits 6:8 - ADC channel 12 sampling time selection"]
171    #[inline(always)]
172    pub fn smp12(&self) -> SMP12_R {
173        SMP12_R::new(((self.bits >> 6) & 0x07) as u8)
174    }
175    #[doc = "Bits 3:5 - ADC channel 11 sampling time selection"]
176    #[inline(always)]
177    pub fn smp11(&self) -> SMP11_R {
178        SMP11_R::new(((self.bits >> 3) & 0x07) as u8)
179    }
180    #[doc = "Bits 0:2 - ADC channel 10 sampling time selection"]
181    #[inline(always)]
182    pub fn smp10(&self) -> SMP10_R {
183        SMP10_R::new((self.bits & 0x07) as u8)
184    }
185}
186impl W {
187    #[doc = "Bits 24:26 - ADC channel 18 sampling time selection"]
188    #[inline(always)]
189    pub fn smp18(&mut self) -> SMP18_W {
190        SMP18_W { w: self }
191    }
192    #[doc = "Bits 21:23 - ADC channel 17 sampling time selection"]
193    #[inline(always)]
194    pub fn smp17(&mut self) -> SMP17_W {
195        SMP17_W { w: self }
196    }
197    #[doc = "Bits 18:20 - ADC channel 16 sampling time selection"]
198    #[inline(always)]
199    pub fn smp16(&mut self) -> SMP16_W {
200        SMP16_W { w: self }
201    }
202    #[doc = "Bits 15:17 - ADC channel 15 sampling time selection"]
203    #[inline(always)]
204    pub fn smp15(&mut self) -> SMP15_W {
205        SMP15_W { w: self }
206    }
207    #[doc = "Bits 12:14 - ADC channel 14 sampling time selection"]
208    #[inline(always)]
209    pub fn smp14(&mut self) -> SMP14_W {
210        SMP14_W { w: self }
211    }
212    #[doc = "Bits 9:11 - ADC channel 13 sampling time selection"]
213    #[inline(always)]
214    pub fn smp13(&mut self) -> SMP13_W {
215        SMP13_W { w: self }
216    }
217    #[doc = "Bits 6:8 - ADC channel 12 sampling time selection"]
218    #[inline(always)]
219    pub fn smp12(&mut self) -> SMP12_W {
220        SMP12_W { w: self }
221    }
222    #[doc = "Bits 3:5 - ADC channel 11 sampling time selection"]
223    #[inline(always)]
224    pub fn smp11(&mut self) -> SMP11_W {
225        SMP11_W { w: self }
226    }
227    #[doc = "Bits 0:2 - ADC channel 10 sampling time selection"]
228    #[inline(always)]
229    pub fn smp10(&mut self) -> SMP10_W {
230        SMP10_W { w: self }
231    }
232}