"Volatile" digital I/O

07 Jul 2010

Does the declaration of a digital input or output (DigitalIn / DigitalOut) intrinsically declare the pin object as being volatile?  Is this true of all of the mbed class constructors?

07 Jul 2010

Hi Barry,

If we're being specific, the DigitalIn/Out etc objects/member functions are not defined as volatile. However, the things they manipulate are registers, which most certainly are defined as volatile (they are the CMSIS register definitions), and hence this ensures the compiler can't optimise away the calls. So I think the answer to what you are generally asking is "yes".

If you are questioning something more specific than this or not what I have answered, or have some concerns, please shout!

Thanks,

Simon

08 Jul 2010

Thanx Simon,

You answered exactly what I meant to ask!

Barry