1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef __VIRTUALCOM_H
- #define __VIRTUALCOM_H
- /***********************************************************************************/
- #include "includes.h"
- #define COM_TX_PORT GPIOA
- #define COM_TX_PIN GPIO_Pin_14
- #define COM_DATA_HIGH() GPIO_SetBits(COM_TX_PORT, COM_TX_PIN)
- #define COM_DATA_LOW() GPIO_ResetBits(COM_TX_PORT, COM_TX_PIN)
- #define COM_RX_PORT GPIOA
- #define COM_RX_PIN GPIO_Pin_13
- #define COM_RX_STAT GPIO_ReadInputDataBit(COM_RX_PORT, COM_RX_PIN)
- enum{
- COM_START_BIT, //Æðʼλ
- COM_D0_BIT, //bit0
- COM_D1_BIT, //bit1
- COM_D2_BIT, //bit2
- COM_D3_BIT, //bit3
- COM_D4_BIT, //bit4
- COM_D5_BIT, //bit5
- COM_D6_BIT, //bit6
- COM_D7_BIT, //bit7
- COM_STOP_BIT, //ֹͣλ
- };
- typedef enum {
- BAUDRATE_9600,BAUDRATE_4800,BAUDRATE_2400,BAUDRATE_1200,
- }BAUDRATE;
- typedef enum {
- SYSCLK_FREQ_72M,SYSCLK_FREQ_48M,SYSCLK_FREQ_36M,
- }SYSCLK_FREQ;
- extern int g_iTIM_DelayUs_ct;
- extern unsigned char g_ucRecvStat;
- extern unsigned char g_ucRecvData;
- extern int g_iCOMRXDelayCt;
- void TIM_Delay_us(int timeus);
- void VirtualCOM_Init(SYSCLK_FREQ SysclkFreq,BAUDRATE BaudRate);
- void VirtualCOM_StringSend(unsigned char *str);
- void VirtualCOM_ByteSend(unsigned char val);
- void COM_RX_Start_Delay(int ct);
- #endif
- /***********************************************************************************/
|