From: Martin Ling Date: Sun, 1 Mar 2015 21:13:30 +0000 (+0000) Subject: ut372: Initial sub-driver skeleton. X-Git-Tag: libsigrok-0.4.0~617 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=f3cde30904b2bc5ac5b1782d5e65d1ec8ce60ed6 ut372: Initial sub-driver skeleton. --- diff --git a/Makefile.am b/Makefile.am index 16007a80..0d45f7c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -115,7 +115,8 @@ libsigrok_la_SOURCES += \ src/dmm/metex14.c \ src/dmm/rs9lcd.c \ src/dmm/bm25x.c \ - src/dmm/ut71x.c + src/dmm/ut71x.c \ + src/dmm/ut372.c # Hardware (LCR chip parsers) if NEED_SERIAL diff --git a/src/dmm/ut372.c b/src/dmm/ut372.c new file mode 100644 index 00000000..4e763a36 --- /dev/null +++ b/src/dmm/ut372.c @@ -0,0 +1,39 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2015 Martin Ling + * + * 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 + */ + +/* + * UNI-T UT372 protocol parser. + */ + +#include "libsigrok.h" +#include "libsigrok-internal.h" + +#define LOG_PREFIX "ut372" + +SR_PRIV gboolean sr_ut372_packet_valid(const uint8_t *buf) +{ + return FALSE; +} + +SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval, + struct sr_datafeed_analog *analog, void *info) +{ + return SR_OK; +} diff --git a/src/drivers.c b/src/drivers.c index 3f006b61..c80af43f 100644 --- a/src/drivers.c +++ b/src/drivers.c @@ -186,6 +186,7 @@ extern SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info; #endif #ifdef HAVE_HW_UNI_T_DMM extern SR_PRIV struct sr_dev_driver tecpel_dmm_8061_driver_info; +extern SR_PRIV struct sr_dev_driver uni_t_ut372_driver_info; extern SR_PRIV struct sr_dev_driver uni_t_ut60a_driver_info; extern SR_PRIV struct sr_dev_driver uni_t_ut60e_driver_info; extern SR_PRIV struct sr_dev_driver uni_t_ut60g_driver_info; @@ -386,6 +387,7 @@ SR_PRIV struct sr_dev_driver *drivers_list[] = { #endif #ifdef HAVE_HW_UNI_T_DMM &tecpel_dmm_8061_driver_info, + &uni_t_ut372_driver_info, &uni_t_ut60a_driver_info, &uni_t_ut60e_driver_info, &uni_t_ut60g_driver_info, diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index e1580b99..a34873b4 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -38,6 +38,7 @@ static const uint32_t devopts[] = { }; SR_PRIV struct sr_dev_driver tecpel_dmm_8061_driver_info; +SR_PRIV struct sr_dev_driver uni_t_ut372_driver_info; SR_PRIV struct sr_dev_driver uni_t_ut60a_driver_info; SR_PRIV struct sr_dev_driver uni_t_ut60e_driver_info; SR_PRIV struct sr_dev_driver uni_t_ut60g_driver_info; @@ -67,6 +68,13 @@ SR_PRIV struct dmm_info udmms[] = { sr_fs9721_00_temp_c, &tecpel_dmm_8061_driver_info, receive_data_TECPEL_DMM_8061, }, + { + "UNI-T", "UT372", 2400, + UT372_PACKET_SIZE, + sr_ut372_packet_valid, sr_ut372_parse, + NULL, + &uni_t_ut372_driver_info, receive_data_UNI_T_UT372, + }, { "UNI-T", "UT60A", 2400, FS9721_PACKET_SIZE, @@ -446,6 +454,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \ }; DRV(tecpel_dmm_8061, TECPEL_DMM_8061, "tecpel-dmm-8061", "Tecpel DMM-8061") +DRV(uni_t_ut372, UNI_T_UT372, "uni-t-ut372", "UNI-T UT372") DRV(uni_t_ut60a, UNI_T_UT60A, "uni-t-ut60a", "UNI-T UT60A") DRV(uni_t_ut60e, UNI_T_UT60E, "uni-t-ut60e", "UNI-T UT60E") DRV(uni_t_ut60g, UNI_T_UT60G, "uni-t-ut60g", "UNI-T UT60G") diff --git a/src/hardware/uni-t-dmm/protocol.c b/src/hardware/uni-t-dmm/protocol.c index 37144980..8355382f 100644 --- a/src/hardware/uni-t-dmm/protocol.c +++ b/src/hardware/uni-t-dmm/protocol.c @@ -303,6 +303,7 @@ SR_PRIV int receive_data_##ID_UPPER(int fd, int revents, void *cb_data) { \ /* Driver-specific receive_data() wrappers */ RECEIVE_DATA(TECPEL_DMM_8061, fs9721) +RECEIVE_DATA(UNI_T_UT372, ut372) RECEIVE_DATA(UNI_T_UT60A, fs9721) RECEIVE_DATA(UNI_T_UT60E, fs9721) RECEIVE_DATA(UNI_T_UT60G, es519xx) diff --git a/src/hardware/uni-t-dmm/protocol.h b/src/hardware/uni-t-dmm/protocol.h index 85783082..141414a7 100644 --- a/src/hardware/uni-t-dmm/protocol.h +++ b/src/hardware/uni-t-dmm/protocol.h @@ -31,6 +31,7 @@ enum { TECPEL_DMM_8061, + UNI_T_UT372, UNI_T_UT60A, UNI_T_UT60E, UNI_T_UT60G, @@ -94,6 +95,7 @@ struct dev_context { }; SR_PRIV int receive_data_TECPEL_DMM_8061(int fd, int revents, void *cb_data); +SR_PRIV int receive_data_UNI_T_UT372(int fd, int revents, void *cb_data); 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); SR_PRIV int receive_data_UNI_T_UT60G(int fd, int revents, void *cb_data); diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 9e080265..574497c1 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -1092,4 +1092,16 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi, SR_PRIV int es51919_serial_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); +/*--- hardware/dmm/ut372.c --------------------------------------------------*/ + +#define UT372_PACKET_SIZE 27 + +struct ut372_info { + int dummy; +}; + +SR_PRIV gboolean sr_ut372_packet_valid(const uint8_t *buf); +SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval, + struct sr_datafeed_analog *analog, void *info); + #endif