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

📄 usb3wcmd.h

📁 LV24000的单片机DEMO程序
💻 H
字号:
// Usb3wCmd.h: Include file for command received from USB-host

//-----------------------------------------------------------------------------
// 3W-Command opcode and format
//-----------------------------------------------------------------------------
// General information
#define RC_NOP_CMD			    	0x00 	// No Operation I: <cmd> O:No reply

/* ---------- NOT USED ----------
#define RC_GET_HARDWARE_REV_CMD		0x01 	// Get hardware revision -  not implemented 
--------------------------------- */

// USB 3W command
#define RC_GET_FIRMWARE_REV_CMD		0x02	// Get Firmware revision 
											//		I:<cmd>
											//		O:<MajorVer> <dot> <MinorVer> <SubVer> -> Example: "0.0A"
#define RC_WRITE3W_CMD				0xCB	// Write 3W I:<cmd><datL><datH>  O:No reply
#define RC_READ3W_CMD				0xCC	// Read 3W  I:<cmd>              O:<cmd><datL><datH>

/* ---------- NOT USED ----------
#define RC_PULSE3W_CMD				0xCD	// Pulse 3W I:<cmd><wStartL><wStartH><time><wStopL><wStopH> 
											//		    O:<cmd><wdatL><wdatH><!cmd>
	// Parameters
	#define P3W_8MS			((BYTE)(1<<0))	// bit 0: 8ms
	#define P3W_32MS		((BYTE)(1<<1))	// bit 1: 32ms
	#define P3W_64MS		((BYTE)(1<<2))	// bit 2: 64ms
	#define P3W_100MS		((BYTE)(1<<3))	// bit 3: 100ms
--------------------------------- */

#define RC_RD3WLINES_CMD			0xCF	// Read 3W lines I:<cmd><Set_L><Set_H>  O:<cmd><datL><datH>
   // --- Input (set pattern)
   #define RIL_CLK_LEVEL 	(1<<0)	// bit 0: clock level to be set
   #define RIL_CLK_CHG   	(1<<1)	// bit 1: change clock line if 1, no change if 0
   #define RIL_DAT_LEVEL 	(1<<2)	// bit 2: data level to be set
   #define RIL_DAT_CHG   	(1<<3)	// bit 3: change data line if 1, no change if 0
   #define RIL_NRW_LEVEL 	(1<<4)	// bit 4: NRW level to be set
   #define RIL_NRW_CHG   	(1<<5)	// bit 5: change NRW line if 1, no change if 0
   // ---- output (lines state)
   #define I3W_CLOCK_STATE  (1<<0)	// Bit 0: clock state
   #define I3W_DATA_STATE   (1<<1)	// Bit 1: data
   #define I3W_NRW_STATE    (1<<2)	// Bit 2: nRW

#define RC_SET_CHIP_INTF_CMD 		0xD0	// Set known chip interface I:<cmd><Intf ID>   O:<cmd><0: OK else error>
   #define INTF_LAST_NR     0	// Increase this when new chip interface is added (support number)

/* ---------- NOT USED ----------
#define RC_PULSE3W_USE_INTF_CMD		0xD1	// Pulse count use known interface I:<cmd><0><0><time> O:<cmd><Cnt_L><Cnt_H><!cmd>
	// Parameters: see RC_PULSE3W_CMD
	// #define P3W_8MS			((BYTE)(1<<0))	// bit 0: 8ms
	// #define P3W_32MS			((BYTE)(1<<1))	// bit 1: 32ms
	// #define P3W_64MS			((BYTE)(1<<2))	// bit 2: 64ms
	// #define P3W_100MS		((BYTE)(1<<3))	// bit 3: 100ms
--------------------------------- */

/* ---------- NOT USED ----------
#define RC_RDSTAT_USE_INTF_CMD		0xD2	// Read status use known interface I:<cmd> O:<cmd><Stat_L><Stat_H>
--------------------------------- */

#define RC_SET_DGT_INTF_CMD			0xD3	// Set chip digital interface version 
											//	I:<cmd><Intf Ver>   
											//	O:<cmd><0: OK else error><0>
	// Defined digital interfaces - see BaseInterfaceDef.h
	#define DGT_INTF_V3		3	// V3: 16 bits (7 clocks read cycle - clock default LOW)
	#define DGT_INTF_V4		4	// V4: 16 bits (8 clocks read cycle - clock default HIGH)
	#define DGT_INTF_LAST   DGT_INTF_V4

