mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-28 06:39:49 +00:00
provide buffer to next_cmd - avoids extra buffer for embedded systems with init scripts
This commit is contained in:
parent
223aafc1c7
commit
d62aca9f5d
@ -55,13 +55,15 @@ typedef struct {
|
|||||||
int (*valid)(void *config); // <-- test if hardware can be supported
|
int (*valid)(void *config); // <-- test if hardware can be supported
|
||||||
const char * (*name) (void *config); // <-- return hardware name
|
const char * (*name) (void *config); // <-- return hardware name
|
||||||
|
|
||||||
/** support for UART baud rate changes */
|
/** support for UART baud rate changes - cmd has to be stored in hci_cmd_buffer
|
||||||
|
* @return have command
|
||||||
|
*/
|
||||||
int (*baudrate_cmd)(void * config, uint32_t baudrate, uint8_t *hci_cmd_buffer);
|
int (*baudrate_cmd)(void * config, uint32_t baudrate, uint8_t *hci_cmd_buffer);
|
||||||
|
|
||||||
/** support custom init sequences after RESET command
|
/** support custom init sequences after RESET command - cmd has to be stored in hci_cmd_buffer
|
||||||
* @return pointer do next command packet used during init
|
* @return have command
|
||||||
*/
|
*/
|
||||||
uint8_t * (*next_command)(void *config);
|
int (*next_cmd)(void *config, uint8_t * hci_cmd_buffer);
|
||||||
|
|
||||||
void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
|
void (*register_for_power_notifications)(void (*cb)(POWER_NOTIFICATION_t event));
|
||||||
|
|
||||||
|
10
src/hci.c
10
src/hci.c
@ -956,14 +956,14 @@ void hci_run(){
|
|||||||
case 3:
|
case 3:
|
||||||
// custom initialization
|
// custom initialization
|
||||||
if (hci_stack.control && hci_stack.control->next_command){
|
if (hci_stack.control && hci_stack.control->next_command){
|
||||||
uint8_t * cmd = (*hci_stack.control->next_command)(hci_stack.config);
|
int valid_cmd = (*hci_stack.control->next_command)(hci_stack.config, hci_stack.hci_cmd_buffer);
|
||||||
if (cmd) {
|
if (valid_cmd){
|
||||||
int size = 3 + cmd[2];
|
int size = 3 + hci_stack.hci_cmd_buffer[2];
|
||||||
hci_stack.hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, cmd, size);
|
hci_stack.hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, hci_stack.hci_cmd_buffer, size);
|
||||||
hci_stack.substate = 4; // more init commands
|
hci_stack.substate = 4; // more init commands
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("hci_run: init script done\n\r");
|
log_info("hci_run: init script done\n\r");
|
||||||
}
|
}
|
||||||
// otherwise continue
|
// otherwise continue
|
||||||
hci_send_cmd(&hci_read_bd_addr);
|
hci_send_cmd(&hci_read_bd_addr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user