mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
samv71-xplained-atwilc3000: add support for STDIN
This commit is contained in:
parent
0af04ee4d3
commit
99e6df5d02
@ -8,7 +8,7 @@
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
#define HAVE_UART_DMA_SET_FLOWCONTROL
|
||||
|
||||
#define HAVE_BTSTACK_STDIN
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_CLASSIC
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
|
||||
// memory config
|
||||
#define MAX_NR_HCI_CONNECTIONS 1
|
||||
#define MAX_NR_L2CAP_SERVICES 2
|
||||
#define MAX_NR_L2CAP_CHANNELS 2
|
||||
#define MAX_NR_L2CAP_SERVICES 3
|
||||
#define MAX_NR_L2CAP_CHANNELS 4
|
||||
#define MAX_NR_RFCOMM_MULTIPLEXERS 1
|
||||
#define MAX_NR_RFCOMM_SERVICES 2
|
||||
#define MAX_NR_RFCOMM_CHANNELS 1
|
||||
|
@ -51,6 +51,8 @@ void SysTick_Handler(void)
|
||||
tick_handler();
|
||||
}
|
||||
|
||||
// Debug console Output
|
||||
|
||||
/**
|
||||
* Configure UART console.
|
||||
*/
|
||||
@ -73,6 +75,34 @@ static void configure_console(void)
|
||||
stdio_serial_init(CONF_UART, &uart_serial_options);
|
||||
}
|
||||
|
||||
// Debug console Input
|
||||
|
||||
#include "btstack_stdin.h"
|
||||
|
||||
static void (*stdin_handler)(char c);
|
||||
static btstack_data_source_t stdin_data_source;
|
||||
|
||||
static void btstack_stdin_process(struct btstack_data_source *ds, btstack_data_source_callback_type_t callback_type){
|
||||
// try to read from console
|
||||
uint32_t stdin_character;
|
||||
uint32_t res = usart_read(CONF_UART, &stdin_character);
|
||||
if (res) return;
|
||||
|
||||
if (stdin_handler){
|
||||
(*stdin_handler)(stdin_character & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
void btstack_stdin_setup(void (*handler)(char c)){
|
||||
// set handler
|
||||
stdin_handler = handler;
|
||||
|
||||
// set up polling data_source
|
||||
btstack_run_loop_set_data_source_handler(&stdin_data_source, &btstack_stdin_process);
|
||||
btstack_run_loop_enable_data_source_callbacks(&stdin_data_source, DATA_SOURCE_CALLBACK_POLL);
|
||||
btstack_run_loop_add_data_source(&stdin_data_source);
|
||||
}
|
||||
|
||||
// [main_console_configure]
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user