forked from gilbertf/libft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCT.cpp
More file actions
35 lines (28 loc) · 678 Bytes
/
Copy pathtestCT.cpp
File metadata and controls
35 lines (28 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "ct.hpp"
#include <iostream>
#include <fstream>
using namespace std;
int cyclesAcc;
ofstream outFile;
int OF = 1;
bool simUpdate(const uint8_t pinState, const uint8_t cycles) {
outFile << cyclesAcc * OF << "\t" << (int) pinState * 5 << endl; //Scale to 5V and oversample with 2
cyclesAcc += cycles;
return true;
}
int main() {
CT ct(&simUpdate);
ct.setTxRole(FTCom::SLAVE);
outFile.open("plots/ctOff.test");
ct.setState(0);
while (ct.getState() == FTCom::TRANSMITTING) {
ct.timeElapsed();
}
outFile.close();
outFile.open("plots/ctOn.test");
ct.setState(1);
while (ct.getState() == FTCom::TRANSMITTING) {
ct.timeElapsed();
}
outFile.close();
}