Keisuke Sehara / Mbed 2 deprecated STM32_Whisking

Dependencies:   mbed

Revision:
11:897ecd5413e0
Parent:
9:e136394bdb39
Child:
12:06ea96546af1
--- a/rig.cpp	Tue Jun 19 10:11:23 2018 +0000
+++ b/rig.cpp	Thu Jun 21 17:57:22 2018 +0000
@@ -1,4 +1,15 @@
 #include "rig.h"
+#include "utils.h"
+
+#define ARDUINO_12 PA_6
+#define ARDUINO_13 PA_5
+
+#define ARDUINO_A0 PA_0
+#define ARDUINO_A1 PA_1
+#define ARDUINO_A2 PA_4
+#define ARDUINO_A3 PB_0
+#define ARDUINO_A4 PC_1
+#define ARDUINO_A5 PC_0
 
 // the task timer
 Timer        timer;
@@ -6,23 +17,23 @@
 // state time out
 Timeout      stateTimeout;
 
-// reward time out
-Timeout      rewardTimeout;
-
 // trigger time out for TASK output
 Timeout      triggerTimeout;
 
+// ticker for audio cue
+Ticker       buzzerTicker;
+
 // input
-InterruptIn  whiskIn(PC_0);   // (Arduino#A5) or USER_BUTTON
-InterruptIn  lickIn(PC_1);    // (Arduino#A4) or USER_BUTTON
+InterruptIn  whiskIn(ARDUINO_12);   // or USER_BUTTON
+InterruptIn  lickIn(ARDUINO_13);    // or USER_BUTTON
 
 // output
-DigitalOut   cueOut(PA_4);    // (Arduino#A3) or LED1
-DigitalOut   rewardOut(PA_1); // (Arduino#A2)
-DigitalOut   enableOut(PA_0); // (Arduino#A1)
+DigitalOut   audioOut(ARDUINO_A0);    // or LED1
+Conditioning visualOut(ARDUINO_A1); // 
+Duration     rewardOut(ARDUINO_A2); //
 
-DigitalOut   trialStart(PA_5);    // (Arduino#13) or any other pin
-DigitalOut   trialEnd(PA_6);   // (Arduino#12)
+Duration     trialStart(ARDUINO_A3, ms_to_us(TRIGGER_DUR_MS));   // or any other pin
+Duration     trialEnd(ARDUINO_A4,   ms_to_us(TRIGGER_DUR_MS));   // 
 
 Task        task(Pair);
 Trial       trial;