File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
13
- Add ADC1 reading functions for channels 16 (temperature) and 17 (internal reference voltage)
14
14
- Update existing ADC example according to ADC API changes
15
15
- Add new ADC example to read ambient temperature using ADC1 CH16
16
+ - Add ` listen ` and ` unlisten ` to ` serial::Tx ` and ` serial::Rx ` .
16
17
17
18
18
19
### Breaking changes
Original file line number Diff line number Diff line change @@ -326,6 +326,26 @@ macro_rules! hal {
326
326
}
327
327
}
328
328
329
+ impl Tx <$USARTX> {
330
+ pub fn listen( & mut self ) {
331
+ unsafe { ( * $USARTX:: ptr( ) ) . cr1. modify( |_, w| w. txeie( ) . set_bit( ) ) } ;
332
+ }
333
+
334
+ pub fn unlisten( & mut self ) {
335
+ unsafe { ( * $USARTX:: ptr( ) ) . cr1. modify( |_, w| w. txeie( ) . clear_bit( ) ) } ;
336
+ }
337
+ }
338
+
339
+ impl Rx <$USARTX> {
340
+ pub fn listen( & mut self ) {
341
+ unsafe { ( * $USARTX:: ptr( ) ) . cr1. modify( |_, w| w. rxneie( ) . set_bit( ) ) } ;
342
+ }
343
+
344
+ pub fn unlisten( & mut self ) {
345
+ unsafe { ( * $USARTX:: ptr( ) ) . cr1. modify( |_, w| w. rxneie( ) . clear_bit( ) ) } ;
346
+ }
347
+ }
348
+
329
349
impl crate :: hal:: serial:: Read <u8 > for Rx <$USARTX> {
330
350
type Error = Error ;
331
351
You can’t perform that action at this time.
0 commit comments