cc256x: allow to specify power vector for each modulation type

This commit is contained in:
Matthias Ringwald 2020-05-15 14:46:04 +02:00
parent 0d1523fec6
commit 63efc2ed25
3 changed files with 29 additions and 3 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- example/le_mitm: MITM implementation that forwards ATT PDUs and allows for pairing
- GAP: gap_set_security_level sets required security level for incoming and outgoing connections
- cc256x: allow to specify power vector for each modulation type
### Changed
- L2CAP ERTM: send extended features request only once per HCI connection

View File

@ -105,6 +105,9 @@ static uint32_t init_script_size;
// power in db - set by btstack_chipset_cc256x_set_power
static int16_t init_power_in_dB = 13; // 13 dBm
// explicit power vectors of 16 uint8_t bytes
static const uint8_t * init_power_vectors[3];
// upload position
static uint32_t init_script_offset = 0;
@ -242,8 +245,16 @@ static int get_highest_level_for_given_power(int power_db, int recommended_db){
}
static void update_set_power_vector(uint8_t *hci_cmd_buffer){
int i;
int modulation_type = hci_cmd_buffer[3];
uint8_t modulation_type = hci_cmd_buffer[3];
btstack_assert(modulation_type <= 2);
// explicit power vector provided by user
if (init_power_vectors[modulation_type] != NULL){
(void)memcpy(&hci_cmd_buffer[4], init_power_vectors[modulation_type], 16);
return;
}
unsigned int i;
int power_db = get_max_power_for_modulation_type(modulation_type);
int dynamic_range = 0;
@ -368,6 +379,11 @@ void btstack_chipset_cc256x_set_power(int16_t power_in_dB){
init_power_in_dB = power_in_dB;
}
void btstack_chipset_cc256x_set_power_vector(uint8_t modulation_type, const uint8_t * power_vector){
btstack_assert(modulation_type <= 2);
}
void btstack_chipset_cc256x_set_init_script(uint8_t * data, uint32_t size){
custom_init_script = data;
custom_init_script_size = size;

View File

@ -55,6 +55,16 @@ extern "C" {
*/
void btstack_chipset_cc256x_set_power(int16_t power_in_dB);
/**
* Configure output power for specific modulation before HCI POWER_ON using explicit power vector
* @see https://processors.wiki.ti.com/index.php/CC256x_VS_HCI_Commands#HCI_VS_DRPb_Set_Power_Vector_.280xFD82.29
* @note data is not copied, pointer has to stay valid
* @note overrides setting from btstack_chipset_cc256x_set_power
* @param modulation_type 0=GFSK, 1=EDR2, 2= EDR3
* @param power_vector array of 16 uint8_t values as explained on TI wiki
*/
void btstack_chipset_cc256x_set_power_vector(uint8_t modulation_type, const uint8_t * power_vector);
/**
* Get chipset instance for CC256x series
*/
@ -71,7 +81,6 @@ uint16_t btstack_chipset_cc256x_lmp_subversion(void);
* Note: Only needed when switching between different add-ons (BLE, AVRP, ANT+)
* Note: Not supported by MSP430 "init script at 0x10000" workaround
*
* @param init_script_data or 0 for default script
* @param init_script_size or 0 for default script
*/
void btstack_chipset_cc256x_set_init_script(uint8_t * data, uint32_t size);