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
Go to the documentation of this file.
1
7
8#ifndef SCPI_DEVICE_H_
9#define SCPI_DEVICE_H_
10
11#include "../libraries/scpi-parser/inc/scpi/parser.h"
12#include "../libraries/scpi-parser/inc/scpi/ieee488.h"
13#include "../libraries/scpi-parser/inc/scpi/error.h"
14#include "../libraries/scpi-parser/inc/scpi/constants.h"
15#include "../libraries/scpi-parser/inc/scpi/minimal.h"
16#include "../libraries/scpi-parser/inc/scpi/units.h"
19
20#include "../Configuration.h"
21
49
50//----------------------------------------------------------------------------------------------------------
51
52extern scpi_t scpi_context;
53
62size_t SCPI_Write(scpi_t * context, const char * data, size_t len);
63
69scpi_result_t SCPI_Flush(scpi_t * context);
70
76int SCPI_Error(scpi_t * context, int_fast16_t err);
77
84scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val);
85
91scpi_result_t SCPI_Reset(scpi_t * context);
92
94void SCPI_Init_Device();
95
101scpi_result_t SCPI_SetResult_ChannelOutOfRange(scpi_t * context);
102
108scpi_result_t SCPI_SetResult_NotSupportedByChannel(scpi_t * context);
109
116scpi_result_t SCPI_QueryChannelParameter(scpi_t * context, SCPIChannelParameters_t paramType);
117
124scpi_result_t SCPI_SetChannelParameter(scpi_t * context, SCPIChannelParameters_t paramType);
125
139bool SCPI_GetNumericFromParam(scpi_t* context, const scpi_number_t& param, float& value, scpi_unit_t unit, float min, float max, float def, float step);
140
141
142scpi_result_t scpi_cmd_outputState(scpi_t * context);
143scpi_result_t scpi_cmd_outputStateQ(scpi_t * context);
144scpi_result_t scpi_cmd_outputGeneral(scpi_t * context);
145scpi_result_t scpi_cmd_outputGeneralQ(scpi_t * context);
146
147
148scpi_result_t scpi_cmd_measureScalarCurrentDCQ(scpi_t * context);
149scpi_result_t scpi_cmd_measureScalarPowerDCQ(scpi_t * context);
150scpi_result_t scpi_cmd_measureScalarVoltageDCQ(scpi_t * context);
151
152
153scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitude(scpi_t * context);
154scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitudeQ(scpi_t * context);
155scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffset(scpi_t * context);
156scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffsetQ(scpi_t * context);
157scpi_result_t scpi_cmd_sourceVoltageProtectionLevel(scpi_t * context);
158scpi_result_t scpi_cmd_sourceVoltageProtectionLevelQ(scpi_t * context);
159scpi_result_t scpi_cmd_sourceVoltageProtectionState(scpi_t * context);
160scpi_result_t scpi_cmd_sourceVoltageProtectionStateQ(scpi_t * context);
161scpi_result_t scpi_cmd_sourceVoltageProtectionDelay(scpi_t * context);
162scpi_result_t scpi_cmd_sourceVoltageProtectionDelayQ(scpi_t * context);
163scpi_result_t scpi_cmd_sourceVoltageProtectionTrippedQ(scpi_t * context);
164scpi_result_t scpi_cmd_sourceVoltageProtectionClear(scpi_t * context);
165scpi_result_t scpi_cmd_sourceCurrentProtectionLevel(scpi_t * context);
166scpi_result_t scpi_cmd_sourceCurrentProtectionLevelQ(scpi_t * context);
167scpi_result_t scpi_cmd_sourceCurrentProtectionState(scpi_t * context);
168scpi_result_t scpi_cmd_sourceCurrentProtectionStateQ(scpi_t * context);
169scpi_result_t scpi_cmd_sourceCurrentProtectionDelay(scpi_t * context);
170scpi_result_t scpi_cmd_sourceCurrentProtectionDelayQ(scpi_t * context);
171scpi_result_t scpi_cmd_sourceCurrentProtectionTrippedQ(scpi_t * context);
172scpi_result_t scpi_cmd_sourceCurrentProtectionClear(scpi_t * context);
173scpi_result_t scpi_cmd_sourcePowerProtectionLevel(scpi_t * context);
174scpi_result_t scpi_cmd_sourcePowerProtectionLevelQ(scpi_t * context);
175scpi_result_t scpi_cmd_sourcePowerProtectionState(scpi_t * context);
176scpi_result_t scpi_cmd_sourcePowerProtectionStateQ(scpi_t * context);
177scpi_result_t scpi_cmd_sourcePowerProtectionDelay(scpi_t * context);
178scpi_result_t scpi_cmd_sourcePowerProtectionDelayQ(scpi_t * context);
179scpi_result_t scpi_cmd_sourcePowerProtectionTrippedQ(scpi_t * context);
180scpi_result_t scpi_cmd_sourcePowerProtectionClear(scpi_t * context);
181scpi_result_t scpi_cmd_sourceFrequencyFixed(scpi_t * context);
182scpi_result_t scpi_cmd_sourceFrequencyFixedQ(scpi_t * context);
183scpi_result_t scpi_cmd_sourceFunctionShape(scpi_t * context);
184scpi_result_t scpi_cmd_sourceFunctionShapeQ(scpi_t * context);
185scpi_result_t scpi_cmd_sourceFunctionModeQ(scpi_t * context);
186#if defined DDS_USER_DEFINED_WAVEFORMS_ENABLED && defined DDS_SUBSYSTEM_ENABLED
187 scpi_result_t scpi_cmd_sourceFunctionData(scpi_t * context);
188#endif
189
190
191scpi_result_t scpi_cmd_systemLocal(scpi_t * context);
192scpi_result_t scpi_cmd_systemRemote(scpi_t * context);
193scpi_result_t scpi_cmd_systemRWLock(scpi_t * context);
194scpi_result_t scpi_cmd_systemChannelCountQ(scpi_t * context);
195scpi_result_t scpi_cmd_systemFirmwareQ(scpi_t * context);
196scpi_result_t scpi_cmd_systemSnoQ(scpi_t * context);
197scpi_result_t scpi_cmd_systemMeasureScalarVoltageDCQ(scpi_t * context);
198
199
200scpi_result_t scpi_cmd_memoryRcl(scpi_t * context);
201scpi_result_t scpi_cmd_memorySav(scpi_t * context);
202
203
204scpi_result_t scpi_cmd_instrumentSelect(scpi_t * context);
205scpi_result_t scpi_cmd_instrumentSelectQ(scpi_t * context);
206scpi_result_t scpi_cmd_instrumentNSelect(scpi_t * context);
207scpi_result_t scpi_cmd_instrumentNSelectQ(scpi_t * context);
208
209#endif /* SCPI_DEVICE_H_ */
Containing different defines for device configuration.
scpi_result_t scpi_cmd_systemRWLock(scpi_t *context)
Function executed when the SYSTem:RWLock command was received.
Definition SCPI_Cmds_System.cpp:22
scpi_result_t scpi_cmd_systemMeasureScalarVoltageDCQ(scpi_t *context)
Function executed when the SYSTem:MEASure[:SCALar][:VOLTage][:DC]?
Definition SCPI_Cmds_System.cpp:50
scpi_result_t scpi_cmd_systemRemote(scpi_t *context)
Function executed when the SYSTem:REMote command was received.
Definition SCPI_Cmds_System.cpp:16
enum SCPIChannelParameters SCPIChannelParameters_t
Available SCPI channel parameters.
void SCPI_Init_Device()
Initialize the SCPI part of the device.
Definition SCPI_Device.cpp:177
scpi_result_t scpi_cmd_sourceVoltageProtectionDelay(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:DELay command was received.
Definition SCPI_Cmds_Source.cpp:58
scpi_result_t SCPI_Reset(scpi_t *context)
Called when a *RST command is received.
Definition SCPI_Device.cpp:170
scpi_result_t scpi_cmd_sourceFunctionModeQ(scpi_t *context)
Function executed when the SOURce#:FUNCtion:MODE?
Definition SCPI_Cmds_Source.cpp:282
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.
Definition SCPI_Device.cpp:154
scpi_result_t scpi_cmd_sourcePowerProtectionClear(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:CLEar command was received.
Definition SCPI_Cmds_Source.cpp:250
scpi_result_t scpi_cmd_measureScalarPowerDCQ(scpi_t *context)
Function executed when the MEASure#[:SCALar]:POWer[:DC]?
Definition SCPI_Cmds_Measure.cpp:15
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitude(scpi_t *context)
Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate][:AMPLitude] command was received.
Definition SCPI_Cmds_Source.cpp:10
scpi_result_t scpi_cmd_sourceCurrentProtectionDelay(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:DELay command was received.
Definition SCPI_Cmds_Source.cpp:144
scpi_result_t scpi_cmd_sourcePowerProtectionState(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:STATe command was received.
Definition SCPI_Cmds_Source.cpp:201
scpi_result_t scpi_cmd_sourcePowerProtectionDelay(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:DELay command was received.
Definition SCPI_Cmds_Source.cpp:213
scpi_result_t SCPI_SetResult_NotSupportedByChannel(scpi_t *context)
Return a "Operation not supported by channel." message with the SCPI context.
Definition SCPI_Device.cpp:197
scpi_result_t scpi_cmd_sourcePowerProtectionTrippedQ(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:TRIPped?
Definition SCPI_Cmds_Source.cpp:225
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.
Definition SCPI_Device.cpp:283
scpi_result_t scpi_cmd_systemChannelCountQ(scpi_t *context)
Function executed when the SYSTem:CHANnel:COUNt?
Definition SCPI_Cmds_System.cpp:28
scpi_result_t scpi_cmd_sourcePowerProtectionDelayQ(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:DELay?
Definition SCPI_Cmds_Source.cpp:218
scpi_result_t scpi_cmd_sourceFrequencyFixedQ(scpi_t *context)
Function executed when the SOURce#:FREQuency[:CW]?
Definition SCPI_Cmds_Source.cpp:263
scpi_result_t scpi_cmd_systemSnoQ(scpi_t *context)
Function executed when the SYSTem:SNO?
Definition SCPI_Cmds_System.cpp:42
scpi_result_t scpi_cmd_sourceCurrentProtectionLevelQ(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection[:LEVel]?
Definition SCPI_Cmds_Source.cpp:125
scpi_result_t scpi_cmd_outputGeneral(scpi_t *context)
Function executed when the OUTPut:GENeral command was received.
Definition SCPI_Cmds_Output.cpp:24
scpi_result_t scpi_cmd_sourceFunctionShapeQ(scpi_t *context)
Function executed when the SOURce#:FUNCtion[:SHAPe]?
Definition SCPI_Cmds_Source.cpp:275
scpi_result_t scpi_cmd_instrumentNSelectQ(scpi_t *context)
Function executed when the INSTrument:NSELect?
Definition SCPI_Cmds_Instrument.cpp:70
size_t SCPI_Write(scpi_t *context, const char *data, size_t len)
Write data to SCPI output.
Definition SCPI_Device.cpp:131
scpi_result_t scpi_cmd_sourceVoltageProtectionClear(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:CLEar command was received.
Definition SCPI_Cmds_Source.cpp:95
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffset(scpi_t *context)
Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate]:OFFSet command was received.
Definition SCPI_Cmds_Source.cpp:22
scpi_result_t scpi_cmd_instrumentSelectQ(scpi_t *context)
Function executed when the INSTrument[:SELect]?
Definition SCPI_Cmds_Instrument.cpp:41
scpi_result_t scpi_cmd_sourceVoltageProtectionLevel(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection[:LEVel] command was received.
Definition SCPI_Cmds_Source.cpp:34
scpi_result_t scpi_cmd_sourceCurrentProtectionLevel(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection[:LEVel] command was received.
Definition SCPI_Cmds_Source.cpp:120
scpi_result_t SCPI_SetResult_ChannelOutOfRange(scpi_t *context)
Return a "Channel number out of range." message with the SCPI context.
Definition SCPI_Device.cpp:190
scpi_result_t scpi_cmd_sourceVoltageProtectionState(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:STATe command was received.
Definition SCPI_Cmds_Source.cpp:46
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.
Definition SCPI_Device.cpp:206
scpi_result_t scpi_cmd_sourcePowerProtectionStateQ(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection:STATe?
Definition SCPI_Cmds_Source.cpp:206
scpi_result_t scpi_cmd_sourceVoltageProtectionLevelQ(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection[:LEVel]?
Definition SCPI_Cmds_Source.cpp:39
int SCPI_Error(scpi_t *context, int_fast16_t err)
Emit error to the SCPI output.
Definition SCPI_Device.cpp:145
scpi_result_t scpi_cmd_sourceVoltageProtectionStateQ(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:STATe?
Definition SCPI_Cmds_Source.cpp:51
scpi_result_t scpi_cmd_sourceCurrentProtectionClear(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:CLEar command was received.
Definition SCPI_Cmds_Source.cpp:181
scpi_result_t scpi_cmd_sourceFunctionShape(scpi_t *context)
Function executed when the SOURce#:FUNCtion[:SHAPe] command was received.
Definition SCPI_Cmds_Source.cpp:270
scpi_result_t scpi_cmd_systemLocal(scpi_t *context)
Function executed when the SYSTem:LOCal command was received.
Definition SCPI_Cmds_System.cpp:10
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.
Definition SCPI_Device.cpp:554
scpi_result_t scpi_cmd_outputStateQ(scpi_t *context)
Function executed when the OUTPut#[:STATe]?
Definition SCPI_Cmds_Output.cpp:17
scpi_result_t scpi_cmd_measureScalarVoltageDCQ(scpi_t *context)
Function executed when the MEASure#[:SCALar][:VOLTage][:DC]?
Definition SCPI_Cmds_Measure.cpp:20
scpi_result_t scpi_cmd_memoryRcl(scpi_t *context)
Function executed when the *RCL command was received.
Definition SCPI_Cmds_Memory.cpp:10
scpi_result_t scpi_cmd_sourcePowerProtectionLevel(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection[:LEVel] command was received.
Definition SCPI_Cmds_Source.cpp:189
scpi_result_t scpi_cmd_sourceFrequencyFixed(scpi_t *context)
Function executed when the SOURce#:FREQuency[:CW] command was received.
Definition SCPI_Cmds_Source.cpp:258
scpi_result_t SCPI_Flush(scpi_t *context)
Flush data to SCPI output.
Definition SCPI_Device.cpp:139
scpi_result_t scpi_cmd_systemFirmwareQ(scpi_t *context)
Function executed when the SYSTem:FIRMware?
Definition SCPI_Cmds_System.cpp:36
scpi_result_t scpi_cmd_outputGeneralQ(scpi_t *context)
Function executed when the OUTPut:GENeral?
Definition SCPI_Cmds_Output.cpp:55
scpi_result_t scpi_cmd_outputState(scpi_t *context)
Function executed when the OUTPut#[:STATe] command was received.
Definition SCPI_Cmds_Output.cpp:10
scpi_result_t scpi_cmd_sourceVoltageProtectionDelayQ(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:DELay?
Definition SCPI_Cmds_Source.cpp:63
scpi_result_t scpi_cmd_sourceCurrentProtectionState(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:STATe command was received.
Definition SCPI_Cmds_Source.cpp:132
scpi_result_t scpi_cmd_sourceCurrentProtectionStateQ(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:STATe?
Definition SCPI_Cmds_Source.cpp:137
scpi_result_t scpi_cmd_measureScalarCurrentDCQ(scpi_t *context)
Function executed when the MEASure#[:SCALar]:CURRent[:DC]?
Definition SCPI_Cmds_Measure.cpp:10
scpi_result_t scpi_cmd_instrumentNSelect(scpi_t *context)
Function executed when the INSTrument:NSELect command was received.
Definition SCPI_Cmds_Instrument.cpp:50
scpi_result_t scpi_cmd_sourceCurrentProtectionTrippedQ(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:TRIPped?
Definition SCPI_Cmds_Source.cpp:156
scpi_result_t scpi_cmd_memorySav(scpi_t *context)
Function executed when the *SAV command was received.
Definition SCPI_Cmds_Memory.cpp:17
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateOffsetQ(scpi_t *context)
Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate]:OFFSet?
Definition SCPI_Cmds_Source.cpp:27
scpi_result_t scpi_cmd_sourceCurrentProtectionDelayQ(scpi_t *context)
Function executed when the SOURce#:CURRent:PROTection:DELay?
Definition SCPI_Cmds_Source.cpp:149
scpi_result_t scpi_cmd_sourceVoltageLevelImmediateAmplitudeQ(scpi_t *context)
Function executed when the SOURce#:VOLTage[:LEVel][:IMMediate][:AMPLitude]?
Definition SCPI_Cmds_Source.cpp:15
SCPIChannelParameters
Available SCPI channel parameters.
Definition SCPI_Device.h:27
@ SCPI_CHPARAM_MEASURED_POWER
Measured power channel parameter.
Definition SCPI_Device.h:38
@ SCPI_CHPARAM_OUTPUTSTATE
Output state (Enabled/Disabled) channel parameter.
Definition SCPI_Device.h:28
@ SCPI_CHPARAM_OPP_LEVEL
Over power protection level channel parameter.
Definition SCPI_Device.h:45
@ SCPI_CHPARAM_MEASURED_CURRENT
Measured current channel parameter.
Definition SCPI_Device.h:37
@ SCPI_CHPARAM_AMPLITUDE
Amplitude channel parameter.
Definition SCPI_Device.h:29
@ SCPI_CHPARAM_OCP_DELAY
Over current protection delay channel parameter.
Definition SCPI_Device.h:44
@ SCPI_CHPARAM_OVP_STATE
Over voltage protection state (Enabled/Disabled) channel parameter.
Definition SCPI_Device.h:40
@ SCPI_CHPARAM_OPP_STATE
Over power protection state (Enabled/Disabled) channel parameter.
Definition SCPI_Device.h:46
@ SCPI_CHPARAM_OVP_DELAY
Over voltage protection delay channel parameter.
Definition SCPI_Device.h:41
@ SCPI_CHPARAM_OFFSET
Offset channel parameter.
Definition SCPI_Device.h:30
@ SCPI_CHPARAM_OVP_LEVEL
Over voltage protection level channel parameter.
Definition SCPI_Device.h:39
@ SCPI_CHPARAM_MEASURED_AMPLITUDE
Measured amplitude channel parameter.
Definition SCPI_Device.h:36
@ SCPI_CHPARAM_OCP_LEVEL
Over current protection level channel parameter.
Definition SCPI_Device.h:42
@ SCPI_CHPARAM_FREQUENCY
Frequency channel parameter.
Definition SCPI_Device.h:31
@ SCPI_CHPARAM_OPP_DELAY
Over power protection delay channel parameter.
Definition SCPI_Device.h:47
@ SCPI_CHPARAM_OCP_STATE
Over current protection state (Enabled/Disabled) channel parameter.
Definition SCPI_Device.h:43
@ SCPI_CHPARAM_SIGNALFORM
Signal form channel parameter.
Definition SCPI_Device.h:32
scpi_result_t scpi_cmd_sourcePowerProtectionLevelQ(scpi_t *context)
Function executed when the SOURce#:POWer:PROTection[:LEVel]?
Definition SCPI_Cmds_Source.cpp:194
scpi_result_t scpi_cmd_sourceVoltageProtectionTrippedQ(scpi_t *context)
Function executed when the SOURce#:VOLTage:PROTection:TRIPped?
Definition SCPI_Cmds_Source.cpp:70
scpi_result_t scpi_cmd_instrumentSelect(scpi_t *context)
Function executed when the INSTrument[:SELect] command was received.
Definition SCPI_Cmds_Instrument.cpp:21
Expressions handling.
Conversion routines and string manipulation routines.