diff options
| author | Hans Josephsen <[email protected]> | 2024-09-22 12:30:38 +0200 |
|---|---|---|
| committer | Hans Josephsen <[email protected]> | 2024-09-22 12:40:46 +0200 |
| commit | e2d2b0f36281326772678f0e903675927faaaddb (patch) | |
| tree | c24a6d41cc4ae263711a118fe8074506106ae8ae | |
| parent | 233905e18cf1446ebba898185882e5fc002a9f20 (diff) | |
Currently the return value of `write` is broken, it never returns the
previous frame even when present.
This happens because a slice of length 64 is always passed to Frame::new
from within the `abort_pending_mailbox` function, causing `Frame::new`
to return None.
The fix is to take a subslice of length `data_length`.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/can/fd/peripheral.rs | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 1c221e876..a0b5d6a70 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -5,3 +5,4 @@ Cargo.lock | |||
| 5 | third_party | 5 | third_party |
| 6 | /Cargo.toml | 6 | /Cargo.toml |
| 7 | out/ | 7 | out/ |
| 8 | .zed | ||
diff --git a/embassy-stm32/src/can/fd/peripheral.rs b/embassy-stm32/src/can/fd/peripheral.rs index 07e3dddad..1c7abfcb2 100644 --- a/embassy-stm32/src/can/fd/peripheral.rs +++ b/embassy-stm32/src/can/fd/peripheral.rs | |||
| @@ -200,7 +200,7 @@ impl Registers { | |||
| 200 | if header_reg.rtr().bit() { | 200 | if header_reg.rtr().bit() { |
| 201 | F::new_remote(id, len as usize) | 201 | F::new_remote(id, len as usize) |
| 202 | } else { | 202 | } else { |
| 203 | F::new(id, &data) | 203 | F::new(id, &data[0..(len as usize)]) |
| 204 | } | 204 | } |
| 205 | } else { | 205 | } else { |
| 206 | // Abort request failed because the frame was already sent (or being sent) on | 206 | // Abort request failed because the frame was already sent (or being sent) on |
