Other Parts Discussed in Thread: CC3100, CC3120
Hello,
I am working on CC3120MOD and interfacing to STM32 using SPI. Is it possible to implement SPI in callback mode (interrupt mode)?
I have gone through the MSP32P4 example which is using Blocking Mode (Polling mode) for SPI implementation. I have also checked CC3100 interfacing example with STM32 discovery that is also using SPI in Blocking Mode(Polling mode).
Is there any way to implement the SPI driver in callback mode (interrupt mode)? Because it will block SPI_read/write function until it complete transaction.
/**********************************Code from cc_pal.c*************/
Fd_t spi_Open(char *ifName, unsigned long flags) { void *lspi_hndl; SPI_Params SPI_Config; /* Initialize the WiFi driver */ WiFi_init(); /* If we could not initialize the device bail out with an error code */ if(curDeviceConfiguration == NULL) { return (-1); } /* Initialize the SPI config structure */ SPI_Params_init(&SPI_Config); SPI_Config.transferMode = SPI_MODE_BLOCKING; //////////////////////////////////Blocking Mode (Polling Mode) ///////////////////////////////////////////////////////// SPI_Config.mode = SPI_MASTER; SPI_Config.bitRate = curDeviceConfiguration->spiBitRate; SPI_Config.dataSize = 8; SPI_Config.frameFormat = SPI_POL0_PHA0; /* Open SPI interface with SPI_Config parameters */ lspi_hndl = SPI_open(curDeviceConfiguration->spiIndex, &SPI_Config); if(NULL == lspi_hndl) { return (-1); } else { return ((Fd_t) lspi_hndl); } }