serial-dmm: Add PCE PCE-DM32 support.

This commit is contained in:
Uwe Hermann 2012-12-02 01:32:57 +01:00
parent a376ffea49
commit d4bd66a0c7
4 changed files with 69 additions and 1 deletions

View File

@ -55,6 +55,7 @@ SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
SR_PRIV struct sr_dev_driver va_va18b_driver_info; SR_PRIV struct sr_dev_driver va_va18b_driver_info;
SR_PRIV struct sr_dev_driver metex_m3640d_driver_info; SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
SR_PRIV struct sr_dev_driver peaktech_4370_driver_info; SR_PRIV struct sr_dev_driver peaktech_4370_driver_info;
SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info;
static struct sr_dev_driver *di_dt4000zc = &digitek_dt4000zc_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_tp4000zc = &tekpower_tp4000zc_driver_info;
@ -64,6 +65,7 @@ static struct sr_dev_driver *di_mas345 = &mastech_mas345_driver_info;
static struct sr_dev_driver *di_va18b = &va_va18b_driver_info; static struct sr_dev_driver *di_va18b = &va_va18b_driver_info;
static struct sr_dev_driver *di_m3640d = &metex_m3640d_driver_info; static struct sr_dev_driver *di_m3640d = &metex_m3640d_driver_info;
static struct sr_dev_driver *di_4370 = &peaktech_4370_driver_info; static struct sr_dev_driver *di_4370 = &peaktech_4370_driver_info;
static struct sr_dev_driver *di_pce_dm32 = &pce_pce_dm32_driver_info;
/* After hw_init() this will point to a device-specific entry (see above). */ /* After hw_init() this will point to a device-specific entry (see above). */
static struct sr_dev_driver *di = NULL; static struct sr_dev_driver *di = NULL;
@ -117,6 +119,12 @@ SR_PRIV struct dmm_info dmms[] = {
sr_metex14_packet_valid, sr_metex14_parse, sr_metex14_packet_valid, sr_metex14_parse,
NULL, NULL,
}, },
{
"PCE", "PCE-DM32", "2400/8n1", 2400,
FS9721_PACKET_SIZE, NULL,
sr_fs9721_packet_valid, sr_fs9721_parse,
dmm_details_pce_dm32,
},
}; };
/* Properly close and free all devices. */ /* Properly close and free all devices. */
@ -170,6 +178,8 @@ static int hw_init(int dmm)
di = di_m3640d; di = di_m3640d;
if (dmm == PEAKTECH_4370) if (dmm == PEAKTECH_4370)
di = di_4370; di = di_4370;
if (dmm == PCE_PCE_DM32)
di = di_pce_dm32;
sr_dbg("Selected '%s' subdriver.", di->name); sr_dbg("Selected '%s' subdriver.", di->name);
di->priv = drvc; di->priv = drvc;
@ -217,6 +227,11 @@ static int hw_init_peaktech_4370(void)
return hw_init(PEAKTECH_4370); return hw_init(PEAKTECH_4370);
} }
static int hw_init_pce_pce_dm32(void)
{
return hw_init(PCE_PCE_DM32);
}
static GSList *scan(const char *conn, const char *serialcomm, int dmm) static GSList *scan(const char *conn, const char *serialcomm, int dmm)
{ {
struct sr_dev_inst *sdi; struct sr_dev_inst *sdi;
@ -340,6 +355,8 @@ static GSList *hw_scan(GSList *options)
dmm = 6; dmm = 6;
if (!strcmp(di->name, "peaktech-4370")) if (!strcmp(di->name, "peaktech-4370"))
dmm = 7; dmm = 7;
if (!strcmp(di->name, "pce-pce-dm32"))
dmm = 8;
if (serialcomm) { if (serialcomm) {
/* Use the provided comm specs. */ /* Use the provided comm specs. */
@ -511,6 +528,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
receive_data = metex_m3640d_receive_data; receive_data = metex_m3640d_receive_data;
if (!strcmp(di->name, "peaktech-4370")) if (!strcmp(di->name, "peaktech-4370"))
receive_data = peaktech_4370_receive_data; receive_data = peaktech_4370_receive_data;
if (!strcmp(di->name, "pce-pce-dm32"))
receive_data = pce_pce_dm32_receive_data;
/* Poll every 50ms, or whenever some data comes in. */ /* Poll every 50ms, or whenever some data comes in. */
sr_source_add(devc->serial->fd, G_IO_IN, 50, sr_source_add(devc->serial->fd, G_IO_IN, 50,
@ -688,3 +707,22 @@ SR_PRIV struct sr_dev_driver peaktech_4370_driver_info = {
.dev_acquisition_stop = hw_dev_acquisition_stop, .dev_acquisition_stop = hw_dev_acquisition_stop,
.priv = NULL, .priv = NULL,
}; };
SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info = {
.name = "pce-pce-dm32",
.longname = "PCE PCE-DM32",
.api_version = 1,
.init = hw_init_pce_pce_dm32,
.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,
};

View File

@ -66,6 +66,25 @@ SR_PRIV void dmm_details_va18b(struct sr_datafeed_analog *analog, void *info)
} }
} }
SR_PRIV void dmm_details_pce_dm32(struct sr_datafeed_analog *analog, void *info)
{
struct fs9721_info *info_local;
info_local = (struct fs9721_info *)info;
/* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (F). */
if (info_local->is_c2c1_01) {
analog->mq = SR_MQ_TEMPERATURE;
analog->unit = SR_UNIT_FAHRENHEIT;
}
/* User-defined FS9721_LP3 flag 'c2c1_10' means temperature (C). */
if (info_local->is_c2c1_10) {
analog->mq = SR_MQ_TEMPERATURE;
analog->unit = SR_UNIT_CELSIUS;
}
}
static void handle_packet(const uint8_t *buf, struct dev_context *devc, static void handle_packet(const uint8_t *buf, struct dev_context *devc,
int dmm, void *info) int dmm, void *info)
{ {
@ -213,3 +232,9 @@ SR_PRIV int peaktech_4370_receive_data(int fd, int revents, void *cb_data)
struct metex14_info info; struct metex14_info info;
return receive_data(fd, revents, PEAKTECH_4370, &info, cb_data); return receive_data(fd, revents, PEAKTECH_4370, &info, cb_data);
} }
SR_PRIV int pce_pce_dm32_receive_data(int fd, int revents, void *cb_data)
{
struct fs9721_info info;
return receive_data(fd, revents, PCE_PCE_DM32, &info, cb_data);
}

View File

@ -39,9 +39,10 @@ enum {
VA_VA18B, VA_VA18B,
METEX_M3640D, METEX_M3640D,
PEAKTECH_4370, PEAKTECH_4370,
PCE_PCE_DM32,
}; };
#define DMM_COUNT 8 #define DMM_COUNT 9
struct dmm_info { struct dmm_info {
char *vendor; char *vendor;
@ -86,9 +87,11 @@ SR_PRIV int mastech_mas345_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int va_va18b_receive_data(int fd, int revents, void *cb_data); SR_PRIV int va_va18b_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int metex_m3640d_receive_data(int fd, int revents, void *cb_data); SR_PRIV int metex_m3640d_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int peaktech_4370_receive_data(int fd, int revents, void *cb_data); SR_PRIV int peaktech_4370_receive_data(int fd, int revents, void *cb_data);
SR_PRIV int pce_pce_dm32_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_tp4000zc(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void dmm_details_dt4000zc(struct sr_datafeed_analog *analog, void *info); SR_PRIV void dmm_details_dt4000zc(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void dmm_details_va18b(struct sr_datafeed_analog *analog, void *info); SR_PRIV void dmm_details_va18b(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void dmm_details_pce_dm32(struct sr_datafeed_analog *analog, void *info);
#endif #endif

View File

@ -122,6 +122,7 @@ extern SR_PRIV struct sr_dev_driver mastech_mas345_driver_info;
extern SR_PRIV struct sr_dev_driver va_va18b_driver_info; extern SR_PRIV struct sr_dev_driver va_va18b_driver_info;
extern SR_PRIV struct sr_dev_driver metex_m3640d_driver_info; extern SR_PRIV struct sr_dev_driver metex_m3640d_driver_info;
extern SR_PRIV struct sr_dev_driver peaktech_4370_driver_info; extern SR_PRIV struct sr_dev_driver peaktech_4370_driver_info;
extern SR_PRIV struct sr_dev_driver pce_pce_dm32_driver_info;
#endif #endif
#ifdef HAVE_HW_UNI_T_DMM #ifdef HAVE_HW_UNI_T_DMM
extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info; extern SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
@ -184,6 +185,7 @@ static struct sr_dev_driver *drivers_list[] = {
&va_va18b_driver_info, &va_va18b_driver_info,
&metex_m3640d_driver_info, &metex_m3640d_driver_info,
&peaktech_4370_driver_info, &peaktech_4370_driver_info,
&pce_pce_dm32_driver_info,
#endif #endif
#ifdef HAVE_HW_UNI_T_DMM #ifdef HAVE_HW_UNI_T_DMM
&uni_t_ut61d_driver_info, &uni_t_ut61d_driver_info,