struct pico_device * pico_eth_create(char *name, uint8_t *mac)
{
    struct pico_device * mrf24wg = PICO_ZALLOC(sizeof(struct pico_device));
    if (!mrf24wg)
        return NULL;

    /*          SPI             CS,               RESET            INTERRUPT   */
    printf("mrf24w> init\n");
    mrf24w_init(SPI2, GPIOB, GPIO_PIN_12, GPIOB, GPIO_PIN_10, GPIOB, GPIO_PIN_11);
    wf_init();

    mrf24wg->poll = pico_mrf24_poll;
    mrf24wg->send = pico_mrf24_send;

    /* Get MAC address */
    wf_getMacAddress(mac);
    printf("mrf24w> mac: %x:%x:%x:%x:%x:%x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);

    if(0 != pico_device_init(mrf24wg, name, mac)) {
        dbg("mrf24w> init failed.\r\n");
        return NULL;
    }

    /* start with a scan */
    {
        uint8_t connectionProfileId;
        uint8_t channelList[] = {};

        //connectionProfileId = wf_cpCreate();
        //ASSERT(connectionProfileId != 0xff);
        //wf_cpSetSsid(connectionProfileId, (uint8_t*) m_ssid, strlen(m_ssid));
        //wf_cpSetNetworkType(connectionProfileId, m_wirelessMode);
        //wf_caSetScanType(WF_ACTIVE_SCAN);
        //wf_caSetChannelList(channelList, sizeof (channelList));
        //wf_caSetListRetryCount(10);
        //wf_caSetBeaconTimeout(40);
        //wf_cpSetSecurity(connectionProfileId, m_securityType, 0, m_securityPassphrase, m_securityPassphraseLen);
        //wf_cmConnect(connectionProfileId);
        wf_scan(0xFF); // Scan using default filter
    }

    return mrf24wg;
}
Exemple #2
0
void Mrf24w::scan(uint8_t cpid) {
  wf_scan(cpid);
}
void mrf24w_scan(uint8_t cpid) {
    wf_scan(cpid);
}