zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.14k stars 6.23k forks source link

How nrf52840 implements spis event handler #30375

Open mfinmuch opened 3 years ago

mfinmuch commented 3 years ago

Recently I am trying to use nrf52840 to implement SPI slave on zephyr But I have a problem In Nordic's SPIS example, it will go to spis_event_handler when an interrupt occurs In spis_event_handler, judge whether the transmission has been completed, as follow if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) I want to implement this interrupt function on zephyr But at present zephyr SPIS I have not seen an example of event handler Only simple spi_writeand spi_readcan be used to write/read And in \zephyr\drivers\spi\spi_nrfx_spi.c, I saw a function that does the same thing as the spis_event_handlerof the Nordic example as follows

static void event_handler(const nrfx_spi_evt_t *p_event, void *p_context)
{
struct spi_nrfx_data *dev_data = p_context;

if (p_event->type == NRFX_SPI_EVENT_DONE) {
spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len);
spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len);

transfer_next_chunk(dev_data->dev);
}
}

How to reference this event_handler in the main function in the sample?

Thanks, PYL

zephyrbot commented 5 months ago

Hi @anangl,

This issue, marked as an Enhancement, was opened a while ago and did not get any traction. Please confirm the issue is correctly assigned and re-assign it otherwise.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@mfinmuch you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!