mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 01:36:35 +11:00
fix UART rx (#187)
This commit is contained in:
parent
fe1e55b8c0
commit
73431a847b
1 changed files with 7 additions and 5 deletions
|
@ -328,19 +328,21 @@ impl<D: UartDevice> UartPeripheral<Enabled, D> {
|
||||||
if bytes_read < buffer.len() {
|
if bytes_read < buffer.len() {
|
||||||
let mut error: Option<ReadErrorType> = None;
|
let mut error: Option<ReadErrorType> = None;
|
||||||
|
|
||||||
if self.device.uartdr.read().oe().bit_is_set() {
|
let read = self.device.uartdr.read();
|
||||||
|
|
||||||
|
if read.oe().bit_is_set() {
|
||||||
error = Some(ReadErrorType::Overrun);
|
error = Some(ReadErrorType::Overrun);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.device.uartdr.read().be().bit_is_set() {
|
if read.be().bit_is_set() {
|
||||||
error = Some(ReadErrorType::Break);
|
error = Some(ReadErrorType::Break);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.device.uartdr.read().pe().bit_is_set() {
|
if read.pe().bit_is_set() {
|
||||||
error = Some(ReadErrorType::Parity);
|
error = Some(ReadErrorType::Parity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.device.uartdr.read().fe().bit_is_set() {
|
if read.fe().bit_is_set() {
|
||||||
error = Some(ReadErrorType::Framing);
|
error = Some(ReadErrorType::Framing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +353,7 @@ impl<D: UartDevice> UartPeripheral<Enabled, D> {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[bytes_read] = self.device.uartdr.read().data().bits();
|
buffer[bytes_read] = read.data().bits();
|
||||||
bytes_read += 1;
|
bytes_read += 1;
|
||||||
} else {
|
} else {
|
||||||
break &mut buffer[bytes_read..];
|
break &mut buffer[bytes_read..];
|
||||||
|
|
Loading…
Add table
Reference in a new issue