Skip to content

Commit c00ec13

Browse files
committed
moved setChipSelect() in front of beginTransactionWithAssertingCS()
This is a more logical order, as beginTransactionWithAssertingCS() and endTransactionWithDeassertingCS() both call it.
1 parent 41635e3 commit c00ec13

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Adafruit_SPIDevice.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ void Adafruit_SPIDevice::endTransaction(void) {
282282
}
283283
}
284284

285+
/*!
286+
* @brief Assert/Deassert the CS pin if it is defined
287+
* @param value The state the CS is set to
288+
*/
289+
void Adafruit_SPIDevice::setChipSelect(int value) {
290+
if (_cs != -1) {
291+
digitalWrite(_cs, value);
292+
}
293+
}
294+
285295
/*!
286296
* @brief Write a buffer or two to the SPI device, with transaction
287297
* management.
@@ -510,14 +520,4 @@ bool Adafruit_SPIDevice::write_and_read(uint8_t *buffer, size_t len) {
510520
return true;
511521
}
512522

513-
/*!
514-
* @brief Assert/Deassert the CS pin if it is defined
515-
* @param value The state the CS is set to
516-
*/
517-
void Adafruit_SPIDevice::setChipSelect(int value) {
518-
if (_cs == -1)
519-
return;
520-
digitalWrite(_cs, value);
521-
}
522-
523523
#endif // SPI exists

0 commit comments

Comments
 (0)