Page 1 of 1

Multiple time declarations (newbie)

Posted: Wed Jul 21, 2010 11:02 pm
by laurentppol
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.