mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
70 lines
820 B
C++
70 lines
820 B
C++
#ifndef STA_SPI_SETTINGS_HPP
|
|
#define STA_SPI_SETTINGS_HPP
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
namespace sta
|
|
{
|
|
enum class SpiClkPolarity
|
|
{
|
|
LOW,
|
|
HIGH
|
|
};
|
|
|
|
enum class SpiClkPhase
|
|
{
|
|
EDGE_1,
|
|
EDGE_2
|
|
};
|
|
|
|
enum class SpiMode
|
|
{
|
|
MODE_0,
|
|
MODE_1,
|
|
MODE_2,
|
|
MODE_3
|
|
};
|
|
|
|
enum class SpiDataSize
|
|
{
|
|
SIZE_8,
|
|
SIZE_16
|
|
};
|
|
|
|
enum class SpiBitOrder
|
|
{
|
|
MSB,
|
|
LSB
|
|
};
|
|
|
|
enum class SpiBaudRatePrescaler
|
|
{
|
|
DIV_2,
|
|
DIV_4,
|
|
DIV_8,
|
|
DIV_16,
|
|
DIV_32,
|
|
DIV_64,
|
|
DIV_128,
|
|
DIV_256
|
|
};
|
|
|
|
|
|
struct SpiSettings
|
|
{
|
|
SpiMode mode;
|
|
SpiDataSize dataSize;
|
|
SpiBitOrder bitOrder;
|
|
uint32_t clkSpeed;
|
|
};
|
|
|
|
|
|
SpiClkPolarity getSpiClkPolarity(SpiMode mode);
|
|
SpiClkPhase getSpiClkPhase(SpiMode mode);
|
|
SpiMode getSpiMode(SpiClkPolarity polarity, SpiClkPhase phase);
|
|
} // namespace sta
|
|
|
|
|
|
#endif // STA_SPI_SETTINGS_HPP
|