1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-04-03 01:20:35 +00:00

hci_transport_h4: add hci_transport_h4_instance_for_uart with btstack_uart

This commit is contained in:
Matthias Ringwald 2021-03-02 14:38:27 +01:00
parent 79530e3778
commit f9bd6dd702
2 changed files with 26 additions and 20 deletions

@ -134,16 +134,17 @@ typedef struct {
// inline various hci_transport_X.h files // inline various hci_transport_X.h files
/* /*
* @brief Setup H4 instance with uart_driver * @brief Setup H4 instance with btstack_uart implementation
* @param uart_driver to use * @param btstack_uart_block_driver to use
*/ */
const hci_transport_t * hci_transport_h4_instance(const btstack_uart_block_t * uart_driver); const hci_transport_t * hci_transport_h4_instance(const btstack_uart_block_t * uart_driver);
/* /*
* @brief Setup H5 instance with uart_driver * @brief Setup H4 instance with btstack_uart_block implementation
* @param uart_driver to use * @param btstack_uart_block_driver to use
* @deprecated use hci_transport_h4_instance_for_uart instead
*/ */
const hci_transport_t * hci_transport_h5_instance(const btstack_uart_block_t * uart_driver); const hci_transport_t * hci_transport_h4_instance_for_uart(const btstack_uart_t * uart_driver);
/* /*
* @brief Setup H5 instance with btstack_uart implementation that supports SLIP frames * @brief Setup H5 instance with btstack_uart implementation that supports SLIP frames

@ -126,7 +126,7 @@ typedef enum {
} TX_STATE; } TX_STATE;
// UART Driver + Config // UART Driver + Config
static const btstack_uart_block_t * btstack_uart; static const btstack_uart_t * btstack_uart;
static btstack_uart_config_t uart_config; static btstack_uart_config_t uart_config;
// write state // write state
@ -728,21 +728,26 @@ static void hci_transport_h4_ehcill_handle_ehcill_command_sent(void){
// configure and return h4 singleton // configure and return h4 singleton
const hci_transport_t * hci_transport_h4_instance(const btstack_uart_block_t * uart_driver) { static const hci_transport_t hci_transport_h4 = {
/* const char * name; */ "H4",
static const hci_transport_t hci_transport_h4 = { /* void (*init) (const void *transport_config); */ &hci_transport_h4_init,
/* const char * name; */ "H4", /* int (*open)(void); */ &hci_transport_h4_open,
/* void (*init) (const void *transport_config); */ &hci_transport_h4_init, /* int (*close)(void); */ &hci_transport_h4_close,
/* int (*open)(void); */ &hci_transport_h4_open, /* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h4_register_packet_handler,
/* int (*close)(void); */ &hci_transport_h4_close, /* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h4_can_send_now,
/* void (*register_packet_handler)(void (*handler)(...); */ &hci_transport_h4_register_packet_handler, /* int (*send_packet)(...); */ &hci_transport_h4_send_packet,
/* int (*can_send_packet_now)(uint8_t packet_type); */ &hci_transport_h4_can_send_now, /* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h4_set_baudrate,
/* int (*send_packet)(...); */ &hci_transport_h4_send_packet, /* void (*reset_link)(void); */ NULL,
/* int (*set_baudrate)(uint32_t baudrate); */ &hci_transport_h4_set_baudrate, /* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
/* void (*reset_link)(void); */ NULL, };
/* void (*set_sco_config)(uint16_t voice_setting, int num_connections); */ NULL,
};
const hci_transport_t * hci_transport_h4_instance_for_uart(const btstack_uart_t * uart_driver){
btstack_uart = uart_driver; btstack_uart = uart_driver;
return &hci_transport_h4; return &hci_transport_h4;
} }
// @deprecated
const hci_transport_t * hci_transport_h4_instance(const btstack_uart_block_t * uart_driver) {
btstack_uart = (const btstack_uart_t *) uart_driver;
return &hci_transport_h4;
}