fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

Revision:
29:1fb060aab1f8
Parent:
28:797536a42b9f
Child:
30:5f975f572ffb
--- a/trial.h	Sun Jul 22 16:25:25 2018 +0000
+++ b/trial.h	Mon Oct 01 14:54:37 2018 +0000
@@ -10,12 +10,13 @@
 struct TrialFlag {
     bool cued;
     bool responded;
+    bool rewarded; // only used during Condition mode
     bool reset;
     
-    TrialFlag(): cued(false), responded(false), reset(false) {}
+    TrialFlag(): cued(false), responded(false), rewarded(false), reset(false) {}
     
     void clear();
-    void writeToSerial();
+    void writeToSerial(const Task& task);
 };
 
 struct Trial {
@@ -44,14 +45,8 @@
     */
     uint16_t      delay_dur_ms;
     
-    /**
-    *   the duration of the cued period for this trial.
-    */
-    uint64_t      cued_dur_us;
-    
-    // (passive) visual cue-related params
+    // (passive) visual cue-related param in the Associate mode.
     uint64_t      vis_onset_us;
-    uint64_t      vis_dur_us;
     
     /**
     *   initialize the trial parameters according to the given Task parameter set.
@@ -65,7 +60,9 @@
     *   the `onset` will distribute exponentially from `0` to `auddur - respdur - mindur`.
     *   the `duration` will distribute uniformly from `mindur` to `phasedur - onset`.
     */
-    void assignCues(const Task& task, const bool& assignVisual=true, const bool& canfail=true);
+    void assignAssociative(const Task& task);
+    
+    void assignForFeedback(const Task& task);
     
     /**
     *   a callback mechanism for marking (timestamping) the start of the trial.
@@ -83,13 +80,13 @@
     *   a callback mechanism for marking (timestamping) the end of the trial.
     *   called from one of the automaton states.
     */
-    void markTrialEnd();
+    void markTrialEnd(const Task& task);
     
     /**
     *   output the result of a trial into a serial port through the IO mechanism.
     *   typically called from one of the automaton states.
     */
-    void writeToSerial();
+    void writeToSerial(const Task& task);
 };
 
 #endif
\ No newline at end of file