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

Dependents:   FinalProject

Committer:
groletter
Date:
Sun Sep 01 23:35:18 2013 +0000
Revision:
0:3f846fc933a2
My library for temperature and motion monitoring and communication over a USB Serial device.  Requires host-side code.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
groletter 0:3f846fc933a2 1 #ifndef _HOMEMON
groletter 0:3f846fc933a2 2 #define _HOMEMON
groletter 0:3f846fc933a2 3
groletter 0:3f846fc933a2 4 // Message Character
groletter 0:3f846fc933a2 5 //
groletter 0:3f846fc933a2 6 // Alert 'a'
groletter 0:3f846fc933a2 7 // Temp Low 'l'
groletter 0:3f846fc933a2 8 // Temp Hi 'h'
groletter 0:3f846fc933a2 9 // Motion 'm'
groletter 0:3f846fc933a2 10 // Ack 'k'
groletter 0:3f846fc933a2 11 // Set Temp Min 'z'
groletter 0:3f846fc933a2 12 // Set Temp Max 'y'
groletter 0:3f846fc933a2 13 // Set Temp Samples 'x'
groletter 0:3f846fc933a2 14 // Set Mot Samples 'w'
groletter 0:3f846fc933a2 15 // Set Period 'v'
groletter 0:3f846fc933a2 16 // Get Temp Samples 'u'
groletter 0:3f846fc933a2 17 // Get Mot Samples 't'
groletter 0:3f846fc933a2 18 // Get Min Temp 's'
groletter 0:3f846fc933a2 19 // Get Max Temp 'r'
groletter 0:3f846fc933a2 20 // Get Period 'q'
groletter 0:3f846fc933a2 21 //
groletter 0:3f846fc933a2 22
groletter 0:3f846fc933a2 23 struct alert_state {
groletter 0:3f846fc933a2 24 bool pendMotion;
groletter 0:3f846fc933a2 25 bool pendTempHi;
groletter 0:3f846fc933a2 26 bool pendTempLo;
groletter 0:3f846fc933a2 27 };
groletter 0:3f846fc933a2 28
groletter 0:3f846fc933a2 29
groletter 0:3f846fc933a2 30 enum MON_STATE {monCONNECTED, monDISCONNECTED};
groletter 0:3f846fc933a2 31
groletter 0:3f846fc933a2 32 enum alert_type {MOTION, TEMP_LOW, TEMP_HI};
groletter 0:3f846fc933a2 33 enum msg_type {SET_TEMP_MIN, SET_TEMP_MAX, SET_TEMP_NUM_SAMPLES, SET_MOTION_NUM_SAMPLES,
groletter 0:3f846fc933a2 34 SET_PERIOD, GET_TEMP_SAMPLES, GET_MOTION_SAMPLES, GET_MIN_TEMP, GET_MAX_TEMP,
groletter 0:3f846fc933a2 35 GET_PERIOD, GET_TEMP_NUM_SAMPLES, GET_MOTION_NUM_SAMPLES, SET_MOTION_THRESH,
groletter 0:3f846fc933a2 36 GET_MOTION_THRESH, MON_ERROR};
groletter 0:3f846fc933a2 37
groletter 0:3f846fc933a2 38
groletter 0:3f846fc933a2 39 #define SAMP_SIZE 7 // This is the width of any sample e.g. -100.35
groletter 0:3f846fc933a2 40
groletter 0:3f846fc933a2 41 #define send_ack() serial.printf("k");
groletter 0:3f846fc933a2 42 #define send_err() serial.printf("e");
groletter 0:3f846fc933a2 43
groletter 0:3f846fc933a2 44 #endif