This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Async wlan_connect with cc3000

Hi,

in my application (using a msp430) I cannot wait 6 seconds for wlan_connect(), so I'm trying to make it non-blocking.

At the end of wlan_connect (in CC3000HostDriver/wlan.c), I replaced

SimpleLinkWaitEvent(HCI_CMND_WLAN_CONNECT, &ret);
errno = ret;
return(ret);

with

tSLInformation.usRxEventOpcode = HCI_CMND_WLAN_CONNECT;
return(1);

And in the main loop of my application, I did something like this:

void main(void)
{
    long retValue;
    // ...

    wlan_connect(/*...*/);

    while(1) {
        if( tSLInformation.usEventOrDataReceived == 0 ) {
            // Do some other stuff
        } else {
            hci_event_handler( (void*)(&retValue), 0, 0 );
            break;
        }
    }

    // here wlan_connect() should have been processed
}

It is safe to proceed in this way, or there is any pitfalls that I did not notice?