PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
SCPI_Device.h File Reference

Containing defines and function prototypes of the SCPI part of the device. More...

#include "../libraries/scpi-parser/inc/scpi/parser.h"
#include "../libraries/scpi-parser/inc/scpi/ieee488.h"
#include "../libraries/scpi-parser/inc/scpi/error.h"
#include "../libraries/scpi-parser/inc/scpi/constants.h"
#include "../libraries/scpi-parser/inc/scpi/minimal.h"
#include "../libraries/scpi-parser/inc/scpi/units.h"
#include "../libraries/scpi-parser/inc/scpi/utils.h"
#include "../libraries/scpi-parser/inc/scpi/expression.h"
#include "../Configuration.h"

Go to the source code of this file.

Typedefs

typedef enum SCPIChannelParameters SCPIChannelParameters_t
 Available SCPI channel parameters.
 

Enumerations

enum  SCPIChannelParameters {
  SCPI_CHPARAM_OUTPUTSTATE , SCPI_CHPARAM_AMPLITUDE , SCPI_CHPARAM_OFFSET , SCPI_CHPARAM_FREQUENCY ,
  SCPI_CHPARAM_SIGNALFORM , SCPI_CHPARAM_MEASURED_AMPLITUDE , SCPI_CHPARAM_MEASURED_CURRENT , SCPI_CHPARAM_MEASURED_POWER ,
  SCPI_CHPARAM_OVP_LEVEL , SCPI_CHPARAM_OVP_STATE , SCPI_CHPARAM_OVP_DELAY , SCPI_CHPARAM_OCP_LEVEL ,
  SCPI_CHPARAM_OCP_STATE , SCPI_CHPARAM_OCP_DELAY , SCPI_CHPARAM_OPP_LEVEL , SCPI_CHPARAM_OPP_STATE ,
  SCPI_CHPARAM_OPP_DELAY
}
 Available SCPI channel parameters. More...
 

Functions

size_t SCPI_Write (scpi_t *context, const char *data, size_t len)
 Write data to SCPI output.
 
scpi_result_t SCPI_Flush (scpi_t *context)
 Flush data to SCPI output.
 
int SCPI_Error (scpi_t *context, int_fast16_t err)
 Emit error to the SCPI output.
 
scpi_result_t SCPI_Control (scpi_t *context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val)
 Wrapper function to control interface from context.
 
scpi_result_t SCPI_Reset (scpi_t *context)
 Called when a *RST command is received.
 
void SCPI_Init_Device ()
 Initialize the SCPI part of the device.
 
scpi_result_t SCPI_SetResult_ChannelOutOfRange (scpi_t *context)
 Return a "Channel number out of range." message with the SCPI context.
 
scpi_result_t SCPI_SetResult_NotSupportedByChannel (scpi_t *context)
 Return a "Operation not supported by channel." message with the SCPI context.
 
scpi_result_t SCPI_QueryChannelParameter (scpi_t *context, SCPIChannelParameters_t paramType)
 Query the value of a specific channel parameter and write it to the output.
 
scpi_result_t SCPI_SetChannelParameter (scpi_t *context, SCPIChannelParameters_t paramType)
 Set the value of a specific channel parameter to the value given with the SCPI parameter.
 
bool SCPI_GetNumericFromParam (scpi_t *context, const scpi_number_t &param, float &value, scpi_unit_t unit, float min, float max, float def, float step)
 Get the numeric repesentation from the SCPI parameter.
 
scpi_result_t scpi_cmd_outputState (scpi_t *context)
 Function executed when the OUTPut#[:STATe] command was received.
 
scpi_result_t scpi_cmd_outputStateQ (scpi_t *context)
 Function executed when the OUTPut#[:STATe]?
 
scpi_result_t scpi_cmd_outputGeneral (scpi_t *context)
 Function executed when the OUTPut:GENeral command was received.
 
scpi_result_t scpi_cmd_outputGeneralQ (scpi_t *context)
 Function executed when the OUTPut:GENeral?
 
scpi_result_t scpi_cmd_measureScalarCurrentDCQ (scpi_t *context)
 Function executed when the MEASure#[:SCALar]:CURRent[:DC]?
 
scpi_result_t scpi_cmd_measureScalarPowerDCQ (scpi_t *context)
 Function executed when the MEASure#[:SCALar]:POWer[:DC]?
 
