efm32gg11b/i2c2/
cmd.rs

1#[doc = "Writer for register CMD"]
2pub type W = crate::W<u32, super::CMD>;
3#[doc = "Register CMD `reset()`'s with value 0"]
4impl crate::ResetValue for super::CMD {
5    type Type = u32;
6    #[inline(always)]
7    fn reset_value() -> Self::Type { 0 }
8}
9#[doc = "Write proxy for field `START`"]
10pub struct START_W<'a> {
11    w: &'a mut W,
12}
13impl<'a> START_W<'a> {
14    #[doc = r"Sets the field bit"]
15    #[inline(always)]
16    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
17    #[doc = r"Clears the field bit"]
18    #[inline(always)]
19    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub fn bit(self, value: bool) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
24        self.w
25    }
26}
27#[doc = "Write proxy for field `STOP`"]
28pub struct STOP_W<'a> {
29    w: &'a mut W,
30}
31impl<'a> STOP_W<'a> {
32    #[doc = r"Sets the field bit"]
33    #[inline(always)]
34    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
35    #[doc = r"Clears the field bit"]
36    #[inline(always)]
37    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
38    #[doc = r"Writes raw bits to the field"]
39    #[inline(always)]
40    pub fn bit(self, value: bool) -> &'a mut W {
41        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
42        self.w
43    }
44}
45#[doc = "Write proxy for field `ACK`"]
46pub struct ACK_W<'a> {
47    w: &'a mut W,
48}
49impl<'a> ACK_W<'a> {
50    #[doc = r"Sets the field bit"]
51    #[inline(always)]
52    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
53    #[doc = r"Clears the field bit"]
54    #[inline(always)]
55    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
56    #[doc = r"Writes raw bits to the field"]
57    #[inline(always)]
58    pub fn bit(self, value: bool) -> &'a mut W {
59        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
60        self.w
61    }
62}
63#[doc = "Write proxy for field `NACK`"]
64pub struct NACK_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> NACK_W<'a> {
68    #[doc = r"Sets the field bit"]
69    #[inline(always)]
70    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
71    #[doc = r"Clears the field bit"]
72    #[inline(always)]
73    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
74    #[doc = r"Writes raw bits to the field"]
75    #[inline(always)]
76    pub fn bit(self, value: bool) -> &'a mut W {
77        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
78        self.w
79    }
80}
81#[doc = "Write proxy for field `CONT`"]
82pub struct CONT_W<'a> {
83    w: &'a mut W,
84}
85impl<'a> CONT_W<'a> {
86    #[doc = r"Sets the field bit"]
87    #[inline(always)]
88    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
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 << 4)) | (((value as u32) & 0x01) << 4);
96        self.w
97    }
98}
99#[doc = "Write proxy for field `ABORT`"]
100pub struct ABORT_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> ABORT_W<'a> {
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
107    #[doc = r"Clears the field bit"]
108    #[inline(always)]
109    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
110    #[doc = r"Writes raw bits to the field"]
111    #[inline(always)]
112    pub fn bit(self, value: bool) -> &'a mut W {
113        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
114        self.w
115    }
116}
117#[doc = "Write proxy for field `CLEARTX`"]
118pub struct CLEARTX_W<'a> {
119    w: &'a mut W,
120}
121impl<'a> CLEARTX_W<'a> {
122    #[doc = r"Sets the field bit"]
123    #[inline(always)]
124    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
125    #[doc = r"Clears the field bit"]
126    #[inline(always)]
127    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
128    #[doc = r"Writes raw bits to the field"]
129    #[inline(always)]
130    pub fn bit(self, value: bool) -> &'a mut W {
131        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
132        self.w
133    }
134}
135#[doc = "Write proxy for field `CLEARPC`"]
136pub struct CLEARPC_W<'a> {
137    w: &'a mut W,
138}
139impl<'a> CLEARPC_W<'a> {
140    #[doc = r"Sets the field bit"]
141    #[inline(always)]
142    pub fn set_bit(self) -> &'a mut W { self.bit(true) }
143    #[doc = r"Clears the field bit"]
144    #[inline(always)]
145    pub fn clear_bit(self) -> &'a mut W { self.bit(false) }
146    #[doc = r"Writes raw bits to the field"]
147    #[inline(always)]
148    pub fn bit(self, value: bool) -> &'a mut W {
149        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
150        self.w
151    }
152}
153impl W {
154    #[doc = "Bit 0 - Send Start Condition"]
155    #[inline(always)]
156    pub fn start(&mut self) -> START_W { START_W { w: self } }
157    #[doc = "Bit 1 - Send Stop Condition"]
158    #[inline(always)]
159    pub fn stop(&mut self) -> STOP_W { STOP_W { w: self } }
160    #[doc = "Bit 2 - Send ACK"]
161    #[inline(always)]
162    pub fn ack(&mut self) -> ACK_W { ACK_W { w: self } }
163    #[doc = "Bit 3 - Send NACK"]
164    #[inline(always)]
165    pub fn nack(&mut self) -> NACK_W { NACK_W { w: self } }
166    #[doc = "Bit 4 - Continue Transmission"]
167    #[inline(always)]
168    pub fn cont(&mut self) -> CONT_W { CONT_W { w: self } }
169    #[doc = "Bit 5 - Abort Transmission"]
170    #[inline(always)]
171    pub fn abort(&mut self) -> ABORT_W { ABORT_W { w: self } }
172    #[doc = "Bit 6 - Clear TX"]
173    #[inline(always)]
174    pub fn cleartx(&mut self) -> CLEARTX_W { CLEARTX_W { w: self } }
175    #[doc = "Bit 7 - Clear Pending Commands"]
176    #[inline(always)]
177    pub fn clearpc(&mut self) -> CLEARPC_W { CLEARPC_W { w: self } }
178}