usb_main.h

来自「USB CDC and HID composite unit.」· C头文件 代码 · 共 76 行

H
76
字号
//-----------------------------------------------------------------------------
// USB_Main.h
//-----------------------------------------------------------------------------

#ifndef USB_MAIN_H
#define USB_MAIN_H

//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------

#if defined C8051F320_H
	// USB clock selections (SFR CLKSEL)
	#define USB_4X_CLOCK			0x00		// Select 4x clock multiplier,
												// for USB Full Speed
	#define USB_INT_OSC_DIV_2		0x10		// See Oscillators in Datasheet
	#define USB_EXT_OSC				0x20
	#define USB_EXT_OSC_DIV_2		0x30
	#define USB_EXT_OSC_DIV_3		0x40
	#define USB_EXT_OSC_DIV_4		0x50

	// System clock selections (SFR CLKSEL)
	#define SYS_INT_OSC				0x00		// Select to use internal osc.
	#define SYS_EXT_OSC				0x01		// Select to use external osc.
	#define SYS_4X_DIV_2			0x02
#endif // C8051F320_H

#if defined C8051F326_H
	// USB clock selections (SFR CLKSEL)
	#define USB_4X_CLOCK			0x00		// Select 4x clock multiplier,
												// for USB Full Speed
	#define USB_INT_OSC_DIV_2		0x10		// See Oscillators in Datasheet
	#define USB_EXT_OSC				0x20
	#define USB_CLOCK_OFF			0x30

	// System clock selections (SFR CLKSEL)
	#define SYS_INT_OSC				0x00		// Select to use internal osc.
	#define SYS_EXT_OSC				0x01		// Select to use external osc.
	#define SYS_4X_DIV_2			0x02
	#define SYS_LOW_FREQ_OSC		0x03		// Low frequency OSC
#endif // C8051F326_H

#if defined C8051F340_H
	// USB clock selections (SFR CLKSEL)
	#define USB_4X_CLOCK			0x00		// Select 4x clock multiplier,
												// for USB Full Speed
	#define USB_INT_OSC_DIV_2		0x10		// See Oscillators in Datasheet
	#define USB_EXT_OSC				0x20
	#define USB_EXT_OSC_DIV_2		0x30
	#define USB_EXT_OSC_DIV_3		0x40
	#define USB_EXT_OSC_DIV_4		0x50

	// System clock selections (SFR CLKSEL)
	#define SYS_INT_OSC				0x00		// Select to use internal osc.
	#define SYS_EXT_OSC				0x01		// Select to use external osc.
	#define SYS_4X_DIV_2			0x02
	#define SYS_4X					0x03
	#define SYS_LOW_FREQ_OSC		0x04		// Low frequency OSC
#endif // C8051F340_H

//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------

extern BYTE xdata HID_InOut_Packet[];	// Last packet received from host

//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------

#endif		/* USB_MAIN_H */

//-----------------------------------------------------------------------------
// End Of File
//-----------------------------------------------------------------------------

⌨️ 快捷键说明

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