add begin/end transaction helpers (needed for really odd devices like SHARP memory display which has inverted CS)

This commit is contained in:
lady ada 2020-07-18 12:03:30 -04:00
parent d984ecd0d2
commit 2179775500
2 changed files with 21 additions and 0 deletions

View File

@ -172,6 +172,25 @@ uint8_t Adafruit_SPIDevice::transfer(uint8_t send) {
return data; return data;
} }
/*!
* @brief Manually begin a transaction (calls beginTransaction if hardware
* SPI)
*/
void Adafruit_SPIDevice::beginTransaction(void) {
if (_spi) {
_spi->beginTransaction(*_spiSetting);
}
}
/*!
* @brief Manually end a transaction (calls endTransaction if hardware SPI)
*/
void Adafruit_SPIDevice::endTransaction(void) {
if (_spi) {
_spi->endTransaction();
}
}
/*! /*!
* @brief Write a buffer or two to the SPI device. * @brief Write a buffer or two to the SPI device.
* @param buffer Pointer to buffer of data to write * @param buffer Pointer to buffer of data to write

View File

@ -51,6 +51,8 @@ public:
uint8_t transfer(uint8_t send); uint8_t transfer(uint8_t send);
void transfer(uint8_t *buffer, size_t len); void transfer(uint8_t *buffer, size_t len);
void beginTransaction(void);
void endTransaction(void);
private: private:
SPIClass *_spi; SPIClass *_spi;