Serial Peripheral Interface. More...
Data Structures | |
struct | spi_channel_attr_t |
struct | spi_handle_t |
Enumerations | |
enum | spi_result_t { SPI_RESULT_OK , SPI_RESULT_INVALID , SPI_RESULT_UNSUPPORTED , SPI_RESULT_TIMEOUT , SPI_RESULT_IDLE , SPI_RESULT_BUSY , SPI_RESULT_ERR , TOTAL_SPI_RESULT } |
enum | spi_status_t { SPI_STATUS_UNKNOWN , SPI_STATUS_OK , SPI_STATUS_BUSY , SPI_STATUS_STOP , SPI_STATUS_SENDING , SPI_STATUS_RECEIVING , SPI_STATUS_ERR , TOTAL_SPI_STATUS } |
enum | spi_mode_t { SPI_MODE_MASTER , SPI_MODE_SLAVE , TOTAL_SPI_MODE } |
enum | spi_direction_t { SPI_DIRECTION_MSB_FIRST , SPI_DIRECTION_LSB_FIRST , TOTAL_SPI_DIRECTION } |
Functions | |
spi_result_t | hal_spi_init (spi_handle_t *handle, const spi_channel_attr_t attr) |
Configure SPI channel with specific attributes. | |
spi_result_t | hal_spi_write (spi_handle_t *handle, const uint8_t *tx_buffer, const size_t len) |
Write data to SPI bus. | |
spi_result_t | hal_spi_read (spi_handle_t *handle, uint8_t *rx_buffer, const size_t len) |
Read data from SPI bus. | |
spi_result_t | hal_spi_read_write (spi_handle_t *handle, const uint8_t *tx_buffer, uint8_t *rx_buffer, const size_t len) |
Simultaneous read and write operation. | |
spi_result_t | hal_spi_stop (spi_handle_t *handle) |
Stop SPI operation. | |
spi_result_t | hal_spi_mutex_take (const uint8_t channel, const uint32_t timeout_ms) |
Try acquire RTOS mutex for specified channel. | |
spi_result_t | hal_spi_mutex_give (const uint8_t channel) |
Release RTOS mutex for specified channel. | |
Serial Peripheral Interface.
enum spi_direction_t |
#include <spi/public_inc/hal_spi.h>
Enumerator | |
---|---|
SPI_DIRECTION_MSB_FIRST | |
SPI_DIRECTION_LSB_FIRST | |
TOTAL_SPI_DIRECTION |
enum spi_mode_t |
#include <spi/public_inc/hal_spi.h>
Enumerator | |
---|---|
SPI_MODE_MASTER | |
SPI_MODE_SLAVE | |
TOTAL_SPI_MODE |
enum spi_result_t |
#include <spi/public_inc/hal_spi.h>
enum spi_status_t |
#include <spi/public_inc/hal_spi.h>
spi_result_t hal_spi_init | ( | spi_handle_t * | handle, |
const spi_channel_attr_t | attr ) |
#include <spi/public_inc/hal_spi.h>
Configure SPI channel with specific attributes.
[in,out] | handle | SPI handler |
[in] | attr | SPI channel attributes |
SPI_RESULT_OK | Success configure SPI channel |
SPI_RESULT_INVALID | Configuration attributes invalid |
SPI_RESULT_UNSUPPORTED | Operation not supported |
SPI_RESULT_ERR | Failed configure SPI channel |
spi_result_t hal_spi_mutex_give | ( | const uint8_t | channel | ) |
#include <spi/public_inc/hal_spi.h>
Release RTOS mutex for specified channel.
[in] | channel | SPI channel's mutex to be released |
SPI_RESULT_OK | Success release mutex |
SPI_RESULT_INVALID | Invalid channel |
SPI_RESULT_UNSUPPORTED | Operation not supported |
SPI_RESULT_ERR | Failed release mutex |
spi_result_t hal_spi_mutex_take | ( | const uint8_t | channel, |
const uint32_t | timeout_ms ) |
#include <spi/public_inc/hal_spi.h>
Try acquire RTOS mutex for specified channel.
[in] | channel | SPI channel's mutex to be locked |
[in] | timeout_ms | Mutex acquiring timeout in milliseconds |
SPI_RESULT_OK | Success acquire mutex |
SPI_RESULT_INVALID | Invalid channel |
SPI_RESULT_UNSUPPORTED | Operation not supported |
SPI_RESULT_ERR | Failed acquire mutex |
spi_result_t hal_spi_read | ( | spi_handle_t * | handle, |
uint8_t * | rx_buffer, | ||
const size_t | len ) |
#include <spi/public_inc/hal_spi.h>
Read data from SPI bus.
[in,out] | handle | SPI handler |
[out] | rx_buffer | Receiving buffer |
[in] | len | Buffer size |
SPI_RESULT_OK | Success read data from SPI bus |
SPI_RESULT_TIMEOUT | Read data from SPI bus timeout |
SPI_RESULT_BUSY | Network busy |
SPI_RESULT_ERR | Failed read data from SPI bus |
spi_result_t hal_spi_read_write | ( | spi_handle_t * | handle, |
const uint8_t * | tx_buffer, | ||
uint8_t * | rx_buffer, | ||
const size_t | len ) |
#include <spi/public_inc/hal_spi.h>
Simultaneous read and write operation.
[in,out] | handle | SPI handler |
[in] | tx_buffer | Buffer to be transmitted |
[out] | rx_buffer | Buffer to be received |
[in] | len | Buffer size |
SPI_RESULT_OK | Success read/write data |
SPI_RESULT_TIMEOUT | Write to SPI bus timeout |
SPI_RESULT_BUSY | Network busy |
SPI_RESULT_ERR | Failed write data to SPI bus |
spi_result_t hal_spi_stop | ( | spi_handle_t * | handle | ) |
#include <spi/public_inc/hal_spi.h>
Stop SPI operation.
[in,out] | handle | SPI handler |
SPI_RESULT_OK | Success stop SPI transaction |
SPI_RESULT_UNSUPPORTED | Operation not supported |
SPI_RESULT_ERR | Failed stop SPI transaction |
spi_result_t hal_spi_write | ( | spi_handle_t * | handle, |
const uint8_t * | tx_buffer, | ||
const size_t | len ) |
#include <spi/public_inc/hal_spi.h>
Write data to SPI bus.
[in,out] | handle | SPI handler |
[in] | tx_buffer | Buffer to be transmitted |
[in] | len | Buffer size |
SPI_RESULT_OK | Success write data to SPI bus |
SPI_RESULT_TIMEOUT | Write to SPI bus timeout |
SPI_RESULT_BUSY | Network busy |
SPI_RESULT_ERR | Failed write data to SPI bus |