]> sigrok.org Git - libsigrok.git/commitdiff
sr: analog: Add MQ and UNIT enums.
authorUwe Hermann <redacted>
Wed, 20 Jun 2012 21:55:23 +0000 (23:55 +0200)
committerUwe Hermann <redacted>
Wed, 20 Jun 2012 21:55:23 +0000 (23:55 +0200)
MQ is the measured quantity, e.g. voltage, current, temperature.

UNIT is the unit in which these quantities are measured, e.g. volt,
ampere, celsius, kelvin, etc. etc.

The same MQ can be specified in different UNITs by the driver, depending
on what the hardware reports. Conversion is left to the frontends.

hardware/hantek-dso/api.c
sigrok.h.in

index e6b87f85eaae6a6d84ca8dfcf6ee4cb17d992df3..c9310336173bd6e625352355cf4a374ab939b7f5 100644 (file)
@@ -573,7 +573,8 @@ 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.mq = SR_MQ_VOLTAGE;
+       analog.unit = SR_UNIT_VOLT;
        analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes);
        data_offset = 0;
        for (i = 0; i < analog.num_samples; i++) {
index 3e6f24e8f00a15337b73c8f183e36bd5cbb16ccf..1d1f8caf8add72445a43a9232c9b970915d8738c 100644 (file)
@@ -167,9 +167,27 @@ enum {
        SR_DF_FRAME_END,
 };
 
+/* sr_datafeed_analog.mq values */
+enum {
+       SR_MQ_VOLTAGE,
+       SR_MQ_CURRENT,
+       SR_MQ_RESISTANCE,
+       SR_MQ_CAPACITANCE,
+       SR_MQ_TEMPERATURE,
+       SR_MQ_FREQUENCY,
+       SR_MQ_DUTY_CYCLE,
+};
+
 /* sr_datafeed_analog.unit values */
 enum {
-       SR_UNIT_VOLTAGE,
+       SR_UNIT_VOLT,
+       SR_UNIT_AMPERE,
+       SR_UNIT_OHM,
+       SR_UNIT_FARAD,
+       SR_UNIT_CELSIUS,
+       SR_UNIT_KELVIN,
+       SR_UNIT_HERTZ,
+       SR_UNIT_PERCENTAGE,
 };
 
 struct sr_datafeed_packet {
@@ -199,7 +217,8 @@ struct sr_datafeed_meta_analog {
 
 struct sr_datafeed_analog {
        int num_samples;
-       int unit;
+       int mq; /* Measured quantity (e.g. voltage, current, temperature) */
+       int unit; /* Unit in which the MQ is measured. */
        float *data;
 };