2012-10-27 20:41:50 +00:00
|
|
|
/*
|
2013-04-23 20:24:30 +00:00
|
|
|
* This file is part of the libsigrok project.
|
2012-10-27 20:41:50 +00:00
|
|
|
*
|
2013-01-26 22:39:24 +00:00
|
|
|
* Copyright (C) 2012-2013 Uwe Hermann <uwe@hermann-uwe.de>
|
2012-10-27 20:41:50 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBSIGROK_HARDWARE_UNI_T_DMM_PROTOCOL_H
|
|
|
|
#define LIBSIGROK_HARDWARE_UNI_T_DMM_PROTOCOL_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <libusb.h>
|
|
|
|
#include "libsigrok.h"
|
|
|
|
#include "libsigrok-internal.h"
|
|
|
|
|
2013-12-23 03:38:35 +00:00
|
|
|
#define LOG_PREFIX "uni-t-dmm"
|
2012-10-27 20:41:50 +00:00
|
|
|
|
2012-10-30 12:11:27 +00:00
|
|
|
enum {
|
2013-05-01 01:00:08 +00:00
|
|
|
TECPEL_DMM_8061,
|
2013-07-05 12:02:50 +00:00
|
|
|
UNI_T_UT60A,
|
|
|
|
UNI_T_UT60E,
|
2014-01-03 21:32:16 +00:00
|
|
|
UNI_T_UT60G,
|
2014-01-01 14:25:39 +00:00
|
|
|
UNI_T_UT61B,
|
2013-12-29 16:35:51 +00:00
|
|
|
UNI_T_UT61C,
|
2012-10-30 12:11:27 +00:00
|
|
|
UNI_T_UT61D,
|
2013-04-29 18:23:21 +00:00
|
|
|
UNI_T_UT61E,
|
2012-10-30 12:11:27 +00:00
|
|
|
VOLTCRAFT_VC820,
|
2013-06-22 14:53:13 +00:00
|
|
|
VOLTCRAFT_VC830,
|
2013-04-30 18:27:04 +00:00
|
|
|
VOLTCRAFT_VC840,
|
2013-11-23 11:50:33 +00:00
|
|
|
TENMA_72_7745,
|
2014-01-06 16:20:35 +00:00
|
|
|
TENMA_72_7750,
|
2012-10-30 12:11:27 +00:00
|
|
|
};
|
|
|
|
|
2012-12-19 18:01:54 +00:00
|
|
|
struct dmm_info {
|
|
|
|
char *vendor;
|
|
|
|
char *device;
|
|
|
|
uint32_t baudrate;
|
|
|
|
int packet_size;
|
|
|
|
gboolean (*packet_valid)(const uint8_t *);
|
|
|
|
int (*packet_parse)(const uint8_t *, float *,
|
|
|
|
struct sr_datafeed_analog *, void *);
|
|
|
|
void (*dmm_details)(struct sr_datafeed_analog *, void *);
|
|
|
|
struct sr_dev_driver *di;
|
|
|
|
int (*receive_data)(int, int, void *);
|
|
|
|
};
|
|
|
|
|
2012-10-27 20:41:50 +00:00
|
|
|
#define CHUNK_SIZE 8
|
2013-01-26 22:39:24 +00:00
|
|
|
|
|
|
|
#define DMM_BUFSIZE 256
|
2012-10-27 20:41:50 +00:00
|
|
|
|
|
|
|
/** Private, per-device-instance driver context. */
|
|
|
|
struct dev_context {
|
|
|
|
/** The current sampling limit (in number of samples). */
|
|
|
|
uint64_t limit_samples;
|
|
|
|
|
|
|
|
/** The current sampling limit (in ms). */
|
|
|
|
uint64_t limit_msec;
|
|
|
|
|
|
|
|
/** Opaque pointer passed in by the frontend. */
|
|
|
|
void *cb_data;
|
|
|
|
|
|
|
|
/** The current number of already received samples. */
|
|
|
|
uint64_t num_samples;
|
|
|
|
|
2013-05-03 22:07:34 +00:00
|
|
|
int64_t starttime;
|
|
|
|
|
2013-01-26 22:39:24 +00:00
|
|
|
gboolean first_run;
|
|
|
|
|
|
|
|
uint8_t protocol_buf[DMM_BUFSIZE];
|
|
|
|
uint8_t bufoffset;
|
|
|
|
uint8_t buflen;
|
2012-10-27 20:41:50 +00:00
|
|
|
};
|
|
|
|
|
2013-05-01 01:00:08 +00:00
|
|
|
SR_PRIV int receive_data_TECPEL_DMM_8061(int fd, int revents, void *cb_data);
|
2013-07-05 12:02:50 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT60A(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_UNI_T_UT60E(int fd, int revents, void *cb_data);
|
2014-01-03 21:32:16 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT60G(int fd, int revents, void *cb_data);
|
2014-01-01 14:25:39 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61B(int fd, int revents, void *cb_data);
|
2013-12-29 16:35:51 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61C(int fd, int revents, void *cb_data);
|
2012-12-19 18:01:54 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61D(int fd, int revents, void *cb_data);
|
2013-04-29 18:23:21 +00:00
|
|
|
SR_PRIV int receive_data_UNI_T_UT61E(int fd, int revents, void *cb_data);
|
2012-12-19 18:01:54 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC820(int fd, int revents, void *cb_data);
|
2013-06-22 14:53:13 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC830(int fd, int revents, void *cb_data);
|
2013-04-30 18:27:04 +00:00
|
|
|
SR_PRIV int receive_data_VOLTCRAFT_VC840(int fd, int revents, void *cb_data);
|
2014-01-06 16:20:35 +00:00
|
|
|
SR_PRIV int receive_data_TENMA_72_7745(int fd, int revents, void *cb_data);
|
|
|
|
SR_PRIV int receive_data_TENMA_72_7750(int fd, int revents, void *cb_data);
|
2012-10-27 20:41:50 +00:00
|
|
|
|
|
|
|
#endif
|