From: Janne Huttunen Date: Sat, 11 Oct 2014 12:47:35 +0000 (+0300) Subject: Add driver for DER EE DE-5000 LCR meter. X-Git-Tag: libsigrok-0.4.0~868 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b50891952d22d1c5012a99ad643ee3dd58495420;p=libsigrok.git Add driver for DER EE DE-5000 LCR meter. Add a driver for the DER EE DE-5000 LCR meter. This meter is based on the Cyrustek ES51919/ES51920 chipset and communicates with the host computer via an optional connectivity kit. The kit uses an optoisolated unidirectional link to connect to the meter and an USB cable on the host side. Internally the connection is using the FTDI FT232R USB UART chip i.e. from the host computer point of view the meter is connected into an RS-232 serial port. This driver implements just a thin shim layer for registering the driver and uses the es51919 module for all the actual work. --- diff --git a/Makefile.am b/Makefile.am index 6491d068..ca70c4db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -188,6 +188,10 @@ if HW_DEMO libsigrok_la_SOURCES += \ src/hardware/demo/demo.c endif +if HW_DEREE_DE5000 +libsigrok_la_SOURCES += \ + src/hardware/deree-de5000/api.c +endif if HW_FLUKE_DMM libsigrok_la_SOURCES += \ src/hardware/fluke-dmm/fluke-dmm.h \ diff --git a/configure.ac b/configure.ac index fbf269e8..f953857c 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,7 @@ DRIVER([Center 3xx], [center-3xx]) DRIVER([ChronoVu LA], [chronovu-la]) DRIVER([Colead SLM], [colead-slm]) DRIVER([Conrad DIGI 35 CPU], [conrad-digi-35-cpu]) +DRIVER([DER EE DE-5000], [deree-de5000]) DRIVER([demo], [demo]) DRIVER([Fluke DMM], [fluke-dmm]) DRIVER([fx2lafw], [fx2lafw]) @@ -286,9 +287,10 @@ if test "x$have_libserialport" = "xno"; then HW_AGILENT_DMM="no"; HW_APPA_55II="no"; HW_ATTEN_PPS3XXX="no"; HW_BRYMEN_DMM="no"; HW_CEM_DT_885X="no"; HW_CENTER_3XX="no"; HW_COLEAD_SLM="no"; HW_CONRAD_DIGI_35_CPU="no"; - HW_FLUKE_DMM="no"; HW_GMC_MH_1X_2X="no"; HW_HAMEG_HMO="no"; - HW_MANSON_HCS_3XXX="no"; HW_MIC_985XX="no"; HW_MOTECH_LPS_30X="no"; - HW_NORMA_DMM="no"; HW_OPENBENCH_LOGIC_SNIFFER="no"; HW_SERIAL_DMM="no"; + HW_DEREE_DE5000="no"; HW_FLUKE_DMM="no"; HW_GMC_MH_1X_2X="no"; + HW_HAMEG_HMO="no"; HW_MANSON_HCS_3XXX="no"; HW_MIC_985XX="no"; + HW_MOTECH_LPS_30X="no"; HW_NORMA_DMM="no"; + HW_OPENBENCH_LOGIC_SNIFFER="no"; HW_SERIAL_DMM="no"; HW_TELEINFO="no"; HW_TONDAJ_SL_814="no"; else # Define HAVE_LIBSERIALPORT in config.h if we found libserialport. @@ -485,6 +487,7 @@ DRIVER2([HW_CHRONOVU_LA], [$HW_CHRONOVU_LA], [HAVE_HW_CHRONOVU_LA]) DRIVER2([HW_COLEAD_SLM], [$HW_COLEAD_SLM], [HAVE_HW_COLEAD_SLM]) DRIVER2([HW_CONRAD_DIGI_35_CPU], [$HW_CONRAD_DIGI_35_CPU], [HAVE_HW_CONRAD_DIGI_35_CPU]) DRIVER2([HW_DEMO], [$HW_DEMO], [HAVE_HW_DEMO]) +DRIVER2([HW_DEREE_DE5000], [$HW_DEREE_DE5000], [HAVE_HW_DEREE_DE5000]) DRIVER2([HW_FLUKE_DMM], [$HW_FLUKE_DMM], [HAVE_HW_FLUKE_DMM]) DRIVER2([HW_FX2LAFW], [$HW_FX2LAFW], [HAVE_HW_FX2LAFW]) DRIVER2([HW_GMC_MH_1X_2X], [$HW_GMC_MH_1X_2X], [HAVE_HW_GMC_MH_1X_2X]) diff --git a/src/drivers.c b/src/drivers.c index 423df731..b8c70602 100644 --- a/src/drivers.c +++ b/src/drivers.c @@ -61,6 +61,9 @@ extern SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info; #ifdef HAVE_HW_DEMO extern SR_PRIV struct sr_dev_driver demo_driver_info; #endif +#ifdef HAVE_HW_DEREE_DE5000 +extern SR_PRIV struct sr_dev_driver deree_de5000_driver_info; +#endif #ifdef HAVE_HW_FLUKE_DMM extern SR_PRIV struct sr_dev_driver flukedmm_driver_info; #endif @@ -238,6 +241,9 @@ SR_PRIV struct sr_dev_driver *drivers_list[] = { #ifdef HAVE_HW_DEMO &demo_driver_info, #endif +#ifdef HAVE_HW_DEREE_DE5000 + &deree_de5000_driver_info, +#endif #ifdef HAVE_HW_FLUKE_DMM &flukedmm_driver_info, #endif diff --git a/src/hardware/deree-de5000/api.c b/src/hardware/deree-de5000/api.c new file mode 100644 index 00000000..40ace4ee --- /dev/null +++ b/src/hardware/deree-de5000/api.c @@ -0,0 +1,90 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2014 Janne Huttunen + * + * 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 3 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, see . + */ + +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +static void std_dev_attach(struct sr_dev_driver *di, struct sr_dev_inst *sdi) +{ + struct drv_context *drvc; + + drvc = di->priv; + + sdi->driver = di; + drvc->instances = g_slist_append(drvc->instances, sdi); +} + +static GSList *std_dev_list(struct sr_dev_driver *di) +{ + return ((struct drv_context *)di->priv)->instances; +} + +#define LOG_PREFIX "deree-de5000" + +SR_PRIV struct sr_dev_driver deree_de5000_driver_info; + +static int init(struct sr_context *sr_ctx) +{ + return std_init(sr_ctx, &deree_de5000_driver_info, LOG_PREFIX); +} + +static int cleanup(void) +{ + return std_dev_clear(&deree_de5000_driver_info, es51919_serial_clean); +} + +static GSList *scan(GSList *options) +{ + struct sr_dev_inst *sdi; + + if (!(sdi = es51919_serial_scan(options, "DER EE", "DE-5000"))) + return NULL; + + std_dev_attach(&deree_de5000_driver_info, sdi); + + return g_slist_append(NULL, sdi); +} + +static GSList *dev_list(void) +{ + return std_dev_list(&deree_de5000_driver_info); +} + +SR_PRIV struct sr_dev_driver deree_de5000_driver_info = { + .name = "deree-de5000", + .longname = "DER EE DE-5000", + .api_version = 1, + .init = init, + .cleanup = cleanup, + .scan = scan, + .dev_list = dev_list, + .dev_clear = NULL, + .config_get = es51919_serial_config_get, + .config_set = es51919_serial_config_set, + .config_list = es51919_serial_config_list, + .dev_open = std_serial_dev_open, + .dev_close = std_serial_dev_close, + .dev_acquisition_start = es51919_serial_acquisition_start, + .dev_acquisition_stop = es51919_serial_acquisition_stop, + .priv = NULL, +};