beginTransactionWithAssertingCS() and endTransactionWithDeassertingCS()
These two methods are similar to beginTransaction() and endTransaction(), but, as the name implies, with CS management. They are both public, as beginTransaction() and endTransaction() are too.
This commit is contained in:
parent
4ca049393f
commit
41635e3c68
|
|
@ -282,6 +282,26 @@ void Adafruit_SPIDevice::endTransaction(void) {
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Write a buffer or two to the SPI device, with transaction
|
||||
* management.
|
||||
* @brief Manually begin a transaction (calls beginTransaction if hardware
|
||||
* SPI) with asserting the CS pin
|
||||
*/
|
||||
void Adafruit_SPIDevice::beginTransactionWithAssertingCS() {
|
||||
beginTransaction();
|
||||
setChipSelect(LOW);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Manually end a transaction (calls endTransaction if hardware SPI)
|
||||
* with deasserting the CS pin
|
||||
*/
|
||||
void Adafruit_SPIDevice::endTransactionWithDeassertingCS() {
|
||||
setChipSelect(HIGH);
|
||||
endTransaction();
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Write a buffer or two to the SPI device, with transaction
|
||||
* management.
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public:
|
|||
void transfer(uint8_t *buffer, size_t len);
|
||||
void beginTransaction(void);
|
||||
void endTransaction(void);
|
||||
void beginTransactionWithAssertingCS();
|
||||
void endTransactionWithDeassertingCS();
|
||||
|
||||
private:
|
||||
SPIClass *_spi;
|
||||
|
|
|
|||
Loading…
Reference in New Issue