13.12.2012 Views

emWin - SEGGER Microcontroller

emWin - SEGGER Microcontroller

emWin - SEGGER Microcontroller

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

320 CHAPTER Execution Model: Single Task / Multitask<br />

Example<br />

#define GUI_X_SIGNAL_EVENT GUI_X_SignalEvent<br />

GUI_X_WAIT_EVENT<br />

Description<br />

Defines a function which waits for an event.<br />

Type<br />

Function replacement<br />

Additional information<br />

Per default the GUI needs to periodically check for events unless a function is defined<br />

which waits and one that triggers an event. This macro defines the function which<br />

waits for an event. Makes only sense in combination with GUI_X_SIGNAL_EVENT. The<br />

advantage of using the macros GUI_X_SIGNAL_EVENT and GUI_X_WAIT_EVENT instead<br />

of polling is the reduction of CPU load of the waiting task to 0% while it waits for<br />

input. If the macro has been defined as recommended and the system waits for user<br />

input the defined function should wait for an event signaled from the function defined<br />

by the macro GUI_X_SIGNAL_EVENT.<br />

It is recommended to specify the function GUI_X_WaitEvent() for the job.<br />

Example<br />

#define GUI_X_WAIT_EVENT GUI_X_WaitEvent<br />

GUI_X_WAIT_EVENT_TIMED<br />

Description<br />

Defines a function which waits for an event for a dedicated period of time.<br />

Type<br />

Function replacement<br />

Additional information<br />

Per default the GUI needs to periodically check for events unless a function is defined<br />

which waits and one that triggers an event. This macro defines the function which<br />

waits for an event if a timer is active. Makes only sense in combination with<br />

GUI_X_SIGNAL_EVENT. If the macro has been defined as recommended and the system<br />

waits for user input during a timer is active the defined function should wait until<br />

the timer expires or an event signaled from the function defined by the macro<br />

GUI_X_SIGNAL_EVENT.<br />

It is recommended to specify the function GUI_X_WaitEventTimed() for the job.<br />

Example<br />

#define GUI_X_WAIT_EVENT_TIMED GUI_X_WaitEventTimed<br />

14.7 Kernel interface API<br />

An RTOS usually offers a mechanism called a resource semaphore, in which a task<br />

using a particular resource claims that resource before actually using it. The display<br />

is an example of a resource that needs to be protected with a resource semaphore.<br />

<strong>emWin</strong> uses the macro GUI_USE to call the function GUI_Use() before it accesses the<br />

display or before it uses a critical internal data structure. In a similar way, it calls<br />

GUI_Unuse() after accessing the display or using the data structure. This is done in<br />

the module GUITask.c.<br />

UM03001 User & Reference Guide for <strong>emWin</strong> V5.18 © 1997 - 2012 <strong>SEGGER</strong> <strong>Microcontroller</strong> GmbH & Co. KG

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!