Set the TX Power for Bluetooth
The function used Sd_ble_gap_tx_power_set (int8_t tx_power);
See Example for s110/ble_app_proximity
#define Tx_power_level (4) /**< TX POWER level value. This would be is set both in the TX power service, in the advertising data, and also used to set the radio transmit power. */
Static voidGap_params_init (void) {uint32_t err_code; ble_gap_conn_params_t Gap_conn_params; ble_gap_conn_sec_mode_t Sec_mode; Ble_gap_conn_sec_mode_set_open (&Sec_mode); Err_code= Sd_ble_gap_device_name_set (&sec_mode, (Constuint8_t *) Device_name, strlen (device_name)); App_error_check (Err_code); Err_code=Sd_ble_gap_appearance_set (ble_appearance_generic_keyring); App_error_check (Err_code); memset (&gap_conn_params,0,sizeof(Gap_conn_params)); Gap_conn_params.min_conn_interval=Min_conn_interval; Gap_conn_params.max_conn_interval=Max_conn_interval; Gap_conn_params.slave_latency=slave_latency; Gap_conn_params.conn_sup_timeout=conn_sup_timeout; Err_code= Sd_ble_gap_ppcp_set (&gap_conn_params); App_error_check (Err_code); Err_code = Sd_ble_gap_tx_power_set (tx_power_level); App_error_check (Err_code);}
The output can be set to the power of accepted values are-40, -30, -20, -16, -12,-8, -4, 0, and 4 dBm
/* * @brief Set the radio ' s transmit power.** @param [in] tx_power radio transmit power in dBm (accepted values are-40, 3 0, -20, -16, -12,-8, -4, 0, and 4 dbm). * * @note -40 dbm would not actually give-40 DBm, but would instead be remapped to- dbm.** @return @ref nrf_success successfully changed the transmit power.* @return @ref Nrf_error_invalid_param INVALID Parameter (s) supplied.* @return @ref nrf_error_busy The stack is BUSY, process pending events and retry. */ Svcall (Sd_ble_gap_tx_power_set, uint32_t, Sd_ble_gap_tx_power_set (int8_t tx_power));
NRF51822 Transmit Power