Skip to content

Commit

Permalink
SPI fix for MSB code
Browse files Browse the repository at this point in the history
There were two incorrect uses of "||" (or) that could have been "|" (bitwise OR) for MSB operation.
  • Loading branch information
bmourit authored Apr 19, 2024
1 parent 8f14963 commit 89ed65b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/SPI/src/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ uint16_t SPIClass::transfer16(uint16_t val16)
if (spisettings.bitorder == LSBFIRST) {
rec_data0 = transfer(trans_data0);
rec_data1 = transfer(trans_data1);
out_halfword = uint16_t(rec_data0 || rec_data1 << 8);
out_halfword = uint16_t(rec_data0 | (rec_data1 << 8));
} else {
rec_data0 = transfer(trans_data1);
rec_data1 = transfer(trans_data0);
out_halfword = uint16_t(rec_data1 || rec_data0 << 8);
out_halfword = uint16_t(rec_data1 | (rec_data0 << 8));
}

return out_halfword;
Expand Down

0 comments on commit 89ed65b

Please sign in to comment.