From 89ed65be356e1bb09dce04de6729b3093de66220 Mon Sep 17 00:00:00 2001 From: Boyd Date: Fri, 19 Apr 2024 11:44:44 -0700 Subject: [PATCH] SPI fix for MSB code There were two incorrect uses of "||" (or) that could have been "|" (bitwise OR) for MSB operation. --- libraries/SPI/src/SPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 48ce23a6..265a6df5 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -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;