This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI_slave_event_handler_register

Hello there, I do not understand the definition Nordic has provided for the "SPI_slave_event_handler_register" function bellow. My understanding is when SPI slave driver occurs then there will be a handler assigned to the event. However, I couldn't find detail explanations of how handler assignment happens and what does SPI slave driver mean? Could someone refer me to some websites or to help me understand this better.

uint32_t spi_slave_evt_handler_register	(	spi_slave_event_handler_t 	event_handler	)	
Function for registering a handler for SPI slave driver event.

Note
Multiple registration requests will overwrite any possible existing registration.
Parameters
[in]	event_handler	The function to be called by the SPI slave driver upon event.
Return values
NRF_SUCCESS	Operation success.
NRF_ERROR_NULL	Operation success. NULL handler registered.
Parents
  • @Milad: spi_slave_evt_handler_register() will assign the address of your SPI event handler to m_event_callback variable. And by this variable, the spi_slave.c library can send the call back event back to main application, in the example it's spi_slave_example.c .

    SPI slave driver is the abstract library that we made in the SDK to help you to use the SPI peripheral, so that you don't have to work directly with the SPI's registers.

Reply
  • @Milad: spi_slave_evt_handler_register() will assign the address of your SPI event handler to m_event_callback variable. And by this variable, the spi_slave.c library can send the call back event back to main application, in the example it's spi_slave_example.c .

    SPI slave driver is the abstract library that we made in the SDK to help you to use the SPI peripheral, so that you don't have to work directly with the SPI's registers.

Children
No Data
Related