Ejemplo n.º 1
0
int test_get_channel(void)
{
    uint16_t asserted_channel = at86rf231_get_channel();
    uint16_t got_channel;
    
    asserted_channel += 1;
    
    if (asserted_channel > 26) {
        asserted_channel = 11;
    } 
    
    if (!test_right_set_channel()) {
        return 0;
    }

    if (asserted_channel != (got_channel = at86rf231_get_channel())) {
        printf("%d != %d\n", asserted_channel, got_channel);
        return 0;
    }

    return 1;
}
Ejemplo n.º 2
0
int test_right_set_channel(void)
{
    uint8_t channel = at86rf231_get_channel();

    if (channel == 26) {
        channel = 11;
    }
    else {
        channel++;
    }

    if (at86rf231_set_channel(channel) == 0) {
        printf("Channel %d should not yield error -1.\n", channel);
        return 0;
    }
    return 1;
}
Ejemplo n.º 3
0
/*
 * @brief Get the radio channel of any transceiver device
 *
 * @param t     The transceiver device
 *
 * @return The current radio channel of the transceiver, -1 on error
 */
static int32_t get_channel(transceiver_type_t t)
{
    switch (t) {
        case TRANSCEIVER_CC1100:
#if (defined(MODULE_CC110X) || defined(MODULE_CC110X_LEGACY))
            return cc110x_get_channel();
#elif MODULE_CC110X_LEGACY_CSMA
            return cc1100_get_channel();
#else
            return -1;
#endif
#ifdef MODULE_CC2420

        case TRANSCEIVER_CC2420:
            return cc2420_get_channel();
#endif
#ifdef MODULE_MC1322X

        case TRANSCEIVER_MC1322X:
            ///< TODO:implement return maca_get_channel();
            return -1;
#endif
#ifdef MODULE_NATIVENET

        case TRANSCEIVER_NATIVE:
            return nativenet_get_channel();
#endif
#ifdef MODULE_AT86RF231

        case TRANSCEIVER_AT86RF231:
            return at86rf231_get_channel();
#endif

        default:
            return -1;
    }
}