コード例 #1
0
void auto_init_at86rf2xx(void)
{
    for (unsigned i = 0; i < AT86RF2XX_NUM; i++) {
        const at86rf2xx_params_t *p = &at86rf2xx_params[i];
        int res;

        DEBUG("Initializing AT86RF2xx radio at SPI_%i\n", p->spi);
        at86rf2xx_setup(&at86rf2xx_devs[i], (at86rf2xx_params_t*) p);
        res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i],
                                           (netdev2_ieee802154_t *)&at86rf2xx_devs[i]);

        if (res < 0) {
            DEBUG("Error initializing AT86RF2xx radio device!\n");
        }
        else {
            gnrc_netdev2_init(_at86rf2xx_stacks[i],
                              AT86RF2XX_MAC_STACKSIZE,
                              AT86RF2XX_MAC_PRIO,
                              "at86rf2xx",
                              &gnrc_adpt[i]);
        }
    }
}
コード例 #2
0
void auto_init_at86rf2xx(void)
{
    for (unsigned i = 0; i < AT86RF2XX_NUM; i++) {
        const at86rf2xx_params_t *p = &at86rf2xx_params[i];
        int res;

        LOG_DEBUG("[auto_init_netif] initializing at86rf2xx #%u\n", i);

        at86rf2xx_setup(&at86rf2xx_devs[i], (at86rf2xx_params_t*) p);
        res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i],
                                           (netdev2_ieee802154_t *)&at86rf2xx_devs[i]);

        if (res < 0) {
            LOG_ERROR("[auto_init_netif] error initializing at86rf2xx radio #%u\n", i);
        }
        else {
            gnrc_netdev2_init(_at86rf2xx_stacks[i],
                              AT86RF2XX_MAC_STACKSIZE,
                              AT86RF2XX_MAC_PRIO,
                              "at86rf2xx",
                              &gnrc_adpt[i]);
        }
    }
}