stm32wb_pac/sai1/
gcr.rs

1#[doc = "Reader of register GCR"]
2pub type R = crate::R<u32, super::GCR>;
3#[doc = "Writer for register GCR"]
4pub type W = crate::W<u32, super::GCR>;
5#[doc = "Register GCR `reset()`'s with value 0"]
6impl crate::ResetValue for super::GCR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SYNCOUT`"]
14pub type SYNCOUT_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SYNCOUT`"]
16pub struct SYNCOUT_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SYNCOUT_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 & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
24        self.w
25    }
26}
27#[doc = "Reader of field `SYNCIN`"]
28pub type SYNCIN_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `SYNCIN`"]
30pub struct SYNCIN_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> SYNCIN_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 & !0x03) | ((value as u32) & 0x03);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 4:5 - Synchronization outputs"]
43    #[inline(always)]
44    pub fn syncout(&self) -> SYNCOUT_R {
45        SYNCOUT_R::new(((self.bits >> 4) & 0x03) as u8)
46    }
47    #[doc = "Bits 0:1 - Synchronization inputs"]
48    #[inline(always)]
49    pub fn syncin(&self) -> SYNCIN_R {
50        SYNCIN_R::new((self.bits & 0x03) as u8)
51    }
52}
53impl W {
54    #[doc = "Bits 4:5 - Synchronization outputs"]
55    #[inline(always)]
56    pub fn syncout(&mut self) -> SYNCOUT_W {
57        SYNCOUT_W { w: self }
58    }
59    #[doc = "Bits 0:1 - Synchronization inputs"]
60    #[inline(always)]
61    pub fn syncin(&mut self) -> SYNCIN_W {
62        SYNCIN_W { w: self }
63    }
64}