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
HIDScope.cpp
00001 #include "HIDScope.h" 00002 00003 HIDScope::HIDScope(int channels) : hid(64,64) 00004 { 00005 bufferData = new float[channels](); 00006 channelCount = channels; 00007 scopeData.length = 64; 00008 } 00009 00010 void HIDScope::set(int ch, float val) 00011 { 00012 bufferData[ch] = val; 00013 } 00014 00015 void HIDScope::set(int ch, int val) 00016 { 00017 set(ch,(float)val); 00018 } 00019 00020 void HIDScope::set(int ch, bool val) 00021 { 00022 set(ch,(val ? 1.0f : 0.0f)); 00023 } 00024 00025 void HIDScope::set(int ch, double val) 00026 { 00027 set(ch,(float)val); 00028 } 00029 00030 void HIDScope::send() 00031 { 00032 for(int ch=0; ch<channelCount; ch++) 00033 memcpy(&scopeData.data[ch*4], &bufferData[ch], 4); // Copy a 4 byte float to the char array 00034 00035 // Send non blocking, can be adjusted to blocking (hid.send) 00036 hid.sendNB(&scopeData); 00037 }
Generated on Wed Jul 20 2022 05:20:03 by
1.7.2
