Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.

Dependents:   FinalProject

USBHomeMon.h

Committer:
groletter
Date:
2013-09-03
Revision:
2:84432add9142
Parent:
0:3f846fc933a2

File content as of revision 2:84432add9142:

#ifndef _HOMEMON
#define _HOMEMON

// Message Character
//
// Alert	'a'
// Temp Low	'l'
// Temp Hi	'h'
// Motion	'm'
// Ack		'k'
// Set Temp Min 'z'
// Set Temp Max 'y'
// Set Temp Samples 'x'
// Set Mot Samples	'w'
// Set Period		'v'
// Get Temp Samples	'u'
// Get Mot Samples	't'
// Get Min Temp		's'
// Get Max Temp		'r'
// Get Period		'q'
//

struct alert_state {
    bool pendMotion;
    bool pendTempHi;
    bool pendTempLo;
};


enum MON_STATE {monCONNECTED, monDISCONNECTED};

enum alert_type {MOTION, TEMP_LOW, TEMP_HI};
enum msg_type {SET_TEMP_MIN, SET_TEMP_MAX, SET_TEMP_NUM_SAMPLES, SET_MOTION_NUM_SAMPLES, 
	SET_PERIOD, GET_TEMP_SAMPLES, GET_MOTION_SAMPLES, GET_MIN_TEMP, GET_MAX_TEMP, 
	GET_PERIOD, GET_TEMP_NUM_SAMPLES, GET_MOTION_NUM_SAMPLES, SET_MOTION_THRESH, 
	GET_MOTION_THRESH, MON_ERROR};


#define SAMP_SIZE 7  // This is the width of any sample e.g. -100.35

#define send_ack() serial.printf("k");
#define send_err() serial.printf("e");

#endif