1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef __UART_INTERFACE_H
- #define __UART_INTERFACE_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef __UART_INTERFACE_H_GLOBAL
- #define __UART_INTERFACE_H_EXTERN
- #else
- #define __UART_INTERFACE_H_EXTERN extern
- #endif
- /************************************************************************************************
- * Version *
- ************************************************************************************************/
- /************************************************************************************************
- * How to use *
- ************************************************************************************************/
- /************************************************************************************************
- * Enable config *
- ************************************************************************************************/
- /************************************************************************************************
- * Includes *
- ************************************************************************************************/
- #include "stm32f4xx.h"
- #include "uart4.h"
- #include <stdint.h>
- /************************************************************************************************
- * Defines *
- ************************************************************************************************/
- #define RX_TX_BUF_LEN (50)
- #define UART_RXNE_IT_DISABLE() USART_ITConfig(UART4, USART_IT_RXNE, DISABLE)
- #define UART_TXE_IT_ENABLE() USART_ITConfig(UART4, USART_IT_TXE, ENABLE)
- /************************************************************************************************
- * Typedefs *
- ************************************************************************************************/
- typedef struct
- {
- uint8_t rx[RX_TX_BUF_LEN];
- uint8_t tx[RX_TX_BUF_LEN];
- uint8_t rx_len;
- uint8_t tx_len;
- uint8_t rx_count_u8;
- uint8_t tx_count_u8;
- uint8_t device_type;
- uint8_t rx_finished_flg;
- uint8_t disconnect_flg;
- uint8_t rx_over_time;
- uint8_t rx_over_time_count;
- uint16_t disconnect_count;
- } uart_type;
- /************************************************************************************************
- * Interfaces *
- ************************************************************************************************/
- extern uart_type uart_msg;
- void uart_rx_ticks(void);
- void uart_start_send(uart_type *p_msg);
- void uart4_it(void);
- #ifdef __cplusplus
- };
- #endif
- #endif // __UART_INTERFACE_H
|