wiced: use btstack_run_loop_execute_code_on_main_thread instead of btstack_run_loop_wiced_execute_code_on_main_thread

This commit is contained in:
Matthias Ringwald 2021-07-02 15:46:43 +02:00
parent 62b026069e
commit 739fcdb2bb
2 changed files with 10 additions and 3 deletions

View File

@ -56,11 +56,14 @@ static wiced_result_t stdin_reader_notify(void * p){
return WICED_SUCCESS;
}
static btstack_context_callback_registration_t callback_registration;
static void stdin_reader_thread_process(wiced_thread_arg_t p){
UNUSED(p);
callback_registration.callback = &callback_registration;
while (true){
uint8_t c = getchar();
btstack_run_loop_wiced_execute_code_on_main_thread(&stdin_reader_notify, (void *)(uintptr_t) c);
callback_registration.context = (void *)(uintptr_t) c;
btstack_run_loop_execute_code_on_main_thread(&callback_registration);
}
}

View File

@ -117,6 +117,7 @@ static wiced_result_t btstack_uart_block_wiced_main_notify_block_read(void *arg)
}
// executed on tx worker thread
static btstack_context_callback_registration_t block_send_callback_registration;
static wiced_result_t btstack_uart_block_wiced_tx_worker_send_block(void * arg){
// wait for CTS to become low in manual flow control mode
if (btstack_flow_control_mode == BTSTACK_FLOW_CONTROL_MANUAL && wiced_bt_uart_pins[WICED_BT_PIN_UART_CTS]){
@ -129,11 +130,13 @@ static wiced_result_t btstack_uart_block_wiced_tx_worker_send_block(void * arg){
platform_uart_transmit_bytes(wiced_bt_uart_driver, tx_worker_data_buffer, tx_worker_data_size);
// let transport know
btstack_run_loop_wiced_execute_code_on_main_thread(&btstack_uart_block_wiced_main_notify_block_send, NULL);
block_send_callback_registration.callback = &btstack_uart_block_wiced_main_notify_block_send;
btstack_run_loop_execute_code_on_main_thread(&block_send_callback_registration);
return WICED_SUCCESS;
}
// executed on rx worker thread
static btstack_context_callback_registration_t block_received_callback_registration;
static wiced_result_t btstack_uart_block_wiced_rx_worker_receive_block(void * arg){
if (btstack_flow_control_mode == BTSTACK_FLOW_CONTROL_MANUAL && wiced_bt_uart_pins[WICED_BT_PIN_UART_CTS]){
@ -155,7 +158,8 @@ static wiced_result_t btstack_uart_block_wiced_rx_worker_receive_block(void * ar
}
// let transport know
btstack_run_loop_wiced_execute_code_on_main_thread(&btstack_uart_block_wiced_main_notify_block_read, NULL);
block_received_callback_registration.callback = &btstack_uart_block_wiced_main_notify_block_read;
btstack_run_loop_execute_code_on_main_thread(&block_received_callback_registration);
return WICED_SUCCESS;
}