Content originally posted in LPCWare by justyn on Sun May 22 09:31:10 MST 2011
Quote: Rob65
What I am concerned about is the fact that you name these files [B][I]driver files[/I][/B].
These files are called [I][B]example projects[/B][/I] by NXP and are in no way meant to be driver files that are of general use. The older versions of the example projects were simple: the ssp directory contained ssp.c and ssp.h and the program ssptest.c.
In the new version of the example projects the ssp.c and ssp.h files have just been moved to a common/driver directory which makes this less readable as an example (since now there is no SSP sample code in the SSP project, it's all 'hidden' in the common/driver project).
These files are, again, in no way ever meant to be used as general purpose drivers.
Ah OK, thank you, yes it is clear I was misunderstanding the purpose of these files.
Quote: Rob65
I think it is hard to create general purpose drivers and for some components this may even be out of bounds: a general SPI driver which is able to be both master and slave may not be what you want (I mostly only act as a master). I2C slave/master is even worse: this will make your code grow.
I understand what you're saying but I can't help feeling that with the use of #define and #ifdef statements we could create some more general purpose drivers for the peripherals that are no larger than custom or hand-modified code.
I think this would be fine for the initialization of the peripherals at least - actual data transfer and such is more likely to be dependent on how you're using interrupts etc.