]> sigrok.org Git - libsigrok.git/blame - src/hardware/scpi-pps/profiles.c
scpi-pps: Add support for Rigol DP832.
[libsigrok.git] / src / hardware / scpi-pps / profiles.c
CommitLineData
d4eabea8
BV
1/*
2 * This file is part of the libsigrok project.
3 *
4 * Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "protocol.h"
21
22#define CH_IDX(x) (1 << x)
23
24enum vendors {
25 RIGOL,
26};
27
28/* Rigol DP800 series */
29static const int32_t devopts_rigol_dp800[] = {
30 SR_CONF_POWER_SUPPLY,
31 SR_CONF_CONTINUOUS,
32 SR_CONF_OVER_TEMPERATURE_PROTECTION,
33};
34
35static const int32_t devopts_cg_rigol_dp800[] = {
36 SR_CONF_OUTPUT_REGULATION,
37 SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED,
38 SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
39 SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD,
40 SR_CONF_OVER_CURRENT_PROTECTION_ENABLED,
41 SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE,
42 SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD,
43 SR_CONF_OUTPUT_VOLTAGE,
44 SR_CONF_OUTPUT_VOLTAGE_MAX,
45 SR_CONF_OUTPUT_CURRENT,
46 SR_CONF_OUTPUT_CURRENT_MAX,
47 SR_CONF_OUTPUT_ENABLED,
48};
49
50struct channel_spec ch_rigol_dp800[] = {
51 { "1", { 0, 30, 0.010 }, { 0, 3, 0.010 } },
52 { "2", { 0, 30, 0.010 }, { 0, 3, 0.010 } },
53 { "3", { 0, 5, 0.010 }, { 0, 3, 0.010 } },
54};
55
56struct channel_group_spec cg_rigol_dp800[] = {
57 { "1", CH_IDX(0), PPS_OVP | PPS_OCP },
58 { "2", CH_IDX(1), PPS_OVP | PPS_OCP },
59 { "3", CH_IDX(2), PPS_OVP | PPS_OCP },
60};
61
62struct scpi_command cmd_rigol_dp800[] = {
63 { SCPI_CMD_KEY_UNLOCK, "SYST:KLOCK OFF" },
64 { SCPI_CMD_GET_MEAS_VOLTAGE, ":MEAS:VOLT? CH%s" },
65 { SCPI_CMD_GET_MEAS_CURRENT, ":MEAS:CURR? CH%s" },
66 { SCPI_CMD_GET_MEAS_POWER, ":MEAS:POWE? CH%s" },
67 { SCPI_CMD_GET_VOLTAGE_MAX, ":SOUR%s:VOLT?" },
68 { SCPI_CMD_SET_VOLTAGE_MAX, ":SOUR%s:VOLT %.6f" },
69 { SCPI_CMD_GET_CURRENT_MAX, ":SOUR%s:CURR?" },
70 { SCPI_CMD_SET_CURRENT_MAX, ":SOUR%s:CURR %.6f" },
71 { SCPI_CMD_GET_OUTPUT_ENABLED, ":OUTP? CH%s" },
72 { SCPI_CMD_SET_OUTPUT_ENABLED, ":OUTP CH%s,%s" },
73 { SCPI_CMD_GET_OUTPUT_REGULATION, ":OUTP:MODE? CH%s" },
74 { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION, ":SYST:OTP?" },
75 { SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION, ":SYST:OTP %s" },
76 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED, ":OUTP:OVP? CH%s" },
77 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_ENABLED, ":OUTP:OVP CH%s,%s" },
78 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, ":OUTP:OVP:QUES? CH%s" },
79 { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL? CH%s" },
80 { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, ":OUTP:OVP:VAL CH%s,%.6f" },
81 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED, ":OUTP:OCP? CH%s" },
82 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLED, ":OUTP:OCP CH%s,%s" },
83 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, ":OUTP:OCP:QUES? CH%s" },
84 { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL? CH%s" },
85 { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, ":OUTP:OCP:VAL CH%s,%.6f" },
86};
87
88SR_PRIV const struct scpi_pps pps_profiles[] = {
89 /* Rigol DP800 series */
90 { RIGOL, "Rigol", "RIGOL TECHNOLOGIES", "DP832", PPS_OTP,
91 ARRAY_AND_SIZE(devopts_rigol_dp800),
92 ARRAY_AND_SIZE(devopts_cg_rigol_dp800),
93 ARRAY_AND_SIZE(ch_rigol_dp800),
94 ARRAY_AND_SIZE(cg_rigol_dp800),
95 ARRAY_AND_SIZE(cmd_rigol_dp800),
96 },
97};
98SR_PRIV unsigned int num_pps_profiles = ARRAY_SIZE(pps_profiles);
99