Multiple time declarations (newbie)

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
laurentppol
Posts: 3
Joined: Wed Jul 21, 2010 10:50 pm

Multiple time declarations (newbie)

Post by laurentppol » Wed Jul 21, 2010 11:02 pm

Hi, sample projects on this site seems to follow thi schema in directory design:

/circuit
/firmware (with subdir /usbdrv)
/"application".

After looking inside (PowerSwitch) sources I realized that there are declarations (#defines) that are (almost - but they define the SAME) the same in TWO places: /firmware/usbconfig.h AND in "application" main. Having the SAME thing TWICE seems error-prone.

Would it be possible to "export" common definitions (VID, PID, product/vendor strings, command definitions) to some *.h file located in "root" of project? And then include (with needed byte/character swapping) into /firmware/usbdrv.h (or /usbdrv.c?) and main.c in application directory?

One point less for errors....

W.P.

Post Reply