Luka Danilovic
/
ELEC351_10497267_SUBMISSION
ELEC351 SUBMISSION - Same as on the DLE
main/main.hpp@0:c66224a27cf8, 2018-01-10 (annotated)
- Committer:
- Luka_Danilovic
- Date:
- Wed Jan 10 09:49:43 2018 +0000
- Revision:
- 0:c66224a27cf8
ELEC351 SUBMISSION - SAme as on the DLE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Luka_Danilovic | 0:c66224a27cf8 | 1 | #ifndef __main__ //Inclusion safeguards |
Luka_Danilovic | 0:c66224a27cf8 | 2 | #define __main__ |
Luka_Danilovic | 0:c66224a27cf8 | 3 | |
Luka_Danilovic | 0:c66224a27cf8 | 4 | /* Libraries */ |
Luka_Danilovic | 0:c66224a27cf8 | 5 | #include "mbed.h" |
Luka_Danilovic | 0:c66224a27cf8 | 6 | #include <iostream> |
Luka_Danilovic | 0:c66224a27cf8 | 7 | #include <string> |
Luka_Danilovic | 0:c66224a27cf8 | 8 | #include "ELEC351_LIBRARY.hpp" // Including necessary Custom Library files |
Luka_Danilovic | 0:c66224a27cf8 | 9 | #include "TextLCD.h" /* Needed since my LCD driver has bug. for more |
Luka_Danilovic | 0:c66224a27cf8 | 10 | details please see note in "ELEC351_LIBRARY.hpp" */ |
Luka_Danilovic | 0:c66224a27cf8 | 11 | #include "SDBlockDevice.h" |
Luka_Danilovic | 0:c66224a27cf8 | 12 | #include "FATFileSystem.h" |
Luka_Danilovic | 0:c66224a27cf8 | 13 | #include "EthernetInterface.h" |
Luka_Danilovic | 0:c66224a27cf8 | 14 | #include "TCPServer.h" |
Luka_Danilovic | 0:c66224a27cf8 | 15 | #include "TCPSocket.h" |
Luka_Danilovic | 0:c66224a27cf8 | 16 | |
Luka_Danilovic | 0:c66224a27cf8 | 17 | |
Luka_Danilovic | 0:c66224a27cf8 | 18 | /* Defines */ |
Luka_Danilovic | 0:c66224a27cf8 | 19 | #define DEF_SAMP_RATE 15 // Default sampling rate = 15sec |
Luka_Danilovic | 0:c66224a27cf8 | 20 | #define GET_SAMPLE 0x01 // Signal to thread to start sampling |
Luka_Danilovic | 0:c66224a27cf8 | 21 | #define DISP_SAMPLE 0x02 // Signal to thread to diplay sample |
Luka_Danilovic | 0:c66224a27cf8 | 22 | #define HTML_SAMPLE 0x04 // Signal to thread to update webpage |
Luka_Danilovic | 0:c66224a27cf8 | 23 | #define SD_SAMPLE 0x08 // Signal to thread to write tot sd card |
Luka_Danilovic | 0:c66224a27cf8 | 24 | |
Luka_Danilovic | 0:c66224a27cf8 | 25 | #define IP "10.0.0.10" |
Luka_Danilovic | 0:c66224a27cf8 | 26 | #define NETMASK "255.0.0.0" |
Luka_Danilovic | 0:c66224a27cf8 | 27 | #define GATEWAY "10.0.0.1" |
Luka_Danilovic | 0:c66224a27cf8 | 28 | |
Luka_Danilovic | 0:c66224a27cf8 | 29 | |
Luka_Danilovic | 0:c66224a27cf8 | 30 | /* HTML */ |
Luka_Danilovic | 0:c66224a27cf8 | 31 | #define HTTP_STATUS_LINE "HTTP/1.0 200 OK" |
Luka_Danilovic | 0:c66224a27cf8 | 32 | #define HTTP_HEADER_FIELDS "Content-Type: text/html; charset=utf-8" |
Luka_Danilovic | 0:c66224a27cf8 | 33 | #define HTTP_HEADER "" \ |
Luka_Danilovic | 0:c66224a27cf8 | 34 | "<html>" "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 35 | " <body style=\"display:flex;text-align:center\">" "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 36 | " <div style=\"margin:auto\">" "\r\n" |
Luka_Danilovic | 0:c66224a27cf8 | 37 | |
Luka_Danilovic | 0:c66224a27cf8 | 38 | #define HTTP_FOOTER "" \ |
Luka_Danilovic | 0:c66224a27cf8 | 39 | " </div>" "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 40 | " </body>" "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 41 | "</html>" |
Luka_Danilovic | 0:c66224a27cf8 | 42 | |
Luka_Danilovic | 0:c66224a27cf8 | 43 | #define HTTP_RESPONSE HTTP_STATUS_LINE "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 44 | HTTP_HEADER_FIELDS "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 45 | "\r\n" \ |
Luka_Danilovic | 0:c66224a27cf8 | 46 | HTTP_MESSAGE_BODY "\r\n" |
Luka_Danilovic | 0:c66224a27cf8 | 47 | |
Luka_Danilovic | 0:c66224a27cf8 | 48 | |
Luka_Danilovic | 0:c66224a27cf8 | 49 | /* Function prototypes */ |
Luka_Danilovic | 0:c66224a27cf8 | 50 | void samplingISR(); |
Luka_Danilovic | 0:c66224a27cf8 | 51 | void samplingFunction(); |
Luka_Danilovic | 0:c66224a27cf8 | 52 | void changeSamplingT(float interval); |
Luka_Danilovic | 0:c66224a27cf8 | 53 | |
Luka_Danilovic | 0:c66224a27cf8 | 54 | #endif |