EMG project for Biorobotics, works with 2 EMG inputs

Dependencies:   USBDevice

Fork of HIDScope by Tom Tom

Committer:
tomlankhorst
Date:
Mon Sep 08 09:26:53 2014 +0000
Revision:
0:79e3f3072f3b
Child:
1:e44574634162
Initial version (v0.1)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tomlankhorst 0:79e3f3072f3b 1 #ifndef _HIDSCOPE_H_
tomlankhorst 0:79e3f3072f3b 2 #define _HIDSCOPE_H_
tomlankhorst 0:79e3f3072f3b 3
tomlankhorst 0:79e3f3072f3b 4 #include "mbed.h"
tomlankhorst 0:79e3f3072f3b 5 #include "USBHID.h"
tomlankhorst 0:79e3f3072f3b 6
tomlankhorst 0:79e3f3072f3b 7 /**A simple HID (Human Interface Device) scope
tomlankhorst 0:79e3f3072f3b 8 - Up to 6 channels of float data is transmitted in a single HID message (64 byte)
tomlankhorst 0:79e3f3072f3b 9 - Theoretical maximum samplerate of 1kHz
tomlankhorst 0:79e3f3072f3b 10 - Data can be parsed using a client-side server like NodeJS
tomlankhorst 0:79e3f3072f3b 11 */
tomlankhorst 0:79e3f3072f3b 12 class HIDScope {
tomlankhorst 0:79e3f3072f3b 13 public:
tomlankhorst 0:79e3f3072f3b 14 ///Instantiate the HID Scope
tomlankhorst 0:79e3f3072f3b 15 HIDScope(int channels);
tomlankhorst 0:79e3f3072f3b 16
tomlankhorst 0:79e3f3072f3b 17 /** Sets the current channel value
tomlankhorst 0:79e3f3072f3b 18 @param ch : integer channel no (0-6)
tomlankhorst 0:79e3f3072f3b 19 @param val : float value
tomlankhorst 0:79e3f3072f3b 20 @return void
tomlankhorst 0:79e3f3072f3b 21 */
tomlankhorst 0:79e3f3072f3b 22 void set(int ch, float val);
tomlankhorst 0:79e3f3072f3b 23
tomlankhorst 0:79e3f3072f3b 24 /** Sets the current channel value
tomlankhorst 0:79e3f3072f3b 25 @param ch : integer channel no (0-6)
tomlankhorst 0:79e3f3072f3b 26 @param val : integer value
tomlankhorst 0:79e3f3072f3b 27 @return void
tomlankhorst 0:79e3f3072f3b 28 */
tomlankhorst 0:79e3f3072f3b 29 void set(int ch, int val);
tomlankhorst 0:79e3f3072f3b 30
tomlankhorst 0:79e3f3072f3b 31 /** Sets the current channel value
tomlankhorst 0:79e3f3072f3b 32 @param ch : integer channel no (0-6)
tomlankhorst 0:79e3f3072f3b 33 @param val : boolean value
tomlankhorst 0:79e3f3072f3b 34 @return void
tomlankhorst 0:79e3f3072f3b 35 */
tomlankhorst 0:79e3f3072f3b 36 void set(int ch, bool val);
tomlankhorst 0:79e3f3072f3b 37
tomlankhorst 0:79e3f3072f3b 38 /** Sets the current channel value
tomlankhorst 0:79e3f3072f3b 39 @param ch : double channel no (0-6)
tomlankhorst 0:79e3f3072f3b 40 @param val : float value
tomlankhorst 0:79e3f3072f3b 41 @return void
tomlankhorst 0:79e3f3072f3b 42 */
tomlankhorst 0:79e3f3072f3b 43 void set(int ch, double val);
tomlankhorst 0:79e3f3072f3b 44
tomlankhorst 0:79e3f3072f3b 45 /** Sends the channel data to the HID client
tomlankhorst 0:79e3f3072f3b 46 @return void
tomlankhorst 0:79e3f3072f3b 47 */
tomlankhorst 0:79e3f3072f3b 48 void send();
tomlankhorst 0:79e3f3072f3b 49 private:
tomlankhorst 0:79e3f3072f3b 50 USBHID hid;
tomlankhorst 0:79e3f3072f3b 51 HID_REPORT scopeData;
tomlankhorst 0:79e3f3072f3b 52 float* bufferData;
tomlankhorst 0:79e3f3072f3b 53 int channelCount;
tomlankhorst 0:79e3f3072f3b 54 };
tomlankhorst 0:79e3f3072f3b 55
tomlankhorst 0:79e3f3072f3b 56 #endif