FD32M0P Microcontroller SDK
Loading...
Searching...
No Matches
spi.h File Reference
#include "SPI_REGS.h"
#include "SPI_RW_API.h"
#include <stdbool.h>
Include dependency graph for spi.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  spi_cfg_t
 SPI Configuation Struct. More...

Macros

#define SPI_CFG_DEFAULT
 Default Values for SPI in Controller mode.

Functions

void spi_set_clk_cfg (SPI_REGS_s *SPI_REGS_PTR, SPI_CLKSEL_CLK_SEL_E clk_sel, uint8_t div_ratio)
 This function updates the clock setting use by the SPI.
void spi_set_moto_mode_cfg (SPI_REGS_s *SPI_REGS_PTR, SPI_MOT_MOD_CNTRL_CLOCK_POLARITY_E clk_polarity, SPI_MOT_MOD_CNTRL_CLOCK_PHASE_E clk_phase, bool parity_en, bool even_partiy)
 This function updates SPI configuration for Moto Mode.
void spi_set_mode_cfg (SPI_REGS_s *SPI_REGS_PTR, SPI_MODE_CTRL_PERIPHERAL_MODE_E mode, SPI_MODE_CTRL_FRAME_FORMAT_E frame_format, uint8_t data_size, bool msb_first)
 This function configure the SPI mode/type of Operation.
void spi_start_transaction (SPI_REGS_s *SPI_REGS_PTR)
 This function starts spi transaction.
void spi_disable (SPI_REGS_s *SPI_REGS_PTR)
 This function disables spi.
void spi_set_loopback (SPI_REGS_s *SPI_REGS_PTR)
 This function sets SPI loopback.
void spi_clr_loopback (SPI_REGS_s *SPI_REGS_PTR)
 This function clear SPI loopback.
void spi_set_tx_ctrl (SPI_REGS_s *SPI_REGS_PTR, uint8_t repeat_tx_data)
 This function set SPI TX ctrl setting.
void spi_set_rx_ctrl (SPI_REGS_s *SPI_REGS_PTR, uint8_t receive_timeout, uint8_t ignore_rx_cnt, uint8_t dly_sample_on_rx)
 This function set SPI RX ctrl setting.
void spi_init (SPI_REGS_s *SPI_REGS_PTR, spi_cfg_t *spi_cfg)
 This function initializes the SPI, with Controller/Peripheral Setting.
uint8_t spi_receive_byte_blocking (SPI_REGS_s *SPI_REGS_PTR)
 Blocking function to recive a single byte.
uint16_t spi_receive_halfword_blocking (SPI_REGS_s *SPI_REGS_PTR)
 Blocking function to recive a half word.
uint32_t spi_receive_word_blocking (SPI_REGS_s *SPI_REGS_PTR)
 Blocking function to recive a word.
bool spi_receive_byte_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint8_t *byte)
 Non - Blocking function to recieve a byte.
bool spi_receive_halfword_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint16_t *halfword)
 Non - Blocking function to recieve a half word.
bool spi_receive_word_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint32_t *word)
 Non - Blocking function to recieve a word.
void spi_transmit_byte_blocking (SPI_REGS_s *SPI_REGS_PTR, uint8_t byte)
 Blocking function to transmit a byte.
void spi_transmit_halfword_blocking (SPI_REGS_s *SPI_REGS_PTR, uint16_t halfword)
 Blocking function to transmit a halfword.
void spi_transmit_word_blocking (SPI_REGS_s *SPI_REGS_PTR, uint32_t word)
 Blocking function to transmit a word.
bool spi_transmit_byte_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint8_t byte)
 Non - Blocking function to transmit a byte.
bool spi_transmit_halfword_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint16_t halfword)
 Non - Blocking function to transmit a halfword.
bool spi_transmit_word_non_blocking (SPI_REGS_s *SPI_REGS_PTR, uint32_t word)
 Non - Blocking function to transmit word.
uint8_t spi_rx_fifo_drain_byte (SPI_REGS_s *SPI_REGS_PTR, uint8_t *buffer, uint8_t max_count)
 Non - Blocking function to drain the rx fifo based on max count.
uint8_t spi_rx_fifo_drain_halfword (SPI_REGS_s *SPI_REGS_PTR, uint16_t *buffer, uint8_t max_count)
 Non - Blocking function to drain the rx fifo based on max count.
uint8_t spi_rx_fifo_drain_word (SPI_REGS_s *SPI_REGS_PTR, uint32_t *buffer, uint8_t max_count)
 Non - Blocking function to drain the rx fifo based on max count.
uint8_t spi_tx_fifo_fill_byte_non_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint8_t *buffer, uint8_t max_count)
 Non - Blocking function to fill the tx fifo based on max count.
uint8_t spi_tx_fifo_fill_halfword_non_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint16_t *buffer, uint8_t max_count)
 Non - Blocking function to fill the tx fifo based on max count.
uint8_t spi_tx_fifo_fill_word_non_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint32_t *buffer, uint8_t max_count)
 Non - Blocking function to fill the tx fifo based on max count.
void spi_tx_fifo_fill_byte_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint8_t *buffer, uint8_t max_count)
 Blocking function to fill the tx fifo based on max count.
void spi_tx_fifo_fill_halfword_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint16_t *buffer, uint8_t max_count)
 Blocking function to fill the tx fifo based on max count.
void spi_tx_fifo_fill_word_blocking (SPI_REGS_s *SPI_REGS_PTR, const uint32_t *buffer, uint8_t max_count)
 Blocking function to fill the tx fifo based on max count.
void spi_enable_cs (SPI_REGS_s *SPI_REGS_PTR, bool soft_cs_en, uint8_t cs_sel)
 function to set enable software controlled cs and sel the cs
void spi_set_soft_cs (SPI_REGS_s *SPI_REGS_PTR)
 function to set soft cs
void spi_clr_soft_cs (SPI_REGS_s *SPI_REGS_PTR)
 function to set soft cs
bool spi_is_idle (SPI_REGS_s *SPI_REGS_PTR)
 function to pool for spi idle