Low Level functions for SPI.
More...
Low Level functions for SPI.
◆ spi_write_tx_data()
Writes data to TX FIFO, data must be right aligned. Function only valid if SPI is enabled. This function does not check if the FIFO is full, it is the user's responsibility to check first. Frames written to a full FIFO are discarded.
- Parameters
-
| id | SPI Instance ID. |
| tx_data | Right aligned tx_data |
- Returns
- spi_status_en Status code indicating success or the reason for failure.
◆ spi_read_rx_data()
Reads data from the RX FIFO. This function is only valid if SPI is enabled. This function does not check to see if there is data in the RX FIFO, it is the user's responsibility to check first. If the FIFO is empty when this is called the RX FIFO underflow interrupt is triggered. call spi_get_num_in_rx_fifo to determine if there is data avaliable.
- Parameters
-
- Returns
- rx data Returned RX data
◆ spi_tx_fifo_not_full()
Checks whether the TX FIFO has space to accept more data. This function is used to ensure the transmit FIFO is not full before writing. Writing to the FIFO when it is full may result in data loss or trigger a TX overflow condition. Use this function in a loop or conditionally to manage flow control during transmission.
- Parameters
-
- Returns
- true - If there is space in the TX FIFO to write more data false - If the TX FIFO is full and cannot accept more data
◆ spi_rx_fifo_not_empty()
Checks whether the RX FIFO contains any received data. This function is used to verify if there is unread data in the receive FIFO. Attempting to read from an empty FIFO may lead to underflow or return invalid data. Always call this function before reading RX data via spi_read_rx_data.
- Parameters
-
- Returns
- true - If there is data available in the RX FIFO false - If the RX FIFO is empty and no data can be read
◆ spi_set_tx_fifo_trig_level()
Threshold value for TX FIFO. When number of entries in TX FIFO is at or below this level TX FIFO Empty status is set. Note any writes greater than or equal to the FIFO size are ignored.
- Parameters
-
| id | SPI Instance ID. |
| fifo_level | TX FIFO level: If TX FIFO is at or below this level then TX FIFO empty status is set |
- Returns
- spi_status_en Status code indicating success or the reason for failure.
◆ spi_get_tx_fifo_trig_level()
Returns TX FIFO Level
- Parameters
-
- Returns
- TX FIFO level
◆ spi_set_rx_fifo_trig_level()
Threshold value for RX FIFO. When number of entries in RX FIFO is at or above this level RX FIFO Full status is set. Note any writes greater than or equal to the FIFO size are ignored.
- Parameters
-
| id | SPI Instance ID. |
| fifo_level | RX FIFO level: If RX FIFO is at or above this level then RX FIFO full status is set |
- Returns
- spi_status_en Status code indicating success or the reason for failure.
◆ spi_get_rx_fifo_trig_level()
Returns RX FIFO Level
- Parameters
-
- Returns
- RX FIFO level
◆ spi_get_num_in_tx_fifo()
Returns number of valid entries in the TX FIFO.
- Parameters
-
- Returns
- Number of entries in TX FIFO
◆ spi_get_num_in_rx_fifo()
Returns number of valid entries in the RX FIFO.
- Parameters
-
- Returns
- Number of entries in RX FIFO
◆ spi_get_status()
Read SPI Status Register.
- Parameters
-
- Returns
- group_spi_macros_status