⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sci.h

📁 单片机开发环境 windows+ads+hjtag
💻 H
字号:
#define INVALID_COM (-1)
#define COM0 0
#define COM1 1
#define COM3 2

enum tagSCI_Config {
	SCICFG_5DataBit=0,
	SCICFG_6DataBit,
	SCICFG_7DataBit,
	SCICFG_8DataBit,
	SCICFG_ParityNone,
	SCICFG_ParityOdd,
	SCICFG_ParityEven,
	SCICFG_ParityForce0,
	SCICFG_ParityForce1,
	SCICFG_1StopBit,
	SCICFG_2StopBit,

	SCICFG_Baud1200=1200,
	SCICFG_Baud2400=2400,
	SCICFG_Baud4800=4800,
	SCICFG_Baud9600=9600,
	SCICFG_Baud19200=19200,
	SCICFG_Baud38400=38400,
	SCICFG_Baud57600=57600,
	SCICFG_Baud115200=115200
};


enum tagRF_ConfigValue {
	RFCFG_Power10db = 0xC3,
	RFCFG_Power5db = 0x85,
	RFCFG_Power0db = 0x51,
	
	RFCFG_Band300MHz = 3,
	RFCFG_Band400MHz = 4,
	RFCFG_Band800MHz = 8,
	RFCFG_Band900MHz = 9,

	RFCFG_TTL = 0,
	RFCFG_RS232 = 2,
	RFCFG_RS485 = 4,

	RFCFG_Baud1200 = 1,
	RFCFG_Baud2400 = 2,
	RFCFG_Baud4800 = 3,
	RFCFG_Baud9600 = 4,
	RFCFG_Baud19200 = 5,
	RFCFG_Baud28800 = 6,
	RFCFG_Baud38400 = 7,
	RFCFG_Baud57600 = 8,
	RFCFG_Baud76800 = 9,
	RFCFG_Baud115200 = 10,
	
	RFCFG_5DataBits=5,
	RFCFG_6DataBits=6,
	RFCFG_7DataBits=7,
	RFCFG_8DataBits=8,
	RFCFG_9DataBits=9,
	
	RFCFG_ParityNone = 0,
	RFCFG_ParityOdd = 1,
	RFCFG_ParityEven = 2,
	
	RFCFG_1StopBit=1,
	RFCFG_2StopBit=2
};

typedef union {
	INT8U buff[8];
	struct {
		INT8U power;
		INT8U band;
		INT8U channel;
		INT8U comType;
		INT8U baud;
		INT8U dataBits;
		INT8U parity;
		INT8U stopBits;
	} items;
} tagRF_Config;




void SCI_Init( void );
void SCI_ISR( INT8U PortNum );


INT16S SCI_Open( INT8U PortNum, INT32U Baud, INT8U dataBit, INT8U parity, INT8U stopBit );
INT16S SCI_Get( INT8U PortNum, INT8U *Buffer, INT16U MaxNum );
INT16S SCI_Send( INT8U PortNum, INT8U *Buffer, INT16U Num );
INT16S SCI_Flush( INT8U PortNum );
INT16S SCI_Close( INT8U PortNum );
INT8U SCI_SendComplete( INT8U PortNum );

void RF_PowerOn( void );
void RF_PowerOff( void );
void IR_PowerOn( void );
void IR_PowerOff( void );
INT16S RF_GetConfig( tagRF_Config *cfg );
INT16S RF_SetConfig( tagRF_Config *cfg );

#define CLEAR_RF_PWR		{RF_PowerOff();}
#define SET_RF_PWR			{RF_PowerOn();}

INT16S SCI_WaitForGet( INT8U PortNum, INT8U *Buffer, INT16U Num, INT16U timeOut );
INT16S SCI_WaitForSend( INT8U PortNum, INT8U *Buffer, INT16U Num );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -