CURRENT ISSUE

Contests

bottom corner

Feature Article



Issue #213 April 2008

Programmable Power
Build a Simple USB DAC
by Yoshiyasu Takefuji

Start | USB Communications | Firmware | MAX517 (DAC) Programming | Firmware, Software, & LIUSB | Host Device Driver Installation | Testing | Sources & PDF

Listing 2—This is part of a usbconfig.h file for hardware configuration where VENDOR_ID, DEVICE_ID, VENDOR_NAME, and DEVICE_NAME are set and disabling FN_WRITE and FN_READ.

#define	USB_CFG_VENDOR_ID		0x84, 0x13
#define	USB_CFG_DEVICE_ID		0x88, 0x88
#define	USB_CFG_DEVICE_VERSION		0x00, 0x01
#define	USB_CFG_VENDOR_NAME		‘D', 'e', 'v', 'D', 'r', 'v'
#define	USB_CFG_VENDOR_NAME_LEN	6
/* These two values define the vendor name returned by the USB 
	* device. The name must be given as a list of characters under 
 * single quotes. The characters are interpreted as Unicode 
 * (UTF-16) entities.If you don't want a vendor name string, 
	* undefine these macros.
	*/
#define	USB_CFG_DEVICE_NAME		'U', 'S', 'B', '-', 'K', 'O'
#define	USB_CFG_DEVICE_NAME_LEN	6
/* Same as above for the device name. If you don't want a device 
	* name, undefine the macros.
	*/

Disable usbFunctionWrite and usbFunctionRead in this example.
#define USB_CFG_IMPLEMENT_FN_WRITE	0
/* Set this to 1 if you want usbFunctionWrite() to be called for 
 * control-out transfers. Set it to 0 if you don't need it and 
 * want to save a couple ofbytes.
	*/
#define USB_CFG_IMPLEMENT_FN_READ	0
/* Set this to 1 if you need to send control replies which are gen- 
 * erated "on the fly" when usbFunctionRead() is called. If you only 
 * want to send data from a static buffer, set it to 0 and return 
 * the data from usbFunctionSetup(). This saves a couple of bytes.
 */
#define	USB_CFG_DEVICE_CLASS	0xff
#define	USB_CFG_DEVICE_SUBCLASS	0
#define	USB_CFG_INTERFACE_CLASS	0
#define	USB_CFG_INTERFACE_SUBCLASS	0
#define	USB_CFG_INTERFACE_PROTOCOL	0

Return

 


bottom corner