
Wolfgang Denk wrote:
Hi Wolfgang,
- pmic_reg_write(REG_POWER_MISC, GPO4ADIN);
It would really be great if someone cold clean up this mess in "include/fsl_pmic.h"
Using an "enum" for register definitions is just horrible.
I am well aware that you did not introduce this code, but reading this feels is if my nails are rolling up.
Well, that's me ! I am aware it sounds crazy. However, the registers on the pmic are not memory mapped and the access is done via SPI. The pmic manuals (MC13783, MC13892,) describe the SPI frame (ok, frame is probably a big word..it is only a 32 bit) and one of the field is the internal register number.
Using a structure looks like to me even stranger. We have to use some kind of offsetof() to get the index number back and put it inside the SPI data.
Best regards, Stefano Babic