libsigrokcxx
unreleased development snapshot
C++ bindings for libsigrok
|
Payload of a datafeed packet with analog data. More...
#include <libsigrokcxx/libsigrokcxx.hpp>
Public Member Functions | |
void * | data_pointer () |
Pointer to data. More... | |
void | get_data_as_float (float *dest) |
Fills dest pointer with the analog data converted to float. More... | |
unsigned int | num_samples () const |
Number of samples in this packet. More... | |
std::vector< std::shared_ptr< Channel > > | channels () |
Channels for which this packet contains data. More... | |
unsigned int | unitsize () const |
Size of a single sample in bytes. More... | |
bool | is_signed () const |
Samples use a signed data type. More... | |
bool | is_float () const |
Samples use float. More... | |
bool | is_bigendian () const |
Samples are stored in big-endian order. More... | |
int | digits () const |
Number of significant digits after the decimal point, if positive. More... | |
bool | is_digits_decimal () const |
TBD. | |
std::shared_ptr< Rational > | scale () |
TBD. | |
std::shared_ptr< Rational > | offset () |
TBD. | |
const Quantity * | mq () const |
Measured quantity of the samples in this packet. More... | |
const Unit * | unit () const |
Unit of the samples in this packet. More... | |
std::vector< const QuantityFlag * > | mq_flags () const |
Measurement flags associated with the samples in this packet. More... | |
std::shared_ptr< Logic > | get_logic_via_threshold (float threshold, uint8_t *data_ptr=nullptr) const |
Provides a Logic packet that contains a conversion of the analog data using a simple threshold. More... | |
std::shared_ptr< Logic > | get_logic_via_schmitt_trigger (float lo_thr, float hi_thr, uint8_t *state, uint8_t *data_ptr=nullptr) const |
Provides a Logic packet that contains a conversion of the analog data using a Schmitt-Trigger. More... | |
Payload of a datafeed packet with analog data.
Definition at line 769 of file libsigrokcxx.hpp.
void* sigrok::Analog::data_pointer | ( | ) |
Pointer to data.
void sigrok::Analog::get_data_as_float | ( | float * | dest | ) |
Fills dest pointer with the analog data converted to float.
The pointer must have space for num_samples() floats.
unsigned int sigrok::Analog::num_samples | ( | ) | const |
Number of samples in this packet.
std::vector<std::shared_ptr<Channel> > sigrok::Analog::channels | ( | ) |
Channels for which this packet contains data.
unsigned int sigrok::Analog::unitsize | ( | ) | const |
Size of a single sample in bytes.
bool sigrok::Analog::is_signed | ( | ) | const |
Samples use a signed data type.
bool sigrok::Analog::is_float | ( | ) | const |
Samples use float.
bool sigrok::Analog::is_bigendian | ( | ) | const |
Samples are stored in big-endian order.
int sigrok::Analog::digits | ( | ) | const |
Number of significant digits after the decimal point, if positive.
When negative, exponent with reversed polarity that is necessary to express the value with all digits without a decimal point. Refers to the value we actually read on the wire.
Examples:
On the wire | Exponential notation | Exp. not. (normalized) | digits |
---|---|---|---|
12.34 MOhm | 1.234 * 10^7 Ohm | 1234 * 10^4 Ohm | -4 |
1.2345 MOhm | 1.2345 * 10^6 Ohm | 12345 * 10^2 Ohm | -2 |
123.4 kOhm | 1.234 * 10^5 Ohm | 1234 * 10^2 Ohm | -2 |
1234 Ohm | 1.234 * 10^3 Ohm | 1234 * 10^0 Ohm | 0 |
12.34 Ohm | 1.234 * 10^1 Ohm | 1234 * 10^-2 Ohm | 2 |
0.0123 Ohm | 1.23 * 10^-2 Ohm | 123 * 10^-4 Ohm | 4 |
1.234 pF | 1.234 * 10^-12 F | 1234 * 10^-15 F | 15 |
const Quantity* sigrok::Analog::mq | ( | ) | const |
Measured quantity of the samples in this packet.
std::vector<const QuantityFlag *> sigrok::Analog::mq_flags | ( | ) | const |
Measurement flags associated with the samples in this packet.
std::shared_ptr<Logic> sigrok::Analog::get_logic_via_threshold | ( | float | threshold, |
uint8_t * | data_ptr = nullptr |
||
) | const |
Provides a Logic packet that contains a conversion of the analog data using a simple threshold.
threshold | Threshold to use. |
data_ptr | Pointer to num_samples() bytes where the logic samples are stored. When nullptr, memory for logic->data_pointer() will be allocated and must be freed by the caller. |
std::shared_ptr<Logic> sigrok::Analog::get_logic_via_schmitt_trigger | ( | float | lo_thr, |
float | hi_thr, | ||
uint8_t * | state, | ||
uint8_t * | data_ptr = nullptr |
||
) | const |
Provides a Logic packet that contains a conversion of the analog data using a Schmitt-Trigger.
lo_thr | Low threshold to use (anything below this is low). |
hi_thr | High threshold to use (anything above this is high). |
state | Points to a byte that contains the current state of the converter. For best results, set to value of logic sample n-1. |
data_ptr | Pointer to num_samples() bytes where the logic samples are stored. When nullptr, memory for logic->data_pointer() will be allocated and must be freed by the caller. |