stm32f1_staging/stm32f103/adc1/
jsqr.rs

1///Register `JSQR` reader
2pub type R = crate::R<JSQRrs>;
3///Register `JSQR` writer
4pub type W = crate::W<JSQRrs>;
5///Field `JSQ(1-4)` reader - %s conversion in injected sequence
6pub type JSQ_R = crate::FieldReader;
7///Field `JSQ(1-4)` writer - %s conversion in injected sequence
8pub type JSQ_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9///Field `JL` reader - Injected sequence length
10pub type JL_R = crate::FieldReader;
11///Field `JL` writer - Injected sequence length
12pub type JL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
13impl R {
14    ///(1-4) conversion in injected sequence
15    ///
16    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `JSQ1` field.</div>
17    #[inline(always)]
18    pub fn jsq(&self, n: u8) -> JSQ_R {
19        #[allow(clippy::no_effect)] [(); 4][n as usize];
20        JSQ_R::new(((self.bits >> (n * 5)) & 0x1f) as u8)
21    }
22    ///Iterator for array of:
23    ///(1-4) conversion in injected sequence
24    #[inline(always)]
25    pub fn jsq_iter(&self) -> impl Iterator<Item = JSQ_R> + '_ {
26        (0..4).map(move |n| JSQ_R::new(((self.bits >> (n * 5)) & 0x1f) as u8))
27    }
28    ///Bits 0:4 - 1 conversion in injected sequence
29    #[inline(always)]
30    pub fn jsq1(&self) -> JSQ_R {
31        JSQ_R::new((self.bits & 0x1f) as u8)
32    }
33    ///Bits 5:9 - 2 conversion in injected sequence
34    #[inline(always)]
35    pub fn jsq2(&self) -> JSQ_R {
36        JSQ_R::new(((self.bits >> 5) & 0x1f) as u8)
37    }
38    ///Bits 10:14 - 3 conversion in injected sequence
39    #[inline(always)]
40    pub fn jsq3(&self) -> JSQ_R {
41        JSQ_R::new(((self.bits >> 10) & 0x1f) as u8)
42    }
43    ///Bits 15:19 - 4 conversion in injected sequence
44    #[inline(always)]
45    pub fn jsq4(&self) -> JSQ_R {
46        JSQ_R::new(((self.bits >> 15) & 0x1f) as u8)
47    }
48    ///Bits 20:21 - Injected sequence length
49    #[inline(always)]
50    pub fn jl(&self) -> JL_R {
51        JL_R::new(((self.bits >> 20) & 3) as u8)
52    }
53}
54impl core::fmt::Debug for R {
55    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
56        f.debug_struct("JSQR")
57            .field("jl", &self.jl())
58            .field("jsq1", &self.jsq1())
59            .field("jsq2", &self.jsq2())
60            .field("jsq3", &self.jsq3())
61            .field("jsq4", &self.jsq4())
62            .finish()
63    }
64}
65impl W {
66    ///(1-4) conversion in injected sequence
67    ///
68    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `JSQ1` field.</div>
69    #[inline(always)]
70    pub fn jsq(&mut self, n: u8) -> JSQ_W<JSQRrs> {
71        #[allow(clippy::no_effect)] [(); 4][n as usize];
72        JSQ_W::new(self, n * 5)
73    }
74    ///Bits 0:4 - 1 conversion in injected sequence
75    #[inline(always)]
76    pub fn jsq1(&mut self) -> JSQ_W<JSQRrs> {
77        JSQ_W::new(self, 0)
78    }
79    ///Bits 5:9 - 2 conversion in injected sequence
80    #[inline(always)]
81    pub fn jsq2(&mut self) -> JSQ_W<JSQRrs> {
82        JSQ_W::new(self, 5)
83    }
84    ///Bits 10:14 - 3 conversion in injected sequence
85    #[inline(always)]
86    pub fn jsq3(&mut self) -> JSQ_W<JSQRrs> {
87        JSQ_W::new(self, 10)
88    }
89    ///Bits 15:19 - 4 conversion in injected sequence
90    #[inline(always)]
91    pub fn jsq4(&mut self) -> JSQ_W<JSQRrs> {
92        JSQ_W::new(self, 15)
93    }
94    ///Bits 20:21 - Injected sequence length
95    #[inline(always)]
96    pub fn jl(&mut self) -> JL_W<JSQRrs> {
97        JL_W::new(self, 20)
98    }
99}
100/**injected sequence register
101
102You can [`read`](crate::Reg::read) this register and get [`jsqr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`jsqr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
103
104See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#ADC1:JSQR)*/
105pub struct JSQRrs;
106impl crate::RegisterSpec for JSQRrs {
107    type Ux = u32;
108}
109///`read()` method returns [`jsqr::R`](R) reader structure
110impl crate::Readable for JSQRrs {}
111///`write(|w| ..)` method takes [`jsqr::W`](W) writer structure
112impl crate::Writable for JSQRrs {
113    type Safety = crate::Unsafe;
114}
115///`reset()` method sets JSQR to value 0
116impl crate::Resettable for JSQRrs {}