This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

to .all or not to .all?



Hi folks

Looking at the examples or the ControlSTICK in CCS v4 moving values to whole registers seems to sometimes use ".all" and sometimes not

I2caRegs.I2CCLKL = 10;

but

I2caRegs.I2CIER.all = 0x24;

Also, I am using F28027 PT ControlSTICK - is the rest of the statement correct?

(e.g. I was surprised to see I2caRegs and not I2cRegs, as there is only the one I2C on this device)

 

Thanks

  • Hi Toby,

    We usually have the .all on only those registers that have bit fields. I2CCLKL is just a 16 bit value whereas I2CIER has individual bit fields that can be accessed e.g I2CIER.bit.AAS etc.

    Its more readable that way. if you wanted to change the AAS bit you could have written I2caRegs.I2CIER.bit.AAS = 1 or I2caRegs.I2CIER.all |= 0x0040. Its a question of personal preference and readability.

    As far as the I2ca part goes we do have some devices that have 2 modules on them and these header files are meant to be generic across all variations in the device family

     

     

     

  • Thanks Vishal!