Thomas Morris
/
PROJ324_Final
Proj 324 Final
Fork of ELEC351_Group_T by
Diff: SETUP.hpp
- Revision:
- 23:3c85d7f657a2
diff -r eb4cc12087b2 -r 3c85d7f657a2 SETUP.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SETUP.hpp Sat Dec 30 20:55:48 2017 +0000 @@ -0,0 +1,90 @@ +#ifndef SETUP_HPP //Known as header guards +#define SETUP_HPP + + + +#include "sample_hardware.hpp" +#include "Networkbits.hpp" +#include "rtos.h" +#include "LED.hpp" +#include "DATA.hpp" +#include "LCD.hpp" +#define SerialTime 1 +#define NotSerialTime 0 +#define SamplingTime 1 +#define NotSamplingTime 0 +#define Print_Time_to_LCD 1 +#define Dont_Print_Time_to_LCD 0 +#define TimerInterval 1 //This is in seconds +#define Serail_Enter_Check_Interval 0.1 //100 ms +#define EDGE_RISEN 1 +#define EDGE_FALLEN 0 +#define mailsize 5 +#define SERIAL_COMMS 1 +#define NotSERIAL_COMMS 0 +#include <iostream> +#include <SERIAL.hpp> +Serial pc(USBTX, USBRX); +//SW1+SW2 are declared as interrupt ins in sample hardware.cpp + + +//Thread IDs +osThreadId idMain; +osThreadId id1; +osThreadId id2; +osThreadId id3; +osThreadId id4; + + +Timeout sw1TimeOut;//Used to prevent switch bounce + +LED Red_led(PE_15); +LED Yellow_led(PB_10); +LED Green_led(PB_11); + +LCD LCD(D8,D9,D4,A0,A1,A2,A3,D7,D6,D3,D1); //Declare the LCD class +char LCD_buffer [50]; +int LCD_sprintf; + +//Tickers + +Ticker Sample_timer; +Ticker Serial_timer; +//Threads +Thread t1; +Thread t2; +Thread t3; +Thread t4; +Thread t5; +Thread t6; + + +double temp = 0; +double pressure = 0; +double lux = 0; +string buffer_time = 0; + +char buffer[32]; +char scom_time_buffer[32]; +char msel_time_buffer[32]; + +void SW1FallingEdge(); +void SW1TimeOutHandler(); + +string Serial_Enter_Check; +string Serial_Input; + +Mutex lock1;//Mutex Locks +Mutex lock2; + +using namespace std; + +int mode = 0; + +Mail<DATA, mailsize> mail_box; //Mail Queue, Type DATA, Capacity mailsize(defined above), name mail_box + +void Serial_Comms(); +void Serial_Comms_set(); + +#endif +