BDG / Mbed OS Thread_Communication_V2

Dependencies:   BMP280

Fork of Thread_Communication by BDG

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #include "LCD.h"
00002 #include "BMP280.h"
00003 #include "SDBlockDevice.h"
00004 #include "FATFileSystem.h"
00005 
00006 #define ENTER_KEY 1
00007 #define MAX_SAMPLES 120
00008 #define SENSOR_UPDATE 1
00009 #define DATA_READY 1
00010 #define SAMPLING_PERIOD 10 
00011 #define ON 1
00012 #define OFF 0
00013 
00014 extern LCD lcd;
00015 extern BMP280 sensor;
00016 extern SDBlockDevice sd (PB_5, D12, D13, D10);
00017 
00018 /* External LEDs as Open Drain */
00019 extern DigitalOut Red_ext      (PE_15); 
00020 extern DigitalOut Yellow_ext   (PB_10);
00021 extern DigitalOut Green_ext    (PB_11);
00022 
00023 /* Configure On-board LEDS */
00024 extern DigitalOut Green_int (LED1);
00025 extern DigitalOut Blue_int (LED2);
00026 extern DigitalOut Red_int (LED3);
00027 
00028 /* Configure Digital In Switches */
00029 extern DigitalIn SW_L (PE_12);
00030 extern DigitalIn SW_R (PE_14);
00031 //extern DigitalIn SW_B (USER_BUTTON); //defined as interrupt now for SD
00032 /* Configure Analogue Pins  */
00033 /* Analogue IN */
00034 extern AnalogIn LDR_In (PA_0);
00035 
00036 /* Congfigure Serial interface */
00037 Serial pc(USBTX, USBRX);
00038 
00039 /* Mail */
00040 typedef struct {
00041     float LDR_Value;
00042     float temp_Value;
00043     float press_Value;
00044 } mail_t;
00045 
00046 Mail<mail_t, 16> mail_box;
00047 
00048 //data FIFO buffer
00049 char data_buffer[MAX_SAMPLES][64];
00050 int sample_h = 0;
00051 int sample_t = 0;
00052 int data_h = 0;
00053 int data_t = 0;
00054 struct tm * sample_epoch;
00055 
00056 
00057 //Serial_CMD
00058 volatile int rx_in=0;
00059 char rx_buffer[32];
00060 time_t raw_time = time(NULL);
00061 char serial_buffer[80];
00062 
00063 extern void POST();