stm32wb_pac/sai1/
bslotr.rs

1#[doc = "Reader of register BSLOTR"]
2pub type R = crate::R<u32, super::BSLOTR>;
3#[doc = "Writer for register BSLOTR"]
4pub type W = crate::W<u32, super::BSLOTR>;
5#[doc = "Register BSLOTR `reset()`'s with value 0"]
6impl crate::ResetValue for super::BSLOTR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SLOTEN`"]
14pub type SLOTEN_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `SLOTEN`"]
16pub struct SLOTEN_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SLOTEN_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0xffff << 16)) | (((value as u32) & 0xffff) << 16);
24        self.w
25    }
26}
27#[doc = "Reader of field `NBSLOT`"]
28pub type NBSLOT_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `NBSLOT`"]
30pub struct NBSLOT_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> NBSLOT_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 & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
38        self.w
39    }
40}
41#[doc = "Reader of field `SLOTSZ`"]
42pub type SLOTSZ_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `SLOTSZ`"]
44pub struct SLOTSZ_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> SLOTSZ_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 & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
52        self.w
53    }
54}
55#[doc = "Reader of field `FBOFF`"]
56pub type FBOFF_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `FBOFF`"]
58pub struct FBOFF_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> FBOFF_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 & !0x1f) | ((value as u32) & 0x1f);
66        self.w
67    }
68}
69impl R {
70    #[doc = "Bits 16:31 - Slot enable"]
71    #[inline(always)]
72    pub fn sloten(&self) -> SLOTEN_R {
73        SLOTEN_R::new(((self.bits >> 16) & 0xffff) as u16)
74    }
75    #[doc = "Bits 8:11 - Number of slots in an audio frame"]
76    #[inline(always)]
77    pub fn nbslot(&self) -> NBSLOT_R {
78        NBSLOT_R::new(((self.bits >> 8) & 0x0f) as u8)
79    }
80    #[doc = "Bits 6:7 - Slot size"]
81    #[inline(always)]
82    pub fn slotsz(&self) -> SLOTSZ_R {
83        SLOTSZ_R::new(((self.bits >> 6) & 0x03) as u8)
84    }
85    #[doc = "Bits 0:4 - First bit offset"]
86    #[inline(always)]
87    pub fn fboff(&self) -> FBOFF_R {
88        FBOFF_R::new((self.bits & 0x1f) as u8)
89    }
90}
91impl W {
92    #[doc = "Bits 16:31 - Slot enable"]
93    #[inline(always)]
94    pub fn sloten(&mut self) -> SLOTEN_W {
95        SLOTEN_W { w: self }
96    }
97    #[doc = "Bits 8:11 - Number of slots in an audio frame"]
98    #[inline(always)]
99    pub fn nbslot(&mut self) -> NBSLOT_W {
100        NBSLOT_W { w: self }
101    }
102    #[doc = "Bits 6:7 - Slot size"]
103    #[inline(always)]
104    pub fn slotsz(&mut self) -> SLOTSZ_W {
105        SLOTSZ_W { w: self }
106    }
107    #[doc = "Bits 0:4 - First bit offset"]
108    #[inline(always)]
109    pub fn fboff(&mut self) -> FBOFF_W {
110        FBOFF_W { w: self }
111    }
112}