File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,22 @@ byte SPIClass::transfer(uint8_t data)
194
194
return _p_sercom->readDataSPI () & 0xFF ;
195
195
}
196
196
197
+ uint16_t SPIClass::transfer16 (uint16_t data) {
198
+ union { uint16_t val; struct { uint8_t lsb; uint8_t msb; }; } t;
199
+
200
+ t.val = data;
201
+
202
+ if (_p_sercom->getDataOrderSPI () == LSB_FIRST) {
203
+ t.lsb = transfer (t.lsb );
204
+ t.msb = transfer (t.msb );
205
+ } else {
206
+ t.msb = transfer (t.msb );
207
+ t.lsb = transfer (t.lsb );
208
+ }
209
+
210
+ return t.val ;
211
+ }
212
+
197
213
void SPIClass::attachInterrupt () {
198
214
// Should be enableInterrupt()
199
215
}
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ class SPIClass {
95
95
96
96
97
97
byte transfer (uint8_t data);
98
+ uint16_t transfer16 (uint16_t data);
98
99
inline void transfer (void *buf, size_t count);
99
100
100
101
// Transaction Functions
You can’t perform that action at this time.
0 commit comments