scpi_result_t scpi_cmd_measureScalarVoltageDCQ (scpi_t *context)
 Function executed when the MEASure#[:SCALar][:VOLTage][:DC]?
 
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitude (scpi_t *context)
 Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate][:AMPLitude] command was received.
 
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitudeQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate][:AMPLitude]?
 
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffset (scpi_t *context)
 Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate]:OFFSet command was received.
 
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffsetQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate]:OFFSet?
 
scpi_result_t scpi_cmd_sourceVoltageProtectionLevel (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection[:LEVel] command was received.
 
scpi_result_t scpi_cmd_sourceVoltageProtectionLevelQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection[:LEVel]?
 
scpi_result_t scpi_cmd_sourceVoltageProtectionState (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:STATe command was received.
 
scpi_result_t scpi_cmd_sourceVoltageProtectionStateQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:STATe?
 
scpi_result_t scpi_cmd_sourceVoltageProtectionDelay (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:DELay command was received.
 
scpi_result_t scpi_cmd_sourceVoltageProtectionDelayQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:DELay?
 
scpi_result_t scpi_cmd_sourceVoltageProtectionTrippedQ (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:TRIPped?
 
scpi_result_t scpi_cmd_sourceVoltageProtectionClear (scpi_t *context)
 Function executed when the SOURce#:VOLTage:PROTection:CLEar command was received.
 
scpi_result_t scpi_cmd_sourceCurrentProtectionLevel (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection[:LEVel] command was received.
 
scpi_result_t scpi_cmd_sourceCurrentProtectionLevelQ (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection[:LEVel]?
 
scpi_result_t scpi_cmd_sourceCurrentProtectionState (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:STATe command was received.
 
scpi_result_t scpi_cmd_sourceCurrentProtectionStateQ (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:STATe?
 
scpi_result_t scpi_cmd_sourceCurrentProtectionDelay (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:DELay command was received.
 
scpi_result_t scpi_cmd_sourceCurrentProtectionDelayQ (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:DELay?
 
scpi_result_t scpi_cmd_sourceCurrentProtectionTrippedQ (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:TRIPped?
 
scpi_result_t scpi_cmd_sourceCurrentProtectionClear (scpi_t *context)
 Function executed when the SOURce#:CURRent:PROTection:CLEar command was received.
 
scpi_result_t scpi_cmd_sourcePowerProtectionLevel (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection[:LEVel] command was received.
 
scpi_result_t scpi_cmd_sourcePowerProtectionLevelQ (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection[:LEVel]?
 
scpi_result_t scpi_cmd_sourcePowerProtectionState (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:STATe command was received.
 
scpi_result_t scpi_cmd_sourcePowerProtectionStateQ (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:STATe?
 
scpi_result_t scpi_cmd_sourcePowerProtectionDelay (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:DELay command was received.
 
scpi_result_t scpi_cmd_sourcePowerProtectionDelayQ (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:DELay?
 
scpi_result_t scpi_cmd_sourcePowerProtectionTrippedQ (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:TRIPped?
 
scpi_result_t scpi_cmd_sourcePowerProtectionClear (scpi_t *context)
 Function executed when the SOURce#:POWer:PROTection:CLEar command was received.
 
scpi_result_t scpi_cmd_sourceFrequencyFixed (scpi_t *context)
 Function executed when the SOURce#:FREQuency[:CW] command was received.
 
scpi_result_t scpi_cmd_sourceFrequencyFixedQ (scpi_t *context)
 Function executed when the SOURce#:FREQuency[:CW]?
 
scpi_result_t scpi_cmd_sourceFunctionShape (scpi_t *context)
 Function executed when the SOURce#:FUNCtion[:SHAPe] command was received.
 
scpi_result_t scpi_cmd_sourceFunctionShapeQ (scpi_t *context)
 Function executed when the SOURce#:FUNCtion[:SHAPe]?
 
scpi_result_t scpi_cmd_sourceFunctionModeQ (scpi_t *context)
 Function executed when the SOURce#:FUNCtion:MODE?
 
scpi_result_t scpi_cmd_systemLocal (scpi_t *context)
 Function executed when the SYSTem:LOCal command was received.
 
scpi_result_t scpi_cmd_systemRemote (scpi_t *context)
 Function executed when the SYSTem:REMote command was received.
 
scpi_result_t scpi_cmd_systemRWLock (scpi_t *context)
 Function executed when the SYSTem:RWLock command was received.
 
scpi_result_t scpi_cmd_systemChannelCountQ (scpi_t *context)
 Function executed when the SYSTem:CHANnel:COUNt?
 
scpi_result_t scpi_cmd_systemFirmwareQ (scpi_t *context)
 Function executed when the SYSTem:FIRMware?
 
scpi_result_t scpi_cmd_systemSnoQ (scpi_t *context)
 Function executed when the SYSTem:SNO?
 
scpi_result_t scpi_cmd_systemMeasureScalarVoltageDCQ (scpi_t *context)
 Function executed when the SYSTem:MEASure[:SCALar][:VOLTage][:DC]?
 
scpi_result_t scpi_cmd_memoryRcl (scpi_t *context)
 Function executed when the *RCL command was received.
 
scpi_result_t scpi_cmd_memorySav (scpi_t *context)
 Function executed when the *SAV command was received.
 
scpi_result_t scpi_cmd_instrumentSelect (scpi_t *context)
 Function executed when the INSTrument[:SELect] command was received.
 
scpi_result_t scpi_cmd_instrumentSelectQ (scpi_t *context)
 Function executed when the INSTrument[:SELect]?
 
scpi_result_t scpi_cmd_instrumentNSelect (scpi_t *context)
 Function executed when the INSTrument:NSELect command was received.
 
scpi_result_t scpi_cmd_instrumentNSelectQ (scpi_t *context)
 Function executed when the INSTrument:NSELect?
 

Variables

scpi_t scpi_context
 Global scpi_t object.
 

Detailed Description

Containing defines and function prototypes of the SCPI part of the device.

Date
01.12.2020 18:08:03
Author
Markus Scheich

Typedef Documentation

◆ SCPIChannelParameters_t

Available SCPI channel parameters.

Enumeration with all channel parameters that are available through the SCPI interface.

Enumeration Type Documentation

◆ SCPIChannelParameters

Available SCPI channel parameters.

Enumeration with all channel parameters that are available through the SCPI interface.

Enumerator
SCPI_CHPARAM_OUTPUTSTATE 

Output state (Enabled/Disabled) channel parameter.

SCPI_CHPARAM_AMPLITUDE 

Amplitude channel parameter.

SCPI_CHPARAM_OFFSET 

Offset channel parameter.

SCPI_CHPARAM_FREQUENCY 

Frequency channel parameter.

SCPI_CHPARAM_SIGNALFORM 

Signal form channel parameter.

SCPI_CHPARAM_MEASURED_AMPLITUDE 

Measured amplitude channel parameter.

SCPI_CHPARAM_MEASURED_CURRENT 

Measured current channel parameter.

SCPI_CHPARAM_MEASURED_POWER 

Measured power channel parameter.

SCPI_CHPARAM_OVP_LEVEL 

Over voltage protection level channel parameter.

SCPI_CHPARAM_OVP_STATE 

Over voltage protection state (Enabled/Disabled) channel parameter.

SCPI_CHPARAM_OVP_DELAY 

Over voltage protection delay channel parameter.

SCPI_CHPARAM_OCP_LEVEL 

Over current protection level channel parameter.

SCPI_CHPARAM_OCP_STATE 

Over current protection state (Enabled/Disabled) channel parameter.

SCPI_CHPARAM_OCP_DELAY 

Over current protection delay channel parameter.

SCPI_CHPARAM_OPP_LEVEL 

Over power protection level channel parameter.

SCPI_CHPARAM_OPP_STATE 

Over power protection state (Enabled/Disabled) channel parameter.

SCPI_CHPARAM_OPP_DELAY 

Over power protection delay channel parameter.

Function Documentation

◆ scpi_cmd_instrumentNSelectQ()

scpi_result_t scpi_cmd_instrumentNSelectQ ( scpi_t * context)

Function executed when the INSTrument:NSELect?

command was received.

◆ scpi_cmd_instrumentSelectQ()

scpi_result_t scpi_cmd_instrumentSelectQ ( scpi_t * context)

Function executed when the INSTrument[:SELect]?

command was received.

◆ scpi_cmd_measureScalarCurrentDCQ()

scpi_result_t scpi_cmd_measureScalarCurrentDCQ ( scpi_t * context)

Function executed when the MEASure#[:SCALar]:CURRent[:DC]?

command was received.

◆ scpi_cmd_measureScalarPowerDCQ()

scpi_result_t scpi_cmd_measureScalarPowerDCQ ( scpi_t * context)

Function executed when the MEASure#[:SCALar]:POWer[:DC]?

command was received.

◆ scpi_cmd_measureScalarVoltageDCQ()

scpi_result_t scpi_cmd_measureScalarVoltageDCQ ( scpi_t * context)

Function executed when the MEASure#[:SCALar][:VOLTage][:DC]?

command was received.

◆ scpi_cmd_outputGeneralQ()

scpi_result_t scpi_cmd_outputGeneralQ ( scpi_t * context)

Function executed when the OUTPut:GENeral?

command was received.

◆ scpi_cmd_outputStateQ()

scpi_result_t scpi_cmd_outputStateQ ( scpi_t * context)

Function executed when the OUTPut#[:STATe]?

command was received.

◆ scpi_cmd_sourceCurrentProtectionDelayQ()

scpi_result_t scpi_cmd_sourceCurrentProtectionDelayQ ( scpi_t * context)

Function executed when the SOURce#:CURRent:PROTection:DELay?

command was received.

◆ scpi_cmd_sourceCurrentProtectionLevelQ()

scpi_result_t scpi_cmd_sourceCurrentProtectionLevelQ ( scpi_t * context)

Function executed when the SOURce#:CURRent:PROTection[:LEVel]?

command was received.

◆ scpi_cmd_sourceCurrentProtectionStateQ()

scpi_result_t scpi_cmd_sourceCurrentProtectionStateQ ( scpi_t * context)

Function executed when the SOURce#:CURRent:PROTection:STATe?

command was received.

◆ scpi_cmd_sourceCurrentProtectionTrippedQ()

scpi_result_t scpi_cmd_sourceCurrentProtectionTrippedQ ( scpi_t * context)

Function executed when the SOURce#:CURRent:PROTection:TRIPped?

command was received.

◆ scpi_cmd_sourceFrequencyFixedQ()

scpi_result_t scpi_cmd_sourceFrequencyFixedQ ( scpi_t * context)

Function executed when the SOURce#:FREQuency[:CW]?

command was received.

◆ scpi_cmd_sourceFunctionModeQ()

scpi_result_t scpi_cmd_sourceFunctionModeQ ( scpi_t * context)

Function executed when the SOURce#:FUNCtion:MODE?

command was received.

◆ scpi_cmd_sourceFunctionShapeQ()

scpi_result_t scpi_cmd_sourceFunctionShapeQ ( scpi_t * context)

Function executed when the SOURce#:FUNCtion[:SHAPe]?

command was received.

◆ scpi_cmd_sourcePowerProtectionDelayQ()

scpi_result_t scpi_cmd_sourcePowerProtectionDelayQ ( scpi_t * context)

Function executed when the SOURce#:POWer:PROTection:DELay?

command was received.

◆ scpi_cmd_sourcePowerProtectionLevelQ()

scpi_result_t scpi_cmd_sourcePowerProtectionLevelQ ( scpi_t * context)

Function executed when the SOURce#:POWer:PROTection[:LEVel]?

command was received.

◆ scpi_cmd_sourcePowerProtectionStateQ()

scpi_result_t scpi_cmd_sourcePowerProtectionStateQ ( scpi_t * context)

Function executed when the SOURce#:POWer:PROTection:STATe?

command was received.

◆ scpi_cmd_sourcePowerProtectionTrippedQ()

scpi_result_t scpi_cmd_sourcePowerProtectionTrippedQ ( scpi_t * context)

Function executed when the SOURce#:POWer:PROTection:TRIPped?

command was received.

◆ scpi_cmd_sourceVoltageLevelImmediateAmplitudeQ()

scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitudeQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate][:AMPLitude]?

command was received.

◆ scpi_cmd_sourceVoltageLevelImmediateOffsetQ()

scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffsetQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate]:OFFSet?

command was received.

◆ scpi_cmd_sourceVoltageProtectionDelayQ()

scpi_result_t scpi_cmd_sourceVoltageProtectionDelayQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage:PROTection:DELay?

command was received.

◆ scpi_cmd_sourceVoltageProtectionLevelQ()

scpi_result_t scpi_cmd_sourceVoltageProtectionLevelQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage:PROTection[:LEVel]?

command was received.

◆ scpi_cmd_sourceVoltageProtectionStateQ()

scpi_result_t scpi_cmd_sourceVoltageProtectionStateQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage:PROTection:STATe?

command was received.

◆ scpi_cmd_sourceVoltageProtectionTrippedQ()

scpi_result_t scpi_cmd_sourceVoltageProtectionTrippedQ ( scpi_t * context)

Function executed when the SOURce#:VOLTage:PROTection:TRIPped?

command was received.

◆ scpi_cmd_systemChannelCountQ()

scpi_result_t scpi_cmd_systemChannelCountQ ( scpi_t * context)

Function executed when the SYSTem:CHANnel:COUNt?

command was received.

◆ scpi_cmd_systemFirmwareQ()

scpi_result_t scpi_cmd_systemFirmwareQ ( scpi_t * context)

Function executed when the SYSTem:FIRMware?

command was received.

◆ scpi_cmd_systemMeasureScalarVoltageDCQ()

scpi_result_t scpi_cmd_systemMeasureScalarVoltageDCQ ( scpi_t * context)

Function executed when the SYSTem:MEASure[:SCALar][:VOLTage][:DC]?

command was received.

◆ scpi_cmd_systemSnoQ()

scpi_result_t scpi_cmd_systemSnoQ ( scpi_t * context)

Function executed when the SYSTem:SNO?

command was received.

◆ SCPI_Control()

scpi_result_t SCPI_Control ( scpi_t * context,
scpi_ctrl_name_t ctrl,
scpi_reg_val_t val )

Wrapper function to control interface from context.

Parameters
contextSCPI parser context
ctrlNumber of control message
valValue of related register

◆ SCPI_Error()

int SCPI_Error ( scpi_t * context,
int_fast16_t err )

Emit error to the SCPI output.

Parameters
contextSCPI parser context
errError to emit

◆ SCPI_Flush()

scpi_result_t SCPI_Flush ( scpi_t * context)

Flush data to SCPI output.

Parameters
contextSCPI parser context
Returns
Flush status (SCPI_RES_OK or SCPI_RES_ERR)

◆ SCPI_GetNumericFromParam()

bool SCPI_GetNumericFromParam ( scpi_t * context,
const scpi_number_t & param,
float & value,
scpi_unit_t unit,
float min,
float max,
float def,
float step )

Get the numeric repesentation from the SCPI parameter.

Special parameters like MIN, DEF, UP, ... are supported. The value is also coerced to be between min and max.

Parameters
contextSCPI parser context
paramscpi_number_t returned by the SCPI_ParamNumber() method
valueOutput variable with the numeric representation of the SCPI parameter
unitSCPI base unit that is used to discard values with other units.
minMinimum value. All values below this number are coerced to min.
maxMaximum value. All values above this number are coerced to max.
defDefault value. This value is used if DEF is received as SCPI parameter.
stepStep value. This value is used to step up or down the value if UP or DOWN are received as SCPI parameters.
Returns
False on error, otherwise true.

◆ SCPI_QueryChannelParameter()

scpi_result_t SCPI_QueryChannelParameter ( scpi_t * context,
SCPIChannelParameters_t paramType )

Query the value of a specific channel parameter and write it to the output.

Parameters
contextSCPI parser context
paramTypeWhich channel parameter should be returned
Returns
Query status (SCPI_RES_OK or SCPI_RES_ERR)

◆ SCPI_Reset()

scpi_result_t SCPI_Reset ( scpi_t * context)

Called when a *RST command is received.

Parameters
contextSCPI parser context
Returns
Reset status (SCPI_RES_OK or SCPI_RES_ERR)

◆ SCPI_SetChannelParameter()

scpi_result_t SCPI_SetChannelParameter ( scpi_t * context,
SCPIChannelParameters_t paramType )

Set the value of a specific channel parameter to the value given with the SCPI parameter.

Parameters
contextSCPI parser context
paramTypeWhich channel parameter should be set
Returns
Set status (SCPI_RES_OK or SCPI_RES_ERR)

◆ SCPI_SetResult_ChannelOutOfRange()

scpi_result_t SCPI_SetResult_ChannelOutOfRange ( scpi_t * context)

Return a "Channel number out of range." message with the SCPI context.

Parameters
contextSCPI parser context
Returns
Always returns SCPI_RES_ERR

◆ SCPI_SetResult_NotSupportedByChannel()

scpi_result_t SCPI_SetResult_NotSupportedByChannel ( scpi_t * context)

Return a "Operation not supported by channel." message with the SCPI context.

Parameters
contextSCPI parser context
Returns
Always returns SCPI_RES_ERR

◆ SCPI_Write()

size_t SCPI_Write ( scpi_t * context,
const char * data,
size_t len )

Write data to SCPI output.

The SCPI parser uses this function to write the given data to an output stream (e.g. for user response).

Parameters
contextSCPI parser context
dataData to write
lenLength of the data in bytes
Returns
Number of written bytes