Skip to main content

MSS_SPI_set_frame_rx_handler

Function MSS_SPI_set_frame_rx_handler 

Source
pub unsafe extern "C" fn MSS_SPI_set_frame_rx_handler(
    this_spi: *mut mss_spi_instance_t,
    rx_handler: mss_spi_frame_rx_handler_t,
)
Expand description

MSS_SPI_set_frame_rx_handler() is used by MSS SPI slaves to specify the receive handler function that is called by the MSS SPI driver interrupt handler when a a frame of data is received by the MSS SPI slave.

@param this_spi this_spi is a pointer to an mss_spi_instance_t structure that identifies the MSS SPI hardware block to be operated.

@param rx_handler rx_handler is a pointer to the frame receive handler that must be called when a frame is received by the MSS SPI slave.

@return This function does not return any value.

@example @code uint32_t g_slave_rx_frame = 0;

void slave_frame_handler(uint32_t rx_frame) { g_slave_rx_frame = rx_frame; }

int setup_slave(void) { const uint16_t frame_size = 25; MSS_SPI_init(&g_mss_spi1_lo); MSS_SPI_configure_slave_mode(&g_mss_spi0_lo, MSS_SPI_MODE2, frame_size, mss_spi_overflow_handler); MSS_SPI_set_frame_rx_handler(&g_mss_spi1_lo, slave_frame_handler); } @endcode