stm32wb_pac/adc/
sqr4.rs

1#[doc = "Reader of register SQR4"]
2pub type R = crate::R<u32, super::SQR4>;
3#[doc = "Writer for register SQR4"]
4pub type W = crate::W<u32, super::SQR4>;
5#[doc = "Register SQR4 `reset()`'s with value 0"]
6impl crate::ResetValue for super::SQR4 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SQ16`"]
14pub type SQ16_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SQ16`"]
16pub struct SQ16_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SQ16_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 & !(0x1f << 6)) | (((value as u32) & 0x1f) << 6);
24        self.w
25    }
26}
27#[doc = "Reader of field `SQ15`"]
28pub type SQ15_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SQ15`"]
30pub struct SQ15_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SQ15_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 & !0x1f) | ((value as u32) & 0x1f);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 6:10 - ADC group regular sequencer rank 16"]
43    #[inline(always)]
44    pub fn sq16(&self) -> SQ16_R {
45        SQ16_R::new(((self.bits >> 6) & 0x1f) as u8)
46    }
47    #[doc = "Bits 0:4 - ADC group regular sequencer rank 15"]
48    #[inline(always)]
49    pub fn sq15(&self) -> SQ15_R {
50        SQ15_R::new((self.bits & 0x1f) as u8)
51    }
52}
53impl W {
54    #[doc = "Bits 6:10 - ADC group regular sequencer rank 16"]
55    #[inline(always)]
56    pub fn sq16(&mut self) -> SQ16_W {
57        SQ16_W { w: self }
58    }
59    #[doc = "Bits 0:4 - ADC group regular sequencer rank 15"]
60    #[inline(always)]
61    pub fn sq15(&mut self) -> SQ15_W {
62        SQ15_W { w: self }
63    }
64}