k22f/i2s0/
tcr3.rs

1#[doc = "Reader of register TCR3"]
2pub type R = crate::R<u32, super::TCR3>;
3#[doc = "Writer for register TCR3"]
4pub type W = crate::W<u32, super::TCR3>;
5#[doc = "Register TCR3 `reset()`'s with value 0"]
6impl crate::ResetValue for super::TCR3 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `WDFL`"]
14pub type WDFL_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `WDFL`"]
16pub struct WDFL_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> WDFL_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) | ((value as u32) & 0x1f);
24        self.w
25    }
26}
27#[doc = "Transmit Channel Enable\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29#[repr(u8)]
30pub enum TCE_A {
31    #[doc = "0: Transmit data channel N is disabled."]
32    _0 = 0,
33    #[doc = "1: Transmit data channel N is enabled."]
34    _1 = 1,
35}
36impl From<TCE_A> for u8 {
37    #[inline(always)]
38    fn from(variant: TCE_A) -> Self {
39        variant as _
40    }
41}
42#[doc = "Reader of field `TCE`"]
43pub type TCE_R = crate::R<u8, TCE_A>;
44impl TCE_R {
45    #[doc = r"Get enumerated values variant"]
46    #[inline(always)]
47    pub fn variant(&self) -> crate::Variant<u8, TCE_A> {
48        use crate::Variant::*;
49        match self.bits {
50            0 => Val(TCE_A::_0),
51            1 => Val(TCE_A::_1),
52            i => Res(i),
53        }
54    }
55    #[doc = "Checks if the value of the field is `_0`"]
56    #[inline(always)]
57    pub fn is_0(&self) -> bool {
58        *self == TCE_A::_0
59    }
60    #[doc = "Checks if the value of the field is `_1`"]
61    #[inline(always)]
62    pub fn is_1(&self) -> bool {
63        *self == TCE_A::_1
64    }
65}
66#[doc = "Write proxy for field `TCE`"]
67pub struct TCE_W<'a> {
68    w: &'a mut W,
69}
70impl<'a> TCE_W<'a> {
71    #[doc = r"Writes `variant` to the field"]
72    #[inline(always)]
73    pub fn variant(self, variant: TCE_A) -> &'a mut W {
74        unsafe { self.bits(variant.into()) }
75    }
76    #[doc = "Transmit data channel N is disabled."]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(TCE_A::_0)
80    }
81    #[doc = "Transmit data channel N is enabled."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(TCE_A::_1)
85    }
86    #[doc = r"Writes raw bits to the field"]
87    #[inline(always)]
88    pub unsafe fn bits(self, value: u8) -> &'a mut W {
89        self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
90        self.w
91    }
92}
93impl R {
94    #[doc = "Bits 0:4 - Word Flag Configuration"]
95    #[inline(always)]
96    pub fn wdfl(&self) -> WDFL_R {
97        WDFL_R::new((self.bits & 0x1f) as u8)
98    }
99    #[doc = "Bits 16:17 - Transmit Channel Enable"]
100    #[inline(always)]
101    pub fn tce(&self) -> TCE_R {
102        TCE_R::new(((self.bits >> 16) & 0x03) as u8)
103    }
104}
105impl W {
106    #[doc = "Bits 0:4 - Word Flag Configuration"]
107    #[inline(always)]
108    pub fn wdfl(&mut self) -> WDFL_W {
109        WDFL_W { w: self }
110    }
111    #[doc = "Bits 16:17 - Transmit Channel Enable"]
112    #[inline(always)]
113    pub fn tce(&mut self) -> TCE_W {
114        TCE_W { w: self }
115    }
116}