bool DRV_WIFI_SpiInit() { #if defined(PLIB_PORTS_ExistsPortsDirection) if (PLIB_PORTS_ExistsPortsDirection(PORTS_ID_0)) { WF_CS_Init(); } #endif WF_CS_Deassert(); // Disable chip select before initialization drvSPIHandle = DRV_SPI_Open(DRV_WIFI_SPI_INDEX, DRV_IO_INTENT_READWRITE|DRV_IO_INTENT_BLOCKING); if (drvSPIHandle == (DRV_SPI_BUFFER_HANDLE)NULL) { //DRV_WIFI_ASSERT(false, "SPI open error"); return false; } return true; }
/***************************************************************************** Function: void WF_SpiDisableChipSelect(void) Summary: Disables the MRF24W SPI chip select. Description: Disables the MRF24W SPI chip select as part of the sequence of SPI communications. Precondition: None Parameters: None Returns: None Remarks: If the SPI bus is shared with other peripherals then the current SPI context is restored. *****************************************************************************/ void WF_SpiDisableChipSelect(void) { /* set Slave Select high ((disable SPI chip select on MRF24W) */ WF_CS_Deassert(); }