fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

Committer:
gwappa
Date:
Mon May 14 18:07:57 2018 +0000
Revision:
2:0c241937eabd
Child:
3:991c6d5ce19d
add (part of) trial implementation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gwappa 2:0c241937eabd 1 #ifndef TRIAL_H_
gwappa 2:0c241937eabd 2 #define TRIAL_H_
gwappa 2:0c241937eabd 3
gwappa 2:0c241937eabd 4 #include "task.h"
gwappa 2:0c241937eabd 5
gwappa 2:0c241937eabd 6 namespace TrialFlags {
gwappa 2:0c241937eabd 7 // nothing
gwappa 2:0c241937eabd 8 const char Clear = 0x00;
gwappa 2:0c241937eabd 9 // flags if the auditory cue is there during the trial
gwappa 2:0c241937eabd 10 const char Cues = 0x01;
gwappa 2:0c241937eabd 11 // flags if any whisking event is detected during the response window
gwappa 2:0c241937eabd 12 const char Responded = 0x02;
gwappa 2:0c241937eabd 13 // flags if licking event is detected during the preparatory/pre-response window
gwappa 2:0c241937eabd 14 const char Licked = 0x04;
gwappa 2:0c241937eabd 15 }
gwappa 2:0c241937eabd 16
gwappa 2:0c241937eabd 17 namespace Responses {
gwappa 2:0c241937eabd 18 const char Hit = 0x03; // cues && responded
gwappa 2:0c241937eabd 19 const char Miss = 0x01; // cues && ~responded
gwappa 2:0c241937eabd 20 const char Catch = 0x02; // ~cues && responded
gwappa 2:0c241937eabd 21 const char Reject = 0x00; // ~cues && ~responded
gwappa 2:0c241937eabd 22 const char Reset = 0x04; // invalid lick
gwappa 2:0c241937eabd 23 const char NA = 0x08; // default
gwappa 2:0c241937eabd 24 }
gwappa 2:0c241937eabd 25
gwappa 2:0c241937eabd 26 struct Trial {
gwappa 2:0c241937eabd 27 /**
gwappa 2:0c241937eabd 28 * whether the animal whisked during the cue.
gwappa 2:0c241937eabd 29 * + whether the animal waited for the cue.
gwappa 2:0c241937eabd 30 */
gwappa 2:0c241937eabd 31 char response;
gwappa 2:0c241937eabd 32 /**
gwappa 2:0c241937eabd 33 * the timestamp when the trial started.
gwappa 2:0c241937eabd 34 */
gwappa 2:0c241937eabd 35 unsigned long starting;
gwappa 2:0c241937eabd 36 /**
gwappa 2:0c241937eabd 37 * the timestamp when the cue started
gwappa 2:0c241937eabd 38 */
gwappa 2:0c241937eabd 39 unsigned long cuestarting;
gwappa 2:0c241937eabd 40 /**
gwappa 2:0c241937eabd 41 * the total waiting period for the animal during this trial before the cue.
gwappa 2:0c241937eabd 42 */
gwappa 2:0c241937eabd 43 unsigned long waiting; // used for calculation of waiting period
gwappa 2:0c241937eabd 44 /**
gwappa 2:0c241937eabd 45 * the duration of the delay period for this trial.
gwappa 2:0c241937eabd 46 */
gwappa 2:0c241937eabd 47 uint16_t delay_dur_ms;
gwappa 2:0c241937eabd 48
gwappa 2:0c241937eabd 49 void reset(const Task& task);
gwappa 2:0c241937eabd 50
gwappa 2:0c241937eabd 51 void writeToSerial();
gwappa 2:0c241937eabd 52 };
gwappa 2:0c241937eabd 53
gwappa 2:0c241937eabd 54 #endif