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
Revision 5:80d551456856, committed 2016-10-06
- 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
--- 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
