fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

Revision:
19:50663f8815b8
Parent:
17:0b241aa1f5b6
Child:
20:4c06d3041337
--- a/trial.h	Sun Jul 01 13:08:06 2018 +0000
+++ b/trial.h	Mon Jul 02 08:26:44 2018 +0000
@@ -7,32 +7,24 @@
 
 typedef int trialtime_t;
 
-namespace TrialFlags {
-    // nothing
-    const char Clear     = 0x00;
-    // flags if the auditory cue is there during the trial
-    const char Cues      = 0x01;
-    // flags if any "response" is detected during the response window
-    const char Responded = 0x02;
-    // flags if licking event is detected during the preparatory/pre-response window
-    const char Licked    = 0x04;
-}
-
-namespace Responses {
-    const char Hit     = 0x03; // cues && responded
-    const char Miss    = 0x01; // cues && ~responded
-    const char Catch   = 0x02; // ~cues && responded
-    const char Reject  = 0x00; // ~cues && ~responded
-    const char Reset   = 0x04; // invalid lick
-    const char NA      = 0x08; // default
-}
+struct TrialFlag {
+    bool cued;
+    bool responded;
+    bool reset;
+    
+    TrialFlag() cued(false), responded(false), reset(false) {}
+    
+    void reset();
+    void writeToSerial();
+};
 
 struct Trial {
     /**
     * whether the animal whisked during the cue.
     * + whether the animal waited for the cue.
     */
-    char          response;
+    TrialFlag     flag;
+    
     /**
     * the timestamp when the trial started.
     */