#ifndef USER_UART_H #define USER_UART_H #ifdef __cplusplus extern "C" { #endif #include "boards.h" #include "nrf_gpio.h" #include "nrf_uart.h" #include "app_uart.h" #define UART_TX_BUF_SIZE 1024 //串口发送缓存大小(字节数) #define UART_RX_BUF_SIZE 1 //串口接收缓存大小(字节数) #define USER_UART_REBYTE_LEN 512 #define USER_UART_SEND_LEN 512 typedef void (*modbus_rec_func)(uint8_t *data,uint8_t *len,bool *stat); typedef void (*uart_rec_func)(char *data); typedef struct{ bool uart_rx_stat; //uart接收完成标志 char uart_rx_Byte[USER_UART_REBYTE_LEN]; //模块返回信息存储 int uart_rx_idx; char uart_tx_Byte[USER_UART_SEND_LEN]; //模块返回信息存储 int uart_tx_idx; bool echo_stat; //回显设置 uart_rec_func m_uart_rec_func; }user_uart_s; void uart_open(void); void uart_close(void); void UartSendString(char *pBuffer); void UartSendHex(uint8_t *hex,uint16_t len,bool space); void UartSendData(uint8_t *ch,uint16_t len); void Uart_Set_Init(void); void Uart_ReData_Pro(void); extern user_uart_s usr_uart; #ifdef __cplusplus } #endif #endif // USER_UART_H