stm32l431_xl_current/App/Inc/uart_dev.h

55 lines
1.6 KiB
C
Raw Permalink Normal View History

2024-07-15 09:07:44 +00:00
#ifndef UART_DEV_H
#define UART_DEV_H
#include "ring_queue.h"
#include "comm_types.h"
#include "string.h"
#include "usart.h"
#include "assertions.h"
#define ASCII_CHAR_BACKSPACE 0x08 /* '\b' */
#define ASCII_CHAR_CHARACTER_TABULATION 0x09 /* '\t' */
#define ASCII_CHAR_LINE_FEED 0x0A /* '\n' */
#define ASCII_CHAR_LINE_TABULATION 0x0B /* '\v' */
#define ASCII_CHAR_FORM_FEED 0x0C /* '\f' */
#define ASCII_CHAR_CARRIAGE_RETURN 0x0D /* '\r' */
typedef u_int32_t device_handle;
extern device_handle g_term_uart_handle;
extern device_handle g_lora_uart_handle;
#define RS485_MAX_PACK_DATA_LEN 30
typedef enum{
RAIN_RS485_UART_INDEX = 0,
TERM_UART_INDEX = 1,
LORA_UART_INDEX = 3,
}uartIndex_e;
/* UART <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9><EFBFBD><EFBFBD>Ӧһ<D3A6><D2BB>uart<72>豸 */
typedef struct _uart_device_info{
u_int8_t init;
uartIndex_e uart_index;
u_int32_t uart_baudrate;
RingQueue uart_ring_queue;
}uart_device_info;
void uart_sendstr(device_handle device,char *str);
void uart_dev_write(device_handle device, void *data, int len);
void init_term_uart();
void init_lora_uart();
void uart_close(uartIndex_e uart_index);
void term_printf(char *format, ...);
2024-07-23 07:38:51 +00:00
void uart_dev_write(device_handle device, void *data, int len);
2024-07-15 09:07:44 +00:00
int term_uart_readln(u_int8_t *buff, int buff_size, u_int32_t timeout_ms);
int uart_dev_char_present(device_handle device);
char uart_dev_in_char(device_handle device);
#endif