Exemplo n.º 1
0
/*
 * \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
}
Exemplo n.º 2
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;
}