libsigrok  unreleased development snapshot
sigrok hardware access and backend library
Functions
conversion.c File Reference

Conversion helper functions. More...

#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
+ Include dependency graph for conversion.c:

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...
 

Detailed Description

Conversion helper functions.

Definition in file conversion.c.

Function Documentation

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.

Parameters
analogThe analog input values.
lo_thrThe low threshold - result becomes 0 below it.
hi_thrThe high threshold - result becomes 1 above it.
stateThe internal converter state. Must contain the state of logic sample n-1, will contain the state of logic sample n+count upon exit.
outputThe converted output values; either 0 or 1. Must provide space for count bytes.
countThe number of samples to process.
Returns
SR_OK on success or SR_ERR on failure.

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.

+ Here is the call graph for this function:

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.

Parameters
[in]analogThe analog input values.
[in]thresholdThe threshold to use.
[out]outputThe converted output values; either 0 or 1. Must provide space for count bytes.
[in]countThe number of samples to process.
Returns
SR_OK on success or SR_ERR on failure.

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.

+ Here is the call graph for this function: