27 #include "libsigrok-internal.h" 30 #define LOG_PREFIX "conv" 45 float threshold, uint8_t *output, uint64_t count)
50 input = g_try_malloc(
sizeof(
float) * count);
58 for (uint64_t i = 0; i < count; i++)
59 output[i] = (input[i] >= threshold) ? 1 : 0;
82 float lo_thr,
float hi_thr, uint8_t *state, uint8_t *output,
88 input = g_try_malloc(
sizeof(
float) * count);
96 for (uint64_t i = 0; i < count; i++) {
97 if (input[i] < lo_thr)
99 else if (input[i] > hi_thr)
struct sr_analog_encoding * encoding
int sr_analog_to_float(const struct sr_datafeed_analog *analog, float *outbuf)
Convert an analog datafeed payload to an array of floats.
int sr_a2l_threshold(const struct sr_datafeed_analog *analog, float threshold, uint8_t *output, uint64_t count)
Convert analog values to logic values by using a fixed threshold.
Analog datafeed payload for type SR_DF_ANALOG.
int sr_a2l_schmitt_trigger(const struct sr_datafeed_analog *analog, float lo_thr, float hi_thr, uint8_t *state, uint8_t *output, uint64_t count)
Convert analog values to logic values by using a Schmitt-trigger algorithm.
Generic/unspecified error.
The public libsigrok header file to be used by frontends.