Keisuke Sehara
/
STM32_Whisking
fast-feedback virtual target task code on STM Nucleo
task.h
- Committer:
- gwappa
- Date:
- 2018-07-04
- Revision:
- 25:56c4b22ec034
- Parent:
- 22:41163fb3fdc6
- Child:
- 27:b31ea8d74f9e
File content as of revision 25:56c4b22ec034:
#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', (5000) #define CFG_DELAY_VAR 'd', (3000) #define CFG_PREP_DUR 'p', (1500) #define CFG_AUD_DUR 'a', (8000) #define CFG_AUD_FREQ 'f', (4) #define CFG_RESP_DUR 'y', (4000) #define CFG_POST_DUR 'n', (4000) #define CFG_REWARD_DUR 'r', (50) #define CFG_PRE_MIN 'o', (1000) #define CFG_VIS_MIN 'j', (1000) #define CFG_VIS_AVG 'v', (2000) #define CFG_VIS_FREQ 'b', (6) #define CFG_VIS_FAIL 'q', (30) #define CFG_WHISK_DEBOUNCE 'w', (5) #define CFG_LICK_DEBOUNCE 'l', (80) 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_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_blink_hz; // the blinking frequency (any positive number), or disabled (0) Property<uint16_t> vis_fail_perc; // the 'failure rate' of the (passive) visual cue. Property<uint16_t> whisk_debounce_ms; // the debounce period for whisking events. Property<uint16_t> lick_debounce_ms; // the debouncing period for licking events. Action test_reward; Action run; explicit Task(const Mode& mode=Pair); void parseFromSerial(); private: void testReward(); void runTrial(); void writeSettingsToSerial(); }; #endif