Laurette Buitenhuis / HIDScope

Dependencies:   USBDevice

Fork of HIDScope by Tom Tom

Files at this revision

API Documentation at this revision

Comitter:
tomlankhorst
Date:
Thu Oct 06 12:54:02 2016 +0000
Parent:
4:eade4ec5282b
Child:
6:188304906687
Commit message:
USBDevice 1 revision back

Changed in this revision

HIDScope.cpp Show annotated file Show diff for this revision Revisions of this file
HIDScope.h Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
--- a/HIDScope.cpp	Thu Sep 22 08:00:52 2016 +0000
+++ b/HIDScope.cpp	Thu Oct 06 12:54:02 2016 +0000
@@ -1,6 +1,6 @@
 #include "HIDScope.h"
 
-HIDScope::HIDScope(int channels) : hid(64,64) 
+HIDScope::HIDScope(int channels, bool non_blocking) : send_non_blocking(non_blocking), hid(64,64)
 {
     bufferData      = new float[channels]();
     channelCount    = channels;
@@ -29,9 +29,6 @@
 
 void HIDScope::send()
 {    
-    for(int ch=0; ch<channelCount; ch++)
-        memcpy(&scopeData.data[ch*4], &bufferData[ch], 4); // Copy a 4 byte float to the char array
-    
-    // Send non blocking, can be adjusted to blocking (hid.send)
+    memcpy(&scopeData.data, bufferData, sizeof( float ) * channelCount); // Copy a 4 byte float to the char array
     hid.sendNB(&scopeData);
 }
\ No newline at end of file
--- a/HIDScope.h	Thu Sep 22 08:00:52 2016 +0000
+++ b/HIDScope.h	Thu Oct 06 12:54:02 2016 +0000
@@ -41,7 +41,7 @@
 class HIDScope {
     public: 
         ///Instantiate the HID Scope
-        HIDScope(int channels);
+        HIDScope(int channels, bool non_blocking = true);
         
         /** Sets the current channel value
           @param ch : integer channel no (0-6)
@@ -76,6 +76,7 @@
         */
         void send();
     private:
+        bool send_non_blocking;
         USBHID hid;
         HID_REPORT scopeData;
         float* bufferData;
--- a/USBDevice.lib	Thu Sep 22 08:00:52 2016 +0000
+++ b/USBDevice.lib	Thu Oct 06 12:54:02 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#01321bd6ff89
+http://mbed.org/users/mbed_official/code/USBDevice/#c1549af978d6