USARTSetup.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __USARTSETUP_H__
  2. #define __USARTSETUP_H__
  3. /*--------------------------------------------------------------------------------------
  4. * @file USARTSetup.h
  5. * @author ZhangJing
  6. * @version base on stm32f0x
  7. * @date 2015.09.11
  8. * @brief 串口驱动
  9. ---------------------------------------------------------------------------------------*/
  10. #include "stdint.h"
  11. #define USART1_RECV_LEN 32 //串口1接收缓冲长度
  12. #define USART1_XMIT_LEN 64 //串口1发送缓冲长度
  13. #define USART2_RECV_LEN 80 //串口2接收缓冲长度
  14. #define USART2_XMIT_LEN 34 //串口2发送缓冲长度
  15. #define USART3_RECV_LEN 32 //串口3接收缓冲长度
  16. #define USART3_XMIT_LEN 64 //串口3发送缓冲长度
  17. extern uint8_t usart1XmitBuffer[USART1_XMIT_LEN]; //USART1发送缓冲
  18. extern uint8_t usart1RecvBuffer[USART1_RECV_LEN]; //USART1接收缓冲
  19. extern uint8_t usart1RecvCnt; //USART1接收计数
  20. extern uint8_t usart2XmitBuffer[USART2_XMIT_LEN]; //USART2发送缓冲
  21. extern uint8_t usart2RecvBuffer[USART2_RECV_LEN]; //USART2接收缓冲
  22. extern uint8_t usart2RecvCnt; //USART2接收计数
  23. extern uint8_t usart3XmitBuffer[USART3_XMIT_LEN]; //USART3发送缓冲
  24. extern uint8_t usart3RecvBuffer[USART3_RECV_LEN]; //USART3接收缓冲
  25. extern uint8_t usart3RecvCnt; //USART3接收计数
  26. void USART1_Init(uint32_t BaudRate);
  27. void USART2_Init(uint32_t BaudRate);
  28. void USART3_Init(uint32_t BaudRate);
  29. void USART1Send( uint8_t *xmitDataBuf, uint32_t xmitLen );
  30. void USART2Send( uint8_t *xmitDataBuf, uint32_t xmitLen );
  31. void USART3Send( uint8_t *xmitDataBuf, uint32_t xmitLen );
  32. void UART1_TRxOver_Interrupt(void);
  33. void UART2_TRxOver_Interrupt(void);
  34. #endif