diff --git a/Adafruit_SPIDevice.cpp b/Adafruit_SPIDevice.cpp index 8afdcf2..02c1b4e 100644 --- a/Adafruit_SPIDevice.cpp +++ b/Adafruit_SPIDevice.cpp @@ -172,6 +172,25 @@ uint8_t Adafruit_SPIDevice::transfer(uint8_t send) { 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. * @param buffer Pointer to buffer of data to write diff --git a/Adafruit_SPIDevice.h b/Adafruit_SPIDevice.h index 3b241ca..58e6167 100644 --- a/Adafruit_SPIDevice.h +++ b/Adafruit_SPIDevice.h @@ -51,6 +51,8 @@ public: uint8_t transfer(uint8_t send); void transfer(uint8_t *buffer, size_t len); + void beginTransaction(void); + void endTransaction(void); private: SPIClass *_spi;