Skip to content

Commit 6ad7cae

Browse files
committed
Merge pull request #1859 from Cross22/master
Fix SPI.transfer16() using wrong endianness
2 parents e82b74e + bda2125 commit 6ad7cae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/SPI/SPI.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ uint16_t SPIClass::transfer16(uint16_t data) {
246246
in.val = data;
247247

248248
if((SPI1C & (SPICWBO | SPICRBO))) {
249-
//MSBFIRST
250-
out.msb = transfer(in.msb);
251-
out.lsb = transfer(in.lsb);
252-
} else {
253249
//LSBFIRST
254250
out.lsb = transfer(in.lsb);
255251
out.msb = transfer(in.msb);
252+
} else {
253+
//MSBFIRST
254+
out.msb = transfer(in.msb);
255+
out.lsb = transfer(in.lsb);
256256
}
257257
return out.val;
258258
}

0 commit comments

Comments
 (0)