Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HIDScope by
Diff: HIDScope.cpp
- Revision:
- 5:80d551456856
- Parent:
- 0:79e3f3072f3b
--- 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
