Keisuke Sehara
/
STM32_Whisking
fast-feedback virtual target task code on STM Nucleo
task.h
- Committer:
- gwappa
- Date:
- 2018-06-25
- Revision:
- 14:af3adf5d5ddf
- Parent:
- 13:8ea85a33e37a
- Child:
- 15:20f7f737c256
File content as of revision 14:af3adf5d5ddf:
#ifndef TASK_H_ #define TASK_H_ #include "mbed.h" #include "config.h" /* * command characters */ #define CMD_TEST_REWARD 'T' #define CMD_EXECUTE 'X' #define CHR_DELAY_MIN 'm' #define CHR_DELAY_VAR 'd' #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_DUR 'r' #define CHR_VIS_MIN 'j' #define CHR_VIS_AVG 'v' #define CHR_VIS_FAIL 'q' enum Mode { Pair, Report, Associate, Motion }; 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; 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_ms; // the duration of reward. 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