1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /**
- ******************************************************************************
- * @file uart_driver.h
- * @author
- * @version V1.0.0
- * @date 23-12-2015
- * @brief uart_driver function.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __UART_DRIVER_H
- #define __UART_DRIVER_H
- /* Includes ------------------------------------------------------------------*/
- //#include "at32f421.h"
- #include "ti_msp_dl_config.h"
- #include <stdbool.h>
- /* Public Function declare---------------------------------------------------*/
- //BMS
- #define UARTUPDATE_COM UART1
- #define UARTUPDATE_BAURATE 115200U
- #define UARTUPDATE_CLK RCU_UART3
- #define UARTUPDATE_TX_PIN GPIO_PIN_14
- #define UARTUPDATE_RX_PIN GPIO_PIN_15
- #define UARTUPDATE_GPIO_PORT GPIOA
- #define UARTUPDATE_GPIO_CLK RCU_GPIOC
- #define UARTUPDATE_IRQn USART1_IRQn
- #define UART_BUFF_SIZE 512
- /* Define to variables declare---------------------------------------------------*/
- typedef struct
- {
- uint16_t ucBufSize;
- uint16_t ucBufWrInde;
- uint16_t ucBufRdInde;
- uint16_t ucBufCnt;
- uint8_t ucBufOvf;
- uint8_t * pcBufAddr;
- UART_Regs* usart_periph;
- uint8_t ucCOMEnable;
- } USART_Buf_TypeDef;
- /* Public variables declare---------------------------------------------------*/
- //extern uint8_t UART_RxBuff1[UART_BUFF_SIZE];
- //extern USART_Buf_TypeDef UART_RxBuff_Struct1;
- //extern uint8_t UART_TxBuff1[UART_BUFF_SIZE];
- //extern USART_Buf_TypeDef UART_TxBuff_Struct1;
- extern uint8_t UART_RxBuff2[UART_BUFF_SIZE];
- extern USART_Buf_TypeDef UART_RxBuff_Struct2;
- extern uint8_t UART_TxBuff2[UART_BUFF_SIZE];
- extern USART_Buf_TypeDef UART_TxBuff_Struct2;
- /*Private function declare---------------------------------------------------*/
- uint8_t UART_ReadChar(USART_Buf_TypeDef * ptRx, uint8_t ucNum);
- void UART_DelChar(USART_Buf_TypeDef * ptRx, uint8_t ucNum);
- void UART_PutChar(USART_Buf_TypeDef * ptTx, uint8_t ucData);
- void UART_SendData(USART_Buf_TypeDef * ptTx, uint8_t* Data, uint8_t Length);
- #endif /*__UART_DRIVER_H */
- /*---------------------------- file end -------------------------------------*/
|