![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Proj 324 Final
Fork of ELEC351_Group_T by
SETUP.hpp@25:36699ed589ab, 2018-01-01 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon Jan 01 20:14:19 2018 +0000
- Revision:
- 25:36699ed589ab
- Child:
- 26:78f5e454e59f
More Serial Comms stuff
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 25:36699ed589ab | 1 | #ifndef _SETUP_HPP_ //Known as header guards |
thomasmorris | 25:36699ed589ab | 2 | #define _SETUP_HPP_ |
thomasmorris | 25:36699ed589ab | 3 | |
thomasmorris | 25:36699ed589ab | 4 | #include "sample_hardware.hpp" |
thomasmorris | 25:36699ed589ab | 5 | #include "Networkbits.hpp" |
thomasmorris | 25:36699ed589ab | 6 | #include "rtos.h" |
thomasmorris | 25:36699ed589ab | 7 | #include "LED.hpp" |
thomasmorris | 25:36699ed589ab | 8 | #include "DATA.hpp" |
thomasmorris | 25:36699ed589ab | 9 | #include "LCD.hpp" |
thomasmorris | 25:36699ed589ab | 10 | #include "SERIAL.hpp" |
thomasmorris | 25:36699ed589ab | 11 | #define SamplingTime 1 |
thomasmorris | 25:36699ed589ab | 12 | #define NotSamplingTime 0 |
thomasmorris | 25:36699ed589ab | 13 | #define Print_Time_to_LCD 1 |
thomasmorris | 25:36699ed589ab | 14 | #define Dont_Print_Time_to_LCD 0 |
thomasmorris | 25:36699ed589ab | 15 | #define TimerInterval 2 //This is in seconds |
thomasmorris | 25:36699ed589ab | 16 | #define EDGE_RISEN 1 |
thomasmorris | 25:36699ed589ab | 17 | #define EDGE_FALLEN 0 |
thomasmorris | 25:36699ed589ab | 18 | #define mailsize 5 |
thomasmorris | 25:36699ed589ab | 19 | #include <iostream> |
thomasmorris | 25:36699ed589ab | 20 | Serial pc(USBTX, USBRX); |
thomasmorris | 25:36699ed589ab | 21 | //SW1+SW2 are declared as interrupt ins in sample hardware.cpp |
thomasmorris | 25:36699ed589ab | 22 | //Forward Declarations |
thomasmorris | 25:36699ed589ab | 23 | |
thomasmorris | 25:36699ed589ab | 24 | void Serial_Comms(); |
thomasmorris | 25:36699ed589ab | 25 | void Sample_signal_set(); |
thomasmorris | 25:36699ed589ab | 26 | |
thomasmorris | 25:36699ed589ab | 27 | float Sample_Rate; |
thomasmorris | 25:36699ed589ab | 28 | //Thread IDs |
thomasmorris | 25:36699ed589ab | 29 | osThreadId idMain; |
thomasmorris | 25:36699ed589ab | 30 | osThreadId id1; |
thomasmorris | 25:36699ed589ab | 31 | osThreadId id2; |
thomasmorris | 25:36699ed589ab | 32 | osThreadId id3; |
thomasmorris | 25:36699ed589ab | 33 | osThreadId id4; |
thomasmorris | 25:36699ed589ab | 34 | osThreadId id5; |
thomasmorris | 25:36699ed589ab | 35 | |
thomasmorris | 25:36699ed589ab | 36 | |
thomasmorris | 25:36699ed589ab | 37 | Timeout sw1TimeOut;//Used to prevent switch bounce |
thomasmorris | 25:36699ed589ab | 38 | |
thomasmorris | 25:36699ed589ab | 39 | LED Red_led(PE_15); |
thomasmorris | 25:36699ed589ab | 40 | LED Yellow_led(PB_10); |
thomasmorris | 25:36699ed589ab | 41 | LED Green_led(PB_11); |
thomasmorris | 25:36699ed589ab | 42 | |
thomasmorris | 25:36699ed589ab | 43 | LCD LCD(D8,D9,D4,A0,A1,A2,A3,D7,D6,D3,D1); |
thomasmorris | 25:36699ed589ab | 44 | char LCD_buffer [50]; |
thomasmorris | 25:36699ed589ab | 45 | int LCD_sprintf; |
thomasmorris | 25:36699ed589ab | 46 | |
thomasmorris | 25:36699ed589ab | 47 | //Tickers |
thomasmorris | 25:36699ed589ab | 48 | |
thomasmorris | 25:36699ed589ab | 49 | Ticker Sample_timer; |
thomasmorris | 25:36699ed589ab | 50 | |
thomasmorris | 25:36699ed589ab | 51 | //Threads |
thomasmorris | 25:36699ed589ab | 52 | Thread t1; |
thomasmorris | 25:36699ed589ab | 53 | Thread t2; |
thomasmorris | 25:36699ed589ab | 54 | Thread t3; |
thomasmorris | 25:36699ed589ab | 55 | Thread t4; |
thomasmorris | 25:36699ed589ab | 56 | Thread t5; |
thomasmorris | 25:36699ed589ab | 57 | |
thomasmorris | 25:36699ed589ab | 58 | double temp = 0; |
thomasmorris | 25:36699ed589ab | 59 | double pressure = 0; |
thomasmorris | 25:36699ed589ab | 60 | double lux = 0; |
thomasmorris | 25:36699ed589ab | 61 | string buffer_time = 0; |
thomasmorris | 25:36699ed589ab | 62 | |
thomasmorris | 25:36699ed589ab | 63 | char buffer[32]; |
thomasmorris | 25:36699ed589ab | 64 | char scom_time_buffer[32]; |
thomasmorris | 25:36699ed589ab | 65 | char msel_time_buffer[32]; |
thomasmorris | 25:36699ed589ab | 66 | |
thomasmorris | 25:36699ed589ab | 67 | void SW1FallingEdge(); |
thomasmorris | 25:36699ed589ab | 68 | void SW1TimeOutHandler(); |
thomasmorris | 25:36699ed589ab | 69 | |
thomasmorris | 25:36699ed589ab | 70 | |
thomasmorris | 25:36699ed589ab | 71 | |
thomasmorris | 25:36699ed589ab | 72 | using namespace std; |
thomasmorris | 25:36699ed589ab | 73 | |
thomasmorris | 25:36699ed589ab | 74 | int mode = 0; |
thomasmorris | 25:36699ed589ab | 75 | |
thomasmorris | 25:36699ed589ab | 76 | Mail<DATA, mailsize> mail_box; //Mail Queue, Type DATA, Capacity mailsize(defined above), name mail_box |
thomasmorris | 25:36699ed589ab | 77 | |
thomasmorris | 25:36699ed589ab | 78 | #endif |