400 views
in GUI Development by
Hi, I would like to use a uint32 variable in Chora as a bitfield, that is I would like to be able to control individual bits in the variable, and use them as flags.

In C, so that I can access individual bits, I would create a structure like this:

Struct

{

                unsigned int aMonday : 1;

                unsigned int aTuesday : 1;

                unsigned int aWednesday : 1;

                unsigned int aThursday : 1;

                unsigned int aFriday : 1;

                unsigned int aSaturday : 1;

                unsigned int aSunday : 1;

} DayOfTheWeek;

Is a structure like this possible in Chora please?

1 Answer

0 votes
by

Hi,

for the DayOfTheWeek I would recommend to use an Enum - but I assume you want to set and clear the items individually. In this case let me recommend to use a Set.

Does this help?

Best regards,

Manfred.

by
Hi Manfred,

Thanks for your answer.  Yes I would like to set and clear the items (bits) individually, so using a set would seem to be a good idea.  I am just investigating now how to use a set in my application - I'll get back with any further questions...

Best regards,

Jonathan

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...