What is function of 'bit_mask' in event functions?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is function of 'bit_mask' in event functions?

Jump to solution
752 Views
stevejanisch
Contributor IV

Several MQX event functions (e.g. _event_wait_all, _event_clear, _event_set) have an argument _mqx_uint bit_mask.

The reference manual only gives a cryptic definition for this argument:

"Each set bit represents an event bit to clear"

Most of the examples use the constant 0x01 for the bit_mask argument, so there is no help there.

Does anyone know precisely what this argument does?

1 Solution
525 Views
DavidS
NXP Employee
NXP Employee

A good summary of using the event flags is to have the capability to AND/OR bits to create unique triggers or simple triggers.

ScreenHunter_29 Sep. 13 08.38.gif

Regards,

David

View solution in original post

5 Replies
525 Views
stevejanisch
Contributor IV

Thanks.  I'll look forward.

It seems like what it is saying is I can have one single event pointer, but multiple "flags" within it.  So, for example, I could set one bit when a pressure reaches 300 bar, and another when it falls below 50 bar.  If I a event waiting for both bits it would be triggered after the rise and fall (talking pressures here, not the roman empire).  Nice feature.

0 Kudos
526 Views
DavidS
NXP Employee
NXP Employee

A good summary of using the event flags is to have the capability to AND/OR bits to create unique triggers or simple triggers.

ScreenHunter_29 Sep. 13 08.38.gif

Regards,

David

525 Views
stevejanisch
Contributor IV

That is an extremely concise yet detailed answer!  Thank you very much!!

Is there a master document that you took this from?  Finding a document with concise and detailed explanations of some of the functions would be akin to finding a lost Monet.

0 Kudos
525 Views
DavidS
NXP Employee
NXP Employee

The FreescaleMQX4_0_2\docs\mqx\MQXUG.pdf does a very good job of explaining the RTOS features and capabilities without getting too deep but it doesn't boil it down to one slide as shown above.  Therefore the reason for the slide ;-)

Regards,

David

0 Kudos
525 Views
c0170
Senior Contributor III

Hello Steve Janisch,

I'll paste here a snippet from the event code file, where is a condition to check bit_mask. This should clear the confusion. Line 2344 if you want to further investigate what it does inside.

if ((all && ((event_ptr->EVENT & bit_mask) != bit_mask)) || (!all && ((event_ptr->EVENT & bit_mask) == 0)))

{

     /* code */

}

I believe examples uses only one event thus (0x01) .

Regards,

0xc0170