| 123456789101112131415161718192021222324252627282930313233 |
- #ifndef _SERIAL_H__
- #define _SERIAL_H__
- #include "libs/types.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 RX_FRAME_MAX_LEN 130
- typedef struct {
- u8 tx_buf[128];
- u8 rx_buf[128];
- c_buffer_t c_tx_buff;
- c_buffer_t c_rx_buff;
- c_buffer_t rx_queue;
- uint16_t tx_length;
- uint16_t tx_crc16;
- uint8_t rx_frame[RX_FRAME_MAX_LEN];
- uint16_t rx_length;
- bool escape;
- }uart_t;
- void serial_init(void);
- void serial_write(u8 *data, int len);
- void uart_write_frame(uint8_t *bytes, int len);
- #endif /* _SERIAL_H__ */
|