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.
Dependents: HIDScope TEST Project5-Motorcontrol EMG_HIDScope_Gr6 ... more
HIDScope.cpp
00001 #include "HIDScope.h" 00002 00003 HIDScope::HIDScope(int channels, bool non_blocking) : send_non_blocking(non_blocking), 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 memcpy(&scopeData.data, bufferData, sizeof( float ) * channelCount); // Copy a 4 byte float to the char array 00033 hid.sendNB(&scopeData); 00034 }
Generated on Sun Jul 17 2022 12:34:45 by
1.7.2