Keisuke Sehara / Mbed 2 deprecated STM32_Whisking

Dependencies:   mbed

Revision:
2:0c241937eabd
Child:
3:991c6d5ce19d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trial.h	Mon May 14 18:07:57 2018 +0000
@@ -0,0 +1,54 @@
+#ifndef TRIAL_H_
+#define TRIAL_H_
+
+#include "task.h"
+
+namespace TrialFlags {
+    // nothing
+    const char Clear     = 0x00;
+    // flags if the auditory cue is there during the trial
+    const char Cues      = 0x01;
+    // flags if any whisking event 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 Trial {
+    /**
+    * whether the animal whisked during the cue.
+    * + whether the animal waited for the cue.
+    */
+    char          response;
+    /**
+    * the timestamp when the trial started.
+    */
+    unsigned long starting;
+    /**
+    * the timestamp when the cue started
+    */
+    unsigned long cuestarting;
+    /**
+    * the total waiting period for the animal during this trial before the cue.
+    */
+    unsigned long waiting;   // used for calculation of waiting period
+    /**
+    * the duration of the delay period for this trial.
+    */
+    uint16_t      delay_dur_ms;
+    
+    void reset(const Task& task);
+    
+    void writeToSerial();
+};
+
+#endif
\ No newline at end of file