FINAL PROJECT isn't it

Fork of ELEC351 by Plymouth ELEC351 Group T

SETUP.hpp

Committer:
thomasmorris
Date:
2018-01-07
Revision:
35:26b0a9b55d82
Parent:
34:c0b8705f183d
Child:
37:7c4d7f206039

File content as of revision 35:26b0a9b55d82:

#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"
#include "SERIAL.hpp"
#include "TIME.hpp"
//#include "NETWORK.hpp"
#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
#define mailsize 5
#include <iostream>
Serial pc(USBTX, USBRX);
//SW1+SW2 are declared as interrupt ins in sample hardware.cpp
//Forward Declarations

void Serial_Comms();
void Sample_signal_set();
void Console_Output_ISR();    
void Serial_Comms_Stealth_Mode();

float Sample_Rate;
//Thread IDs
osThreadId idMain;
osThreadId id1;
osThreadId id2;
osThreadId id3;
osThreadId id4;
osThreadId id5;


Timeout sw1TimeOut;//Used to prevent switch bounce
Timeout sw2TimeOut;//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); 
char LCD_buffer [50];
int LCD_sprintf;

//Tickers

Ticker Sampling_Timer;
Ticker Console_Output_Timer;

//Threads

Thread t1(osPriorityRealtime); //Sampler Set to a higher priority cos nick wants it
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;
DATA Data_Buffer[mailsize];

using namespace std;

int mode = 0;

//DigitalIn  onBoardSwitch(USER_BUTTON);
#endif