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

MyTimers Class Reference

MyTimers Class Reference

The MyTimers class creates a Ticker and decrements a collection of unsigned longs that act as timers across the program. More...

#include <timers.h>

Public Types

enum  eTimerType {
  tmr_GroveMeasure, tmr_GprsPower, tmr_GprsRxTx, tmr_SdWaitError,
  tmr_MeasFlash
}

Public Member Functions

 ~MyTimers ()
 eTimerType identifies each of the timers in program, and is used to set and get a timer
void run ()
 run is called each time Ticker fires, which is every 1ms, and decrements all timers if necessary
void SetTimer (eTimerType timertype, unsigned long time_ms)
 SetTimer sets the value of the timer.
unsigned long GetTimer (eTimerType timertype)
 GetTimer gets the value of a timer.

Detailed Description

The MyTimers class creates a Ticker and decrements a collection of unsigned longs that act as timers across the program.

See also:
eTimerType is used to link external callers with a collection of unsigned longs which are decremented each ms by
run(). This acts as a collection of timers. This collection can be set by
SetTimer and retrieved by
GetTimer.

Definition at line 14 of file timers.h.


Member Enumeration Documentation

enum eTimerType
Enumerator:
tmr_GroveMeasure 

Used in GroveDht22 handler.

tmr_GprsPower 

Used to power the SIM900 on and off.

tmr_GprsRxTx 

Timeout waiting for a response from the SIM900 over the serial line.

tmr_SdWaitError 

Sd card has hit an error, wait before retrying.

tmr_MeasFlash 

Flash once every 2 seconds for heartbeat.

Definition at line 21 of file timers.h.


Constructor & Destructor Documentation

~MyTimers (  )

eTimerType identifies each of the timers in program, and is used to set and get a timer

Definition at line 17 of file timers.cpp.


Member Function Documentation

unsigned long GetTimer ( eTimerType  timertype )

GetTimer gets the value of a timer.

Parameters:
timertypeidentifies the timer whose value we want to get
Returns:
the value of the timer

Definition at line 56 of file timers.cpp.

void run (  )

run is called each time Ticker fires, which is every 1ms, and decrements all timers if necessary

Definition at line 22 of file timers.cpp.

void SetTimer ( eTimerType  timertype,
unsigned long  time_ms 
)

SetTimer sets the value of the timer.

Parameters:
timertypeidentifies the timer whose value we want to set
time_msis the value the timer will be set to, to start counting down from, in ms

Definition at line 33 of file timers.cpp.