FFI for clamp control
Currently I am accessing GUI elements directly for many these. My ideal API would look like:
GetClampState(headstage)
Returns:
{
'Mode': 'IC'|'VC'|'I=0',
'HoldingPotential': float,
'HoldingPotentialEnable': bool,
'BiasCurrent': float,
'BiasCurrentEnable': bool,
'AutoBiasVcom': float,
'AutoBiasVcomVariance': float,
'AutoBiasIbiasmax': float,
'AutoBiasEnable': float,
'PipetteOffsetVC': float,
'PipetteOffsetIC': float,
}
SetClampMode(headstage, mode)
SetHoldingPotential(headstage, value, enable)
SetBiasCurrent(headstage, value, enable)
SetAutoBias(headstage, target_potential, enable)
SetHeadstageActive(headstage, enable)
SetTestPulseEnable(headstage, enable)
AutoPipetteOffset(headstage)
AutoCapacitance(headstage)
AutoBridgeBalance(headstage)
Notes:
- All of the functions above are currently possible by accessing GUI elements directly, but many require multiple requests that degrade performance (including setting the headstage selection slider)
- If GetClampState is too expensive as written, it could be broken up into more targeted requests
- All of the values returned by GetClampState are currently being read using the pub/sub topic 'amplifier:set value', but it is also necessary to be able to explicitly request these before such message has been received
- All Set..() functions should return only after the change is complete
- You're welcome to simplify the API by combining set functions, like
setClampParameter(headstage, param_name, value) - Maybe you'll want to add
deviceas the first argument to all functions?
-
[x] GetClampState(headstage) ->
FFI_GetClampState(string device, variable headstage) -
[x] SetClampMode(headstage, mode) ->
FFI_SetClampMode(string device, variable headstage, variable clampMode) -
[x] SetHoldingPotential(headstage, value, enable) ->
FFI_SetHoldingPotential(string device, variable headstage, variable potential) -
[x] SetBiasCurrent(headstage, value, enable) ->
FFI_SetBiasCurrent(string device, variable headstage, variable biasCurrent) -
[x] SetAutoBias(headstage, target_potential, enable) ->
FFI_SetAutoBias(string device, variable headstage, variable potential, variable enable) -
[x] SetHeadstageActive(headstage, enable) ->
FFI_SetHeadstageActive(string device, variable headstage, variable enable) -
[x] SetTestPulseEnable(headstage, enable) ->
FFI_SetTestPulseEnable(string device, variable headstage, variable enable) -
[x] AutoPipetteOffset(headstage)
-
[x] AutoCapacitance(headstage)
-
[x] AutoBridgeBalance(headstage) ->
FFI_TriggerAutoClampControl(string device, variable headstage, variable autoCtrl)
AI_GetFunctionConstantForClampMode -> get ctrl names -> AI_AmpStorageControlToRowLabel and then read from GetAmplifierParamStorageWave
AI_MapFunctionConstantToName for clampState wave
Adapt amplifier function such that GUIWrite = 1 only is effective if current HS equals requested headstage -> done in AI_UpdateAmpView
Move range checks to lower AI_ functions
ctrl = GetPanelControl(i, CHANNEL_TYPE_HEADSTAGE, CHANNEL_CONTROL_CHECK)