mirror of
https://github.com/bluekitchen/btstack.git
synced 2024-12-29 09:26:08 +00:00
btstack_uart_block: allow to 'unset' a callback by setting it to NULL. Update code for freertos and embedded to implement this
This commit is contained in:
parent
2c204492a0
commit
3ce3a4ebf3
@ -92,15 +92,21 @@ static void btstack_uart_embedded_process(btstack_data_source_t *ds, btstack_dat
|
||||
case DATA_SOURCE_CALLBACK_POLL:
|
||||
if (send_complete){
|
||||
send_complete = 0;
|
||||
block_sent();
|
||||
if (block_sent){
|
||||
block_sent();
|
||||
}
|
||||
}
|
||||
if (receive_complete){
|
||||
receive_complete = 0;
|
||||
block_received();
|
||||
if (block_received){
|
||||
block_received();
|
||||
}
|
||||
}
|
||||
if (wakeup_event){
|
||||
wakeup_event = 0;
|
||||
wakeup_handler();
|
||||
if (wakeup_handler){
|
||||
wakeup_handler();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -86,11 +86,15 @@ static void btstack_uart_block_freertos_process(btstack_data_source_t *ds, btsta
|
||||
case DATA_SOURCE_CALLBACK_POLL:
|
||||
if (send_complete){
|
||||
send_complete = 0;
|
||||
block_sent();
|
||||
if (block_sent){
|
||||
block_sent();
|
||||
}
|
||||
}
|
||||
if (receive_complete){
|
||||
receive_complete = 0;
|
||||
block_received();
|
||||
if (block_received){
|
||||
block_received();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -86,12 +86,12 @@ typedef struct {
|
||||
int (*close)(void);
|
||||
|
||||
/**
|
||||
* set callback for block received
|
||||
* set callback for block received. NULL disables callback
|
||||
*/
|
||||
void (*set_block_received)(void (*block_handler)(void));
|
||||
|
||||
/**
|
||||
* set callback for sent
|
||||
* set callback for sent. NULL disables callback
|
||||
*/
|
||||
void (*set_block_sent)(void (*block_handler)(void));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user