| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #pragma once
- #include "libs/shark_libs.h"
- #include "libs/byte_queue.h"
- #include "libs/circle_buffer.h"
- #define CH_START 0xF5
- #define CH_END 0xF6
- #define CH_ESC 0xF7
- #define CH_ESC_START 0x05
- #define CH_ESC_END 0x06
- #define CH_ESC_ESC 0x07
- #define SHARK_UART_TX_MEM_SIZE 512
- #define SHARK_UART_RX_MEM_SIZE 512
- typedef enum {
- SHARK_UART0,
- SHARK_UART1,
- SHARK_UART2,
- SHARK_UART3,
- SHARK_UART4,
- SHARK_UART_COUNT
- } uart_enum_t;
- typedef struct {
- byte_queue_t tx_queue;
- c_buffer_t rx_queue;
- dma_channel_enum rx_dma_ch;
- dma_channel_enum tx_dma_ch;
- uint16_t tx_length;
- uint16_t tx_crc16;
- uint32_t uart_com;//uart device
- uint8_t rx_frame[256];
- uint16_t rx_length;
- bool escape;
- }shark_uart_t;
- void shark_uart_init(uart_enum_t uart_no);
- void shark_uart_deinit(uart_enum_t uart_no);
- void shark_uart_write_frame(uart_enum_t uart_no, char *bytes, int len);
|