#include "app_uart.h" #include "uart.h" #include "bsp.h" //#if defined(NRF_LOG_USES_UART) && NRF_LOG_USES_UART == 1 //#define RX_PIN_NUMBER 9 // if you want to map these pin to other,HWFC must set false and APP_UART_FLOW_CONTROL_ENABLED turn to APP_UART_FLOW_CONTROL_DISABLED //#define TX_PIN_NUMBER 8 // and just map RX and TX only,because flow control is disable //#define CTS_PIN_NUMBER 17 //#define RTS_PIN_NUMBER 16 #define UART_TX_BUF_SIZE 256 #define UART_RX_BUF_SIZE 256 void uart_event_handle(app_uart_evt_t * p_event) { switch (p_event->evt_type) { case APP_UART_DATA_READY: break; default: break; } } void uart_init(void) { uint32_t err_code; const app_uart_comm_params_t comm_params = { RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, APP_UART_FLOW_CONTROL_DISABLED, false, UART_BAUDRATE_BAUDRATE_Baud115200 }; APP_UART_FIFO_INIT( &comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_event_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code); } //#endif