100 lines
2.4 KiB
C
100 lines
2.4 KiB
C
/*
|
|
******************************************************************************
|
|
*
|
|
* @file uart.h
|
|
* @brief uart module
|
|
* @ic sy8835
|
|
*
|
|
* @version 1.0
|
|
* @date 2024/11/01 09:59:40
|
|
* @author Alex Xu
|
|
*
|
|
* Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
|
|
* All Rights Reserved
|
|
*
|
|
* History:
|
|
* Revision Date Author Desc
|
|
* 1.0.0 2024/11/01 Alex build this file
|
|
******************************************************************************
|
|
*/
|
|
|
|
#ifndef __UART_H__
|
|
#define __UART_H__
|
|
|
|
/*_____ I N C L U D E S ____________________________________________________*/
|
|
|
|
#include "define.h"
|
|
|
|
/******************************************************************************\
|
|
Macro definitions
|
|
\******************************************************************************/
|
|
|
|
#if XUANHENG
|
|
#define Baud_Rate0 9600//9600//19200//38400//93750
|
|
#else
|
|
#define Baud_Rate0 9600//9600//19200//38400//93750
|
|
#endif
|
|
|
|
#define S0REL_VALUE (1024-345600/Baud_Rate0)
|
|
|
|
#define Baud_Rate1 9600//19200//38400//93750
|
|
#define S1REL_VALUE (1024-345600/Baud_Rate1)
|
|
|
|
/* Log Debug ½Ó¿Ú¡£ */
|
|
|
|
#define Baud_Rate2 115200//19200//38400//93750
|
|
#define S2REL_VALUE (1024-345600/Baud_Rate2)
|
|
|
|
#define UART_REC_ENABLE_Pos (4U)
|
|
#define UART_REC_ENABLE_Pos_Msk (0x1UL << UART_REC_ENABLE_Pos)
|
|
#define UART_REC_ENABLE UART_REC_ENABLE_Pos_Msk
|
|
|
|
#ifdef _DEBUG_ALL
|
|
|
|
extern char putchar (char ch);
|
|
|
|
#endif
|
|
|
|
#define COM0_Data_Lenth 32
|
|
|
|
#ifdef VOX_RX
|
|
|
|
/******************************************************************************\
|
|
Variables definitions
|
|
\******************************************************************************/
|
|
|
|
extern uint8_t RX0_Buffer[COM0_Data_Lenth]; //½ÓÊÕ»º³å
|
|
|
|
extern bit Uart0_RX_Finish_Flag;
|
|
#endif
|
|
/******************************************************************************\
|
|
Functions definitions
|
|
\******************************************************************************/
|
|
#ifdef _DEBUG_ALL
|
|
|
|
extern char putchar (char ch);
|
|
#endif
|
|
|
|
|
|
extern void UART0_Init(void);
|
|
|
|
extern void Uart0SendData(uint8_t Txdata);
|
|
|
|
#ifdef VOX_TX
|
|
extern void Uart0SendPacket(uint16_t Length,uint8_t *TransBuf);
|
|
#endif
|
|
|
|
|
|
extern void UART1_Init(void);
|
|
|
|
extern void Uart1SendData(uint8_t Txdata);
|
|
|
|
|
|
extern void UART2_Init(void);
|
|
|
|
extern void Uart2SendData(uint8_t Txdata);
|
|
|
|
|
|
#endif
|
|
|