stm32f1/stm32f101/adc1/
sqr3.rs

1#[doc = "Register `SQR3` reader"]
2pub struct R(crate::R<SQR3_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SQR3_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SQR3_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SQR3_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SQR3` writer"]
17pub struct W(crate::W<SQR3_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SQR3_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<SQR3_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SQR3_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SQ6` reader - 6th conversion in regular sequence"]
38pub type SQ6_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `SQ6` writer - 6th conversion in regular sequence"]
40pub type SQ6_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
41#[doc = "Field `SQ5` reader - 5th conversion in regular sequence"]
42pub type SQ5_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `SQ5` writer - 5th conversion in regular sequence"]
44pub type SQ5_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
45#[doc = "Field `SQ4` reader - 4th conversion in regular sequence"]
46pub type SQ4_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `SQ4` writer - 4th conversion in regular sequence"]
48pub type SQ4_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
49#[doc = "Field `SQ3` reader - 3rd conversion in regular sequence"]
50pub type SQ3_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `SQ3` writer - 3rd conversion in regular sequence"]
52pub type SQ3_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
53#[doc = "Field `SQ2` reader - 2nd conversion in regular sequence"]
54pub type SQ2_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `SQ2` writer - 2nd conversion in regular sequence"]
56pub type SQ2_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
57#[doc = "Field `SQ1` reader - 1st conversion in regular sequence"]
58pub type SQ1_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `SQ1` writer - 1st conversion in regular sequence"]
60pub type SQ1_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SQR3_SPEC, u8, u8, 5, O>;
61impl R {
62    #[doc = "Bits 25:29 - 6th conversion in regular sequence"]
63    #[inline(always)]
64    pub fn sq6(&self) -> SQ6_R {
65        SQ6_R::new(((self.bits >> 25) & 0x1f) as u8)
66    }
67    #[doc = "Bits 20:24 - 5th conversion in regular sequence"]
68    #[inline(always)]
69    pub fn sq5(&self) -> SQ5_R {
70        SQ5_R::new(((self.bits >> 20) & 0x1f) as u8)
71    }
72    #[doc = "Bits 15:19 - 4th conversion in regular sequence"]
73    #[inline(always)]
74    pub fn sq4(&self) -> SQ4_R {
75        SQ4_R::new(((self.bits >> 15) & 0x1f) as u8)
76    }
77    #[doc = "Bits 10:14 - 3rd conversion in regular sequence"]
78    #[inline(always)]
79    pub fn sq3(&self) -> SQ3_R {
80        SQ3_R::new(((self.bits >> 10) & 0x1f) as u8)
81    }
82    #[doc = "Bits 5:9 - 2nd conversion in regular sequence"]
83    #[inline(always)]
84    pub fn sq2(&self) -> SQ2_R {
85        SQ2_R::new(((self.bits >> 5) & 0x1f) as u8)
86    }
87    #[doc = "Bits 0:4 - 1st conversion in regular sequence"]
88    #[inline(always)]
89    pub fn sq1(&self) -> SQ1_R {
90        SQ1_R::new((self.bits & 0x1f) as u8)
91    }
92}
93impl W {
94    #[doc = "Bits 25:29 - 6th conversion in regular sequence"]
95    #[inline(always)]
96    pub fn sq6(&mut self) -> SQ6_W<25> {
97        SQ6_W::new(self)
98    }
99    #[doc = "Bits 20:24 - 5th conversion in regular sequence"]
100    #[inline(always)]
101    pub fn sq5(&mut self) -> SQ5_W<20> {
102        SQ5_W::new(self)
103    }
104    #[doc = "Bits 15:19 - 4th conversion in regular sequence"]
105    #[inline(always)]
106    pub fn sq4(&mut self) -> SQ4_W<15> {
107        SQ4_W::new(self)
108    }
109    #[doc = "Bits 10:14 - 3rd conversion in regular sequence"]
110    #[inline(always)]
111    pub fn sq3(&mut self) -> SQ3_W<10> {
112        SQ3_W::new(self)
113    }
114    #[doc = "Bits 5:9 - 2nd conversion in regular sequence"]
115    #[inline(always)]
116    pub fn sq2(&mut self) -> SQ2_W<5> {
117        SQ2_W::new(self)
118    }
119    #[doc = "Bits 0:4 - 1st conversion in regular sequence"]
120    #[inline(always)]
121    pub fn sq1(&mut self) -> SQ1_W<0> {
122        SQ1_W::new(self)
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "regular sequence register 3\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 [sqr3](index.html) module"]
132pub struct SQR3_SPEC;
133impl crate::RegisterSpec for SQR3_SPEC {
134    type Ux = u32;
135}
136#[doc = "`read()` method returns [sqr3::R](R) reader structure"]
137impl crate::Readable for SQR3_SPEC {
138    type Reader = R;
139}
140#[doc = "`write(|w| ..)` method takes [sqr3::W](W) writer structure"]
141impl crate::Writable for SQR3_SPEC {
142    type Writer = W;
143}
144#[doc = "`reset()` method sets SQR3 to value 0"]
145impl crate::Resettable for SQR3_SPEC {
146    #[inline(always)]
147    fn reset_value() -> Self::Ux {
148        0
149    }
150}