Skip to content

Commit 8025ad8

Browse files
committed
updated SPI library (from Arduino 1.6.6)
1 parent 292a392 commit 8025ad8

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

1.0.2/libraries/SPI/SPI.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,23 @@ byte SPIClass::transfer(byte _pin, uint8_t _data, SPITransferMode _mode) {
186186
return d & 0xFF;
187187
}
188188

189+
uint16_t SPIClass::transfer16(byte _pin, uint16_t _data, SPITransferMode _mode) {
190+
union { uint16_t val; struct { uint8_t lsb; uint8_t msb; }; } t;
191+
uint32_t ch = BOARD_PIN_TO_SPI_CHANNEL(_pin);
192+
193+
t.val = _data;
194+
195+
if (bitOrder[ch] == LSBFIRST) {
196+
t.lsb = transfer(_pin, t.lsb, SPI_CONTINUE);
197+
t.msb = transfer(_pin, t.msb, _mode);
198+
} else {
199+
t.msb = transfer(_pin, t.msb, SPI_CONTINUE);
200+
t.lsb = transfer(_pin, t.lsb, _mode);
201+
}
202+
203+
return t.val;
204+
}
205+
189206
void SPIClass::transfer(byte _pin, void *_buf, size_t _count, SPITransferMode _mode) {
190207
if (_count == 0)
191208
return;

1.0.2/libraries/SPI/library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author=Arduino
44
maintainer=Arduino <info@arduino.cc>
55
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For Arduino DUE only.
66
paragraph=
7-
url=http://arduino.cc/en/Reference/SPI
7+
category=Communication
8+
url=http://www.arduino.cc/en/Reference/SPI
89
architectures=sam
9-
types=Arduino
1010

0 commit comments

Comments
 (0)