Added timeout to bus communication and added error handling via return values

This commit is contained in:
dario
2024-11-03 18:22:34 +01:00
parent 53567724f1
commit bbb8f3505e
14 changed files with 212 additions and 109 deletions

View File

@@ -30,6 +30,7 @@ namespace sta
SPIDevice(SPI * intf, GpioPin * csPin);
using Device::transfer;
/**
* @brief Send and receive data simultaneously.
*
@@ -37,7 +38,7 @@ namespace sta
* @param rxBuffer Receive buffer
* @param size Number of bytes to transfer
*/
void transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size);
bool transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size, uint32_t timeout = STA_MAX_TIMEOUT);
/**
* @brief Get %SPI interface settings.