moved setChipSelect() in front of beginTransactionWithAssertingCS()

This is a more logical order, as beginTransactionWithAssertingCS() and
endTransactionWithDeassertingCS() both call it.
This commit is contained in:
Christian Riggenbach 2022-05-02 22:37:17 +02:00
parent 41635e3c68
commit c00ec13218
1 changed files with 10 additions and 10 deletions

View File

@ -282,6 +282,16 @@ void Adafruit_SPIDevice::endTransaction(void) {
}
}
/*!
* @brief Assert/Deassert the CS pin if it is defined
* @param value The state the CS is set to
*/
void Adafruit_SPIDevice::setChipSelect(int value) {
if (_cs != -1) {
digitalWrite(_cs, value);
}
}
/*!
* @brief Write a buffer or two to the SPI device, with transaction
* management.
@ -510,14 +520,4 @@ bool Adafruit_SPIDevice::write_and_read(uint8_t *buffer, size_t len) {
return true;
}
/*!
* @brief Assert/Deassert the CS pin if it is defined
* @param value The state the CS is set to
*/
void Adafruit_SPIDevice::setChipSelect(int value) {
if (_cs == -1)
return;
digitalWrite(_cs, value);
}
#endif // SPI exists