serial-dmm: Add MASTECH MAS345 support.
This commit is contained in:
parent
f0ac4929d3
commit
5887c9cc1a
|
@ -51,11 +51,13 @@ SR_PRIV struct sr_dev_driver digitek_dt4000zc_driver_info;
|
|||
SR_PRIV struct sr_dev_driver tekpower_tp4000zc_driver_info;
|
||||
SR_PRIV struct sr_dev_driver metex_me31_driver_info;
|
||||
SR_PRIV struct sr_dev_driver peaktech_3410_driver_info;
|
||||
SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
|
||||
|
||||
static struct sr_dev_driver *di_dt4000zc = &digitek_dt4000zc_driver_info;
|
||||
static struct sr_dev_driver *di_tp4000zc = &tekpower_tp4000zc_driver_info;
|
||||
static struct sr_dev_driver *di_me31 = &metex_me31_driver_info;
|
||||
static struct sr_dev_driver *di_3410 = &peaktech_3410_driver_info;
|
||||
static struct sr_dev_driver *di_mas345 = &mastech_mas345_driver_info;
|
||||
|
||||
/* After hw_init() this will point to a device-specific entry (see above). */
|
||||
static struct sr_dev_driver *di = NULL;
|
||||
|
@ -85,6 +87,12 @@ SR_PRIV struct dmm_info dmms[] = {
|
|||
sr_metex14_packet_valid, sr_metex14_parse,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
"MASTECH", "MAS345", "600/7n2/rts=0/dtr=1", 600,
|
||||
METEX14_PACKET_SIZE, sr_metex14_packet_request,
|
||||
sr_metex14_packet_valid, sr_metex14_parse,
|
||||
NULL,
|
||||
},
|
||||
};
|
||||
|
||||
/* Properly close and free all devices. */
|
||||
|
@ -130,6 +138,8 @@ static int hw_init(int dmm)
|
|||
di = di_me31;
|
||||
if (dmm == PEAKTECH_3410)
|
||||
di = di_3410;
|
||||
if (dmm == MASTECH_MAS345)
|
||||
di = di_mas345;
|
||||
sr_dbg("Selected '%s' subdriver.", di->name);
|
||||
|
||||
di->priv = drvc;
|
||||
|
@ -157,6 +167,11 @@ static int hw_init_peaktech_3410(void)
|
|||
return hw_init(PEAKTECH_3410);
|
||||
}
|
||||
|
||||
static int hw_init_mastech_mas345(void)
|
||||
{
|
||||
return hw_init(MASTECH_MAS345);
|
||||
}
|
||||
|
||||
static GSList *scan(const char *conn, const char *serialcomm, int dmm)
|
||||
{
|
||||
struct sr_dev_inst *sdi;
|
||||
|
@ -272,6 +287,8 @@ static GSList *hw_scan(GSList *options)
|
|||
dmm = 2;
|
||||
if (!strcmp(di->name, "peaktech-3410"))
|
||||
dmm = 3;
|
||||
if (!strcmp(di->name, "mastech-mas345"))
|
||||
dmm = 4;
|
||||
|
||||
if (serialcomm) {
|
||||
/* Use the provided comm specs. */
|
||||
|
@ -435,6 +452,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
receive_data = metex_me31_receive_data;
|
||||
if (!strcmp(di->name, "peaktech-3410"))
|
||||
receive_data = peaktech_3410_receive_data;
|
||||
if (!strcmp(di->name, "mastech-mas345"))
|
||||
receive_data = mastech_mas345_receive_data;
|
||||
|
||||
/* Poll every 50ms, or whenever some data comes in. */
|
||||
sr_source_add(devc->serial->fd, G_IO_IN, 50,
|
||||
|
@ -540,3 +559,21 @@ SR_PRIV struct sr_dev_driver peaktech_3410_driver_info = {
|
|||
.dev_acquisition_stop = hw_dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
};
|
||||
|
||||
SR_PRIV struct sr_dev_driver mastech_mas345_driver_info = {
|
||||
.name = "mastech-mas345",
|
||||
.longname = "MASTECH MAS345",
|
||||
.api_version = 1,
|
||||
.init = hw_init_mastech_mas345,
|
||||
.cleanup = hw_cleanup,
|
||||
.scan = hw_scan,
|
||||
.dev_list = hw_dev_list,
|
||||
.dev_clear = clear_instances,
|
||||
.dev_open = hw_dev_open,
|
||||
.dev_close = hw_dev_close,
|
||||
.info_get = hw_info_get,
|
||||
.dev_config_set = hw_dev_config_set,
|
||||
.dev_acquisition_start = hw_dev_acquisition_start,
|
||||
.dev_acquisition_stop = hw_dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
};
|
||||
|
|
|
@ -181,3 +181,10 @@ SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data)
|
|||
|
||||
return receive_data(fd, revents, PEAKTECH_3410, &info, cb_data);
|
||||
}
|
||||
|
||||
SR_PRIV int mastech_mas345_receive_data(int fd, int revents, void *cb_data)
|
||||
{
|
||||
struct metex14_info info;
|
||||
|
||||
return receive_data(fd, revents, MASTECH_MAS345, &info, cb_data);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ enum {
|
|||
TEKPOWER_TP4000ZC,
|
||||
METEX_ME31,
|
||||
PEAKTECH_3410,
|
||||
MASTECH_MAS345,
|
||||
};
|
||||
|
||||
struct dmm_info {
|
||||
|
@ -49,7 +50,7 @@ struct dmm_info {
|
|||
void (*dmm_details)(struct sr_datafeed_analog *, void *);
|
||||
};
|
||||
|
||||
SR_PRIV struct dmm_info dmms[4];
|
||||
SR_PRIV struct dmm_info dmms[5];
|
||||
|
||||
#define DMM_BUFSIZE 256
|
||||
|
||||
|
@ -75,6 +76,7 @@ SR_PRIV int digitek_dt4000zc_receive_data(int fd, int revents, void *cb_data);
|
|||
SR_PRIV int tekpower_tp4000zc_receive_data(int fd, int revents, void *cb_data);
|
||||
SR_PRIV int metex_me31_receive_data(int fd, int revents, void *cb_data);
|
||||
SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data);
|
||||
SR_PRIV int mastech_mas345_receive_data(int fd, int revents, void *cb_data);
|
||||
|
||||
SR_PRIV void dmm_details_tp4000zc(struct sr_datafeed_analog *analog, void *info);
|
||||
SR_PRIV void dmm_details_dt4000zc(struct sr_datafeed_analog *analog, void *info);
|
||||
|
|
|
@ -118,6 +118,7 @@ extern SR_PRIV struct sr_dev_driver digitek_dt4000zc_driver_info;
|
|||
extern SR_PRIV struct sr_dev_driver tekpower_tp4000zc_driver_info;
|
||||
extern SR_PRIV struct sr_dev_driver metex_me31_driver_info;
|
||||
extern SR_PRIV struct sr_dev_driver peaktech_3410_driver_info;
|
||||
extern SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
|
||||
#endif
|
||||
#ifdef HAVE_HW_UNI_T_DMM
|
||||
extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
|
||||
|
@ -176,6 +177,7 @@ static struct sr_dev_driver *drivers_list[] = {
|
|||
&tekpower_tp4000zc_driver_info,
|
||||
&metex_me31_driver_info,
|
||||
&peaktech_3410_driver_info,
|
||||
&mastech_mas345_driver_info,
|
||||
#endif
|
||||
#ifdef HAVE_HW_UNI_T_DMM
|
||||
&uni_t_ut61d_driver_info,
|
||||
|
|
Loading…
Reference in New Issue