libsigrok
unreleased development snapshot
sigrok hardware access and backend library
|
Conversion helper functions. More...
Go to the source code of this file.
Functions | |
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. More... | |
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. More... | |
Conversion helper functions.
Definition in file conversion.c.
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.
analog | The analog input values. |
lo_thr | The low threshold - result becomes 0 below it. |
hi_thr | The high threshold - result becomes 1 above it. |
state | The internal converter state. Must contain the state of logic sample n-1, will contain the state of logic sample n+count upon exit. |
output | The converted output values; either 0 or 1. Must provide space for count bytes. |
count | The number of samples to process. |
Definition at line 81 of file conversion.c.
References sr_datafeed_analog::data, sr_datafeed_analog::encoding, sr_analog_encoding::is_float, sr_analog_to_float(), SR_ERR, and SR_OK.
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.
[in] | analog | The analog input values. |
[in] | threshold | The threshold to use. |
[out] | output | The converted output values; either 0 or 1. Must provide space for count bytes. |
[in] | count | The number of samples to process. |
Definition at line 44 of file conversion.c.
References sr_datafeed_analog::data, sr_datafeed_analog::encoding, sr_analog_encoding::is_float, sr_analog_to_float(), SR_ERR, and SR_OK.