From 1d34e6ac316c27dc0e1149835d5f1ad53e074c88 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 1 May 2024 11:15:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20znrf=5Fserial=5Ftx=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=97=A5=E5=BF=97=E4=B8=B2=E5=8F=A3=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libraries/log/nrf_log_backend_uart.h | 3 +++ components/libraries/log/src/nrf_log_backend_uart.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/components/libraries/log/nrf_log_backend_uart.h b/components/libraries/log/nrf_log_backend_uart.h index 87b7b32..ebabcc6 100644 --- a/components/libraries/log/nrf_log_backend_uart.h +++ b/components/libraries/log/nrf_log_backend_uart.h @@ -66,6 +66,9 @@ typedef struct { void nrf_log_backend_uart_init(void); +void znrf_serial_tx(char const * p_buffer, size_t len); + + #ifdef __cplusplus } #endif diff --git a/components/libraries/log/src/nrf_log_backend_uart.c b/components/libraries/log/src/nrf_log_backend_uart.c index 593320c..d9513e7 100644 --- a/components/libraries/log/src/nrf_log_backend_uart.c +++ b/components/libraries/log/src/nrf_log_backend_uart.c @@ -88,6 +88,15 @@ static void serial_tx(void const * p_context, char const * p_buffer, size_t len) } } +void znrf_serial_tx(char const * p_buffer, size_t len){ + m_xfer_done = false; + uint8_t len8 = (uint8_t)(len & 0x000000FF); + ret_code_t err_code = nrf_drv_uart_tx(&m_uart, (uint8_t *)p_buffer, len8); + while (m_async_mode && (m_xfer_done == false)) + { + } +} + static void nrf_log_backend_uart_put(nrf_log_backend_t const * p_backend, nrf_log_entry_t * p_msg)