ELEC351 SUBMISSION - Same as on the DLE

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.hpp Source File

main.hpp

00001 #ifndef __main__ //Inclusion safeguards
00002 #define __main__
00003 
00004 /* Libraries */
00005 #include "mbed.h"
00006 #include <iostream>
00007 #include <string>
00008 #include "ELEC351_LIBRARY.hpp"  // Including necessary Custom Library files 
00009 #include "TextLCD.h"            /* Needed since my LCD driver has bug. for more 
00010 details please see note in "ELEC351_LIBRARY.hpp"                              */
00011 #include "SDBlockDevice.h"
00012 #include "FATFileSystem.h"
00013 #include "EthernetInterface.h"
00014 #include "TCPServer.h"
00015 #include "TCPSocket.h"
00016 
00017 
00018 /* Defines */
00019 #define DEF_SAMP_RATE 15        // Default sampling rate = 15sec
00020 #define GET_SAMPLE  0x01        // Signal to thread to start sampling
00021 #define DISP_SAMPLE 0x02        // Signal to thread to diplay sample
00022 #define HTML_SAMPLE 0x04        // Signal to thread to update webpage
00023 #define SD_SAMPLE   0x08        // Signal to thread to write tot sd card  
00024 
00025 #define IP        "10.0.0.10"
00026 #define NETMASK   "255.0.0.0"
00027 #define GATEWAY   "10.0.0.1"
00028 
00029 
00030 /* HTML */
00031 #define HTTP_STATUS_LINE "HTTP/1.0 200 OK"
00032 #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8"
00033 #define HTTP_HEADER ""                                          \
00034 "<html>" "\r\n"                                                 \
00035 "  <body style=\"display:flex;text-align:center\">" "\r\n"      \
00036 "    <div style=\"margin:auto\">" "\r\n"
00037 
00038 #define HTTP_FOOTER ""                                          \
00039 "    </div>" "\r\n"                                             \
00040 "  </body>" "\r\n"                                              \
00041 "</html>"
00042 
00043 #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n"   \
00044                       HTTP_HEADER_FIELDS "\r\n" \
00045                       "\r\n"                    \
00046                       HTTP_MESSAGE_BODY "\r\n"
00047 
00048 
00049 /* Function prototypes */
00050 void samplingISR();
00051 void samplingFunction();
00052 void changeSamplingT(float interval);
00053 
00054 #endif