stm32f1/stm32f103/adc3/
jsqr.rs

1#[doc = "Register `JSQR` reader"]
2pub struct R(crate::R<JSQR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<JSQR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<JSQR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<JSQR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `JSQR` writer"]
17pub struct W(crate::W<JSQR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<JSQR_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<JSQR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<JSQR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `JL` reader - Injected sequence length"]
38pub type JL_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `JL` writer - Injected sequence length"]
40pub type JL_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, JSQR_SPEC, u8, u8, 2, O>;
41#[doc = "Field `JSQ4` reader - 4th conversion in injected sequence"]
42pub type JSQ4_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `JSQ4` writer - 4th conversion in injected sequence"]
44pub type JSQ4_W<'a, const O: u8> = crate::FieldWriter<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
45#[doc = "Field `JSQ3` reader - 3rd conversion in injected sequence"]
46pub type JSQ3_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `JSQ3` writer - 3rd conversion in injected sequence"]
48pub type JSQ3_W<'a, const O: u8> = crate::FieldWriter<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
49#[doc = "Field `JSQ2` reader - 2nd conversion in injected sequence"]
50pub type JSQ2_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `JSQ2` writer - 2nd conversion in injected sequence"]
52pub type JSQ2_W<'a, const O: u8> = crate::FieldWriter<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
53#[doc = "Field `JSQ1` reader - 1st conversion in injected sequence"]
54pub type JSQ1_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `JSQ1` writer - 1st conversion in injected sequence"]
56pub type JSQ1_W<'a, const O: u8> = crate::FieldWriter<'a, u32, JSQR_SPEC, u8, u8, 5, O>;
57impl R {
58    #[doc = "Bits 20:21 - Injected sequence length"]
59    #[inline(always)]
60    pub fn jl(&self) -> JL_R {
61        JL_R::new(((self.bits >> 20) & 3) as u8)
62    }
63    #[doc = "Bits 15:19 - 4th conversion in injected sequence"]
64    #[inline(always)]
65    pub fn jsq4(&self) -> JSQ4_R {
66        JSQ4_R::new(((self.bits >> 15) & 0x1f) as u8)
67    }
68    #[doc = "Bits 10:14 - 3rd conversion in injected sequence"]
69    #[inline(always)]
70    pub fn jsq3(&self) -> JSQ3_R {
71        JSQ3_R::new(((self.bits >> 10) & 0x1f) as u8)
72    }
73    #[doc = "Bits 5:9 - 2nd conversion in injected sequence"]
74    #[inline(always)]
75    pub fn jsq2(&self) -> JSQ2_R {
76        JSQ2_R::new(((self.bits >> 5) & 0x1f) as u8)
77    }
78    #[doc = "Bits 0:4 - 1st conversion in injected sequence"]
79    #[inline(always)]
80    pub fn jsq1(&self) -> JSQ1_R {
81        JSQ1_R::new((self.bits & 0x1f) as u8)
82    }
83}
84impl W {
85    #[doc = "Bits 20:21 - Injected sequence length"]
86    #[inline(always)]
87    pub fn jl(&mut self) -> JL_W<20> {
88        JL_W::new(self)
89    }
90    #[doc = "Bits 15:19 - 4th conversion in injected sequence"]
91    #[inline(always)]
92    pub fn jsq4(&mut self) -> JSQ4_W<15> {
93        JSQ4_W::new(self)
94    }
95    #[doc = "Bits 10:14 - 3rd conversion in injected sequence"]
96    #[inline(always)]
97    pub fn jsq3(&mut self) -> JSQ3_W<10> {
98        JSQ3_W::new(self)
99    }
100    #[doc = "Bits 5:9 - 2nd conversion in injected sequence"]
101    #[inline(always)]
102    pub fn jsq2(&mut self) -> JSQ2_W<5> {
103        JSQ2_W::new(self)
104    }
105    #[doc = "Bits 0:4 - 1st conversion in injected sequence"]
106    #[inline(always)]
107    pub fn jsq1(&mut self) -> JSQ1_W<0> {
108        JSQ1_W::new(self)
109    }
110    #[doc = "Writes raw bits to the register."]
111    #[inline(always)]
112    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
113        self.0.bits(bits);
114        self
115    }
116}
117#[doc = "injected sequence 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 [jsqr](index.html) module"]
118pub struct JSQR_SPEC;
119impl crate::RegisterSpec for JSQR_SPEC {
120    type Ux = u32;
121}
122#[doc = "`read()` method returns [jsqr::R](R) reader structure"]
123impl crate::Readable for JSQR_SPEC {
124    type Reader = R;
125}
126#[doc = "`write(|w| ..)` method takes [jsqr::W](W) writer structure"]
127impl crate::Writable for JSQR_SPEC {
128    type Writer = W;
129}
130#[doc = "`reset()` method sets JSQR to value 0"]
131impl crate::Resettable for JSQR_SPEC {
132    #[inline(always)]
133    fn reset_value() -> Self::Ux {
134        0
135    }
136}