How can I printf bit value of type "EventBits_t"?

zeni241 wrote on July 25, 2019:

How can I print bit value of type EventBits_t in C using printf? Is it integer and I should use %d in printf? Any other method to see the current value of event Bit?
Thank you please.

PrasadV-AWS wrote on July 29, 2019:

Hi Zeni,

EventBits_t is the type that holds event bits and matches TickType_t. The number of bits it holds is set by the configuration configUSE_16_BIT_TICKS so it is uint16_t when this is set to 1 and uint32_t when this is set to 0. So you can print it as unsigned integer and convert it or to check a specific bit (for example Bit 2) you can use -
( uxBits & BIT_2 )
Where uxBits is of type EventBits_t
and BIT_2 is #define BIT_2 ( 1 << 2 )

Let me know if this helps.

abhijit-AWS wrote on August 02, 2019:

I hope the above comment answers your question, if not, please feel free post. Thanks.