Skip to content
Snippets Groups Projects
Commit 28ec88ea authored by jsiegle's avatar jsiegle
Browse files

Remove parameter initialization from header file

parent e0590a2c
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,8 @@
PulsePal::PulsePal()
{
setDefaultParameters();
}
PulsePal::~PulsePal()
......@@ -45,6 +46,30 @@ PulsePal::~PulsePal()
serial.close();
}
void PulsePal::setDefaultParameters()
{
for (int i = 1; i < 5; i++)
{
currentOutputParams[i].isBiphasic = 0;
currentOutputParams[i].phase1Voltage = 5;
currentOutputParams[i].phase2Voltage = -5;
currentOutputParams[i].phase1Duration = 0.001;
currentOutputParams[i].interPhaseInterval = 0.001;
currentOutputParams[i].phase2Duration = 0.001;
currentOutputParams[i].interPulseInterval = 0.01;
currentOutputParams[i].burstDuration = 0;
currentOutputParams[i].interBurstInterval = 0;
currentOutputParams[i].pulseTrainDuration = 1;
currentOutputParams[i].pulseTrainDelay = 0;
currentOutputParams[i].linkTriggerChannel1 = 1;
currentOutputParams[i].linkTriggerChannel2 = 0;
currentOutputParams[i].customTrainID = 0;
currentOutputParams[i].customTrainTarget = 0;
currentOutputParams[i].customTrainLoop = 0;
}
}
void PulsePal::initialize()
{
......@@ -78,7 +103,7 @@ uint32_t PulsePal::getFirmwareVersion() // JS 1/30/2014
uint8_t handshakeByte = 72;
uint8_t responseBytes[5] = { 0 };
serial.writeByte(handshakeByte);
Sleep(100);
usleep(100000);
serial.readBytes(responseBytes,5);
firmwareVersion = makeLong(responseBytes[4], responseBytes[3], responseBytes[2], responseBytes[1]);
return firmwareVersion;
......
......@@ -44,9 +44,11 @@ public:
PulsePal();
~PulsePal();
void initialize();
uint32_t PulsePal::getFirmwareVersion();
uint32_t getFirmwareVersion();
void disconnectClient();
void setDefaultParameters();
// Program single parameter
void setBiphasic(uint8_t channel, bool isBiphasic);
void setPhase1Voltage(uint8_t channel, float voltage);
......@@ -82,22 +84,22 @@ public:
// Fields
struct OutputParams {
int isBiphasic = 0;
float phase1Voltage = 5;
float phase2Voltage = -5;
float phase1Duration = 0.001;
float interPhaseInterval = 0.001;
float phase2Duration = 0.001;
float interPulseInterval = 0.01;
float burstDuration = 0;
float interBurstInterval = 0;
float pulseTrainDuration = 1;
float pulseTrainDelay = 0;
int linkTriggerChannel1 = 1;
int linkTriggerChannel2 = 0;
int customTrainID = 0;
int customTrainTarget = 0;
int customTrainLoop = 0;
int isBiphasic;
float phase1Voltage;
float phase2Voltage;
float phase1Duration;
float interPhaseInterval;
float phase2Duration;
float interPulseInterval;
float burstDuration;
float interBurstInterval;
float pulseTrainDuration;
float pulseTrainDelay;
int linkTriggerChannel1;
int linkTriggerChannel2;
int customTrainID;
int customTrainTarget;
int customTrainLoop;
} currentOutputParams[5]; // Use 1-indexing for the channels (output channels 1-4 = currentOutputParams[1]-currentOutputParams[4])
struct InputParams {
int triggerMode;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment