Improvement for the definitions of factory calibration values
Inspired from a beginner issues in this topic, I noticed a possible improvements. Let's take an example from a stm32f767xx.h definition file:
#define VREFINT_CAL_ADDR_CMSIS ((uint16_t*) (0x1FF0F44A))The first improvement is to add a const qualifier for the referenced memory and remove the useless parentheses for the address:
#define VREFINT_CAL_ADDR ((const uint16_t*) 0x1FF0F44A)The second is to make the macro access and actual data:
#define VREFINT_CAL ( *((const uint16_t*) 0x1FF0F44A) )This way developers can just use it as a normal variable in their calculations, which is the typical usage of those values. And those, who do actually need the address for some purpose, can still take it with an & (address of) operator.
Also it is clear what the "_ADDR" part of the name means, but the "_CMSIS" part is nonsense. If it is used for making the names more unique in the namespace, then it would be better to add some "ADCCAL_" or something like that at the beginning of all those calibration data definitions so that it makes some sense.
