/*
 * \brief Application task to start peer search
 *
 * \param mode starts the peer search in this particular mode
 */
void peer_search_receptor_init(void *arg)
{
	pib_value_t pib_value;
	peer_search_receptor_arg_t *arg_ptr = (peer_search_receptor_arg_t *)arg;

	/* Change LED pattern */
	app_led_event(LED_EVENT_START_PEER_SEARCH);

	/* Peer process seq number */
	seq_num = rand();

	/* assign a random address */
	do {
		node_info.peer_short_addr = rand();
		/* Make sure random number is not zero */
	} while (!node_info.peer_short_addr);

	/* Set my address which my peer send me */
	pib_value.pib_value_16bit = arg_ptr->my_short_addr;
	tal_pib_set(macShortAddress, &pib_value);

#ifdef EXT_RF_FRONT_END_CTRL
	/* Disable RF front end control during peer search process*/
	tal_ext_pa_ctrl(PA_EXT_DISABLE);
	/* Make sure that Tx power is at max, when PA_EXT is disabled */
	tal_set_tx_pwr(REGISTER_VALUE, 0x00);
#endif
}
Beispiel #2
0
/**
 * \brief Recover all user settings before Start of CW transmission
 */
void recover_all_settings(void)
{
	int8_t tx_pwr_dbm;
	uint8_t temp_var;
	pib_value_t pib_value;

#if (ANTENNA_DIVERSITY == 1)
	if (ANT_DIV_DISABLE == ant_div_before_ct) {
		tal_ant_div_config(ANT_DIVERSITY_DISABLE, ant_sel_before_ct);
	}

#endif

#if (TAL_TYPE == AT86RF233)
	/* Set the ISM frequency back   */
	if (CC_BAND_0 != cc_band_ct) {
		tal_set_frequency_regs(cc_band_ct, cc_number_ct);
	}

#endif /* End of #if(TAL_TYPE == AT86RF233) */

	/*RPC settings are reseted during tal_reset,hence reconfiguring based
	 *on old config*/
#if ((TAL_TYPE == ATMEGARFR2)||(TAL_TYPE == AT86RF233))
	if (true == curr_trx_config_params.rpc_enable) {
		/* RPC feature configuration. */
		tal_rpc_mode_config(ENABLE_ALL_RPC_MODES); 
		                                            
	} else {
		tal_rpc_mode_config(DISABLE_ALL_RPC_MODES);
	}

#endif

#if (TAL_TYPE != AT86RF230B)
	/* set the desensitization settings back */
	if (true == curr_trx_config_params.rx_desensitize) {
		tal_set_rx_sensitivity_level(RX_DESENSITIZE_LEVEL);
	}

#endif

#if ((TAL_TYPE != AT86RF212) && (TAL_TYPE != AT86RF212B))
	if (last_tx_power_format_set == 0) {
		uint8_t tx_pwr_reg = curr_trx_config_params.tx_power_reg;
		tal_set_tx_pwr(REGISTER_VALUE, tx_pwr_reg);
	} else
#endif
	{
		tx_pwr_dbm = curr_trx_config_params.tx_power_dbm;
		temp_var = CONV_DBM_TO_phyTransmitPower(tx_pwr_dbm);
		pib_value.pib_value_8bit = temp_var;
		tal_pib_set(phyTransmitPower, &pib_value);
	}
}
Beispiel #3
0
/*
 * \brief Application task to start peer search
 *
 * \param arg arguments to start the peer search
 */
void peer_search_initiator_init(void *arg)
{
	pib_value_t pib_value_temp;
	/* Change LED pattern */
	app_led_event(LED_EVENT_START_PEER_SEARCH);

	/* Print the message if it is Range measurement mode */
	if (PEER_SEARCH_RANGE_TX == node_info.main_state) {
		print_event(PRINT_PEER_SEARCH_INITATED);
	}

	/* Peer search process seq number */
	seq_num = rand();

	/* assign a random address */
	do {
		node_info.peer_short_addr = (uint16_t)rand();
		/* Make sure random number is not zero */
	} while (!node_info.peer_short_addr);

#ifdef EXT_RF_FRONT_END_CTRL
    /* Disable RF front end control during peer search process*/
    tal_ext_pa_ctrl(PA_EXT_DISABLE);
    /* Make sure that Tx power is at max, when PA_EXT is disabled */
    tal_set_tx_pwr(REGISTER_VALUE, 0x00);
#endif
    
	/* Reduce the TX power level to minium,if configuration mode is enabled
	**/
	if (true == node_info.configure_mode) {
		/* set the tx power to lowest in configuration mode */
		uint8_t config_tx_pwr = CONFIG_MODE_TX_PWR;
		pib_value_temp.pib_value_8bit = config_tx_pwr;
		tal_pib_set(phyTransmitPower, &pib_value_temp);
	}

	/* Keep compiler happy */
	arg = arg;
}