stm32wb_pac/adc/
smpr1.rs

1#[doc = "Reader of register SMPR1"]
2pub type R = crate::R<u32, super::SMPR1>;
3#[doc = "Writer for register SMPR1"]
4pub type W = crate::W<u32, super::SMPR1>;
5#[doc = "Register SMPR1 `reset()`'s with value 0"]
6impl crate::ResetValue for super::SMPR1 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SMP9`"]
14pub type SMP9_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SMP9`"]
16pub struct SMP9_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SMP9_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 << 27)) | (((value as u32) & 0x07) << 27);
24        self.w
25    }
26}
27#[doc = "Reader of field `SMP8`"]
28pub type SMP8_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SMP8`"]
30pub struct SMP8_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SMP8_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 << 24)) | (((value as u32) & 0x07) << 24);
38        self.w
39    }
40}
41#[doc = "Reader of field `SMP7`"]
42pub type SMP7_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `SMP7`"]
44pub struct SMP7_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> SMP7_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 << 21)) | (((value as u32) & 0x07) << 21);
52        self.w
53    }
54}
55#[doc = "Reader of field `SMP6`"]
56pub type SMP6_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `SMP6`"]
58pub struct SMP6_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> SMP6_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 << 18)) | (((value as u32) & 0x07) << 18);
66        self.w
67    }
68}
69#[doc = "Reader of field `SMP5`"]
70pub type SMP5_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `SMP5`"]
72pub struct SMP5_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> SMP5_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 << 15)) | (((value as u32) & 0x07) << 15);
80        self.w
81    }
82}
83#[doc = "Reader of field `SMP4`"]
84pub type SMP4_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `SMP4`"]
86pub struct SMP4_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> SMP4_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 << 12)) | (((value as u32) & 0x07) << 12);
94        self.w
95    }
96}
97#[doc = "Reader of field `SMP3`"]
98pub type SMP3_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `SMP3`"]
100pub struct SMP3_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> SMP3_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 << 9)) | (((value as u32) & 0x07) << 9);
108        self.w
109    }
110}
111#[doc = "Reader of field `SMP2`"]
112pub type SMP2_R = crate::R<u8, u8>;
113#[doc = "Write proxy for field `SMP2`"]
114pub struct SMP2_W<'a> {
115    w: &'a mut W,
116}
117impl<'a> SMP2_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 << 6)) | (((value as u32) & 0x07) << 6);
122        self.w
123    }
124}
125#[doc = "Reader of field `SMP1`"]
126pub type SMP1_R = crate::R<u8, u8>;
127#[doc = "Write proxy for field `SMP1`"]
128pub struct SMP1_W<'a> {
129    w: &'a mut W,
130}
131impl<'a> SMP1_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 << 3)) | (((value as u32) & 0x07) << 3);
136        self.w
137    }
138}
139impl R {
140    #[doc = "Bits 27:29 - ADC channel 9 sampling time selection"]
141    #[inline(always)]
142    pub fn smp9(&self) -> SMP9_R {
143        SMP9_R::new(((self.bits >> 27) & 0x07) as u8)
144    }
145    #[doc = "Bits 24:26 - ADC channel 8 sampling time selection"]
146    #[inline(always)]
147    pub fn smp8(&self) -> SMP8_R {
148        SMP8_R::new(((self.bits >> 24) & 0x07) as u8)
149    }
150    #[doc = "Bits 21:23 - ADC channel 7 sampling time selection"]
151    #[inline(always)]
152    pub fn smp7(&self) -> SMP7_R {
153        SMP7_R::new(((self.bits >> 21) & 0x07) as u8)
154    }
155    #[doc = "Bits 18:20 - ADC channel 6 sampling time selection"]
156    #[inline(always)]
157    pub fn smp6(&self) -> SMP6_R {
158        SMP6_R::new(((self.bits >> 18) & 0x07) as u8)
159    }
160    #[doc = "Bits 15:17 - ADC channel 5 sampling time selection"]
161    #[inline(always)]
162    pub fn smp5(&self) -> SMP5_R {
163        SMP5_R::new(((self.bits >> 15) & 0x07) as u8)
164    }
165    #[doc = "Bits 12:14 - ADC channel 4 sampling time selection"]
166    #[inline(always)]
167    pub fn smp4(&self) -> SMP4_R {
168        SMP4_R::new(((self.bits >> 12) & 0x07) as u8)
169    }
170    #[doc = "Bits 9:11 - ADC channel 3 sampling time selection"]
171    #[inline(always)]
172    pub fn smp3(&self) -> SMP3_R {
173        SMP3_R::new(((self.bits >> 9) & 0x07) as u8)
174    }
175    #[doc = "Bits 6:8 - ADC channel 2 sampling time selection"]
176    #[inline(always)]
177    pub fn smp2(&self) -> SMP2_R {
178        SMP2_R::new(((self.bits >> 6) & 0x07) as u8)
179    }
180    #[doc = "Bits 3:5 - ADC channel 1 sampling time selection"]
181    #[inline(always)]
182    pub fn smp1(&self) -> SMP1_R {
183        SMP1_R::new(((self.bits >> 3) & 0x07) as u8)
184    }
185}
186impl W {
187    #[doc = "Bits 27:29 - ADC channel 9 sampling time selection"]
188    #[inline(always)]
189    pub fn smp9(&mut self) -> SMP9_W {
190        SMP9_W { w: self }
191    }
192    #[doc = "Bits 24:26 - ADC channel 8 sampling time selection"]
193    #[inline(always)]
194    pub fn smp8(&mut self) -> SMP8_W {
195        SMP8_W { w: self }
196    }
197    #[doc = "Bits 21:23 - ADC channel 7 sampling time selection"]
198    #[inline(always)]
199    pub fn smp7(&mut self) -> SMP7_W {
200        SMP7_W { w: self }
201    }
202    #[doc = "Bits 18:20 - ADC channel 6 sampling time selection"]
203    #[inline(always)]
204    pub fn smp6(&mut self) -> SMP6_W {
205        SMP6_W { w: self }
206    }
207    #[doc = "Bits 15:17 - ADC channel 5 sampling time selection"]
208    #[inline(always)]
209    pub fn smp5(&mut self) -> SMP5_W {
210        SMP5_W { w: self }
211    }
212    #[doc = "Bits 12:14 - ADC channel 4 sampling time selection"]
213    #[inline(always)]
214    pub fn smp4(&mut self) -> SMP4_W {
215        SMP4_W { w: self }
216    }
217    #[doc = "Bits 9:11 - ADC channel 3 sampling time selection"]
218    #[inline(always)]
219    pub fn smp3(&mut self) -> SMP3_W {
220        SMP3_W { w: self }
221    }
222    #[doc = "Bits 6:8 - ADC channel 2 sampling time selection"]
223    #[inline(always)]
224    pub fn smp2(&mut self) -> SMP2_W {
225        SMP2_W { w: self }
226    }
227    #[doc = "Bits 3:5 - ADC channel 1 sampling time selection"]
228    #[inline(always)]
229    pub fn smp1(&mut self) -> SMP1_W {
230        SMP1_W { w: self }
231    }
232}