add begin/end transaction helpers (needed for really odd devices like SHARP memory display which has inverted CS)
This commit is contained in:
parent
d984ecd0d2
commit
2179775500
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue