Skip to main content

k22f/dma/
ssrt.rs

1#[doc = "Writer for register SSRT"]
2pub type W = crate::W<u8, super::SSRT>;
3#[doc = "Register SSRT `reset()`'s with value 0"]
4impl crate::ResetValue for super::SSRT {
5    type Type = u8;
6    #[inline(always)]
7    fn reset_value() -> Self::Type {
8        0
9    }
10}
11#[doc = "Write proxy for field `SSRT`"]
12pub struct SSRT_W<'a> {
13    w: &'a mut W,
14}
15impl<'a> SSRT_W<'a> {
16    #[doc = r"Writes raw bits to the field"]
17    #[inline(always)]
18    pub unsafe fn bits(self, value: u8) -> &'a mut W {
19        self.w.bits = (self.w.bits & !0x0f) | ((value as u8) & 0x0f);
20        self.w
21    }
22}
23#[doc = "Set All START Bits (activates all channels)\n\nValue on reset: 0"]
24#[derive(Clone, Copy, Debug, PartialEq)]
25pub enum SAST_AW {
26    #[doc = "0: Set only the TCDn_CSR\\[START\\]
27bit specified in the SSRT field"]
28    _0 = 0,
29    #[doc = "1: Set all bits in TCDn_CSR\\[START\\]"]
30    _1 = 1,
31}
32impl From<SAST_AW> for bool {
33    #[inline(always)]
34    fn from(variant: SAST_AW) -> Self {
35        variant as u8 != 0
36    }
37}
38#[doc = "Write proxy for field `SAST`"]
39pub struct SAST_W<'a> {
40    w: &'a mut W,
41}
42impl<'a> SAST_W<'a> {
43    #[doc = r"Writes `variant` to the field"]
44    #[inline(always)]
45    pub fn variant(self, variant: SAST_AW) -> &'a mut W {
46        {
47            self.bit(variant.into())
48        }
49    }
50    #[doc = "Set only the TCDn_CSR\\[START\\]
51bit specified in the SSRT field"]
52    #[inline(always)]
53    pub fn _0(self) -> &'a mut W {
54        self.variant(SAST_AW::_0)
55    }
56    #[doc = "Set all bits in TCDn_CSR\\[START\\]"]
57    #[inline(always)]
58    pub fn _1(self) -> &'a mut W {
59        self.variant(SAST_AW::_1)
60    }
61    #[doc = r"Sets the field bit"]
62    #[inline(always)]
63    pub fn set_bit(self) -> &'a mut W {
64        self.bit(true)
65    }
66    #[doc = r"Clears the field bit"]
67    #[inline(always)]
68    pub fn clear_bit(self) -> &'a mut W {
69        self.bit(false)
70    }
71    #[doc = r"Writes raw bits to the field"]
72    #[inline(always)]
73    pub fn bit(self, value: bool) -> &'a mut W {
74        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
75        self.w
76    }
77}
78#[doc = "No Op enable\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq)]
80pub enum NOP_AW {
81    #[doc = "0: Normal operation"]
82    _0 = 0,
83    #[doc = "1: No operation, ignore the other bits in this register"]
84    _1 = 1,
85}
86impl From<NOP_AW> for bool {
87    #[inline(always)]
88    fn from(variant: NOP_AW) -> Self {
89        variant as u8 != 0
90    }
91}
92#[doc = "Write proxy for field `NOP`"]
93pub struct NOP_W<'a> {
94    w: &'a mut W,
95}
96impl<'a> NOP_W<'a> {
97    #[doc = r"Writes `variant` to the field"]
98    #[inline(always)]
99    pub fn variant(self, variant: NOP_AW) -> &'a mut W {
100        {
101            self.bit(variant.into())
102        }
103    }
104    #[doc = "Normal operation"]
105    #[inline(always)]
106    pub fn _0(self) -> &'a mut W {
107        self.variant(NOP_AW::_0)
108    }
109    #[doc = "No operation, ignore the other bits in this register"]
110    #[inline(always)]
111    pub fn _1(self) -> &'a mut W {
112        self.variant(NOP_AW::_1)
113    }
114    #[doc = r"Sets the field bit"]
115    #[inline(always)]
116    pub fn set_bit(self) -> &'a mut W {
117        self.bit(true)
118    }
119    #[doc = r"Clears the field bit"]
120    #[inline(always)]
121    pub fn clear_bit(self) -> &'a mut W {
122        self.bit(false)
123    }
124    #[doc = r"Writes raw bits to the field"]
125    #[inline(always)]
126    pub fn bit(self, value: bool) -> &'a mut W {
127        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
128        self.w
129    }
130}
131impl W {
132    #[doc = "Bits 0:3 - Set START Bit"]
133    #[inline(always)]
134    pub fn ssrt(&mut self) -> SSRT_W {
135        SSRT_W { w: self }
136    }
137    #[doc = "Bit 6 - Set All START Bits (activates all channels)"]
138    #[inline(always)]
139    pub fn sast(&mut self) -> SAST_W {
140        SAST_W { w: self }
141    }
142    #[doc = "Bit 7 - No Op enable"]
143    #[inline(always)]
144    pub fn nop(&mut self) -> NOP_W {
145        NOP_W { w: self }
146    }
147}