Sorry if this is out of place here. Comp.lang.C would probably be better but I left my flameproof underwear at work.
Really I guess I am asking advice about source code organisation.
I have a C langage project - a small robot. I want to use the various types defined in stdint.h such as uint8_t, uint16_t and so on as I expect the code to get ported to other processors.
Now, in any particular module, the module header file declares exported functions and variables and so needs to know the types. Is it considered acceptable to include the stdint.h header in the module header or is it better to include it in the source code. Now I have written it out loud, I suppose the latter is best as the header file never gets compiled, just included with other compilation units.
In a similar vein, the hardware definitions for the location of the buttons, LEDs, motor drivers etc all live in a single header file called hardware.h. In here, I have included the processor definitions header as the actual names of the ports and pins are closely dependent upon the actual processor used. This is the only place in the project where the processor header is included. Is it better to do this?
I would be grateful for anyone who can point me at a good resource recommeding how best to organize modules and their headers. From a lot of browsing about, everyone semms to just do their own thing but there must be good and bad practice out there to learn from.
Pete