Example #1
0
static void prepare(void)
{
    radio_claim();

    // unsigned int cpsr = disableIRQ();

    old_radio_state = radio_state;

    store_conf();
    cc110x_writeburst_reg(0x00, gate_radio_config, CC1100_CONF_SIZE);

    // not sure I need this:
    // cc110x_strobe(CC1100_SFSTXON);
}
Example #2
0
/*---------------------------------------------------------------------------*
 * 								Radio Driver API                             *
 *---------------------------------------------------------------------------*/
void cc110x_init(int tpid)
{
    transceiver_pid = tpid;
    DEBUG("Transceiver PID: %i\n", transceiver_pid);

    rx_buffer_next = 0;

#ifdef MODULE_CC110X_SPI
    /* Initialize SPI */
    cc110x_spi_init();
#endif

    /* Load driver & reset */
    power_up_reset();

    /* Write configuration to configuration registers */
    cc110x_writeburst_reg(0x00, cc110x_conf, CC1100_CONF_SIZE);

    /* Write PATABLE (power settings) */
    cc110x_write_reg(CC1100_PATABLE, pa_table[pa_table_index]);

    /* Initialize Radio Flags */
    rflags._RSSI         = 0x00;
    rflags.LL_ACK       = 0;
    rflags.CAA          = 0;
    rflags.CRC_STATE    = 0;
    rflags.SEQ          = 0;
    rflags.MAN_WOR      = 0;
    rflags.KT_RES_ERR   = 0;
    rflags.TX           = 0;
    rflags.WOR_RST      = 0;

    /* Set default channel number */
#ifdef MODULE_CONFIG
    cc110x_set_config_channel(sysconfig.radio_channel);
#else
    cc110x_set_channel(CC1100_DEFAULT_CHANNR);
#endif
    DEBUG("CC1100 initialized and set to channel %i\n", radio_channel);

    /* Switch to desired mode (WOR or RX) */
    rd_set_mode(RADIO_MODE_ON);

#ifdef DBG_IGNORE
    cc110x_init_ignore();
#endif
}
Example #3
0
static void restore_conf(void)
{
    cc110x_writeburst_reg(0x00, old_conf, CC1100_CONF_SIZE);
    // cc110x_write_reg(CC1100_PATABLE, pa_table[pa_table_index]);
}
Example #4
0
static void broadcast_code(void)
{
    // MCSM1[TXOFF_MODE]=01 meaning after tx radio will go back to FSTXON state
    cc110x_writeburst_reg(RF_TXFIFOWR, gate_toggle_code, sizeof(gate_toggle_code));
    cc110x_strobe(RF_STX);
}