fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

Revision:
30:5f975f572ffb
Parent:
29:1fb060aab1f8
Child:
31:b320ca61a8c0
--- a/task.cpp	Mon Oct 01 14:54:37 2018 +0000
+++ b/task.cpp	Mon Oct 01 15:16:04 2018 +0000
@@ -19,8 +19,9 @@
     vis_test_every      (CFG_VIS_TEST_EVERY),
     whisk_debounce_ms   (CFG_WHISK_DEBOUNCE),
     lick_debounce_ms    (CFG_LICK_DEBOUNCE),
-    test_reward         (CMD_TEST_REWARD, callback(this, &Task::testReward)),
-    run                 (CMD_EXECUTE,     callback(this, &Task::runTrial))
+    test_reward         (CMD_TEST_REWARD, callback(this, &Task::testReward)      ),
+    clear_index         (CMD_CLEAR_INDEX, callback(this, &Task::clearTrialIndex) ),
+    run                 (CMD_EXECUTE,     callback(this, &Task::runTrial)        )
 { }
 
 const char ModeSelection::CMD_ID_MODE        = '_';
@@ -74,6 +75,11 @@
     automaton::run();
     IO::result("done");
 }
+
+void Task::clearTrialIndex() {
+    automaton::init<ClearTrialIndex>();
+    automaton::run();
+}
  
 void Task::runTrial() {
     automaton::init<Delay>();