Tscope5
|
Go to the source code of this file.
Functions | |
General timing functions | |
The general timing functions are mainly used to control stimulus timing. You can either wait for a given amount of time, or until some time in the future. | |
double | ts5_get_time () |
void | ts5_wait (double waittime) |
void | ts5_wait_until (double deadline) |
Response registration | |
The response registration functions require you to define response keys first using ts5_define_mouse_key(), ts5_define_keyboard_key(), ts5_define_joystick_key(), ts5_define_cedrusbox_key() or ts5_define_parport_key(). Each response key will get a response value. The first key that is defined will get number 1, etc. Registration of responses is done asynchronously. All key presses that are defined will be buffered continuously during the program. Waiting for a response to a stimulus will typically involve flushing all buffered responses that occurred befor stimulus onset using ts5_flush_responses() and then checking for new responses using ts5_check_response(), ts5_wait_for_response(), ts5_wait_for_response_timed() or ts5_wait_for_response_until(). The response definition can be altered during the program using ts5_hide_response_key() or ts5_remove_response_keys(). | |
int | ts5_hide_response_key (int key) |
void | ts5_remove_response_keys () |
void | ts5_flush_responses () |
int | ts5_check_response (double *resptime, double *timing_error) |
int | ts5_wait_for_response (double *resptime, double *timing_error) |
int | ts5_wait_for_response_timed (double *resptime, double *timing_error, double maxtime) |
int | ts5_wait_for_response_until (double *resptime, double *timing_error, double deadline) |
Trigger input/output | |
The trigger input functions require you to define trigger devices using ts5_define_parport_trigger_input() or ts5_define_serialport_trigger_input(). Registration of trigger input is done asynchronously. All triggers received on the parallel and/or serial port(s) will be buffered continuously during the program. Waiting for a trigger is similar to waiting for a reponse. Old triggers that were not processed yet can be flushed using ts5_flush_triggers(). One can either wait for a trigger indefinitely, for a given amount of time or until some deadline has passed. The value of the trigger is defined by the computer that sends the trigger. During the development of the program it is not necessary to connect a computer that sends the triggers. Trigger input can be simulated using ts5_simulate_parport_trigger_input() or ts5_simulate_serialport_trigger_input(). At the end of the program all triggers can be written to a logfile using ts5_write_all_triggers(). Trigger output is simple, call ts5_send_parport_trigger() or ts5_send_serialport_trigger() each time you want to send a trigger. | |
void | ts5_flush_triggers () |
int | ts5_check_trigger (double *trigtime, double *timing_error) |
int | ts5_wait_for_trigger (double *trigtime, double *timing_error) |
int | ts5_wait_for_trigger_timed (double *trigtime, double *timing_error, double maxtime) |
int | ts5_wait_for_trigger_until (double *trigtime, double *timing_error, double deadline) |
void | ts5_write_all_triggers (char *filename) |
Definition in file timer.c.
double ts5_get_time | ( | ) |
void ts5_wait | ( | double | waittime | ) |
Wait for a number of seconds.
void ts5_wait_until | ( | double | deadline | ) |
int ts5_hide_response_key | ( | int | key | ) |
Temporarily deactivates a response key.
key | The key that has to be deactivated. |
This function also checks whether there are any active response left. Aborts if necessary.
Reactivating all defined keys is possible by calling ts5_hide_response_key(0).
void ts5_remove_response_keys | ( | ) |
void ts5_flush_responses | ( | ) |
int ts5_check_response | ( | double * | resptime, |
double * | timing_error | ||
) |
Check for a reponse.
resptime | Variable that will store the response time. |
timing_error | Variable that will store the timing error (works only for cedrusboxes). |
This function checks for a response and returns immediately.
int ts5_wait_for_response | ( | double * | resptime, |
double * | timing_error | ||
) |
int ts5_wait_for_response_timed | ( | double * | resptime, |
double * | timing_error, | ||
double | maxtime | ||
) |
Wait for a response for a given time.
resptime | Variable that will store the response time. |
timing_error | Variable that will store the timing error (works only for cedrusboxes). |
maxtime | Maximum time for a response. |
int ts5_wait_for_response_until | ( | double * | resptime, |
double * | timing_error, | ||
double | deadline | ||
) |
Wait for a response until a deadline.
resptime | Variable that will store the response time. |
timing_error | Variable that will store the timing error (works only for cedrusboxes). |
deadline | Deadline for a response. |
int ts5_check_trigger | ( | double * | trigtime, |
double * | timing_error | ||
) |
int ts5_wait_for_trigger | ( | double * | trigtime, |
double * | timing_error | ||
) |
int ts5_wait_for_trigger_timed | ( | double * | trigtime, |
double * | timing_error, | ||
double | maxtime | ||
) |
Wait for a trigger for a given time.
trigtime | Variable that will store the trigger time. |
timing_error | Variable that will store the timing error (works only for cedrusboxes). |
maxtime | Maximum time for a trigger. |
int ts5_wait_for_trigger_until | ( | double * | trigtime, |
double * | timing_error, | ||
double | deadline | ||
) |
Wait for a trigger until a deadline.
trigtime | Variable that will store the trigger time. |
timing_error | Variable that will store the timing error (works only for cedrusboxes). |
deadline | Deadline for a trigger. |