Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.
USBHomeMon.h
00001 #ifndef _HOMEMON 00002 #define _HOMEMON 00003 00004 // Message Character 00005 // 00006 // Alert 'a' 00007 // Temp Low 'l' 00008 // Temp Hi 'h' 00009 // Motion 'm' 00010 // Ack 'k' 00011 // Set Temp Min 'z' 00012 // Set Temp Max 'y' 00013 // Set Temp Samples 'x' 00014 // Set Mot Samples 'w' 00015 // Set Period 'v' 00016 // Get Temp Samples 'u' 00017 // Get Mot Samples 't' 00018 // Get Min Temp 's' 00019 // Get Max Temp 'r' 00020 // Get Period 'q' 00021 // 00022 00023 struct alert_state { 00024 bool pendMotion; 00025 bool pendTempHi; 00026 bool pendTempLo; 00027 }; 00028 00029 00030 enum MON_STATE {monCONNECTED, monDISCONNECTED}; 00031 00032 enum alert_type {MOTION, TEMP_LOW, TEMP_HI}; 00033 enum msg_type {SET_TEMP_MIN, SET_TEMP_MAX, SET_TEMP_NUM_SAMPLES, SET_MOTION_NUM_SAMPLES, 00034 SET_PERIOD, GET_TEMP_SAMPLES, GET_MOTION_SAMPLES, GET_MIN_TEMP, GET_MAX_TEMP, 00035 GET_PERIOD, GET_TEMP_NUM_SAMPLES, GET_MOTION_NUM_SAMPLES, SET_MOTION_THRESH, 00036 GET_MOTION_THRESH, MON_ERROR}; 00037 00038 00039 #define SAMP_SIZE 7 // This is the width of any sample e.g. -100.35 00040 00041 #define send_ack() serial.printf("k"); 00042 #define send_err() serial.printf("e"); 00043 00044 #endif
Generated on Fri Jul 22 2022 02:01:25 by 1.7.2