2 * This file is part of the libsigrok project.
4 * Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
5 * Copyright (C) 2013 Aurelien Jacobs <aurel@gnuage.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 * Cyrustek ES519XX protocol parser.
25 * Communication parameters: Unidirectional, 2400/7o1 or 19230/7o1
32 #include "libsigrok.h"
33 #include "libsigrok-internal.h"
35 /* Message logging helpers with subsystem-specific prefix string. */
36 #define LOG_PREFIX "es519xx: "
37 #define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
38 #define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
39 #define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
40 #define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
41 #define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
42 #define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
44 /* Factors for the respective measurement mode (0 means "invalid"). */
45 static const float factors_2400_11B[8][8] = {
46 {1e-4, 1e-3, 1e-2, 1e-1, 1, 0, 0, 0 }, /* V */
47 {1e-7, 1e-6, 0, 0, 0, 0, 0, 0 }, /* uA */
48 {1e-5, 1e-4, 0, 0, 0, 0, 0, 0 }, /* mA */
49 {1e-2, 0, 0, 0, 0, 0, 0, 0 }, /* A */
50 {1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 0, 0 }, /* RPM */
51 {1e-1, 1, 1e1, 1e2, 1e3, 1e4, 0, 0 }, /* Resistance */
52 {1, 1e1, 1e2, 1e3, 1e4, 1e5, 0, 0 }, /* Frequency */
53 {1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5}, /* Capacitance */
55 static const float factors_19200_11B_5digits[8][8] = {
56 {1e-4, 1e-3, 1e-2, 1e-1, 1e-5, 0, 0, 0}, /* V */
57 {1e-8, 1e-7, 0, 0, 0, 0, 0, 0}, /* uA */
58 {1e-6, 1e-5, 0, 0, 0, 0, 0, 0}, /* mA */
59 {0, 1e-3, 0, 0, 0, 0, 0, 0}, /* A */
60 {1e-4, 1e-3, 1e-2, 1e-1, 1, 0, 0, 0}, /* Manual A */
61 {1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4, 0}, /* Resistance */
62 {1e-1, 0, 1, 1e1, 1e2, 1e3, 1e4, 0}, /* Frequency */
63 {1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5}, /* Capacitance */
65 static const float factors_19200_11B_clampmeter[8][8] = {
66 {1e-3, 1e-2, 1e-1, 1, 1e-4, 0, 0, 0}, /* V */
67 {1e-7, 1e-6, 0, 0, 0, 0, 0, 0}, /* uA */
68 {1e-5, 1e-4, 0, 0, 0, 0, 0, 0}, /* mA */
69 {1e-2, 0, 0, 0, 0, 0, 0, 0}, /* A */
70 {1e-3, 1e-2, 1e-1, 1, 0, 0, 0, 0}, /* Manual A */
71 {1e-1, 1, 1e1, 1e2, 1e3, 1e4, 0, 0}, /* Resistance */
72 {1e-1, 0, 1, 1e1, 1e2, 1e3, 1e4, 0}, /* Frequency */
73 {1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5}, /* Capacitance */
75 static const float factors_19200_11B[8][8] = {
76 {1e-3, 1e-2, 1e-1, 1, 1e-4, 0, 0, 0}, /* V */
77 {1e-7, 1e-6, 0, 0, 0, 0, 0, 0}, /* uA */
78 {1e-5, 1e-4, 0, 0, 0, 0, 0, 0}, /* mA */
79 {1e-3, 1e-2, 0, 0, 0, 0, 0, 0}, /* A */
80 {0, 0, 0, 0, 0, 0, 0, 0}, /* Manual A */
81 {1e-1, 1, 1e1, 1e2, 1e3, 1e4, 0, 0}, /* Resistance */
82 {1, 1e1, 1e2, 1e3, 1e4, 0, 0, 0}, /* Frequency */
83 {1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 0}, /* Capacitance */
85 static const float factors_19200_14B[8][8] = {
86 {1e-4, 1e-3, 1e-2, 1e-1, 1e-5, 0, 0, 0}, /* V */
87 {1e-8, 1e-7, 0, 0, 0, 0, 0, 0}, /* uA */
88 {1e-6, 1e-5, 0, 0, 0, 0, 0, 0}, /* mA */
89 {1e-3, 0, 0, 0, 0, 0, 0, 0}, /* A */
90 {1e-4, 1e-3, 1e-2, 1e-1, 1, 0, 0, 0}, /* Manual A */
91 {1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4, 0}, /* Resistance */
92 {1e-2, 1e-1, 0, 1, 1e1, 1e2, 1e3, 1e4}, /* Frequency */
93 {1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5}, /* Capacitance */
96 static int parse_value(const uint8_t *buf, struct es519xx_info *info,
99 int i, intval, nb_digits = 4 + (info->packet_size == 14);
102 /* Bytes 1-4 (or 5): Value (4 or 5 decimal digits) */
104 sr_spew("Over limit.");
107 } else if (info->is_ul) {
108 sr_spew("Under limit.");
111 } else if (!isdigit(buf[1]) || !isdigit(buf[2]) ||
112 !isdigit(buf[3]) || !isdigit(buf[4]) ||
113 (nb_digits == 5 && !isdigit(buf[5]))) {
114 sr_err("Value contained invalid digits: %02x %02x %02x %02x "
115 "(%c %c %c %c).", buf[1], buf[2], buf[3], buf[4],
116 buf[1], buf[2], buf[3], buf[4]);
119 intval = info->is_digit4;
120 for (i=0; i<nb_digits; i++)
121 intval = 10*intval + (buf[i+1] - '0');
124 intval *= info->is_sign ? -1 : 1;
126 floatval = (float)intval;
128 /* Note: The decimal point position will be parsed later. */
130 sr_spew("The display value is %f.", floatval);
136 static int parse_range(uint8_t b, float *floatval,
137 const struct es519xx_info *info)
139 int mode, idx = b - '0';
142 if (idx < 0 || idx > 7) {
143 sr_dbg("Invalid range byte / index: 0x%02x / 0x%02x.", b, idx);
147 /* Parse range byte (depends on the measurement mode). */
148 if (info->is_voltage)
150 else if (info->is_current && info->is_micro)
152 else if (info->is_current && info->is_milli)
154 else if (info->is_current && info->is_auto)
156 else if (info->is_current)
157 mode = 4; /* Manual A */
158 else if (info->is_rpm)
160 else if (info->is_resistance)
161 mode = 5; /* Resistance */
162 else if (info->is_frequency)
163 mode = 6; /* Frequency */
164 else if (info->is_capacitance)
165 mode = 7; /* Capacitance */
167 sr_dbg("Invalid mode, range byte was: 0x%02x.", b);
173 factor = (const float[]){ 1e-1, 1 }[idx];
174 else if (info->is_milli)
175 factor = (const float[]){ 1e-2, 1e-1 }[idx];
177 else if (info->baudrate == 2400)
178 factor = factors_2400_11B[mode][idx];
179 else if (info->fivedigits)
180 factor = factors_19200_11B_5digits[mode][idx];
181 else if (info->clampmeter)
182 factor = factors_19200_11B_clampmeter[mode][idx];
183 else if (info->packet_size == 11)
184 factor = factors_19200_11B[mode][idx];
185 else if (info->packet_size == 14)
186 factor = factors_19200_14B[mode][idx];
189 sr_dbg("Invalid factor for range byte: 0x%02x.", b);
193 /* Apply respective factor (mode-dependent) on the value. */
195 sr_dbg("Applying factor %f, new value is %f.", factor, *floatval);
200 static void parse_flags(const uint8_t *buf, struct es519xx_info *info)
202 int function = 5 + (info->packet_size == 14), status = function + 1;
205 if (info->alt_functions) {
206 info->is_sign = (buf[status] & (1 << 3)) != 0;
207 info->is_batt = (buf[status] & (1 << 2)) != 0; /* Battery low */
208 info->is_ol = (buf[status] & (1 << 1)) != 0; /* Input overflow */
209 info->is_ol |= (buf[status] & (1 << 0)) != 0; /* Input overflow */
211 info->is_judge = (buf[status] & (1 << 3)) != 0;
212 info->is_sign = (buf[status] & (1 << 2)) != 0;
213 info->is_batt = (buf[status] & (1 << 1)) != 0; /* Battery low */
214 info->is_ol = (buf[status] & (1 << 0)) != 0; /* Input overflow */
217 if (info->packet_size == 14) {
219 info->is_max = (buf[8] & (1 << 3)) != 0;
220 info->is_min = (buf[8] & (1 << 2)) != 0;
221 info->is_rel = (buf[8] & (1 << 1)) != 0;
222 info->is_rmr = (buf[8] & (1 << 0)) != 0;
225 info->is_ul = (buf[9] & (1 << 3)) != 0;
226 info->is_pmax = (buf[9] & (1 << 2)) != 0;
227 info->is_pmin = (buf[9] & (1 << 1)) != 0;
230 info->is_dc = (buf[10] & (1 << 3)) != 0;
231 info->is_ac = (buf[10] & (1 << 2)) != 0;
232 info->is_auto = (buf[10] & (1 << 1)) != 0;
233 info->is_vahz = (buf[10] & (1 << 0)) != 0;
235 if (info->selectable_lpf) {
237 info->is_hold = (buf[11] & (1 << 3)) != 0;
238 info->is_vbar = (buf[11] & (1 << 2)) != 0;
239 info->is_lpf1 = (buf[11] & (1 << 1)) != 0;
240 info->is_lpf0 = (buf[11] & (1 << 0)) != 0;
243 info->is_vbar = (buf[11] & (1 << 2)) != 0;
244 info->is_hold = (buf[11] & (1 << 1)) != 0;
245 info->is_lpf1 = (buf[11] & (1 << 0)) != 0;
247 } else if (info->alt_functions) {
249 info->is_dc = (buf[8] & (1 << 3)) != 0;
250 info->is_auto = (buf[8] & (1 << 2)) != 0;
251 info->is_apo = (buf[8] & (1 << 0)) != 0;
252 info->is_ac = !info->is_dc;
255 if (info->baudrate == 2400) {
256 info->is_pmax = (buf[7] & (1 << 3)) != 0;
257 info->is_pmin = (buf[7] & (1 << 2)) != 0;
258 info->is_vahz = (buf[7] & (1 << 0)) != 0;
259 } else if (info->fivedigits) {
260 info->is_ul = (buf[7] & (1 << 3)) != 0;
261 info->is_pmax = (buf[7] & (1 << 2)) != 0;
262 info->is_pmin = (buf[7] & (1 << 1)) != 0;
263 info->is_digit4 = (buf[7] & (1 << 0)) != 0;
264 } else if (info->clampmeter) {
265 info->is_ul = (buf[7] & (1 << 3)) != 0;
266 info->is_vasel = (buf[7] & (1 << 2)) != 0;
267 info->is_vbar = (buf[7] & (1 << 1)) != 0;
269 info->is_hold = (buf[7] & (1 << 3)) != 0;
270 info->is_max = (buf[7] & (1 << 2)) != 0;
271 info->is_min = (buf[7] & (1 << 1)) != 0;
275 info->is_dc = (buf[8] & (1 << 3)) != 0;
276 info->is_ac = (buf[8] & (1 << 2)) != 0;
277 info->is_auto = (buf[8] & (1 << 1)) != 0;
278 if (info->baudrate == 2400)
279 info->is_apo = (buf[8] & (1 << 0)) != 0;
281 info->is_vahz = (buf[8] & (1 << 0)) != 0;
285 if (info->alt_functions) {
286 switch (buf[function]) {
288 info->is_current = info->is_auto = TRUE;
291 info->is_current = info->is_micro = info->is_auto = TRUE;
294 info->is_current = info->is_milli = info->is_auto = TRUE;
297 info->is_voltage = TRUE;
299 case 0x37: /* Resistance */
300 info->is_resistance = TRUE;
302 case 0x36: /* Continuity */
303 info->is_continuity = TRUE;
305 case 0x3b: /* Diode */
306 info->is_diode = TRUE;
308 case 0x3a: /* Frequency */
309 info->is_frequency = TRUE;
311 case 0x34: /* ADP0 */
312 case 0x35: /* ADP0 */
313 info->is_adp0 = TRUE;
315 case 0x38: /* ADP1 */
316 case 0x39: /* ADP1 */
317 info->is_adp1 = TRUE;
319 case 0x32: /* ADP2 */
320 case 0x33: /* ADP2 */
321 info->is_adp2 = TRUE;
323 case 0x30: /* ADP3 */
324 case 0x31: /* ADP3 */
325 info->is_adp3 = TRUE;
328 sr_err("Invalid function byte: 0x%02x.", buf[function]);
332 switch (buf[function]) {
334 info->is_voltage = TRUE;
337 info->is_current = info->is_micro = info->is_auto = TRUE;
340 info->is_current = info->is_milli = info->is_auto = TRUE;
343 info->is_current = info->is_auto = TRUE;
345 case 0x39: /* Manual A */
346 info->is_current = TRUE;
347 info->is_auto = FALSE; /* Manual mode */
349 case 0x33: /* Resistance */
350 info->is_resistance = TRUE;
352 case 0x35: /* Continuity */
353 info->is_continuity = TRUE;
355 case 0x31: /* Diode */
356 info->is_diode = TRUE;
358 case 0x32: /* Frequency / RPM / duty cycle */
359 if (info->packet_size == 14) {
361 info->is_frequency = TRUE;
363 info->is_duty_cycle = TRUE;
368 info->is_frequency = TRUE;
371 case 0x36: /* Capacitance */
372 info->is_capacitance = TRUE;
374 case 0x34: /* Temperature */
375 info->is_temperature = TRUE;
377 info->is_celsius = TRUE;
379 info->is_fahrenheit = TRUE;
381 case 0x3e: /* ADP0 */
382 info->is_adp0 = TRUE;
384 case 0x3c: /* ADP1 */
385 info->is_adp1 = TRUE;
387 case 0x38: /* ADP2 */
388 info->is_adp2 = TRUE;
390 case 0x3a: /* ADP3 */
391 info->is_adp3 = TRUE;
394 sr_err("Invalid function byte: 0x%02x.", buf[function]);
399 if (info->is_current && (info->is_micro || info->is_milli) && info->is_vasel) {
400 info->is_current = info->is_auto = FALSE;
401 info->is_voltage = TRUE;
404 if (info->baudrate == 2400) {
405 /* inverted mapping between mA and A, and no manual A */
406 if (info->is_current && (info->is_milli || !info->is_auto)) {
407 info->is_milli = !info->is_milli;
408 info->is_auto = TRUE;
413 static void handle_flags(struct sr_datafeed_analog *analog,
414 float *floatval, const struct es519xx_info *info)
417 * Note: is_micro etc. are not used directly to multiply/divide
418 * floatval, this is handled via parse_range() and factors[][].
421 /* Measurement modes */
422 if (info->is_voltage) {
423 analog->mq = SR_MQ_VOLTAGE;
424 analog->unit = SR_UNIT_VOLT;
426 if (info->is_current) {
427 analog->mq = SR_MQ_CURRENT;
428 analog->unit = SR_UNIT_AMPERE;
430 if (info->is_resistance) {
431 analog->mq = SR_MQ_RESISTANCE;
432 analog->unit = SR_UNIT_OHM;
434 if (info->is_frequency) {
435 analog->mq = SR_MQ_FREQUENCY;
436 analog->unit = SR_UNIT_HERTZ;
438 if (info->is_capacitance) {
439 analog->mq = SR_MQ_CAPACITANCE;
440 analog->unit = SR_UNIT_FARAD;
442 if (info->is_temperature && info->is_celsius) {
443 analog->mq = SR_MQ_TEMPERATURE;
444 analog->unit = SR_UNIT_CELSIUS;
446 if (info->is_temperature && info->is_fahrenheit) {
447 analog->mq = SR_MQ_TEMPERATURE;
448 analog->unit = SR_UNIT_FAHRENHEIT;
450 if (info->is_continuity) {
451 analog->mq = SR_MQ_CONTINUITY;
452 analog->unit = SR_UNIT_BOOLEAN;
453 *floatval = (*floatval < 0.0) ? 0.0 : 1.0;
455 if (info->is_diode) {
456 analog->mq = SR_MQ_VOLTAGE;
457 analog->unit = SR_UNIT_VOLT;
460 analog->mq = SR_MQ_FREQUENCY;
461 analog->unit = SR_UNIT_REVOLUTIONS_PER_MINUTE;
463 if (info->is_duty_cycle) {
464 analog->mq = SR_MQ_DUTY_CYCLE;
465 analog->unit = SR_UNIT_PERCENTAGE;
468 /* Measurement related flags */
470 analog->mqflags |= SR_MQFLAG_AC;
472 analog->mqflags |= SR_MQFLAG_DC;
474 analog->mqflags |= SR_MQFLAG_AUTORANGE;
476 analog->mqflags |= SR_MQFLAG_DIODE;
478 analog->mqflags |= SR_MQFLAG_HOLD;
480 analog->mqflags |= SR_MQFLAG_MAX;
482 analog->mqflags |= SR_MQFLAG_MIN;
484 analog->mqflags |= SR_MQFLAG_RELATIVE;
488 sr_spew("Judge bit is set.");
490 sr_spew("Battery is low.");
492 sr_spew("Input overflow.");
494 sr_spew("Input underflow.");
496 sr_spew("pMAX active, LCD shows max. peak value.");
498 sr_spew("pMIN active, LCD shows min. peak value.");
500 sr_spew("VAHZ active.");
502 sr_spew("Auto-Power-Off enabled.");
504 sr_spew("VBAR active.");
505 if ((!info->selectable_lpf && info->is_lpf1) ||
506 (info->selectable_lpf && (!info->is_lpf0 || !info->is_lpf1)))
507 sr_spew("Low-pass filter feature is active.");
510 static gboolean flags_valid(const struct es519xx_info *info)
514 /* Does the packet have more than one multiplier? */
515 count = info->is_micro;
516 count += info->is_milli;
518 sr_err("More than one multiplier detected in packet.");
522 /* Does the packet "measure" more than one type of value? */
523 count = info->is_voltage;
524 count += info->is_current;
525 count += info->is_resistance;
526 count += info->is_frequency;
527 count += info->is_capacitance;
528 count += info->is_temperature;
529 count += info->is_continuity;
530 count += info->is_diode;
531 count += info->is_rpm;
533 sr_err("More than one measurement type detected in packet.");
537 /* Both AC and DC set? */
538 if (info->is_ac && info->is_dc) {
539 sr_err("Both AC and DC flags detected in packet.");
546 static gboolean sr_es519xx_packet_valid(const uint8_t *buf,
547 struct es519xx_info *info)
549 int s = info->packet_size;
551 if (info->packet_size == 11 && memcmp(buf, buf + s, s))
554 if (buf[s-2] != '\r' || buf[s-1] != '\n')
557 parse_flags(buf, info);
559 if (!flags_valid(info))
565 static int sr_es519xx_parse(const uint8_t *buf, float *floatval,
566 struct sr_datafeed_analog *analog,
567 struct es519xx_info *info)
571 if (!sr_es519xx_packet_valid(buf, info))
574 if ((ret = parse_value(buf, info, floatval)) != SR_OK) {
575 sr_err("Error parsing value: %d.", ret);
579 handle_flags(analog, floatval, info);
581 return parse_range(buf[0], floatval, info);
586 * Functions for 2400 bauds 11 Bytes protocols.
587 * This includes ES51962, ES51971, ES51972, ES51978 and ES51989.
589 SR_PRIV gboolean sr_es519xx_2400_11B_packet_valid(const uint8_t *buf)
591 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 2400,
593 return sr_es519xx_packet_valid(buf, &info);
596 SR_PRIV int sr_es519xx_2400_11B_parse(const uint8_t *buf, float *floatval,
597 struct sr_datafeed_analog *analog,
600 struct es519xx_info *info_local = info;
601 *info_local = (const struct es519xx_info) { .baudrate = 2400,
603 return sr_es519xx_parse(buf, floatval, analog, info);
608 * Functions for 2400 bauds 11 Bytes protocols.
609 * This includes ES51960, ES51977 and ES51988.
611 SR_PRIV gboolean sr_es519xx_2400_11B_alt_functions_packet_valid(const uint8_t *buf)
613 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 2400,
615 .alt_functions = TRUE };
616 return sr_es519xx_packet_valid(buf, &info);
619 SR_PRIV int sr_es519xx_2400_11B_alt_functions_parse(const uint8_t *buf,
621 struct sr_datafeed_analog *analog,
624 struct es519xx_info *info_local = info;
625 *info_local = (const struct es519xx_info) { .baudrate = 2400,
627 .alt_functions = TRUE };
628 return sr_es519xx_parse(buf, floatval, analog, info);
633 * Functions for 19200 bauds 11 Bytes protocols with 5 digits display
634 * This includes ES51911, ES51916 and ES51918.
636 SR_PRIV gboolean sr_es519xx_19200_11B_5digits_packet_valid(const uint8_t *buf)
638 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 19200,
641 return sr_es519xx_packet_valid(buf, &info);
644 SR_PRIV int sr_es519xx_19200_11B_5difits_parse(const uint8_t *buf,
645 float *floatval, struct sr_datafeed_analog *analog, void *info)
647 struct es519xx_info *info_local = info;
648 *info_local = (const struct es519xx_info) { .baudrate = 19200,
650 .fivedigits = TRUE };
651 return sr_es519xx_parse(buf, floatval, analog, info);
656 * Functions for 19200 bauds 11 Bytes protocols with clamp meter support
657 * This includes ES51967 and ES51969.
659 SR_PRIV gboolean sr_es519xx_19200_11B_clamp_packet_valid(const uint8_t *buf)
661 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 19200,
664 return sr_es519xx_packet_valid(buf, &info);
667 SR_PRIV int sr_es519xx_19200_11B_clamp_parse(const uint8_t *buf,
669 struct sr_datafeed_analog *analog,
672 struct es519xx_info *info_local = info;
673 *info_local = (const struct es519xx_info) { .baudrate = 19200,
675 .clampmeter = TRUE };
676 return sr_es519xx_parse(buf, floatval, analog, info);
681 * Functions for 19200 bauds 11 Bytes protocols.
682 * This includes ES51981, ES51982, ES51983, ES51984 and ES51986.
684 SR_PRIV gboolean sr_es519xx_19200_11B_packet_valid(const uint8_t *buf)
686 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 19200,
688 return sr_es519xx_packet_valid(buf, &info);
691 SR_PRIV int sr_es519xx_19200_11B_parse(const uint8_t *buf, float *floatval,
692 struct sr_datafeed_analog *analog,
695 struct es519xx_info *info_local = info;
696 *info_local = (const struct es519xx_info) { .baudrate = 19200,
698 return sr_es519xx_parse(buf, floatval, analog, info);
703 * Functions for 19200 bauds 14 Bytes protocols.
704 * This includes ES51921 and ES51922.
706 SR_PRIV gboolean sr_es519xx_19200_14B_packet_valid(const uint8_t *buf)
708 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 19200,
710 return sr_es519xx_packet_valid(buf, &info);
713 SR_PRIV int sr_es519xx_19200_14B_parse(const uint8_t *buf, float *floatval,
714 struct sr_datafeed_analog *analog,
717 struct es519xx_info *info_local = info;
718 *info_local = (const struct es519xx_info) { .baudrate = 19200,
720 return sr_es519xx_parse(buf, floatval, analog, info);
725 * Functions for 19200 bauds 14 Bytes protocols with selectable LPF.
726 * This includes ES51931 and ES51932.
728 SR_PRIV gboolean sr_es519xx_19200_14B_selectable_lpfpacket_valid(const uint8_t *buf)
730 struct es519xx_info info = (const struct es519xx_info){ .baudrate = 19200,
732 .selectable_lpf = TRUE };
733 return sr_es519xx_packet_valid(buf, &info);
736 SR_PRIV int sr_es519xx_19200_14B_selectable_lpf_parse(const uint8_t *buf,
738 struct sr_datafeed_analog *analog,
741 struct es519xx_info *info_local = info;
742 *info_local = (const struct es519xx_info) { .baudrate = 19200,
744 .selectable_lpf = TRUE };
745 return sr_es519xx_parse(buf, floatval, analog, info);