Skip to main content

atsamd51g19a/tcc0/
wexctrl.rs

1#[doc = "Reader of register WEXCTRL"]
2pub type R = crate::R<u32, super::WEXCTRL>;
3#[doc = "Writer for register WEXCTRL"]
4pub type W = crate::W<u32, super::WEXCTRL>;
5#[doc = "Register WEXCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::WEXCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `OTMX`"]
14pub type OTMX_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `OTMX`"]
16pub struct OTMX_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> OTMX_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) | ((value as u32) & 0x03);
24        self.w
25    }
26}
27#[doc = "Reader of field `DTIEN0`"]
28pub type DTIEN0_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `DTIEN0`"]
30pub struct DTIEN0_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> DTIEN0_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
48        self.w
49    }
50}
51#[doc = "Reader of field `DTIEN1`"]
52pub type DTIEN1_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `DTIEN1`"]
54pub struct DTIEN1_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> DTIEN1_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
72        self.w
73    }
74}
75#[doc = "Reader of field `DTIEN2`"]
76pub type DTIEN2_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `DTIEN2`"]
78pub struct DTIEN2_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> DTIEN2_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
96        self.w
97    }
98}
99#[doc = "Reader of field `DTIEN3`"]
100pub type DTIEN3_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `DTIEN3`"]
102pub struct DTIEN3_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> DTIEN3_W<'a> {
106    #[doc = r"Sets the field bit"]
107    #[inline(always)]
108    pub fn set_bit(self) -> &'a mut W {
109        self.bit(true)
110    }
111    #[doc = r"Clears the field bit"]
112    #[inline(always)]
113    pub fn clear_bit(self) -> &'a mut W {
114        self.bit(false)
115    }
116    #[doc = r"Writes raw bits to the field"]
117    #[inline(always)]
118    pub fn bit(self, value: bool) -> &'a mut W {
119        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
120        self.w
121    }
122}
123#[doc = "Reader of field `DTLS`"]
124pub type DTLS_R = crate::R<u8, u8>;
125#[doc = "Write proxy for field `DTLS`"]
126pub struct DTLS_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> DTLS_W<'a> {
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub unsafe fn bits(self, value: u8) -> &'a mut W {
133        self.w.bits = (self.w.bits & !(0xff << 16)) | (((value as u32) & 0xff) << 16);
134        self.w
135    }
136}
137#[doc = "Reader of field `DTHS`"]
138pub type DTHS_R = crate::R<u8, u8>;
139#[doc = "Write proxy for field `DTHS`"]
140pub struct DTHS_W<'a> {
141    w: &'a mut W,
142}
143impl<'a> DTHS_W<'a> {
144    #[doc = r"Writes raw bits to the field"]
145    #[inline(always)]
146    pub unsafe fn bits(self, value: u8) -> &'a mut W {
147        self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24);
148        self.w
149    }
150}
151impl R {
152    #[doc = "Bits 0:1 - Output Matrix"]
153    #[inline(always)]
154    pub fn otmx(&self) -> OTMX_R {
155        OTMX_R::new((self.bits & 0x03) as u8)
156    }
157    #[doc = "Bit 8 - Dead-time Insertion Generator 0 Enable"]
158    #[inline(always)]
159    pub fn dtien0(&self) -> DTIEN0_R {
160        DTIEN0_R::new(((self.bits >> 8) & 0x01) != 0)
161    }
162    #[doc = "Bit 9 - Dead-time Insertion Generator 1 Enable"]
163    #[inline(always)]
164    pub fn dtien1(&self) -> DTIEN1_R {
165        DTIEN1_R::new(((self.bits >> 9) & 0x01) != 0)
166    }
167    #[doc = "Bit 10 - Dead-time Insertion Generator 2 Enable"]
168    #[inline(always)]
169    pub fn dtien2(&self) -> DTIEN2_R {
170        DTIEN2_R::new(((self.bits >> 10) & 0x01) != 0)
171    }
172    #[doc = "Bit 11 - Dead-time Insertion Generator 3 Enable"]
173    #[inline(always)]
174    pub fn dtien3(&self) -> DTIEN3_R {
175        DTIEN3_R::new(((self.bits >> 11) & 0x01) != 0)
176    }
177    #[doc = "Bits 16:23 - Dead-time Low Side Outputs Value"]
178    #[inline(always)]
179    pub fn dtls(&self) -> DTLS_R {
180        DTLS_R::new(((self.bits >> 16) & 0xff) as u8)
181    }
182    #[doc = "Bits 24:31 - Dead-time High Side Outputs Value"]
183    #[inline(always)]
184    pub fn dths(&self) -> DTHS_R {
185        DTHS_R::new(((self.bits >> 24) & 0xff) as u8)
186    }
187}
188impl W {
189    #[doc = "Bits 0:1 - Output Matrix"]
190    #[inline(always)]
191    pub fn otmx(&mut self) -> OTMX_W {
192        OTMX_W { w: self }
193    }
194    #[doc = "Bit 8 - Dead-time Insertion Generator 0 Enable"]
195    #[inline(always)]
196    pub fn dtien0(&mut self) -> DTIEN0_W {
197        DTIEN0_W { w: self }
198    }
199    #[doc = "Bit 9 - Dead-time Insertion Generator 1 Enable"]
200    #[inline(always)]
201    pub fn dtien1(&mut self) -> DTIEN1_W {
202        DTIEN1_W { w: self }
203    }
204    #[doc = "Bit 10 - Dead-time Insertion Generator 2 Enable"]
205    #[inline(always)]
206    pub fn dtien2(&mut self) -> DTIEN2_W {
207        DTIEN2_W { w: self }
208    }
209    #[doc = "Bit 11 - Dead-time Insertion Generator 3 Enable"]
210    #[inline(always)]
211    pub fn dtien3(&mut self) -> DTIEN3_W {
212        DTIEN3_W { w: self }
213    }
214    #[doc = "Bits 16:23 - Dead-time Low Side Outputs Value"]
215    #[inline(always)]
216    pub fn dtls(&mut self) -> DTLS_W {
217        DTLS_W { w: self }
218    }
219    #[doc = "Bits 24:31 - Dead-time High Side Outputs Value"]
220    #[inline(always)]
221    pub fn dths(&mut self) -> DTHS_W {
222        DTHS_W { w: self }
223    }
224}