usart.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. *
  3. *
  4. */
  5. #ifndef __USART_H
  6. #define __USART_H
  7. #include "stm32f4xx.h"
  8. #include "stdio.h"
  9. #define UART_INF_REG 1
  10. #define WIFI_LOWEST_BAUDRATE 115200
  11. #define WIFI_HIGH_BAUDRATE 921600
  12. #define WIFI_HIGHEST_BAUDRATE 1000000
  13. #define WIFI_UART_WORDLENGTH UART_WORDLENGTH_8B
  14. #define WIFI_UART_STOPBITS UART_STOPBITS_1
  15. #define WIFI_UART_PARITY UART_PARITY_NONE
  16. #define WIFI_UART UART5
  17. #if UART_INF_REG==0
  18. extern UART_HandleTypeDef wifi_UartHandle;
  19. extern UART_HandleTypeDef huart3;
  20. #endif
  21. void Delay_ms( unsigned int time_ms );
  22. void Wifi_USART_Init(uint32_t baud);
  23. void Wifi_Start(void);
  24. int Wifi_reset(void);
  25. int Wifi_Uart_Send(uint8_t *buf, uint32_t len, uint32_t timeout);
  26. int Wifi_Uart_Receive(uint8_t *buf, uint32_t len, uint32_t timeout);
  27. unsigned int Wifi_Uart_DataLen(void);
  28. unsigned int Wifi_Uart_ReadData(uint8_t* buf, uint32_t len);
  29. void Wifi_Uart_ClearRxBuf(void);
  30. void Wifi_Uart_ClearTxBuf(void);
  31. void Wifi_Uart_IRQ_Handler(void);
  32. #endif