Keisuke Sehara
/
STM32_Whisking
fast-feedback virtual target task code on STM Nucleo
task.h
- Committer:
- gwappa
- Date:
- 2018-07-01
- Revision:
- 17:0b241aa1f5b6
- Parent:
- 16:33c17c62840e
- Child:
- 18:66246d6c5476
File content as of revision 17:0b241aa1f5b6:
#ifndef TASK_H_ #define TASK_H_ #include "mbed.h" #include "config.h" /* * command characters */ #define CMD_TEST_REWARD 'T' #define CMD_EXECUTE 'X' #define CFG_DELAY_MIN ('m', 3000) #define CFG_DELAY_VAR ('d', 3000) #define CHR_PREP_DUR 'p' #define CHR_AUD_DUR 'a' #define CHR_AUD_FREQ 'f' #define CHR_RESP_DUR 'y' #define CHR_POST_DUR 'n' #define CHR_REWARD_ONSET 'u' #define CHR_REWARD_DUR 'r' #define CHR_PRE_MIN 'o' #define CHR_VIS_MIN 'j' #define CHR_VIS_AVG 'v' #define CHR_VIS_FAIL 'q' enum Mode { Pair, Report, Associate, Motion, MotionAlt }; struct ModeSelection: public config::CommandResponder { static const char CMD_ID_MODE; static const char CMD_MODE_PAIR; static const char CMD_MODE_REPORT; static const char CMD_MODE_ASSOCIATE; static const char CMD_MODE_MOTION; static const char CMD_MODE_MOTION_ALT; ModeSelection(); // not allowed explicit ModeSelection(const Mode& defaultValue); virtual ~ModeSelection(); virtual bool parse(const char& c); virtual bool writeSettings(); virtual void echoback(); Mode value; }; struct Task { ModeSelection mode; // the trial mode. Property<uint16_t> delay_min_ms; // the minimum duration for the delay. Property<uint16_t> delay_var_ms; // the average for the (exponential) variable // duration of the delay. Property<uint16_t> prep_dur_ms; // the duration of the "preparatory period", // during which licking is not allowed. Property<uint16_t> aud_dur_ms; // the auditory cue duration. Property<uint16_t> aud_tick_hz; // the frequency of auditory cue flickering. Property<uint16_t> resp_dur_ms; // the size of the minimal 'response window' for the passive paradigms. Property<uint16_t> post_dur_ms; // the post-reward recording duration. Property<uint16_t> reward_on_ms; // the onset of reward relative to visual cue during Pair. Property<uint16_t> reward_dur_ms; // the duration of reward. Property<uint16_t> pre_min_ms; // the minimum onset for the (passive) visual cue. Property<uint16_t> vis_min_ms; // the minimum duration for the (passive) visual cue. Property<uint16_t> vis_avg_ms; // the average duration for the (passive) visual cue. Property<uint16_t> vis_fail_perc; // the 'failure rate' of the (passive) visual cue. Action test_reward; Action run; explicit Task(const Mode& mode=Pair); void parseFromSerial(); private: void testReward(); void runTrial(); void writeSettingsToSerial(); }; #endif