/* ****************************************************************************** * * @file uart.c * @brief uart module * * * @version 1.0 * @date 2022/12/14 15:00:40 * @author Alex Xu * * Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd. * All Rights Reserved * * History: * Revision Date Author Desc * 1.0.0 2022/12/14 Alex build this file ******************************************************************************/ /*_____ I N C L U D E S ____________________________________________________*/ #include "uart.h" #include "system.h" #include "vox_module.h" #include "sleep.h" #if UART0_ENABLE /******************************************************************************\ Macro definitions \******************************************************************************/ #define NONE_PARITY 0 //无校验 #define ODD_PARITY 1 //奇校验 #define EVEN_PARITY 2 //偶校验 #define MARK_PARITY 3 //标记校验 #define SPACE_PARITY 4 //空白校验 #define PARITYBIT EVEN_PARITY //定义校验位 /******************************************************************************\ Variables definitions \******************************************************************************/ bit busy0; idata uint8_t RX0_Buffer[COM0_Data_Lenth] = 0; //接收缓冲 bit Uart0_RX_Finish_Flag = 0; #endif #ifdef _DEBUG_ALL char putchar(char c) { while(!TI0); TI0 = 0; return (S0BUF = c); } #endif #if UART0_ENABLE /* ******************************************************************************* * void Uart0SendPacket(uint8_t Length,uint8_t *TransBuf) * * Description : UART0 Send Packet * * Arguments : NONE * Returns : NONE * Notes : NONE * ******************************************************************************* */ #ifdef VOX_TX void Uart0SendPacket(uint8_t Length,uint8_t *TransBuf) { uint8_t i = 0; for(i=0;i COM0_Data_Lenth) ) //当接收到的data个数等于RX0DataLen,这结束本次传输。 { RX0_Cnt = 0; Rx0Status = 0; Uart0_RX_Finish_Flag = 1; } } #endif } } #endif