]> sigrok.org Git - libsigrok.git/commitdiff
serial-dmm: Add PeakTech 3410 support.
authorUwe Hermann <redacted>
Sat, 1 Dec 2012 21:45:45 +0000 (22:45 +0100)
committerUwe Hermann <redacted>
Sun, 2 Dec 2012 13:22:51 +0000 (14:22 +0100)
hardware/serial-dmm/api.c
hardware/serial-dmm/protocol.c
hardware/serial-dmm/protocol.h
hwdriver.c

index 3202777027dab14e17fa11d8425de551dc677b40..ec72e33bed3fed14e147eeda2842bb63d18a9acb 100644 (file)
@@ -50,10 +50,12 @@ static const char *probe_names[] = {
 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;
 
 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;
 
 /* After hw_init() this will point to a device-specific entry (see above). */
 static struct sr_dev_driver *di = NULL;
@@ -77,6 +79,12 @@ SR_PRIV struct dmm_info dmms[] = {
                sr_metex14_packet_valid, sr_metex14_parse,
                NULL,
        },
+       {
+               "Peaktech", "3410", "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. */
@@ -120,6 +128,8 @@ static int hw_init(int dmm)
                di = di_tp4000zc;
        if (dmm == METEX_ME31)
                di = di_me31;
+       if (dmm == PEAKTECH_3410)
+               di = di_3410;
        sr_dbg("Selected '%s' subdriver.", di->name);
 
        di->priv = drvc;
@@ -142,6 +152,11 @@ static int hw_init_metex_me31(void)
        return hw_init(METEX_ME31);
 }
 
+static int hw_init_peaktech_3410(void)
+{
+       return hw_init(PEAKTECH_3410);
+}
+
 static GSList *scan(const char *conn, const char *serialcomm, int dmm)
 {
        struct sr_dev_inst *sdi;
@@ -255,6 +270,8 @@ static GSList *hw_scan(GSList *options)
                dmm = 1;
        if (!strcmp(di->name, "metex-me31"))
                dmm = 2;
+       if (!strcmp(di->name, "peaktech-3410"))
+               dmm = 3;
 
        if (serialcomm) {
                /* Use the provided comm specs. */
@@ -416,6 +433,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                receive_data = tekpower_tp4000zc_receive_data;
        if (!strcmp(di->name, "metex-me31"))
                receive_data = metex_me31_receive_data;
+       if (!strcmp(di->name, "peaktech-3410"))
+               receive_data = peaktech_3410_receive_data;
 
        /* Poll every 50ms, or whenever some data comes in. */
        sr_source_add(devc->serial->fd, G_IO_IN, 50,
@@ -503,3 +522,21 @@ SR_PRIV struct sr_dev_driver metex_me31_driver_info = {
        .dev_acquisition_stop = hw_dev_acquisition_stop,
        .priv = NULL,
 };
+
+SR_PRIV struct sr_dev_driver peaktech_3410_driver_info = {
+       .name = "peaktech-3410",
+       .longname = "PeakTech 3410",
+       .api_version = 1,
+       .init = hw_init_peaktech_3410,
+       .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,
+};
index 479e954e4251e3018a72d17482a08a60aac0f4f6..b98b698a8f1cb70176b04730d79aa0019fde9ccb 100644 (file)
@@ -174,3 +174,10 @@ SR_PRIV int metex_me31_receive_data(int fd, int revents, void *cb_data)
 
        return receive_data(fd, revents, METEX_ME31, &info, cb_data);
 }
+
+SR_PRIV int peaktech_3410_receive_data(int fd, int revents, void *cb_data)
+{
+       struct metex14_info info;
+
+       return receive_data(fd, revents, PEAKTECH_3410, &info, cb_data);
+}
index 7b676a39e517834a348664983ee8f1a1211cc94d..e2f13d1301d78435c6a3ff999228b51c482b0b94 100644 (file)
@@ -33,6 +33,7 @@ enum {
        DIGITEK_DT4000ZC,
        TEKPOWER_TP4000ZC,
        METEX_ME31,
+       PEAKTECH_3410,
 };
 
 struct dmm_info {
@@ -48,7 +49,7 @@ struct dmm_info {
        void (*dmm_details)(struct sr_datafeed_analog *, void *);
 };
 
-SR_PRIV struct dmm_info dmms[3];
+SR_PRIV struct dmm_info dmms[4];
 
 #define DMM_BUFSIZE 256
 
@@ -73,6 +74,7 @@ struct dev_context {
 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 void dmm_details_tp4000zc(struct sr_datafeed_analog *analog, void *info);
 SR_PRIV void dmm_details_dt4000zc(struct sr_datafeed_analog *analog, void *info);
index df24f15e193ea582b355d2406cc658ff1b828492..64218e7145b4b90c0fe4a97e1ba139aa4219bb9a 100644 (file)
@@ -117,6 +117,7 @@ extern SR_PRIV struct sr_dev_driver radioshackdmm_driver_info;
 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;
 #endif
 #ifdef HAVE_HW_UNI_T_DMM
 extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
@@ -174,6 +175,7 @@ static struct sr_dev_driver *drivers_list[] = {
        &digitek_dt4000zc_driver_info,
        &tekpower_tp4000zc_driver_info,
        &metex_me31_driver_info,
+       &peaktech_3410_driver_info,
 #endif
 #ifdef HAVE_HW_UNI_T_DMM
        &uni_t_ut61d_driver_info,