PageRenderTime 43ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/DotsX/tasks/countermanding/gXCMDnolevers_hardware.m

http://dotsx.googlecode.com/
MATLAB | 121 lines | 20 code | 11 blank | 90 comment | 1 complexity | ee8833063f930c9b4e1f7abf7f449acf MD5 | raw file
Possible License(s): LGPL-2.0
  1. function hardware_ = gXCMD_hardware(varargin)
  2. %Get hardware device configuration for the simple_demo task
  3. %
  4. % hardware_ = gXsimpleDemo_hardware(varargin)
  5. %
  6. % gXsimpleDemo_hardware returns a cell array of class names, parameters,
  7. % and values for configuring hardware for the simple_demo task. This
  8. % includes:
  9. % two dXbeep objects for task timing
  10. % two dXsound objects for performance feedback
  11. %
  12. % The simple_demo task also uses the dXkbHID hardware device for checking
  13. % keyboard inputs, but that device is automatically activated and
  14. % configured by rInit.
  15. %
  16. % hardware_ is a cell array with rows of the form
  17. % {class_name, number_of_instances, rAdd_args, parameters_and_values}
  18. % See below for details.
  19. %
  20. % This is the form expected by the rGroup function, so invoking
  21. % rGroup('gXsimpleDemo_hardware')
  22. % will add all of the configured hardware devices to ROOT_STRUCT.
  23. %
  24. % gXsimpleDemo_hardware may also be included as a helper for a dXtask, in
  25. % which case the configured hardware devices will be added to the
  26. % ROOT_STRUCT for that task.
  27. %
  28. % varargin may be a boolean specifying whether to mute all sounds.
  29. %
  30. % See also rInit, rGroup, rAdd, taskSimpleDemo
  31. % 2008 by Benjamin Heasly
  32. % University of Pennsylvania
  33. % benjamin.heasly@gmail.com
  34. % (written in the Black Hills of South Dakota!)
  35. % check varargin for a mute value
  36. if nargin && varargin{1}
  37. mute = true;
  38. else
  39. mute = false;
  40. end
  41. % get parameters_and_values for one dXbeep object
  42. % the second is a low tone to scold the subject for an invalid response.
  43. arg_dXbeep = { ...
  44. 'mute', mute, ...
  45. 'frequency', {500}, ...
  46. 'duration', .100, ...
  47. 'gain', .2};
  48. % get parameters_and_values for two dXsound objects
  49. % the first is a Mario coin sound to indicate a correct response.
  50. % the second is a Zelda damage sound to indicate an incorrect response.
  51. arg_dXsound = { ...
  52. 'mute', mute, ...
  53. 'rawSound', {'Coin.wav', 'AOL_Hurt.wav'}, ...% scan 4 analog inputs (vs. ground) at 1000Hz
  54. 'gain', {.5, 2}};
  55. %%%FOR USING LEVERS
  56. % scan 4 analog inputs (vs. ground) at 1000Hz
  57. % % mode = 1 means +/-10V
  58. % chans = 8:11;
  59. % nc = length(chans);
  60. % modes = ones(size(chans));
  61. % f = 1000;
  62. % [load, loadID] = formatPMDReport('AInSetup', chans, modes);
  63. % [start, startID] = formatPMDReport('AInScan', chans, f);
  64. % [stop, stopID] = formatPMDReport('AInStop');
  65. %
  66. % % tell HIDx which channels are in use
  67. % cc = num2cell(chans);
  68. % [PMDChans(1:nc).ID] = deal(cc{:});
  69. %
  70. % % covert integers to decimal Voltages and divide out internal gain
  71. % gc = num2cell(0.01./2);
  72. % [PMDChans(1:nc).gain] = deal(gc{:});
  73. %
  74. % [PMDChans(1:nc).offset] = deal(0);
  75. % [PMDChans(1:nc).high] = deal(nan);
  76. %
  77. % % only report lever state changes
  78. % % i.e. crossing the +3V line
  79. % [PMDChans(1:nc).low] = deal(3);
  80. % [PMDChans(1:nc).delta] = deal(.5);
  81. %
  82. % % convert serial numbers to sample times
  83. % [PMDChans(1:nc).freq] = deal(f);
  84. %
  85. % arg_dXPMDHID = { ...
  86. % 'HIDChannelizer', PMDChans, ...
  87. % 'loadID', loadID, ...
  88. % 'loadReport', load, ...
  89. % 'startID', startID, ...
  90. % 'startReport', start, ...
  91. % 'stopID', stopID, ...
  92. % 'stopReport', stop};
  93. %%END LEVER CODE
  94. % configure the rAdd_args. This tells rAdd four things:
  95. % 1. What group should these objects belong to? 'root' means add
  96. % objects to the root group, which is always active.
  97. %
  98. % 2. Should rAdd try to reuse existing objects of the same type? If so,
  99. % rAdd will configure some existing objects rather than create new ones.
  100. %
  101. % 3. Should rAdd configure objects with rSet immediately upon creation?
  102. %
  103. % 4. Should rGroup reconfigure the object with rSet every time rGroup
  104. % activates this object (e.g. every time the task is activated)?
  105. rAdd_args = {'root', true, true, false};
  106. hardware_ = { ...
  107. 'dXbeep', 1, rAdd_args, arg_dXbeep; ...
  108. 'dXsound', 2, rAdd_args, arg_dXsound; ...
  109. % 'dXPMDHID', 1, rAdd_args, arg_dXPMDHID; ... %%%FOR LEVERS
  110. };