Skip to content

Commit

Permalink
Fix #133 (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
SerenaLynas committed Apr 26, 2023
1 parent 8e25482 commit 70b29ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/lpspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,18 @@ impl<P, const N: u8> Lpspi<P, N> {
let mut tx_idx = 0usize;
let mut rx_idx = 0usize;

while tx_idx < buffer.len() && rx_idx < buffer.len() {
// Continue looping while there is either tx OR rx remaining
while tx_idx < buffer.len() || rx_idx < buffer.len() {
if tx_idx < buffer.len() {
let word = buffer[tx_idx];

// Turn off TCR CONT on last tx as a workaround so that the final
// falling edge comes through:
// https://community.nxp.com/t5/i-MX-RT/RT1050-LPSPI-last-bit-not-completing-in-continuous-mode/m-p/898460
if tx_idx + 1 == buffer.len() {
transaction.continuous = false;
}

self.wait_for_transmit_fifo_space()?;
self.enqueue_transaction(&transaction);

Expand Down

0 comments on commit 70b29ae

Please sign in to comment.