fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

rig.cpp

Committer:
gwappa
Date:
2018-06-25
Revision:
12:06ea96546af1
Parent:
11:897ecd5413e0
Child:
20:4c06d3041337

File content as of revision 12:06ea96546af1:

#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;

// state time out
Timeout      stateTimeout;

// trigger time out for TASK output
Timeout      triggerTimeout;

// ticker for audio cue
Ticker       buzzerTicker;

// input
InterruptIn  whiskIn(ARDUINO_12);   // or USER_BUTTON
InterruptIn  lickIn(ARDUINO_13);    // or USER_BUTTON

// output
DigitalOut   audioOut(ARDUINO_A0);    // or LED1
Pulse        visualOut(ARDUINO_A1); // 
Pulse        rewardOut(ARDUINO_A2); //

Pulse        trialStart(ARDUINO_A3, ms_to_us(TRIGGER_DUR_MS));   // or any other pin
Pulse        trialEnd(ARDUINO_A4,   ms_to_us(TRIGGER_DUR_MS));   // 

Task        task(Pair);
Trial       trial;