stm32l4x2_pac/usart1/
rqr.rs

1#[doc = r" Value to write to the register"]
2pub struct W {
3    bits: u32,
4}
5impl super::RQR {
6    #[doc = r" Writes to the register"]
7    #[inline]
8    pub fn write<F>(&self, f: F)
9    where
10        F: FnOnce(&mut W) -> &mut W,
11    {
12        let mut w = W::reset_value();
13        f(&mut w);
14        self.register.set(w.bits);
15    }
16}
17#[doc = "Values that can be written to the field `TXFRQ`"]
18pub enum TXFRQW {
19    #[doc = "Set the TXE flags. This allows to discard the transmit data"]
20    DISCARD,
21}
22impl TXFRQW {
23    #[allow(missing_docs)]
24    #[doc(hidden)]
25    #[inline]
26    pub fn _bits(&self) -> bool {
27        match *self {
28            TXFRQW::DISCARD => true,
29        }
30    }
31}
32#[doc = r" Proxy"]
33pub struct _TXFRQW<'a> {
34    w: &'a mut W,
35}
36impl<'a> _TXFRQW<'a> {
37    #[doc = r" Writes `variant` to the field"]
38    #[inline]
39    pub fn variant(self, variant: TXFRQW) -> &'a mut W {
40        {
41            self.bit(variant._bits())
42        }
43    }
44    #[doc = "Set the TXE flags. This allows to discard the transmit data"]
45    #[inline]
46    pub fn discard(self) -> &'a mut W {
47        self.variant(TXFRQW::DISCARD)
48    }
49    #[doc = r" Sets the field bit"]
50    pub fn set_bit(self) -> &'a mut W {
51        self.bit(true)
52    }
53    #[doc = r" Clears the field bit"]
54    pub fn clear_bit(self) -> &'a mut W {
55        self.bit(false)
56    }
57    #[doc = r" Writes raw bits to the field"]
58    #[inline]
59    pub fn bit(self, value: bool) -> &'a mut W {
60        const MASK: bool = true;
61        const OFFSET: u8 = 4;
62        self.w.bits &= !((MASK as u32) << OFFSET);
63        self.w.bits |= ((value & MASK) as u32) << OFFSET;
64        self.w
65    }
66}
67#[doc = "Values that can be written to the field `RXFRQ`"]
68pub enum RXFRQW {
69    #[doc = "clears the RXNE flag. This allows to discard the received data without reading it, and avoid an overrun condition"]
70    DISCARD,
71}
72impl RXFRQW {
73    #[allow(missing_docs)]
74    #[doc(hidden)]
75    #[inline]
76    pub fn _bits(&self) -> bool {
77        match *self {
78            RXFRQW::DISCARD => true,
79        }
80    }
81}
82#[doc = r" Proxy"]
83pub struct _RXFRQW<'a> {
84    w: &'a mut W,
85}
86impl<'a> _RXFRQW<'a> {
87    #[doc = r" Writes `variant` to the field"]
88    #[inline]
89    pub fn variant(self, variant: RXFRQW) -> &'a mut W {
90        {
91            self.bit(variant._bits())
92        }
93    }
94    #[doc = "clears the RXNE flag. This allows to discard the received data without reading it, and avoid an overrun condition"]
95    #[inline]
96    pub fn discard(self) -> &'a mut W {
97        self.variant(RXFRQW::DISCARD)
98    }
99    #[doc = r" Sets the field bit"]
100    pub fn set_bit(self) -> &'a mut W {
101        self.bit(true)
102    }
103    #[doc = r" Clears the field bit"]
104    pub fn clear_bit(self) -> &'a mut W {
105        self.bit(false)
106    }
107    #[doc = r" Writes raw bits to the field"]
108    #[inline]
109    pub fn bit(self, value: bool) -> &'a mut W {
110        const MASK: bool = true;
111        const OFFSET: u8 = 3;
112        self.w.bits &= !((MASK as u32) << OFFSET);
113        self.w.bits |= ((value & MASK) as u32) << OFFSET;
114        self.w
115    }
116}
117#[doc = "Values that can be written to the field `MMRQ`"]
118pub enum MMRQW {
119    #[doc = "Puts the USART in mute mode and sets the RWU flag"]
120    MUTE,
121}
122impl MMRQW {
123    #[allow(missing_docs)]
124    #[doc(hidden)]
125    #[inline]
126    pub fn _bits(&self) -> bool {
127        match *self {
128            MMRQW::MUTE => true,
129        }
130    }
131}
132#[doc = r" Proxy"]
133pub struct _MMRQW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _MMRQW<'a> {
137    #[doc = r" Writes `variant` to the field"]
138    #[inline]
139    pub fn variant(self, variant: MMRQW) -> &'a mut W {
140        {
141            self.bit(variant._bits())
142        }
143    }
144    #[doc = "Puts the USART in mute mode and sets the RWU flag"]
145    #[inline]
146    pub fn mute(self) -> &'a mut W {
147        self.variant(MMRQW::MUTE)
148    }
149    #[doc = r" Sets the field bit"]
150    pub fn set_bit(self) -> &'a mut W {
151        self.bit(true)
152    }
153    #[doc = r" Clears the field bit"]
154    pub fn clear_bit(self) -> &'a mut W {
155        self.bit(false)
156    }
157    #[doc = r" Writes raw bits to the field"]
158    #[inline]
159    pub fn bit(self, value: bool) -> &'a mut W {
160        const MASK: bool = true;
161        const OFFSET: u8 = 2;
162        self.w.bits &= !((MASK as u32) << OFFSET);
163        self.w.bits |= ((value & MASK) as u32) << OFFSET;
164        self.w
165    }
166}
167#[doc = "Values that can be written to the field `SBKRQ`"]
168pub enum SBKRQW {
169    #[doc = "sets the SBKF flag and request to send a BREAK on the line, as soon as the transmit machine is available"]
170    BREAK,
171}
172impl SBKRQW {
173    #[allow(missing_docs)]
174    #[doc(hidden)]
175    #[inline]
176    pub fn _bits(&self) -> bool {
177        match *self {
178            SBKRQW::BREAK => true,
179        }
180    }
181}
182#[doc = r" Proxy"]
183pub struct _SBKRQW<'a> {
184    w: &'a mut W,
185}
186impl<'a> _SBKRQW<'a> {
187    #[doc = r" Writes `variant` to the field"]
188    #[inline]
189    pub fn variant(self, variant: SBKRQW) -> &'a mut W {
190        {
191            self.bit(variant._bits())
192        }
193    }
194    #[doc = "sets the SBKF flag and request to send a BREAK on the line, as soon as the transmit machine is available"]
195    #[inline]
196    pub fn break_(self) -> &'a mut W {
197        self.variant(SBKRQW::BREAK)
198    }
199    #[doc = r" Sets the field bit"]
200    pub fn set_bit(self) -> &'a mut W {
201        self.bit(true)
202    }
203    #[doc = r" Clears the field bit"]
204    pub fn clear_bit(self) -> &'a mut W {
205        self.bit(false)
206    }
207    #[doc = r" Writes raw bits to the field"]
208    #[inline]
209    pub fn bit(self, value: bool) -> &'a mut W {
210        const MASK: bool = true;
211        const OFFSET: u8 = 1;
212        self.w.bits &= !((MASK as u32) << OFFSET);
213        self.w.bits |= ((value & MASK) as u32) << OFFSET;
214        self.w
215    }
216}
217#[doc = "Values that can be written to the field `ABRRQ`"]
218pub enum ABRRQW {
219    #[doc = "resets the ABRF flag in the USART_ISR and request an automatic baud rate measurement on the next received data frame"]
220    REQUEST,
221}
222impl ABRRQW {
223    #[allow(missing_docs)]
224    #[doc(hidden)]
225    #[inline]
226    pub fn _bits(&self) -> bool {
227        match *self {
228            ABRRQW::REQUEST => true,
229        }
230    }
231}
232#[doc = r" Proxy"]
233pub struct _ABRRQW<'a> {
234    w: &'a mut W,
235}
236impl<'a> _ABRRQW<'a> {
237    #[doc = r" Writes `variant` to the field"]
238    #[inline]
239    pub fn variant(self, variant: ABRRQW) -> &'a mut W {
240        {
241            self.bit(variant._bits())
242        }
243    }
244    #[doc = "resets the ABRF flag in the USART_ISR and request an automatic baud rate measurement on the next received data frame"]
245    #[inline]
246    pub fn request(self) -> &'a mut W {
247        self.variant(ABRRQW::REQUEST)
248    }
249    #[doc = r" Sets the field bit"]
250    pub fn set_bit(self) -> &'a mut W {
251        self.bit(true)
252    }
253    #[doc = r" Clears the field bit"]
254    pub fn clear_bit(self) -> &'a mut W {
255        self.bit(false)
256    }
257    #[doc = r" Writes raw bits to the field"]
258    #[inline]
259    pub fn bit(self, value: bool) -> &'a mut W {
260        const MASK: bool = true;
261        const OFFSET: u8 = 0;
262        self.w.bits &= !((MASK as u32) << OFFSET);
263        self.w.bits |= ((value & MASK) as u32) << OFFSET;
264        self.w
265    }
266}
267impl W {
268    #[doc = r" Reset value of the register"]
269    #[inline]
270    pub fn reset_value() -> W {
271        W { bits: 0 }
272    }
273    #[doc = r" Writes raw bits to the register"]
274    #[inline]
275    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
276        self.bits = bits;
277        self
278    }
279    #[doc = "Bit 4 - Transmit data flush request"]
280    #[inline]
281    pub fn txfrq(&mut self) -> _TXFRQW {
282        _TXFRQW { w: self }
283    }
284    #[doc = "Bit 3 - Receive data flush request"]
285    #[inline]
286    pub fn rxfrq(&mut self) -> _RXFRQW {
287        _RXFRQW { w: self }
288    }
289    #[doc = "Bit 2 - Mute mode request"]
290    #[inline]
291    pub fn mmrq(&mut self) -> _MMRQW {
292        _MMRQW { w: self }
293    }
294    #[doc = "Bit 1 - Send break request"]
295    #[inline]
296    pub fn sbkrq(&mut self) -> _SBKRQW {
297        _SBKRQW { w: self }
298    }
299    #[doc = "Bit 0 - Auto baud rate request"]
300    #[inline]
301    pub fn abrrq(&mut self) -> _ABRRQW {
302        _ABRRQW { w: self }
303    }
304}