mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-12-16 16:48:04 +00:00
Rework SPI interfaces
This commit is contained in:
@@ -23,7 +23,7 @@ namespace sta
|
||||
* @param settings SPI interface settings
|
||||
* @param mutex Mutex object for managing shared access. Pass nullptr for no access control
|
||||
*/
|
||||
SpiInterface(const SpiSettings & settings, Mutex * mutex = nullptr);
|
||||
SpiInterface(Mutex * mutex = nullptr);
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,6 +32,12 @@ namespace sta
|
||||
* @param value 8-bit value
|
||||
*/
|
||||
virtual void transfer(uint8_t value) = 0;
|
||||
/**
|
||||
* @brief Send two bytes of data.
|
||||
*
|
||||
* @param value 16-bit value
|
||||
*/
|
||||
virtual void transfer16(uint16_t value) = 0;
|
||||
/**
|
||||
* @brief Send data from buffer.
|
||||
*
|
||||
@@ -47,29 +53,6 @@ namespace sta
|
||||
* @param size Number of bytes to transfer
|
||||
*/
|
||||
virtual void transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size) = 0;
|
||||
|
||||
/**
|
||||
* @brief Send two bytes of data.
|
||||
*
|
||||
* @param value 16-bit value
|
||||
*/
|
||||
virtual void transfer16(uint16_t value) = 0;
|
||||
|
||||
/**
|
||||
* @brief Send byte value repeatedly.
|
||||
*
|
||||
* @param value 8-bit value to repeat
|
||||
* @param count Number of repetitions
|
||||
*/
|
||||
virtual void fill(uint8_t value, size_t count) = 0;
|
||||
/**
|
||||
* @brief Send 32-bit value repeatedly.
|
||||
*
|
||||
* @param value 32-bit value to repeat
|
||||
* @param count Number of repetitions
|
||||
*/
|
||||
virtual void fill32(uint32_t value, size_t count) = 0;
|
||||
|
||||
/**
|
||||
* @brief Read incoming data to buffer.
|
||||
*
|
||||
@@ -79,12 +62,21 @@ namespace sta
|
||||
virtual void receive(uint8_t * buffer, size_t size) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Send byte value repeatedly.
|
||||
*
|
||||
* @param value 8-bit value to repeat
|
||||
* @param count Number of repetitions
|
||||
*/
|
||||
virtual void fill(uint8_t value, size_t count) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get SPI interface settings.
|
||||
*
|
||||
* @return SPI settings
|
||||
*/
|
||||
const SpiSettings & settings() const;
|
||||
virtual const SpiSettings & settings() const = 0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,7 +93,6 @@ namespace sta
|
||||
virtual void release();
|
||||
|
||||
private:
|
||||
SpiSettings settings_; /** SPI settings */
|
||||
Mutex * mutex_; /**< Mutex object */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
Reference in New Issue
Block a user