Rework SPI interfaces

This commit is contained in:
Henrik Stickann
2022-04-19 23:20:20 +02:00
parent 4504ee9c3b
commit a468133c97
5 changed files with 51 additions and 78 deletions

View File

@@ -23,6 +23,7 @@ namespace sta
*/
SpiDevice(SpiInterface * intf);
/**
* @brief Start transmission with device.
*
@@ -36,12 +37,19 @@ namespace sta
*/
void endTransmission();
/**
* @brief Send single byte of data.
*
* @param value 8-bit value
*/
void transfer(uint8_t value);
/**
* @brief Send two bytes of data.
*
* @param value 16-bit value
*/
void transfer16(uint16_t data);
/**
* @brief Send data from buffer.
*
@@ -58,11 +66,13 @@ namespace sta
*/
void transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size);
/**
* @brief Send two bytes of data.
* @brief Read incoming data to buffer.
*
* @param value 16-bit value
* @param buffer Destination buffer
* @param size Number of bytes to read
*/
void transfer16(uint16_t data);
void receive(uint8_t * buffer, size_t size);
/**
* @brief Send byte value repeatedly.
@@ -71,21 +81,6 @@ namespace sta
* @param count Number of repetitions
*/
void fill(uint8_t value, size_t count);
/**
* @brief Send 32-bit value repeatedly.
*
* @param value 32-bit value to repeat
* @param count Number of repetitions
*/
void fill32(uint32_t value, size_t count);
/**
* @brief Read incoming data to buffer.
*
* @param buffer Destination buffer
* @param size Number of bytes to read
*/
void receive(uint8_t * buffer, size_t size);
/**