* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/**
- * @file
- *
- * <em>Motech LPS-30x series</em> power supply driver
- *
- * @internal
- */
-
#include <config.h>
#include <ctype.h>
#include <math.h>
SR_PRIV int lps_cmd_reply(char *reply, struct sr_serial_dev_inst *serial, const char *fmt, ...);
SR_PRIV int lps_query_status(struct sr_dev_inst *sdi);
-/* Serial communication parameters */
#define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0"
#define VENDOR_MOTECH "Motech"
-/** Driver scanning options. */
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_SERIALCOMM,
};
-/** Driver capabilities generic. */
static const uint32_t drvopts[] = {
- /* Device class */
SR_CONF_POWER_SUPPLY,
};
-/** Hardware capabilities generic. */
static const uint32_t devopts[] = {
- /* Device class */
- /* Acquisition modes. */
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
- /* Device configuration */
SR_CONF_CHANNEL_CONFIG | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
};
-/** Hardware capabilities channel 3. (LPS-304/305 only). */
+/** Hardware capabilities channel 3 (LPS-304/305 only). */
static const uint32_t devopts_ch3[] = {
SR_CONF_VOLTAGE | SR_CONF_GET,
SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
},
};
-/** Send command to device with va_list.
- */
+/** Send command to device with va_list. */
SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_list args)
{
int retc;
return SR_OK;
}
-/** Send command to device.
- */
+/** Send command to device. */
SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...)
{
int retc;
return SR_ERR; /* Timeout! */
}
-/** Scan for LPS-300 series device.
- */
+/** Scan for LPS-300 series device. */
static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options)
{
struct sr_dev_inst *sdi;
devc = sdi->priv;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
case SR_CONF_LIMIT_MSEC:
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
+
switch (key) {
case SR_CONF_VOLTAGE:
*data = g_variant_new_double(devc->channel_status[ch_idx].output_voltage_last);
return SR_ERR_NA;
if (!cg) {
- /* No channel group: global options. */
switch (key) {
case SR_CONF_LIMIT_MSEC:
case SR_CONF_LIMIT_SAMPLES:
return SR_ERR_NA;
}
} else {
- /* Channel group specified: per-channel options. */
/* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
devc = (sdi) ? sdi->priv : NULL;
- /* Device options, independent from channel groups. */
if (!cg) {
switch (key) {
case SR_CONF_SCAN_OPTIONS:
}
}
- /* Device options, depending on channel groups. */
+ /* We only ever have one channel per channel group in this driver. */
ch = cg->channels->data;
ch_idx = ch->index;
+
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */