mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt : add BR/EDR TX power set
This commit is contained in:
parent
96b4a45cde
commit
e660785532
@ -72,6 +72,8 @@ extern void API_vhci_host_register_callback(const vhci_host_callback_t *callback
|
||||
|
||||
extern int ble_txpwr_set(int power_type, int power_level);
|
||||
extern int ble_txpwr_get(int power_type);
|
||||
extern int bredr_txpwr_set(int min_power_level, int max_power_level);
|
||||
extern int bredr_txpwr_get(int *min_power_level, int *max_power_level);
|
||||
|
||||
extern char _bss_start_btdm;
|
||||
extern char _bss_end_btdm;
|
||||
@ -614,4 +616,31 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
return (esp_power_level_t)ble_txpwr_get(power_type);
|
||||
}
|
||||
|
||||
esp_err_t esp_bredr_tx_power_set(esp_power_level_t min_power_level, esp_power_level_t max_power_level)
|
||||
{
|
||||
esp_err_t err;
|
||||
int ret;
|
||||
|
||||
ret = bredr_txpwr_set(min_power_level, max_power_level);
|
||||
|
||||
if (ret == 0) {
|
||||
err = ESP_OK;
|
||||
} else if (ret == -1) {
|
||||
err = ESP_ERR_INVALID_ARG;
|
||||
} else {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t esp_bredr_tx_power_get(esp_power_level_t *min_power_level, esp_power_level_t *max_power_level)
|
||||
{
|
||||
if (bredr_txpwr_get((int *)min_power_level, (int *)max_power_level) != 0) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
|
@ -139,6 +139,31 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
*/
|
||||
esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type);
|
||||
|
||||
/**
|
||||
* @brief Set BR/EDR TX power
|
||||
* BR/EDR power control will use the power in range of minimum value and maximum value.
|
||||
* The power level will effect the global BR/EDR TX power, such inquire, page, connection and so on.
|
||||
* Please call the function after esp_bt_controller_enable and before any function which cause RF do TX.
|
||||
* So you can call the function can before do discover, beofre profile init and so on.
|
||||
* For example, if you want BR/EDR use the new TX power to do inquire, you should call
|
||||
* this function before inquire. Another word, If call this function when BR/EDR is in inquire(ING),
|
||||
* please do inquire again after call this function.
|
||||
* Default minimum power level is ESP_PWR_LVL_N2, and maximum power level is ESP_PWR_LVL_P1.
|
||||
* @param min_power_level: The minimum power level
|
||||
* @param max_power_level: The maximum power level
|
||||
* @return ESP_OK - success, other - failed
|
||||
*/
|
||||
esp_err_t esp_bredr_tx_power_set(esp_power_level_t min_power_level, esp_power_level_t max_power_level);
|
||||
|
||||
/**
|
||||
* @brief Get BR/EDR TX power
|
||||
* If the argument is not NULL, then store the corresponding value.
|
||||
* @param min_power_level: The minimum power level
|
||||
* @param max_power_level: The maximum power level
|
||||
* @return ESP_OK - success, other - failed
|
||||
*/
|
||||
esp_err_t esp_bredr_tx_power_get(esp_power_level_t *min_power_level, esp_power_level_t *max_power_level);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize BT controller to allocate task and other resource.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 74a772d0b88271d6161d0e61e4c358030a001ab5
|
||||
Subproject commit d1e2bce5585b2aded165a886aced8dacfbac9dee
|
Loading…
Reference in New Issue
Block a user