bool IspSpi_Rx(unsigned char * const buf, int size) { SYS_INT_PROCESSOR_STATUS intStatusSaving; if (size == 0) { return true; } intStatusSaving = SYS_INT_StatusGetAndDisable(); // Disable all interrupts spiBufferHandleRx = DRV_SPI_BufferAddRead(drvSPIHandle, buf, size, 0, 0); if (spiBufferHandleRx == (DRV_SPI_BUFFER_HANDLE)NULL) { // WDRV_ASSERT(false, "SPI read error"); SYS_INT_StatusRestore(intStatusSaving); // Restore interrupts return false; } while (DRV_SPI_BUFFER_EVENT_COMPLETE != DRV_SPI_BufferStatus(spiBufferHandleRx)) // Check for the successful data transfer { DRV_SPI_Tasks(*p_drvSPIObject); } SYS_INT_StatusRestore(intStatusSaving); // Restore interrupts return true; }
void SPI3_Write(unsigned char value, unsigned char num_of_bytes) { /* Add the buffer to transmit */ display_ctrlData.drvSPIWRBUFHandle = DRV_SPI_BufferAddWrite(display_ctrlData.drvSPIHandle, (SPI_DATA_TYPE *) & value, num_of_bytes, 0, 0); while (!(DRV_SPI_BUFFER_EVENT_COMPLETE & DRV_SPI_BufferStatus(display_ctrlData.drvSPIWRBUFHandle))); }
void IspSpi_TxRx(unsigned char *p_txBuf, int txLen, unsigned char *p_rxBuf,int rxLen) { if((txLen==0) && (rxLen ==0)) return ; spiBufferHandleTxRx = DRV_SPI_BufferAddWriteRead ( drvSPIHandle, p_txBuf, p_rxBuf,rxLen ) ; if ( spiBufferHandleTxRx == NULL ) { //SYS_ASSERT(false, "SPI Read error"); return ; } while(!(DRV_SPI_BUFFER_EVENT_COMPLETE & DRV_SPI_BufferStatus (spiBufferHandleTxRx) )) //Check for the successful data transfer { DRV_SPI_Tasks (drvSPIObject); } return ; }
bool IspSpi_Rx(unsigned char *buf,int size) { if(size==0) return true; spiBufferHandleRx = DRV_SPI_BufferAddRead ( drvSPIHandle, buf, size ) ; if ( spiBufferHandleRx == NULL ) { //SYS_ASSERT(false, "SPI Read error"); return false; } while(!(DRV_SPI_BUFFER_EVENT_COMPLETE & DRV_SPI_BufferStatus (spiBufferHandleRx) ))//Check for the successful data transfer { DRV_SPI_Tasks (drvSPIObject); } return true; }