-
Notifications
You must be signed in to change notification settings - Fork 60
TWI name classification not perfect. (Information Request) #492
Description
Hallo,
I'm dealing with TWI right now. I noticed that your naming scheme is not 100% the same. The TWI buffer length 'BUFFER_LENGTH' should have the name TWI_BUFFER_LENGTH. Otherwise it will be too easily overwritten by own defines. This is the big disadvantage of C and defines. They are visible everywhere without access protection.
BUFFER_LENGTH is actually a common name for something like that for itself. So it can collide very easily.
After renaming this to TWI_BUFFER_LENGTH please,
I would remove the check in twi.h.
#ifndef TWI_BUFFER_LENGTH
I would define TWI_BUFFER_LENGTH hard depending on RAMSIZE.
Then a programmer has when compiling the chance of an error message when trying to create multiple identically named defines. Otherwise the programmer gets no warning and the value is overwritten or skipped if necessary.
Files: twi,h, twi.c and Wire.cpp
Would you please change that?
Is certainly in the MegaCoreX the same problem. I think.