esp32: allow to compile BTstack without CONFIG_ESP_CONSOLE_UART

Fixes #571
This commit is contained in:
Matthias Ringwald 2024-03-12 08:15:17 +01:00
parent c17118d067
commit 8c35a1166e
2 changed files with 16 additions and 2 deletions

View File

@ -44,6 +44,10 @@
* Busy waits until character has been processed
*/
#include "sdkconfig.h"
#ifdef CONFIG_ESP_CONSOLE_UART
#include "btstack_stdin.h"
#include "btstack_run_loop.h"
#include "btstack_defines.h"
@ -56,7 +60,6 @@
#include <errno.h>
#include <reent.h>
#include "sdkconfig.h"
#include "driver/uart.h"
#include "esp_vfs_dev.h"
@ -142,7 +145,7 @@ static void btstack_stdio_task(void *arg){
#define UART_SCLK_DEFAULT UART_SCLK_APB
#endif
void btstack_stdio_init() {
void btstack_stdio_init(void) {
/* Drain stdout before reconfiguring it */
fflush(stdout);
fsync(fileno(stdout));
@ -204,3 +207,12 @@ void btstack_stdin_setup(void (*handler)(char c)){
// set handler
stdin_handler = handler;
}
#else
// Empty functions for backwards-compatiblitity
void btstack_stdio_init(void) {}
void btstack_stdin_setup(void (*handler)(char c)){
(void) handler;
}
#endif /* CONFIG_ESP_CONSOLE_UART */

View File

@ -67,8 +67,10 @@ int app_main(void){
// optional: enable packet logger
// hci_dump_init(hci_dump_embedded_stdout_get_instance());
#ifdef CONFIG_ESP_CONSOLE_UART
// Enable buffered stdout
btstack_stdio_init();
#endif
// Configure BTstack for ESP32 VHCI Controller
btstack_init();