Ejemplo n.º 1
0
/*****************************************************************************
  Function:
    bool WF_SpiInit(void)

  Summary:
    Initializes the SPI interface to the MRF24W device.

  Description:
    Configures the SPI interface for communications with the MRF24W.

  Precondition:
    None

  Parameters:
    None

  Returns:
    None
      
  Remarks:
    This function is called by WFHardwareInit.
*****************************************************************************/
bool WF_SpiInit(void)
{
    bool res;
    
    /* disable the spi interrupt if necessary */
    // No need because SPI interrupt is not used

    // Initialize IO for WF chip select    
    WF_CS_Init();     
    WF_SpiDisableChipSelect();  // Disable chip select before initialization

    res = ConfigureSpiMRF24W();  
    return res;
}
Ejemplo n.º 2
0
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;
}