#define RC_WRITE3W_MUL_CMD			0xD4	// Write 3W multiple data
											//	I:<cmd><Cnt=n><datL0><datH0><datL1><datH1><datL2><datH2>...<datLn><datHn>
											//	O:No reply

#define RC_REPEAT_IO_PAT_CMD		0xD5	// Repeat IO pattern
											// I:<cmd><byDuration><wValue1L><wValue1H><wValue2L><wValue2H><wFreqHzL><wFreqHzH>
											// O: no reply
	#define SET_REPEAT_IO_ON		0x00
	#define SET_REPEAT_IO_OFF		0xFF

#define RC_IRQ_CONTROL_CMD		0xD6	// Interrupt control 
										// I:<cmd><Action> where actions are:
	#define RCA_INFIRQ_ENABLE	0x00	//			0: Enable interface IRQ		// No reply
	#define RCA_INFIRQ_DISABLE	0x01	//			1: Disable interface IRQ	// No reply
	#define RCA_INFIRQ_SUSPEND	0x02	//			2: Suspend interface IRQ	// No reply
	#define RCA_INFIRQ_RESUME	0x03	//			3: Resume interface IRQ		// No reply
	#define RCA_INFIRQ_GETDATA	0x04	//			4: Get interface IRQ data	// <Cmd><ByteCnt><byte0><byte1><byte2><byte3><byte4><byte5>

	#define RCA_DEVIRQ_ENABLE	0x80	//			0: Enable device IRQ		// No reply
	#define RCA_DEVIRQ_DISABLE	0x81	//			1: Disable device IRQ		// No reply
	#define RCA_DEVIRQ_SUSPEND	0x82	//			2: Suspend device IRQ		// No reply
	#define RCA_DEVIRQ_RESUME	0x83	//			3: Resume device IRQ		// No reply
	#define RCA_DEVIRQ_GETDATA	0x84	//			4: Get device IRQ data		// <Cmd><ByteCnt><byte0><byte1><byte2><byte3><byte4><byte5>
	#define RCA_DEVIRQ_INSTALL	0x85	//			5: Install interrupt handler script // See source
	#define RCA_DEVIRQ_REMOVE	0x86	//			6: Remove interrupt handler script  // No reply
	#define RCA_DEVIRQ_SETCB	0x87	//			7: Set callback						// NA: for USB-uC
	#define RCA_DEVIRQ_SETBUF	0x88	//			8: Set IRQ data buffer
	#define RCA_DEVIRQ_MOD_SBUF	0x89	//			9: Modify scratch buffer (buffer 0)

#define ERC_PULSE3W_CMD				0xD7	// Extended Pulse 3W 	
											//	I:<cmd><TimeMs><NA><NA><wStartL><wStartH><wStopL><wStopH>
											//	O:<cmd><TimeUs[7:0]><TimeUs[15:8]><TimeUs[23:16]><TimeUs[31:24]>

/* ---------- NOT USED ----------
#define ERC_PULSE3W_USE_INTF_CMD	0xD8	// Extended pulse count use known interface 
											// I:<cmd><RollOverCnt><IniValL><IniValH>
											// O:<cmd><ExtraCntValL><ExtraCntValH><Cnt_L><Cnt_H>
--------------------------------- */

#define ERC_EXEC_SCRIPT_CMD		0xD9	// Execute the passed along script command
	//I:<cmd><ScriptLength=n><Script data 0><Reply length=m><...><Script data n-1>
	//O:<cmd><Return length=m><Return data 0><...><Return data m-1>

#define RC_OPEN_CLOSE_3WBUS_CMD	0xF0		// Open/Close the 3-wire bus on USB adaptor
											//	I:<cmd><Open or Close><Bus number>
											//	O:<cmd><0: OK else error><0>
	#define ROC_CLOSE_3W		0			// Close 3-wire request
	#define ROC_OPEN_3W			1			// Open 3-wire request

⌨️ 快捷键说明

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