![]() |
embedded system library for e-puck
1.0.1
A redesigned API library for the e-puck robot platform
|
Go to the source code of this file.
Typedefs | |
typedef bool(* | el_condition )(void *) |
Enumerations | |
enum | el_trigger_event_type { EL_EVENT_NONE = 0, EL_EVENT_INTERNAL_A = 1, EL_EVENT_INTERNAL_B = 2, EL_EVENT_INTERNAL_C = 3, EL_EVENT_INTERNAL_D = 4, EL_EVENT_INTERNAL_E = 5, EL_EVENT_INTERNAL_F = 6, EL_EVENT_IR_RECEIVER_INCOME = 10, EL_EVENT_UART1_RECEIVED = 11, EL_EVENT_UART2_RECEIVED = 12, EL_EVENT_ACCELEROMETER_UPDATE = 20, EL_EVENT_IR_PROXIMITY_UPDATE = 21, EL_EVENT_CAMERA_FRAME_UPDATE = 22 } |
Functions | |
el_handle | el_create_trigger () |
create a trigger in the system More... | |
void | el_delete_trigger (el_handle trigger) |
delete the trigger More... | |
void | el_trigger_enable (el_handle h) |
enable a trigger More... | |
void | el_trigger_disable (el_handle h) |
disable a trigger More... | |
el_bool | el_trigger_is_enabled (el_handle h) |
check whether a trigger More... | |
void | el_trigger_set_event (el_handle h, el_trigger_event_type e) |
set the event of the trigger More... | |
void | el_trigger_set_condition (el_handle h, el_condition f) |
set the condition callback function of the trigger More... | |
void | el_trigger_set_process (el_handle h, el_process func) |
set the process entry function of the trigger More... | |
el_uint32 | el_trigger_get_counter (el_handle h) |
get the number of times the trigger passed its condition More... | |
void | el_trigger_issue_internal_event (el_enum e) |
issue an internal event More... | |
This enum is used in el_trigger_set_event to specify the event of a trigger. Internal events are manually triggered using el_trigger_issue_internal_event.
el_handle el_create_trigger | ( | ) |
create a trigger in the system
This function create a trigger in the system. It returns a handle to the trigger created. This handle is used to refer the trigger in the related functions.
void el_delete_trigger | ( | el_handle | trigger | ) |
delete the trigger
handle | of the trigger |
void el_trigger_enable | ( | el_handle | h | ) |
enable a trigger
h | handle of the trigger |
Only when a trigger is enabled, its event will be effective. A trigger is enabled by default after its creation.
void el_trigger_disable | ( | el_handle | h | ) |
disable a trigger
h | handle of the trigger |
When a trigger is disabled, its event will be ignored. A trigger is automatically disabled when its process is launched.
el_bool el_trigger_is_enabled | ( | el_handle | h | ) |
check whether a trigger
h | handle of the trigger |
void el_trigger_set_event | ( | el_handle | h, |
el_trigger_event_type | e | ||
) |
set the event of the trigger
h | handle of the trigger |
e | type of the event within the category |
This function defines the event of the trigger.
void el_trigger_set_condition | ( | el_handle | h, |
el_condition | f | ||
) |
set the condition callback function of the trigger
h | handle of the trigger |
f | pointer to the callback function |
When the event of the trigger occurs, the trigger's condition callback will be called. If this callback function returns true, the trigger passes the condition. Otherwise, the trigger does not pass the condition.
If a trigger does not have a condition callback (by default), the trigger will automatically pass it's condition.
void el_trigger_set_process | ( | el_handle | h, |
el_process | func | ||
) |
set the process entry function of the trigger
h | handle of the trigger |
func | pointer to the process function |
When the trigger passes its condition and it has a registered process, the process will be launched while the trigger will be disabled automatically.
The parameter of the process function of a trigger will be assigned with the handle of the trigger. The following code can be used to make the handle more explicit:
To learn more about the usage of a process, see Process.
el_uint32 el_trigger_get_counter | ( | el_handle | h | ) |
get the number of times the trigger passed its condition
h | handle of the trigger |
For each time the trigger passes its condition, its counter will +1.
void el_trigger_issue_internal_event | ( | el_enum | e | ) |
issue an internal event
e | event type (must be internal events) |
This will affect those triggers using "EL_EVENT_INTERNAL_<*>" as their events.