btstack_uart_block_embedded: use bool for flags

This commit is contained in:
Matthias Ringwald 2023-12-04 18:34:10 +01:00
parent c5dd676df1
commit 4a049df246

View File

@ -44,6 +44,7 @@
* Callbacks are executed on main thread via data source and btstack_run_loop_poll_data_sources_from_irq
*/
#include "btstack_bool.h"
#include "btstack_debug.h"
#include "btstack_uart_block.h"
#include "btstack_run_loop.h"
@ -58,9 +59,9 @@ static const btstack_uart_config_t * btstack_uart_block_configuration;
// data source for integration with BTstack Runloop
static btstack_data_source_t transport_data_source;
static int send_complete;
static int receive_complete;
static int wakeup_event;
static bool send_complete;
static bool receive_complete;
static bool wakeup_event;
// callbacks
static void (*block_sent)(void);
@ -69,17 +70,17 @@ static void (*wakeup_handler)(void);
static void btstack_uart_block_received(void){
receive_complete = 1;
receive_complete = true;
btstack_run_loop_poll_data_sources_from_irq();
}
static void btstack_uart_block_sent(void){
send_complete = 1;
send_complete = true;
btstack_run_loop_poll_data_sources_from_irq();
}
static void btstack_uart_cts_pulse(void){
wakeup_event = 1;
wakeup_event = true;
btstack_run_loop_poll_data_sources_from_irq();
}
@ -95,19 +96,19 @@ static void btstack_uart_embedded_process(btstack_data_source_t *ds, btstack_dat
switch (callback_type){
case DATA_SOURCE_CALLBACK_POLL:
if (send_complete){
send_complete = 0;
send_complete = false;
if (block_sent){
block_sent();
}
}
if (receive_complete){
receive_complete = 0;
receive_complete = false;
if (block_received){
block_received();
}
}
if (wakeup_event){
wakeup_event = 0;
wakeup_event = false;
if (wakeup_handler){
wakeup_handler();
}