Time: 17:33 Date: 10/12/2017 Description: Task 1,7,8 Currently Functioning
Dependencies: BME280 BMP280 TextLCD
Working Repository
SETUP.hpp
- Committer:
- thomasmorris
- Date:
- 2018-01-08
- Revision:
- 42:ae1640bca2e1
- Parent:
- 41:859b5e1e3d9a
- Child:
- 45:875f7e18a386
File content as of revision 42:ae1640bca2e1:
#ifndef _SETUP_HPP_ //SETUP header guard #define _SETUP_HPP_ //File includes #include "sample_hardware.hpp" #include "rtos.h" #include "LED.hpp" #include "DATA.hpp" #include "LCD.hpp" #include "SERIAL.hpp" #include "TIME.hpp" #include <iostream> //Signal definitions #define SerialCommsTime 1 #define NotSerialCommsTime 0 #define SamplingTime 1 #define NotSamplingTime 0 #define Print_Time_to_LCD 1 #define Dont_Print_Time_to_LCD 0 #define EDGE_RISEN 1 #define EDGE_FALLEN 0 #define SD_Data_Ready 1 #define No_SD_Data_Ready 0 //Time definitions #define TimerInterval 1 //This is in seconds #define Default_Mode_Toggle_Time 3000 #define NetworkWait 5000 //Definition of Data buffer size (120 in specification) #define mailsize 20 DATA Data_Active;//Current data sample DATA Data_Buffer[mailsize];//Data buffer int Data_Buffer_Write_Pointer; int Write_To_Data_Buffer(DATA Data_Store, int Write_Pointer); int Write_Pointer = 0; LCD LCD(D8,D9,D4,A0,A1,A2,A3,D7,D6,D3,D1);//LCD object creation via constructor Serial pc(USBTX, USBRX);//Define serial namespace so the serial comms can be printed to //Forward Declarations of functions void Serial_Comms(); void Sample_signal_set(); void Console_Output_ISR(); void Serial_Comms_Data_Get(); void Sampling_ISR(); void Console_Output_ISR(); //Declarations of Varialbes float Sample_Rate; int mode = 0;//Used to switch modes in serial comms char LCD_buffer [50]; int LCD_sprintf; int Log_Value = 0; 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]; //Thread IDs osThreadId idMain; osThreadId id1; osThreadId id2; osThreadId id3; osThreadId id4; osThreadId id5; //Time out Declarations Timeout sw1TimeOut;//Used to prevent switch bounce Timeout sw2TimeOut;//Used to prevent switch bounce //LED object constructors LED Red_led(PE_15); LED Yellow_led(PB_10); LED Green_led(PB_11); //Tickers Ticker Sampling_Timer;//Controls Sampling Ticker Console_Output_Timer;//Controls Serial comms //Threads Thread t1(osPriorityRealtime); //Sampler Set to a highest priority Thread t2; Thread t3; Thread t4; Thread t5; using namespace std;//Set default namespace enables use of iostream with serial comms #endif