mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Use new SPI settings
This commit is contained in:
@@ -45,6 +45,7 @@ namespace sta
|
||||
|
||||
void receive(uint8_t * buffer, size_t size) override;
|
||||
|
||||
|
||||
private:
|
||||
SPI_HandleTypeDef * handle_; /**< SPI handle */
|
||||
};
|
||||
|
@@ -87,6 +87,15 @@ namespace sta
|
||||
*/
|
||||
void receive(uint8_t * buffer, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get SPI interface settings.
|
||||
*
|
||||
* @return SPI settings
|
||||
*/
|
||||
const SpiSettings & settings() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Activate device via CS pin.
|
||||
*/
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#define STA_SPI_INTERFACE_HPP
|
||||
|
||||
#include <sta/mutex.hpp>
|
||||
#include <sta/spi_settings.hpp>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -19,9 +20,10 @@ namespace sta
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param settings SPI interface settings
|
||||
* @param mutex Mutex object for managing shared access. Pass nullptr for no access control
|
||||
*/
|
||||
SpiInterface(Mutex * mutex = nullptr);
|
||||
SpiInterface(const SpiSettings & settings, Mutex * mutex = nullptr);
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,6 +78,15 @@ namespace sta
|
||||
*/
|
||||
virtual void receive(uint8_t * buffer, size_t size) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get SPI interface settings.
|
||||
*
|
||||
* @return SPI settings
|
||||
*/
|
||||
const SpiSettings & settings() const;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Acquire usage rights to use the interface.
|
||||
*
|
||||
@@ -90,7 +101,8 @@ namespace sta
|
||||
virtual void release();
|
||||
|
||||
private:
|
||||
Mutex * mutex_; /**< Mutex object */
|
||||
SpiSettings settings_; /** SPI settings */
|
||||
Mutex * mutex_; /**< Mutex object */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
Reference in New Issue
Block a user