]> sigrok.org Git - libsigrok.git/commitdiff
Bindings: Provide helper method that auto-converts analog
authorSoeren Apel <redacted>
Sat, 27 May 2017 20:37:09 +0000 (22:37 +0200)
committerSoeren Apel <redacted>
Sat, 27 May 2017 20:37:28 +0000 (22:37 +0200)
bindings/cxx/classes.cpp
bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp

index 5c0ae3d0a0fc7ccbdc3756f49aaa511cdfa6d45c..be76263a942e7af576bf3c97e3f9f464ddc1f6ac 100644 (file)
@@ -1212,6 +1212,11 @@ void *Analog::data_pointer()
        return _structure->data;
 }
 
+void Analog::get_data_as_float(float *dest)
+{
+       check(sr_analog_to_float(_structure, dest));
+}
+
 unsigned int Analog::num_samples() const
 {
        return _structure->num_samples;
index b82679ab4b9da9db9e3f70119c5174bd58e838b1..b1ab7a5bd6f6e04a06607c80017e8fc0d9473f73 100644 (file)
@@ -768,6 +768,11 @@ class SR_API Analog :
 public:
        /** Pointer to data. */
        void *data_pointer();
+       /**
+        * Fills dest pointer with the analog data converted to float.
+        * The pointer must have space for num_samples() floats.
+        */
+       void get_data_as_float(float *dest);
        /** Number of samples in this packet. */
        unsigned int num_samples() const;
        /** Channels for which this packet contains data. */