A simple WIP that logs data from a Grove sensor, and can send and receive information over USB and SMS.

Dependencies:   DHT DS_1337 SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

UsbComms Class Reference

The UsbComms class handles input and output for the serial port connected to a PC The main run() function cycles through checking for input and copying to a buffer to be handled, and checking the output buffer to see if there is anything to be sent out. More...

#include <UsbComms.h>

Inherits AbstractHandler.

Public Types

enum  request_t { usbreq_PrintToTerminal, usbreq_PrintToTerminalTimestamp }

Public Member Functions

void run ()
 run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.
void setRequest (int request, void *data=0)
 setRequest sets a request that the handler will complete when it is able to

Protected Attributes

MyTimersm_timer
 Handler classes use timers to pause in the state machine, and continue after delay has finished.

Detailed Description

The UsbComms class handles input and output for the serial port connected to a PC The main run() function cycles through checking for input and copying to a buffer to be handled, and checking the output buffer to see if there is anything to be sent out.

Data can be queued for output by copying it to the circular buffer

Definition at line 18 of file UsbComms.h.


Member Enumeration Documentation

enum request_t
Enumerator:
usbreq_PrintToTerminal 

Print to terminal normally.

usbreq_PrintToTerminalTimestamp 

Print to terminal, including the timestamp.

Definition at line 28 of file UsbComms.h.


Member Function Documentation

void run (  ) [virtual]

run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.

Implements AbstractHandler.

Definition at line 29 of file UsbComms.cpp.

void setRequest ( int  request,
void *  data = 0 
) [virtual]

setRequest sets a request that the handler will complete when it is able to

Parameters:
requestunique to the reimplemented class (an enum) that will be completed in the state machine
messagean optional array of information relevant to the request

Implements AbstractHandler.

Definition at line 64 of file UsbComms.cpp.


Field Documentation

MyTimers* m_timer [protected, inherited]

Handler classes use timers to pause in the state machine, and continue after delay has finished.

Definition at line 31 of file AbstractHandler.h.