From c00ec13218669062731270f0cdf79ed4d65b3a00 Mon Sep 17 00:00:00 2001 From: Christian Riggenbach Date: Mon, 2 May 2022 22:37:17 +0200 Subject: [PATCH] moved setChipSelect() in front of beginTransactionWithAssertingCS() This is a more logical order, as beginTransactionWithAssertingCS() and endTransactionWithDeassertingCS() both call it. --- Adafruit_SPIDevice.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Adafruit_SPIDevice.cpp b/Adafruit_SPIDevice.cpp index 45a2e65..00a7c6b 100644 --- a/Adafruit_SPIDevice.cpp +++ b/Adafruit_SPIDevice.cpp @@ -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