REQ: gUSBampADC Bipolar Derivation
Posted: 17 Feb 2012, 00:45
I'm not very good at C++ so I'm asking for help putting bipolar derivation into the gUSBamp source module.
From the gUSBampSoftwareManual,
It seems like this would be easy enough to add to the current module. I guess it is something like:
I would prefer to iterate through the channels rather than have them typed out manually, but I don't know how to iterate through fields of a structure in C++. Also, when there's more than one device, must I have a unique BIPOLAR structure for each device (i.e., BipolarDerivation1, BipolarDerivation2, etc)? Finally, to make the module backwards compatible I would prefer to use a variable instead of directly accessing the Parameter, where the variable defaults to 0 for every device x channel and is changed only if the parameter is defined. I also do not know how to do this. Preflight would need to check that the parameter is empty or that it is the same length as SourceCh... that I can do.
So I can spend a day or so hacking something together for myself, or maybe someone else wants to do it properly and contribute it to the core? Is this a desirable feature?
-Chad
From the gUSBampSoftwareManual,
Code: Select all
Status = GT_SetBipolar(HANDLE hDevice, BIPOLAR bipoChannel);
Define the channels for a bipolar derivation.
The function returns true if the call succeeded otherwise it will return false.
Input:
hDevice HANDLE handle of the device
bipoChannel BIPOLAR
Channel1 UCHAR define the channel number for the bipolar derivation with channel 1. If channel 2 is selected, g.USBamp performs a bipolar derivation between channel 1 and 2. Set the channel number to zero if no bipolar derivation should be performed.
Channel2 UCHAR set to channel number or 0
...
Channel16 UCHAR set to channel number or 0
Output:
Status BOOL Status=0 command not successful
Status=1 command successful
Code: Select all
BIPOLAR BipolarDerivation
m_numdevices=Parameter("DeviceIDs")->NumValues();
int deviceChannelsOffset = 0;
for (int dev=0; dev<m_numdevices; dev++)
{
BipolarDerivation.Channel1=(int)Parameter("BipolarList")(deviceChannelsOffset + 0)
.
.
.
BipolarDerivation.Channel16=(int)Parameter("BipolarList")(deviceChannelsOffset + 15)
GT_SetChannels(m_hdev.at(dev), BipolarDerivation)
}
deviceChannelsOffset += 16;
So I can spend a day or so hacking something together for myself, or maybe someone else wants to do it properly and contribute it to the core? Is this a desirable feature?
-Chad