785 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...