mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
stm32-sx1280: allow to configure set of advertisement channels
This commit is contained in:
parent
9efa14e56c
commit
1cd6e5652b
@ -16,12 +16,11 @@ Uses 32.768 kHz crytstal as LSE for timing
|
||||
|
||||
Support for Broadcaster and Peripheral roles.
|
||||
|
||||
The current Makefile project compiles the gatt_counter.c example.
|
||||
The Makefile project compiles gatt_counter, gatt_streamer_server, hog_mouse and hog_keyboard examples.
|
||||
|
||||
## Limitation
|
||||
|
||||
### Advertising State:
|
||||
- Only advertises on Channel 37
|
||||
- Advertises as fast as possible, back to back
|
||||
- Only Connectable Advertising supported
|
||||
- Only fixed public BD_ADDR of 33:33:33:33:33:33 is used
|
||||
@ -50,8 +49,8 @@ For the FMLR-80-P-STL4E module, just run make. You can upload the .elf file crea
|
||||
## TODO
|
||||
|
||||
### General
|
||||
- advertise on all configured channels
|
||||
- only advertise with advertising interval
|
||||
- support other adv types
|
||||
- indicate random address in adertising pdus
|
||||
- allow to set random BD_ADDR via HCI command
|
||||
- handle Connection Param Update
|
||||
|
@ -108,6 +108,18 @@ static void controller_handle_hci_command(uint8_t * packet, uint16_t size){
|
||||
case HCI_OPCODE_HCI_LE_READ_BUFFER_SIZE:
|
||||
send_command_complete(opcode, 0, read_buffer_size_result, 8);
|
||||
break;
|
||||
case HCI_OPCODE_HCI_LE_SET_ADVERTISING_PARAMETERS:
|
||||
status = ll_set_advertising_parameters(
|
||||
little_endian_read_16(packet,3),
|
||||
little_endian_read_16(packet,5),
|
||||
packet[7],
|
||||
packet[8],
|
||||
packet[9],
|
||||
&packet[10],
|
||||
packet[16],
|
||||
packet[17]);
|
||||
send_command_complete(opcode, status, NULL, 0);
|
||||
break;
|
||||
case HCI_OPCODE_HCI_LE_SET_ADVERTISING_DATA:
|
||||
status = ll_set_advertising_data(packet[3], &packet[4]);
|
||||
send_command_complete(opcode, status, NULL, 0);
|
||||
|
@ -67,6 +67,10 @@ uint8_t ll_set_scan_enable(uint8_t le_scan_enable, uint8_t filter_duplicates);
|
||||
|
||||
uint8_t ll_set_advertise_enable(uint8_t le_adv_enable);
|
||||
|
||||
uint8_t ll_set_advertising_parameters(uint16_t advertising_interval_min, uint16_t advertising_interval_max,
|
||||
uint8_t advertising_type, uint8_t own_address_type, uint8_t peer_address_types, uint8_t * peer_address,
|
||||
uint8_t advertising_channel_map, uint8_t advertising_filter_policy);
|
||||
|
||||
uint8_t ll_set_advertising_data(uint8_t adv_len, const uint8_t * adv_data);
|
||||
|
||||
bool ll_reserve_acl_packet(void);
|
||||
|
@ -905,7 +905,7 @@ uint8_t ll_set_scan_enable(uint8_t le_scan_enable, uint8_t filter_duplicates){
|
||||
static uint8_t ll_start_advertising(void){
|
||||
// COMMAND DISALLOWED if wrong state.
|
||||
if (ll_state != LL_STATE_STANDBY) return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
printf("Start Advertising on channels 0x0x\n", ctx.adv_map);
|
||||
printf("Start Advertising on channels 0x%0x\n", ctx.adv_map);
|
||||
start_advertising();
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
@ -926,6 +926,19 @@ uint8_t ll_set_advertise_enable(uint8_t le_adv_enable){
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t ll_set_advertising_parameters(uint16_t advertising_interval_min, uint16_t advertising_interval_max,
|
||||
uint8_t advertising_type, uint8_t own_address_type, uint8_t peer_address_types, uint8_t * peer_address,
|
||||
uint8_t advertising_channel_map, uint8_t advertising_filter_policy){
|
||||
if (advertising_channel_map == 0) return ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS;
|
||||
if ((advertising_channel_map & 0xf8) != 0) return ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS;
|
||||
ctx.adv_map = advertising_channel_map;
|
||||
|
||||
// TODO: validate other params
|
||||
// TODO: process other params
|
||||
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t ll_set_advertising_data(uint8_t adv_len, const uint8_t * adv_data){
|
||||
// COMMAND DISALLOWED if wrong state.
|
||||
if (ll_state == LL_STATE_ADVERTISING) return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user