I am writing some embedded code to interface with an external device over SPI. The device has several registers of varying length and to help keep things straight I have def
Since they are defined as constants, what have I overlooked?
In C objects declared with the const
modifier aren't true constants. A better name for const would probably be readonly
- what it really means is that the compiler won't let you change it. And you need true constants to initialize objects with static storage (I suspect regs_to_read
is global).
You could try assigning regs_to_read
in a function called before anything else uses that array.