mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-29 03:32:49 +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,16 +92,22 @@ static void btstack_uart_embedded_process(btstack_data_source_t *ds, btstack_dat
|
|||||||
case DATA_SOURCE_CALLBACK_POLL:
|
case DATA_SOURCE_CALLBACK_POLL:
|
||||||
if (send_complete){
|
if (send_complete){
|
||||||
send_complete = 0;
|
send_complete = 0;
|
||||||
|
if (block_sent){
|
||||||
block_sent();
|
block_sent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (receive_complete){
|
if (receive_complete){
|
||||||
receive_complete = 0;
|
receive_complete = 0;
|
||||||
|
if (block_received){
|
||||||
block_received();
|
block_received();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (wakeup_event){
|
if (wakeup_event){
|
||||||
wakeup_event = 0;
|
wakeup_event = 0;
|
||||||
|
if (wakeup_handler){
|
||||||
wakeup_handler();
|
wakeup_handler();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -86,12 +86,16 @@ static void btstack_uart_block_freertos_process(btstack_data_source_t *ds, btsta
|
|||||||
case DATA_SOURCE_CALLBACK_POLL:
|
case DATA_SOURCE_CALLBACK_POLL:
|
||||||
if (send_complete){
|
if (send_complete){
|
||||||
send_complete = 0;
|
send_complete = 0;
|
||||||
|
if (block_sent){
|
||||||
block_sent();
|
block_sent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (receive_complete){
|
if (receive_complete){
|
||||||
receive_complete = 0;
|
receive_complete = 0;
|
||||||
|
if (block_received){
|
||||||
block_received();
|
block_received();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -86,12 +86,12 @@ typedef struct {
|
|||||||
int (*close)(void);
|
int (*close)(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set callback for block received
|
* set callback for block received. NULL disables callback
|
||||||
*/
|
*/
|
||||||
void (*set_block_received)(void (*block_handler)(void));
|
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));
|
void (*set_block_sent)(void (*block_handler)(void));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user