Plymouth ELEC351 Group T
/
ELEC351_Group_T
FINAL PROJECT isn't it
Fork of ELEC351 by
Diff: SETUP.hpp
- Revision:
- 41:859b5e1e3d9a
- Parent:
- 39:5c499989d2b9
- Child:
- 42:ae1640bca2e1
--- a/SETUP.hpp Sun Jan 07 23:01:38 2018 +0000 +++ b/SETUP.hpp Mon Jan 08 14:20:30 2018 +0000 @@ -1,47 +1,68 @@ -#ifndef _SETUP_HPP_ //Known as header guards +#ifndef _SETUP_HPP_ //SETUP header guard #define _SETUP_HPP_ - +//File includes #include "sample_hardware.hpp" -//#include "Networkbits.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 TimerInterval 2 //This is in seconds -#define Default_Mode_Toggle_Time 3000 #define EDGE_RISEN 1 #define EDGE_FALLEN 0 -#include <iostream> -#define mailsize 150 +#define SD_Data_Ready 1 +#define No_SD_Data_Ready 0 -DATA Data_Active; -DATA Data_Buffer[mailsize]; +//Time definitions +#define TimerInterval 2 //This is in seconds +#define Default_Mode_Toggle_Time 3000 +#define NetworkWait 5000 + +//Definition of Data buffer size (120 in specification) +#define mailsize 120 + +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 LCD(D8,D9,D4,A0,A1,A2,A3,D7,D6,D3,D1);//LCD object creation via constructor -Serial pc(USBTX, USBRX); -//SW1+SW2 are declared as interrupt ins in sample hardware.cpp -//Forward Declarations +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 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; @@ -50,53 +71,26 @@ 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); -char LCD_buffer [50]; -int LCD_sprintf; - //Tickers - -Ticker Sampling_Timer; -Ticker Console_Output_Timer; +Ticker Sampling_Timer;//Controls Sampling +Ticker Console_Output_Timer;//Controls Serial comms //Threads - -Thread t1(osPriorityRealtime); //Sampler Set to a higher priority cos nick wants it +Thread t1(osPriorityRealtime); //Sampler Set to a highest priority Thread t2; Thread t3; Thread t4; Thread t5; -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]; - -void SW1FallingEdge(); -void SW1TimeOutHandler(); -void Sampling_ISR(); -void Console_Output_ISR(); -void SW1RisingEdge(); -void SW2RisingEdge(); - - -//DATA Data_Active; - -using namespace std; - -int mode = 0; - -//DigitalIn onBoardSwitch(USER_BUTTON); +using namespace std;//Set default namespace enables use of iostream with serial comms #endif \ No newline at end of file