File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
11
11
12
12
- Updated the ` cast ` dependency from 0.2 to 0.3
13
13
14
+ ### Added
15
+
16
+ - Provide getters to serial status flags idle/txe/rxne/tc.
17
+
14
18
### Fixed
15
19
16
20
- Wrong mode when using PWM channel 2 of a two-channel timer
Original file line number Diff line number Diff line change @@ -378,6 +378,26 @@ macro_rules! usart {
378
378
} ,
379
379
}
380
380
}
381
+
382
+ /// Returns true if the line idle status is set
383
+ pub fn is_idle( & self ) -> bool {
384
+ self . usart. isr. read( ) . idle( ) . bit_is_set( )
385
+ }
386
+
387
+ /// Returns true if the tx register is empty
388
+ pub fn is_txe( & self ) -> bool {
389
+ self . usart. isr. read( ) . txe( ) . bit_is_set( )
390
+ }
391
+
392
+ /// Returns true if the rx register is not empty (and can be read)
393
+ pub fn is_rx_not_empty( & self ) -> bool {
394
+ self . usart. isr. read( ) . rxne( ) . bit_is_set( )
395
+ }
396
+
397
+ /// Returns true if transmission is complete
398
+ pub fn is_tx_complete( & self ) -> bool {
399
+ self . usart. isr. read( ) . tc( ) . bit_is_set( )
400
+ }
381
401
}
382
402
) +
383
403
}
You can’t perform that action at this time.
0 commit comments