mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Add SPI subdir
This commit is contained in:
parent
b73e03fddf
commit
8efed8802d
@ -1,11 +1,12 @@
|
||||
/**
|
||||
* @brief SPI interface definitions.
|
||||
* @file
|
||||
* @brief SPI device interface.
|
||||
*/
|
||||
#ifndef STA_SPI_DEVICE_HPP
|
||||
#define STA_SPI_DEVICE_HPP
|
||||
|
||||
#include <sta/intf/gpio_pin.hpp>
|
||||
#include <sta/intf/spi_interface.hpp>
|
||||
#include <sta/spi/interface.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -15,6 +16,8 @@ namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Interface for SPI devices.
|
||||
*
|
||||
* @ingroup staCoreSPI
|
||||
*/
|
||||
class SpiDevice
|
||||
{
|
@ -1,11 +1,12 @@
|
||||
/**
|
||||
* @brief SPI interface definitions.
|
||||
* @file
|
||||
* @brief SPI interface definition.
|
||||
*/
|
||||
#ifndef STA_SPI_INTERFACE_HPP
|
||||
#define STA_SPI_INTERFACE_HPP
|
||||
|
||||
#include <sta/intf/mutex.hpp>
|
||||
#include <sta/spi_settings.hpp>
|
||||
#include <sta/spi/settings.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -15,6 +16,8 @@ namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Interface for SPI hardware.
|
||||
*
|
||||
* @ingroup staCoreSPI
|
||||
*/
|
||||
class SpiInterface
|
||||
{
|
@ -1,21 +1,35 @@
|
||||
/**
|
||||
* @brief SPI setting types.
|
||||
* @file
|
||||
* @brief SPI settings.
|
||||
*/
|
||||
#ifndef STA_SPI_SETTINGS_HPP
|
||||
#define STA_SPI_SETTINGS_HPP
|
||||
|
||||
/**
|
||||
* @defgroup staCoreSPI SPI
|
||||
* @ingroup staCore
|
||||
* @brief SPI interface.
|
||||
*/
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @ingroup staCoreSPI
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief SPI clock polarity.
|
||||
*/
|
||||
enum class SpiClkPolarity
|
||||
{
|
||||
LOW,
|
||||
HIGH
|
||||
LOW, /**< Low idle clock */
|
||||
HIGH /**< High idle clock */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -23,8 +37,8 @@ namespace sta
|
||||
*/
|
||||
enum class SpiClkPhase
|
||||
{
|
||||
EDGE_1,
|
||||
EDGE_2
|
||||
EDGE_1, /**< Sample on first edge, shift out on second edge */
|
||||
EDGE_2 /**< Shift out on first edge, sample on second edge */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -32,10 +46,10 @@ namespace sta
|
||||
*/
|
||||
enum class SpiMode
|
||||
{
|
||||
MODE_0,
|
||||
MODE_1,
|
||||
MODE_2,
|
||||
MODE_3
|
||||
MODE_0, /**< Low idle clock, sample on rising edge, shift out on falling edge */
|
||||
MODE_1, /**< Low idle clock, sample on falling edge, shift out on rising edge */
|
||||
MODE_2, /**< High idle clock, sample on rising edge, shift out on falling edge */
|
||||
MODE_3 /**< High idle clock, sample on falling edge, shift out on rising edge */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -43,8 +57,8 @@ namespace sta
|
||||
*/
|
||||
enum class SpiDataSize
|
||||
{
|
||||
SIZE_8,
|
||||
SIZE_16
|
||||
SIZE_8, /**< 8-bit data size */
|
||||
SIZE_16 /**< 16-bit data size */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -52,23 +66,8 @@ namespace sta
|
||||
*/
|
||||
enum class SpiBitOrder
|
||||
{
|
||||
MSB,
|
||||
LSB
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Spi baud rate prescaler.
|
||||
*/
|
||||
enum class SpiBaudRatePrescaler
|
||||
{
|
||||
DIV_2,
|
||||
DIV_4,
|
||||
DIV_8,
|
||||
DIV_16,
|
||||
DIV_32,
|
||||
DIV_64,
|
||||
DIV_128,
|
||||
DIV_256
|
||||
MSB, /**< Send most significant bit first */
|
||||
LSB /**< Send least significant bit first */
|
||||
};
|
||||
|
||||
|
||||
@ -106,6 +105,9 @@ namespace sta
|
||||
* @return SPI clock mode
|
||||
*/
|
||||
SpiMode getSpiMode(SpiClkPolarity polarity, SpiClkPhase phase);
|
||||
|
||||
|
||||
/** @} */
|
||||
} // namespace sta
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <sta/spi_device.hpp>
|
||||
#include <sta/spi/device.hpp>
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <sta/intf/spi_interface.hpp>
|
||||
#include <sta/spi/interface.hpp>
|
||||
|
||||
|
||||
namespace sta
|
@ -1,4 +1,4 @@
|
||||
#include <sta/spi_settings.hpp>
|
||||
#include <sta/spi/settings.hpp>
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
#include <sta/lang.hpp>
|
Loading…
x
Reference in New Issue
Block a user