I've found trailing '#' characters in the pin description section in some datasheets, which indicates that the specific pin has active-low functionality.
Is there any conventions for variable names which hold for example pulled up GPIO input pin values?
CodePudding user response:
It is very helpful when translating a schematic to a header file with constants for the pin numbers to name the constants as close as possible to the net names on the schematic.
This leaves three problems that I have encountered regularly:
Net names with a dash: I just replace this with an underscore.
BAT-LEVEL
becomesBAT_LEVEL
.Net names starting with a digit: I start all the pin numbers with the same prefix:
3V3_ENABLE
becomesPIN_3V3_ENABLE
.Net names with a slash or hash character or overbar (all of which signify active low). I replace this with a lower-case
n
in an otherwise all-capitals constant.SPI_CS#
becomesSPI_nCS
.