forked from racheldenison/temporal-attention
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initEyelink.m
81 lines (67 loc) · 2.27 KB
/
initEyelink.m
1
function [el, error]=initEyelink(dataID)%% Initializes eyeLink-connection, creates edf-file% and writes experimental parameters to edf-file% global constant visual scr%---------------------%% define edf-filename %%---------------------%edffilename = strcat(dataID,'.edf');% dummymode (mouse is tracked) or eyelink connected (eyes are tracked)error=0;if constant.EYETRACK if (Eyelink('initialize') ~= 0) Eyelink('initializedummy'); endelse Eyelink('initializedummy');end% create edf-filei = Eyelink( 'openfile', edffilename);if i~=0 fprintf('Cannot create EDF file ''%s'' ', edffilename); Eyelink( 'Shutdown'); return;end% set eyelink defaultsel=EyelinkInitDefaults(scr.main);%---------------------------------------%% general information on the experiment %%---------------------------------------%Eyelink('command', 'add_file_preamble_text ''Recorded with CPDExoInvalid by Antoine Barbot''');% SET UP TRACKER CONFIGURATIONEyelink('command', 'calibration_type = HV9');Eyelink('command', 'link_event_filter = LEFT,RIGHT,BUTTON');Eyelink('command', 'link_sample_data = LEFT,RIGHT,GAZE,AREA');Eyelink('command', 'heuristic_filter = 1 1');%--------------------------------------------------------%% write descriptions of the experiment into the edf-file %%--------------------------------------------------------%Eyelink('message', 'BEGIN OF DESCRIPTIONS');Eyelink('message', 'Subject code: %s', dataID);Eyelink('message', 'END OF DESCRIPTIONS');%--------------------------------------%% modify a few of the default settings %%--------------------------------------%el.backgroundcolour = visual.bgColor; % background color when calibratingel.foregroundcolour = visual.fgColor; % foreground color when calibratingel.calibrationfailedsound = 0; % no sounds indicating success of calibrationel.calibrationsuccesssound = 0;% test mode of eyelink connectionstatus = Eyelink('isconnected');switch status case -1 fprintf(1, 'Eyelink in dummymode.\n\n'); case 0 fprintf(1, 'Eyelink not connected.\n\n'); case 1 fprintf(1, 'Eyelink connected.\n\n');endif Eyelink('isconnected')==el.notconnected Eyelink('closefile'); Eyelink('shutdown'); Screen('closeall'); return;enderror=el.ABORT_EXPT;