sr: add unit field to sr_df_analog packet

This commit is contained in:
Bert Vermeulen 2012-06-05 17:37:28 +02:00
parent 62bb8840e1
commit aff5a729ab
2 changed files with 8 additions and 0 deletions

View File

@ -574,6 +574,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
packet.payload = &analog;
/* TODO: support for 5xxx series 9-bit samples */
analog.num_samples = transfer->actual_length / 2;
analog.unit = SR_UNIT_VOLTAGE;
analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes);
data_offset = 0;
for (i = 0; i < analog.num_samples; i++) {

View File

@ -167,6 +167,12 @@ enum {
SR_DF_FRAME_END,
};
/* sr_datafeed_analog.unit values */
enum {
SR_UNIT_VOLTAGE,
SR_UNIT_CURRENT,
};
struct sr_datafeed_packet {
uint16_t type;
void *payload;
@ -194,6 +200,7 @@ struct sr_datafeed_meta_analog {
struct sr_datafeed_analog {
int num_samples;
int unit;
float *data;
};