Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
rig.cpp@12:06ea96546af1, 2018-06-25 (annotated)
- Committer:
- gwappa
- Date:
- Mon Jun 25 12:10:31 2018 +0000
- Revision:
- 12:06ea96546af1
- Parent:
- 11:897ecd5413e0
- Child:
- 20:4c06d3041337
extend Pulse class to accommodate the usage for visual cue output
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gwappa | 3:991c6d5ce19d | 1 | #include "rig.h" |
gwappa | 11:897ecd5413e0 | 2 | #include "utils.h" |
gwappa | 11:897ecd5413e0 | 3 | |
gwappa | 11:897ecd5413e0 | 4 | #define ARDUINO_12 PA_6 |
gwappa | 11:897ecd5413e0 | 5 | #define ARDUINO_13 PA_5 |
gwappa | 11:897ecd5413e0 | 6 | |
gwappa | 11:897ecd5413e0 | 7 | #define ARDUINO_A0 PA_0 |
gwappa | 11:897ecd5413e0 | 8 | #define ARDUINO_A1 PA_1 |
gwappa | 11:897ecd5413e0 | 9 | #define ARDUINO_A2 PA_4 |
gwappa | 11:897ecd5413e0 | 10 | #define ARDUINO_A3 PB_0 |
gwappa | 11:897ecd5413e0 | 11 | #define ARDUINO_A4 PC_1 |
gwappa | 11:897ecd5413e0 | 12 | #define ARDUINO_A5 PC_0 |
gwappa | 3:991c6d5ce19d | 13 | |
gwappa | 3:991c6d5ce19d | 14 | // the task timer |
gwappa | 3:991c6d5ce19d | 15 | Timer timer; |
gwappa | 3:991c6d5ce19d | 16 | |
gwappa | 3:991c6d5ce19d | 17 | // state time out |
gwappa | 3:991c6d5ce19d | 18 | Timeout stateTimeout; |
gwappa | 3:991c6d5ce19d | 19 | |
gwappa | 9:e136394bdb39 | 20 | // trigger time out for TASK output |
gwappa | 9:e136394bdb39 | 21 | Timeout triggerTimeout; |
gwappa | 9:e136394bdb39 | 22 | |
gwappa | 11:897ecd5413e0 | 23 | // ticker for audio cue |
gwappa | 11:897ecd5413e0 | 24 | Ticker buzzerTicker; |
gwappa | 11:897ecd5413e0 | 25 | |
gwappa | 3:991c6d5ce19d | 26 | // input |
gwappa | 11:897ecd5413e0 | 27 | InterruptIn whiskIn(ARDUINO_12); // or USER_BUTTON |
gwappa | 11:897ecd5413e0 | 28 | InterruptIn lickIn(ARDUINO_13); // or USER_BUTTON |
gwappa | 3:991c6d5ce19d | 29 | |
gwappa | 3:991c6d5ce19d | 30 | // output |
gwappa | 11:897ecd5413e0 | 31 | DigitalOut audioOut(ARDUINO_A0); // or LED1 |
gwappa | 12:06ea96546af1 | 32 | Pulse visualOut(ARDUINO_A1); // |
gwappa | 12:06ea96546af1 | 33 | Pulse rewardOut(ARDUINO_A2); // |
gwappa | 9:e136394bdb39 | 34 | |
gwappa | 12:06ea96546af1 | 35 | Pulse trialStart(ARDUINO_A3, ms_to_us(TRIGGER_DUR_MS)); // or any other pin |
gwappa | 12:06ea96546af1 | 36 | Pulse trialEnd(ARDUINO_A4, ms_to_us(TRIGGER_DUR_MS)); // |
gwappa | 3:991c6d5ce19d | 37 | |
gwappa | 3:991c6d5ce19d | 38 | Task task(Pair); |
gwappa | 3:991c6d5ce19d | 39 | Trial trial; |