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

📄 thwi2c.h.svn-base

📁 最新火热的CX32 源代码
💻 SVN-BASE
字号:

/* Constants for Timer	*/
#define	HWI2C_TIMER_END		0					/* Finish couting the timer	*/
#define	HWI2C_TIMER_STOP	1					/* Clear Timer

/* Constants for SBI0CR1	*/
#define SWRMON              0x01
#define	ACK			        0x10
#define	HWI2C_SCL_SEL	    0x01
#define	BC0			        0x20
#define	HWI2C_ACK_8		    HWI2C_SCL_SEL | ACK		/* 8-bit, ACK	*/
#define	HWI2C_NACK_8	    HWI2C_SCL_SEL			/* 8-bit, NACK	*/
#define	HWI2C_NACK_1	    HWI2C_SCL_SEL | BC0		/* 1-bit, NACK	*/

/* Constants for SBI0CR2	*/
#define	HWI2C_SW_RESET1	    0x0a
#define	HWI2C_SW_RESET2	    0x09
#define	HWI2C_START		    0xf8
#define	HWI2C_STOP		    0xd8
#define	HWI2C_BUS_FREE	    0x18

/* Constant for SBI0BR0	*/
#define	HWI2C_SBI0BR0	    0x00

/* Constant for SBI0BR1	*/
#define	P4EN		        0x80
#define	HWI2C_CLK_EN	    P4EN

/* Constant for I2C0AR	*/
#define	HWI2C_MCU_SLV	    0x20

/* General constants	*/
#define	C_BIT_ON		    1			/* ON for flag? data	*/
#define	C_BIT_OFF		    0			/* OFF for flag? data	*/

#define	C_1000MS20		    0xCE		/* 1s by 20ms timer	*/

/* SBI0CR1	*/
#define	SCK0		0x01
#define	SWRMON		0x01
#define	SCK1		0x02
#define	SCK2		0x04
#define	ACK			0x10
#define	SIOM0		0x10
#define	BC0			0x20
#define	SIOM1		0x20
#define	BC1			0x40
#define	SIOINH		0x40
#define	BC2			0x80
#define	SIOS		0x80


/* SBI0CR2	*/
#define	LRB			0x01
#define	SWRST0		0x01
#define	AD0			0x02
#define	SWRST		0x02
#define	AAS			0x04
#define	SBIM0		0x04
#define	AL			0x08
#define	SBIM1		0x08
#define	PIN			0x10
#define	BB			0x20
#define	TRX			0x40
#define	MST			0x80

⌨️ 快捷键说明

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