X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fdmm%2Ffs9721.c;h=eaf5b477518de3f0fc10dd02623620556f639f25;hb=c8d9a71e436c1ae3f4f2e9c2fed6c873247e2308;hp=f3101f8b34b88ce5bffc9078341bdd3e7c4c9d35;hpb=155b680da482cea2381becb73c51cfb838bff31e;p=libsigrok.git diff --git a/src/dmm/fs9721.c b/src/dmm/fs9721.c index f3101f8b..eaf5b477 100644 --- a/src/dmm/fs9721.c +++ b/src/dmm/fs9721.c @@ -31,11 +31,12 @@ * - The protocol seems to be exactly the same. */ +#include #include #include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #define LOG_PREFIX "fs9721" @@ -259,52 +260,52 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, /* Measurement modes */ if (info->is_volt) { - analog->mq = SR_MQ_VOLTAGE; - analog->unit = SR_UNIT_VOLT; + analog->meaning->mq = SR_MQ_VOLTAGE; + analog->meaning->unit = SR_UNIT_VOLT; } if (info->is_ampere) { - analog->mq = SR_MQ_CURRENT; - analog->unit = SR_UNIT_AMPERE; + analog->meaning->mq = SR_MQ_CURRENT; + analog->meaning->unit = SR_UNIT_AMPERE; } if (info->is_ohm) { - analog->mq = SR_MQ_RESISTANCE; - analog->unit = SR_UNIT_OHM; + analog->meaning->mq = SR_MQ_RESISTANCE; + analog->meaning->unit = SR_UNIT_OHM; } if (info->is_hz) { - analog->mq = SR_MQ_FREQUENCY; - analog->unit = SR_UNIT_HERTZ; + analog->meaning->mq = SR_MQ_FREQUENCY; + analog->meaning->unit = SR_UNIT_HERTZ; } if (info->is_farad) { - analog->mq = SR_MQ_CAPACITANCE; - analog->unit = SR_UNIT_FARAD; + analog->meaning->mq = SR_MQ_CAPACITANCE; + analog->meaning->unit = SR_UNIT_FARAD; } if (info->is_beep) { - analog->mq = SR_MQ_CONTINUITY; - analog->unit = SR_UNIT_BOOLEAN; + analog->meaning->mq = SR_MQ_CONTINUITY; + analog->meaning->unit = SR_UNIT_BOOLEAN; *floatval = (*floatval == INFINITY) ? 0.0 : 1.0; } if (info->is_diode) { - analog->mq = SR_MQ_VOLTAGE; - analog->unit = SR_UNIT_VOLT; + analog->meaning->mq = SR_MQ_VOLTAGE; + analog->meaning->unit = SR_UNIT_VOLT; } if (info->is_percent) { - analog->mq = SR_MQ_DUTY_CYCLE; - analog->unit = SR_UNIT_PERCENTAGE; + analog->meaning->mq = SR_MQ_DUTY_CYCLE; + analog->meaning->unit = SR_UNIT_PERCENTAGE; } /* Measurement related flags */ if (info->is_ac) - analog->mqflags |= SR_MQFLAG_AC; + analog->meaning->mqflags |= SR_MQFLAG_AC; if (info->is_dc) - analog->mqflags |= SR_MQFLAG_DC; + analog->meaning->mqflags |= SR_MQFLAG_DC; if (info->is_auto) - analog->mqflags |= SR_MQFLAG_AUTORANGE; + analog->meaning->mqflags |= SR_MQFLAG_AUTORANGE; if (info->is_diode) - analog->mqflags |= SR_MQFLAG_DIODE; + analog->meaning->mqflags |= SR_MQFLAG_DIODE; if (info->is_hold) - analog->mqflags |= SR_MQFLAG_HOLD; + analog->meaning->mqflags |= SR_MQFLAG_HOLD; if (info->is_rel) - analog->mqflags |= SR_MQFLAG_RELATIVE; + analog->meaning->mqflags |= SR_MQFLAG_RELATIVE; /* Other flags */ if (info->is_rs232) @@ -335,7 +336,7 @@ SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf) * * @param buf Buffer containing the 14-byte protocol packet. Must not be NULL. * @param floatval Pointer to a float variable. That variable will contain the - * result value upon parsing success. Mut not be NULL. + * result value upon parsing success. Must not be NULL. * @param analog Pointer to a struct sr_datafeed_analog. The struct will be * filled with data according to the protocol packet. * Must not be NULL. @@ -372,8 +373,8 @@ SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info) /* User-defined FS9721_LP3 flag 'c2c1_00' means temperature (C). */ if (info_local->is_c2c1_00) { - analog->mq = SR_MQ_TEMPERATURE; - analog->unit = SR_UNIT_CELSIUS; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->unit = SR_UNIT_CELSIUS; } } @@ -385,8 +386,8 @@ SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info) /* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (C). */ if (info_local->is_c2c1_01) { - analog->mq = SR_MQ_TEMPERATURE; - analog->unit = SR_UNIT_CELSIUS; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->unit = SR_UNIT_CELSIUS; } } @@ -398,8 +399,8 @@ SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info) /* 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; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->unit = SR_UNIT_CELSIUS; } } @@ -411,14 +412,14 @@ SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *i /* 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; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->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; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->unit = SR_UNIT_CELSIUS; } } @@ -430,16 +431,16 @@ SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info) /* User-defined FS9721_LP3 flag 'c2c1_00' means MAX. */ if (info_local->is_c2c1_00) - analog->mqflags |= SR_MQFLAG_MAX; + analog->meaning->mqflags |= SR_MQFLAG_MAX; /* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (C). */ if (info_local->is_c2c1_01) { - analog->mq = SR_MQ_TEMPERATURE; - analog->unit = SR_UNIT_CELSIUS; + analog->meaning->mq = SR_MQ_TEMPERATURE; + analog->meaning->unit = SR_UNIT_CELSIUS; } /* User-defined FS9721_LP3 flag 'c2c1_11' means MIN. */ if (info_local->is_c2c1_11) - analog->mqflags |= SR_MQFLAG_MIN; + analog->meaning->mqflags |= SR_MQFLAG_MIN; }