Commit 5daa852 1 parent 3bc2ee4 commit 5daa852 Copy full SHA for 5daa852
File tree 3 files changed +27
-2
lines changed
3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8
8
9
9
## [ unreleased]
10
10
11
+ ## [ v0.11.1] 2025-03-10
12
+
13
+ ## Fixed
14
+
15
+ - Fix ` embedded_io ` UART implementation to implement the documented contract properly.
16
+ The implementation will now block until at least one byte is available or can be written, unless
17
+ the send or receive buffer is empty.
18
+
11
19
## [ v0.11.0] 2025-03-07
12
20
13
21
## Changed
@@ -253,6 +261,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
253
261
- README with basic instructions how to set up own binary crate
254
262
255
263
[ unreleased ] : https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-hal-v0.11.0...HEAD
264
+ [ v0.11.1 ] : https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-hal-v0.11.0...va108xx-hal-v0.11.1
256
265
[ v0.11.0 ] : https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-hal-v0.10.0...va108xx-hal-v0.11.0
257
266
[ v0.10.0 ] : https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-hal-v0.9.0...va108xx-hal-v0.10.0
258
267
[ v0.9.0 ] : https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/compare/va108xx-hal-v0.8.0...va108xx-hal-v0.9.0
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " va108xx-hal"
3
- version = " 0.11.0 "
3
+ version = " 0.11.1 "
4
4
authors = [
" Robin Mueller <[email protected] >" ]
5
5
edition = " 2021"
6
6
description = " HAL for the Vorago VA108xx family of microcontrollers"
Original file line number Diff line number Diff line change @@ -892,7 +892,15 @@ impl<Uart: Instance> embedded_hal_nb::serial::Read<u8> for Rx<Uart> {
892
892
893
893
impl < Uart : Instance > embedded_io:: Read for Rx < Uart > {
894
894
fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize , Self :: Error > {
895
+ if buf. is_empty ( ) {
896
+ return Ok ( 0 ) ;
897
+ }
895
898
let mut read = 0 ;
899
+ loop {
900
+ if self . 0 . rxstatus ( ) . read ( ) . rdavl ( ) . bit_is_set ( ) {
901
+ break ;
902
+ }
903
+ }
896
904
for byte in buf. iter_mut ( ) {
897
905
match <Self as embedded_hal_nb:: serial:: Read < u8 > >:: read ( self ) {
898
906
Ok ( w) => {
@@ -1058,6 +1066,14 @@ impl<Uart: Instance> embedded_hal_nb::serial::Write<u8> for Tx<Uart> {
1058
1066
1059
1067
impl < Uart : Instance > embedded_io:: Write for Tx < Uart > {
1060
1068
fn write ( & mut self , buf : & [ u8 ] ) -> Result < usize , Self :: Error > {
1069
+ if buf. is_empty ( ) {
1070
+ return Ok ( 0 ) ;
1071
+ }
1072
+ loop {
1073
+ if self . 0 . txstatus ( ) . read ( ) . wrrdy ( ) . bit_is_set ( ) {
1074
+ break ;
1075
+ }
1076
+ }
1061
1077
let mut written = 0 ;
1062
1078
for byte in buf. iter ( ) {
1063
1079
match <Self as embedded_hal_nb:: serial:: Write < u8 > >:: write ( self , * byte) {
@@ -1066,7 +1082,7 @@ impl<Uart: Instance> embedded_io::Write for Tx<Uart> {
1066
1082
}
1067
1083
}
1068
1084
1069
- Ok ( buf . len ( ) )
1085
+ Ok ( written )
1070
1086
}
1071
1087
1072
1088
fn flush ( & mut self ) -> Result < ( ) , Self :: Error > {
You can’t perform that action at this time.
0 commit comments