myUart.h 507 B

123456789101112131415161718192021222324
  1. #ifndef __MYUART_H
  2. #define __MYUART_H
  3. #include <stdio.h>
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. #include <string.h>
  7. typedef void (*UART_CALLBACK)(uint8_t *buf, uint16_t count);
  8. #define USART_REC_LEN 255 //
  9. typedef struct
  10. {
  11. bool isValid;
  12. uint8_t packet[USART_REC_LEN];
  13. uint16_t len;
  14. }uartPacket_ts;
  15. void myUart1_init(uint32_t baudrate, UART_CALLBACK cb);
  16. void myUart1_sendByte(uint8_t src);
  17. void myUart1_sendArray(uint8_t *src, uint16_t srclen);
  18. #endif