BMT M9 Groep01 / HIDScope

Dependencies:   HIDScope USBDevice

Fork of HIDScope by Tom Tom

Embed: (wiki syntax)

« Back to documentation index

HIDScope Class Reference

HIDScope Class Reference

A simple HID (Human Interface Device) scope

  • Up to 6 channels of float data is transmitted in a single HID message (64 byte)
  • Theoretical maximum samplerate of 1kHz
  • Data can be parsed using a client-side server like NodeJS.
More...

#include <HIDScope.h>

Public Member Functions

 HIDScope (int channels)
 Instantiate the HID Scope.
void set (int ch, float val)
 Sets the current channel value.
void set (int ch, int val)
 Sets the current channel value.
void set (int ch, bool val)
 Sets the current channel value.
void set (int ch, double val)
 Sets the current channel value.
void send ()
 Sends the channel data to the HID client.

Detailed Description

A simple HID (Human Interface Device) scope

  • Up to 6 channels of float data is transmitted in a single HID message (64 byte)
  • Theoretical maximum samplerate of 1kHz
  • Data can be parsed using a client-side server like NodeJS.

Example:

 #include "mbed.h"
 #include "HIDScope.h"

 HIDScope    scope(2);
 Ticker      scopeTimer;
 
 AnalogIn    a0(A0);
 
 int main()
 {
   
   scopeTimer.attach_us(&scope, &HIDScope::send, 1e4); // Send data at 100 Hz
   
   while(1){  // Generate some data
       scope.set(0, a0.read());
       scope.set(1, a0.read());
       wait_us(1000);
   };    
   
 }

Definition at line 36 of file HIDScope.h.


Constructor & Destructor Documentation

HIDScope ( int  channels )

Instantiate the HID Scope.

Definition at line 3 of file HIDScope.cpp.


Member Function Documentation

void send (  )

Sends the channel data to the HID client.

Returns:
void

Definition at line 30 of file HIDScope.cpp.

void set ( int  ch,
int  val 
)

Sets the current channel value.

Parameters:
ch: integer channel no (0-6)
val: integer value
Returns:
void

Definition at line 15 of file HIDScope.cpp.

void set ( int  ch,
double  val 
)

Sets the current channel value.

Parameters:
ch: double channel no (0-6)
val: float value
Returns:
void

Definition at line 25 of file HIDScope.cpp.

void set ( int  ch,
bool  val 
)

Sets the current channel value.

Parameters:
ch: integer channel no (0-6)
val: boolean value
Returns:
void

Definition at line 20 of file HIDScope.cpp.

void set ( int  ch,
float  val 
)

Sets the current channel value.

Parameters:
ch: integer channel no (0-6)
val: float value
Returns:
void

Definition at line 10 of file HIDScope.cpp.